query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Same as defining a structure block, but with no attributes besides relationships (such as in a manytomany)
def no_structure structure {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def structure(name, &block)\n if existing = @base.structures.select { |s| s.name == name }.first\n structure = existing\n else\n structure = Moonrope::Structure.new(@base, name)\n @base.structures << structure\n end\n structure.dsl.instance_eval(&block) if block_given?\n structure\n end", "def x______________STRUCTURE\r\nend", "def x______________STRUCTURE\r\nend", "def structure\n repeat ? structure_repeat : structure_single\n end", "def structure(name)\n self.class.structure(name)\n end", "def structure\n raise \"structure must be implemented for class #{self.class}\"\n end", "def anonymous_blocklists; end", "def structure\n @change_set = change_set_class.new(find_resource(params[:id])).prepopulate!\n authorize! :structure, @change_set.resource\n @logical_order = (Array(@change_set.logical_structure).first || Structure.new).decorate\n members = Wayfinder.for(@change_set.resource).members_with_parents\n @logical_order = WithProxyForObject.new(@logical_order, members)\n end", "def format_as_block_html(name, attr, body, indent); end", "def structure\n @change_set = ChangeSet.for(find_resource(params[:id]), change_set_param: change_set_param).prepopulate!\n authorize! :structure, @change_set.resource\n @logical_order = (Array(@change_set.logical_structure).first || Structure.new).decorate\n members = Wayfinder.for(@change_set.resource).members_with_parents\n @logical_order = WithProxyForObject.new(@logical_order, members)\n end", "def new\n\t\t@block = Block.new\n\tend", "def new_block_el(*args); end", "def blocklists; end", "def block_node; end", "def block_node; end", "def basic_blocks\n cfg.blocks\n end", "def structure\n [\n # scaffold inject marker\n ]\n end", "def nesting() end", "def structure_dump() end", "def cms_blocks_attributes\n self.cms_blocks.inject([]) do |arr, block|\n block_attr = {}\n block_attr[:label] = block.label\n block_attr[:content] = block.content\n block_attr[:id] = block.id\n arr << block_attr\n end\n end", "def block_class() Block; end", "def new_block_el(*args)\n el = Element.new(*args)\n if @block_ial\n el.options[:ial] = @block_ial\n @block_ial = nil\n end\n el\n end", "def block_node=(_); end", "def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end", "def structure\n @change_set = change_set_class.new(find_resource(params[:id])).prepopulate!\n @logical_order = (Array(@change_set.logical_structure).first || Structure.new).decorate\n @logical_order = WithProxyForObject.new(@logical_order, query_service.find_members(resource: @change_set.id).to_a)\n authorize! :structure, @change_set.resource\n end", "def content_outline record\n blocks = record.content_blocks if record.parsed_content.present?\n return unless blocks\n\n content_tag :ul, class: 'content-outline' do\n # Loop through each block in the record, and generate a short piece of text describing that block.\n for block in blocks\n case block['type']\n when 'paragraph'\n text = block['data']['text']\n if block['data']['type'] == 'header'\n result = tag.strong(text)\n else\n result = block['data']['text'].truncate(200)\n end\n\n when 'list'\n result = ''\n result = \"<em>#{translate('admin.javascript.blocks.list.type.contents')}</em><br>\" if block['data']['type'] == 'contents'\n result += block['data']['items'].map { |i|\n depth = (i.is_a?(Hash) ? (i.dig('level') || 'h2')[1].to_i : 2) - 1\n text = i.is_a?(Hash) ? i['text'] : i\n \"#{'—' * depth} #{text}\".truncate(60)\n }.join('<br>')\n result = sanitize(result, tags: %w[em br])\n\n when 'layout'\n result = block['data']['items'].map { |i| \"— #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[br])\n\n when 'catalog'\n result = translate(\"activerecord.models.#{block['data']['type'].singularize}.other\")\n result += \": #{translate('admin.content.items', count: block['data']['items'].length)}\"\n\n when 'textbox'\n result = ''\n result += \"<strong>#{block['data']['title']}</strong><br>\" if block['data']['title'].present?\n result += \"#{block['data']['text']&.truncate(60)}<br>\" if block['data']['text'].present?\n result += tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'].present? && block['data']['url'].present?\n result = sanitize(result, tags: %w[strong br])\n\n when 'action'\n result = tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'] && block['data']['url']\n\n when 'media'\n result = if block['data']['type'] == 'image'\n block['data']['items'].map { |i| \"#{tag.i(class: 'image icon')} <a href=\\\"#{i['image']['preview']}\\\" target=\\\"_blank\\\">#{i['image']['preview'].split('/').last}</a>#{\" - \\\"#{i['caption'].truncate(100)}\\\"\" if i['caption']}\" }\n elsif block['data']['type'] == 'audio'\n block['data']['items'].map { |i| \"#{tag.i(class: 'volume up icon')} <a href=\\\"#{i['audio']['preview']}\\\" target=\\\"_blank\\\">#{i['title']}</a>\" }\n elsif block['data']['type'] == 'youtube'\n tag.span('[YouTube Embed] → ') + tag.small(\"https://www.youtube.com/watch?v=#{block['data']['youtube_id']}\") if block['data']['youtube_id'] # TODO: Translate\n else\n block['data']['items'].map { |i| \"#{tag.i(class: \"#{block['data']['type']} icon\")} #{i['name']} (#{i['id']})\" }\n end\n result = result.join('<br>') if result.kind_of?(Array)\n result = sanitize(result, tags: %w[i a br], attributes: %w[href class target])\n\n when 'vimeo'\n result = block['data']['items'].map { |i| \"#{tag.i(class: 'video icon')} #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[i a br])\n\n when 'whitespace'\n separators = {\n large: '==',\n medium: '—',\n small: '--',\n }\n\n result = separators[block['data']['size'].to_sym] * 3\n\n else\n concat block.inspect\n end\n\n concat content_tag :li, result, class: \"content-outline__#{block['type']} content-outline__#{block['type']}--#{block['data']['type']}\"\n end\n end\n end", "def initialize\n super(Network.generate_id(\"block_\"))\n end", "def <<(block)\n # parent assignment pending refactor\n #block.parent = self\n @blocks << block\n end", "def basic_blocks\n @basic_block_collection ||= BasicBlockCollection.new(self)\n end", "def list_block()\n\nend", "def start_new_block_element(attrs)\n @current_block = {\n formatting_spans: [],\n paragraph_classes: [],\n }.merge(attrs)\n @block_elements << @current_block\n end", "def code_of_conduct; end", "def create_block(g, mod)\n pos(g)\n\n state = g.state\n state.scope.nest_scope self\n\n args = make_arguments(mod)\n\n blk = new_generator g, @name, args\n\n blk.push_state self\n\n blk.state.push_super state.super\n blk.state.push_eval state.eval\n\n blk.definition_line(@line)\n\n blk.state.push_name blk.name\n\n pos(blk)\n\n blk.state.push_block\n blk.push_modifiers\n blk.break = nil\n blk.next = nil\n blk.redo = blk.new_label\n blk.redo.set!\n\n # order matters quite a lot here\n args.bytecode(blk)\n\n recv = receiver_pattern(mod)\n if recv.binds?\n blk.push_self\n recv.deconstruct(blk, mod)\n end\n\n args.deconstruct_patterns(blk, mod)\n\n mod.compile(blk, @body)\n\n blk.pop_modifiers\n blk.state.pop_block\n\n blk.ret\n blk.close\n blk.pop_state\n\n blk.splat_index = args.splat_index\n blk.local_count = local_count\n blk.local_names = local_names\n\n g.create_block blk\n end", "def xml_blocks\n %w(start_blocks toolbox_blocks required_blocks recommended_blocks)\n end", "def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end", "def body_attributes\n {}\n end", "def body_attributes\n {}\n end", "def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end", "def structure_single\n structure_repeat.first || []\n end", "def new\n @block = @site.blocks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @block }\n end\n end", "def block_name \n :CodeBlock \n end", "def block_name \n :CodeBlock \n end", "def allowed_types\n [ Entities::NetBlock]\nend", "def allowed_types\n [ Entities::NetBlock]\nend", "def get_parsable\n @block ||= Block.new\n end", "def sane_structure?\n structure.nil? || (structure.to_s =~ Structure::STRUCTURE_PATTERN && !ancestor_ids.include?(self.id))\n end", "def parent_structure(p = self)\n while p.parent\n p = p.parent\n break if p.kind_of? Ruckus::Structure\n end\n return p\n end", "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockCenter)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDir)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDiv)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockFieldset)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockForm)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH1)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH2)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH3)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH4)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH5)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH6)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockMenu)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockNoframes)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockNoscript)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockOl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockP)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockPre)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTable)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockUl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDd)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDt)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockFrameset)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockLi)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTbody)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTd)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTfoot)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTh)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockThead)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTr)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockScript)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockHead)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_HtmlBlockInTags unless _tmp\n return _tmp\n end", "def data_structure *args, &block\n\t\t@data_structure ||= Reporter::DataStructure.new self, *args\n\t\tyield @data_structure if block_given?\n\t\t@data_structure\n\tend", "def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end", "def flex_attributes; nil end", "def initialize(id)\n @id = id\n @@all_blocks[id] = self\n end", "def test_create_layer_aloud_with_no_base\n block = @block\n HT::Cascade.new do \n layer :layer_1, &block\n end\n end", "def validate_structure(parent, child)\n if parent.ast_class == Root && child.type == :inline\n msg = \"#{child.name} needs to be wrapped in a block level tag.\"\n elsif parent && !parent.allowed_child?(child)\n msg = \"#{child.name} is not a valid child element of #{parent.name}.\"\n else\n return\n end\n raise ContextError, \"Invalid HTML structure: #{msg}\"\n end", "def block_params\n params.require(:block).permit(:name, :left, :top, :width, :height, :space_id, :block_type, :parent_id, :is_floor, :max_head_cap, :footage, :equipment, :fee, :photo, :start_at, :end_at, :image, :intro, :user_id, :registration_id, :color, :unit_id)\n end", "def collection include_object_type=false, &block\n ASObj.generate :collection, !include_object_type, &block\n end", "def new_blocks_attributes\n return [] if @new_blocks_attributes.empty?\n\n blocks_attributes = if @new_blocks_attributes.is_a?(Hash)\n @new_blocks_attributes.values\n else\n @new_blocks_attributes\n end\n\n if home_page? || footer?\n return blocks_attributes + include_srcset_block(blk_attrs: blocks_attributes)\n end\n\n convert_content_to_html(blocks_attributes)\n\n blocks_attributes\n end", "def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end", "def update_blocks!\n RevisionRegister.new(page, user: author, blocks_attributes: page.blocks_attributes).save!\n\n assign_blocks\n page.save!\n end", "def initialize(model, &block)\n @model = model\n @associations = {}\n @fields = []\n @attributes = []\n @conditions = []\n @groupings = []\n @options = {}\n @delta_object = nil\n \n initialize_from_builder(&block) if block_given?\n end", "def declare!(inst, *args, &block)\n _indent\n @target << \"<!#{inst}\"\n args.each do |arg|\n case arg\n when ::String\n @target << %{ \"#{arg}\"} # \" WART\n when ::Symbol\n @target << \" #{arg}\"\n end\n end\n if ::Kernel::block_given?\n @target << \" [\"\n _newline\n _nested_structures(block)\n @target << \"]\"\n end\n @target << \">\"\n _newline\n end", "def record name, description: nil, mode: nil\n record_check!\n\n # TODO: do we need to raise if no block was given?\n raise ArgumentError, \"a block is required\" unless block_given?\n\n nested_field = add_field name, :record, description: description, mode: mode\n yield nested_field\n nested_field\n end", "def initialize(name, type, ast_class: nil, **options)\n # Set basic params converting some args to symbols for consistency\n @name = name.to_sym\n @type = type.to_sym\n @ast_class = nil\n # use self.ast_class to trigger setter method\n self.ast_class = ast_class if ast_class\n\n # Ensure block level tags have an AST class\n if @type == :block && @ast_class.nil?\n raise ArgumentError, \"Block level tag #{name} must have an AST class.\"\n end\n\n # Set attributes from optinos hash, currently unused during AST generation\n @attributes = options.fetch(:attributes, {})\n # WordML properties defined by the tag, i.e. <w:b /> for the <b> tag,\n # etc. All the keys need to be symbols to avoid getting reparsed\n # with the element's CSS attributes.\n @properties = options.fetch(:properties, {})\n @properties = Hash[@properties.map { |k, v| [k.to_sym, v] }]\n # Set permitted child tags or tag groups\n self.allowed_children = options[:allowed_children]\n end", "def nest_blocklists(doc)\n logger.info(\"Nesting blocklists\")\n\n Slaw::Parse::Blocklists.nest_blocklists(doc)\n end", "def define_schema\n yield schema if block_given?\n end", "def parse_with_entity entity, child = nil, is_admin = false\n locals = ZenConfig.liquid_attrs\n locals.merge! entity.liquid_attrs unless entity.nil?\n locals['child'] = child unless child.nil?\n\n others = self.content.scan(/\\{\\{.*\\}\\}/).map { |s| s.gsub(/[ |\\{|\\}]/, '') }\n for other in Layout.in(name: others)\n next if entity and other.name == entity.type.name\n otherLiq = Liquid::Template.parse(other.content).render(locals)\n otherHtml = Nokogiri::XML.fragment(otherLiq)\n other.adminize(otherHtml) if is_admin\n locals[other.name] = \"<div class='zen-layout-wrapper' data-zen-id='#{other.id}' data-zen-name='#{other.name}'>#{otherHtml.to_s}</div>\"\n end\n\n render = Liquid::Template.parse(self.content).render(locals)\n html = Nokogiri::XML.fragment(render)\n self.adminize(html) if is_admin\n render = html.to_s\n if self.parent\n self.parent.parse_with_entity(entity, render, is_admin)\n else\n add_assets(render)\n end\n end", "def create_model(name, &block)\n name = name.to_s.tableize\n raise \"Model name '#{name}' is not unique\" if site.model_types.key?(name)\n \n # create a new instance of model\n child = self.class.new(site)\n child.name = name.camelcase.singularize\n child.parent = self\n \n # inherited fields\n fields.each do |name, field|\n child.set(name, get(name)) if field.inherited?\n end\n \n # insert the model in to the site models list\n class_name = name.classify\n site.model_types[name] = child.id\n site.model_plural_names[class_name] = name\n site.save\n \n # append the model to ancestor descendant lists (these are used in queries to\n # restrict the type of records returned, e.g pages.all => _model: ['Page', ...]\n child.tap do |child|\n child.add_descendant(child)\n child.instance_exec(child, &block) if block_given?\n child.save\n end\n end", "def authors_block\n <<-XML.strip_heredoc\n <Authors>\n <Author>\n <LastName>#{author_attributes.name.last}</LastName>\n <FirstName>#{author_attributes.name.first}</FirstName>\n <MiddleName>#{author_attributes.name.middle}</MiddleName>\n #{author_attributes.institution.address.to_xml}\n <Version>1</Version>\n </Author>\n </Authors>\n <DocumentCategory>#{category}</DocumentCategory>\n XML\n end", "def initialize(opts={})\n\n # A Structure is really just a Blob with extra goop\n @value = Blob.new\n @value.parent = self\n\n # Most of the goop is for figuring out what fields to\n # add, with what arguments, given where we are in the\n # inheritance hierarchy.\n\n template = self.class.templates\n\n # If this is the first time we're seeing this definition,\n # we also need to convert field names into blob offsets.\n pop = false\n if not self.class.structure_field_names\n self.class.write_inheritable_hash :structure_field_names, {}\n pop = true\n end\n\n template.each do |t|\n # do some rewriting to support an old style of declaring\n # fields that we supported like 6 months ago.\n name = template_decoder_ring(t)\n\n # index the field name if this is the first time we've\n # ever instantiated this kind of structure, and the field\n # is valid\n self.class.structure_field_names[name] = @value.count if (name and pop)\n\n begin\n # create the structure field object, parent it\n klass, args = [t[0], t[1]]\n obj = klass.new(*args)\n obj.parent = @value\n\n template_entry_added_hook(obj) || @value << obj\n rescue\n pp t\n raise\n end\n end\n\n opts.each do |k, v|\n if self.class.structure_field_names.has_key? k\n raise \"attempting to assign field name as option; use with_{field_name} instead\"\n end\n end\n\n super(opts)\n\n final_initialization_hook\n end", "def create_block_object(&block)\n block\nend", "def create\n @block = @site.blocks.build(params[:block])\n @block.user_id = current_user.id\n\n respond_to do |format|\n if @block.save\n flash[:notice] = 'Block was successfully created.'\n format.html { redirect_to(one_table_blocks_path(@one_table)) }\n format.xml { render :xml => @block, :status => :created, :location => @block }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @block.errors, :status => :unprocessable_entity }\n end\n end\n end", "def page_struct; end", "def format_as_indented_block_html(name, attr, body, indent); end", "def child_relation; end", "def parse_block_html; end", "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def to_prepare_blocks; end", "def block_params\n if(params[:block].present?)\n\t params.require(:block).permit(:name, :block_code, :district_id, :partner_id, manager_attributes: [:id, :user_id, :start_date, :end_date], director_attributes: [:id, :user_id, :start_date, :end_date])\n end\n end", "def nested_attributes\n []\n end", "def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend", "def activity include_object_type=false, &block\n ASObj.generate :activity, !include_object_type, &block\n end", "def process_complex_block_opener(tk); end", "def hidden_tuple_from_block block, type\n\t\thidden_tuple get_block_cells(block), type\n\tend", "def allowed_types\n [NetBlock]\nend", "def do_without_hydrogens(&block)\n _obmol = @ob.get_parent\n had_hydrogens = _obmol.has_hydrogens_added\n _obmol.delete_hydrogens(self.ob) if had_hydrogens\n reply = block.call(had_hydrogens)\n _obmol.add_hydrogens(self.ob) if had_hydrogens\n reply\n end", "def disable_content_blocks\n cannot :manage, ContentBlock\n end", "def create_first_block\n\ti = 0\n\tinstance_variable_set( \"@b#{i}\", \n\t\t\t\t\t\t\t\t\t\t\t\t Block.first( \n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Dutchgrown\", to: \"Vincent\", what: \"Tulip Bloemendaal Sunset\", qty: 10 },\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Keukenhof\", to: \"Anne\", what: \"Tulip Semper Augustus\", qty: 7 } )\n\t\t\t\t\t\t\t\t\t\t\t )\n\tLEDGER << @b0\n\tpp @b0\n\tp \"============================\"\n\tadd_block\nend", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end" ]
[ "0.6523887", "0.62286806", "0.62286806", "0.60197866", "0.5778948", "0.5758897", "0.57343125", "0.5664925", "0.56506187", "0.56104726", "0.55098844", "0.54686576", "0.54533803", "0.5437469", "0.5437469", "0.540584", "0.54001445", "0.5363214", "0.53423434", "0.5316378", "0.5308999", "0.5301324", "0.5272707", "0.52643514", "0.5262515", "0.52586234", "0.52386993", "0.52364177", "0.5195559", "0.51826364", "0.51636654", "0.51635456", "0.5159849", "0.51430786", "0.51424414", "0.51361907", "0.51361907", "0.50729924", "0.5070863", "0.5070084", "0.50691766", "0.50691766", "0.50688964", "0.50688964", "0.5055808", "0.5042851", "0.50381917", "0.50375634", "0.5033212", "0.5022565", "0.5017364", "0.50157106", "0.50015193", "0.49653834", "0.4959679", "0.4954708", "0.49494642", "0.49462026", "0.49376023", "0.49362066", "0.4928956", "0.49271512", "0.49154836", "0.49140865", "0.49074954", "0.49015558", "0.48988017", "0.48979938", "0.48876747", "0.48794407", "0.48763832", "0.48745257", "0.48742726", "0.4871599", "0.48698813", "0.48643628", "0.48520735", "0.48518696", "0.4851614", "0.48511565", "0.48432878", "0.4839938", "0.48398277", "0.4834147", "0.48272583", "0.48233858", "0.48220164", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127", "0.48213127" ]
0.5946359
4
Use callbacks to share common setup or constraints between actions.
def set_car_seat @car_seat = CarSeat.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def car_seat_params params.require(:car_seat).permit(:car_model_id, :sportseat, :seatmaterial, :seatheightadjustment, :driverseatadjustmentmode, :auxiliaryseatadjustmentmode, :driverseatlumbarsupportadjustment, :driverseatshouldersupportadjustment, :frontseatheadrestadjustment, :rearseatadjustmentmode, :rearseatreclineproportion, :rearseatangleadjustment, :frontseatcenterarmrest, :rearseatcenterarmrest, :seatventilation, :seatheating, :seatmassage, :electricseatmemory, :childseatfixdevice, :thirdrowseat) 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
build a gable roof porch
def build_gr(entities,r,t) gr_group = entities.add_group origin = Geom::Point3d.new(0,0,0) v1 = Geom::Vector3d.new($gr_width/2,0,0) v2 = Geom::Vector3d.new(0,0,$gr_width*$gr_pitch/12) v3 = Geom::Vector3d.new(0, $gr_length,0) f1 = gr_group.entities.add_face(origin,origin-v3,origin-v3+v2+v1,origin+v2+v1) f1.material = $roofColor f2 = gr_group.entities.add_face(origin-v3+v2+v1,origin+v2+v1, origin+v1+v1, origin+v1+v1-v3) f2.material = $roofColor if($gr_wall[1] == 2) f5 = gr_group.entities.add_face([0,-$gr_length,0],[6, -$gr_length,0],[6, 6-$gr_length,0],[0,6-$gr_length,0]) f5.pushpull $gr_height f6 = gr_group.entities.add_face([$gr_width,-$gr_length,0],[$gr_width-6, -$gr_length,0],[$gr_width-6, 6-$gr_length,0],[$gr_width,6-$gr_length,0]) f6.pushpull $gr_height end if($gr_wall[0] == 1) f3 = gr_group.entities.add_face([0,0,0],[0,0,-$gr_height],[0,-$gr_length, -$gr_height],[0, -$gr_length,0]) f3.material = $wallColor end if($gr_wall[2] == 1) f3 = gr_group.entities.add_face([$gr_width,0,0],[$gr_width,0,-$gr_height],[$gr_width,-$gr_length, -$gr_height],[$gr_width, -$gr_length,0]) f3.material = $wallColor end entities.transform_entities r, gr_group entities.transform_entities t, gr_group end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rooks\n self[[0,0]] = SlidingPiece.new([0,0], :black, \"R \")\n self[[0,7]] = SlidingPiece.new([0,7], :black, \"R \")\n self[[7,0]] = SlidingPiece.new([7,0], :white, \"R \")\n self[[7,7]] = SlidingPiece.new([7,7], :white, \"R \")\n end", "def make_room max_w,max_h\n\t{\n\t\tx: rand(@grid_w - max_w - 1) + 1,\n\t\ty: rand(@grid_h - max_h - 1) + 1,\n\t\tw: rand(max_w) + 1,\n\t\th: rand(max_h) + 1,\n\t}\n\tend", "def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end", "def place_room(w,h,room_id)\n \n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n \n # if checks ok, build the room and the perimeter\n if !failed\n\t\t\t\t# Probability falls so there are an average of 2 doors per room\n\t\t\t\tper = 2*(w+h)\n\t\t\t\tdoor_chance = Dungeon::ROOM_DOORS/per\n\n\t\t\t\t# Prep for building a logical object ready for dead end removal\n\t\t\t\troom_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n\t\t\t\t\t\t\t# If perimeter wall, assign door if random number is under the threshold\n \t\t\t\t\t\tif i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1 \n @cells[i][j].type = Cell::PERIMETER \n\t\t\t\t\t\t\t\tif i.odd? || j.odd?\n\t\t @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\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# Store the room cells read for assignment to logical structure\n\t\t\t\t\t\t\troom_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n\t\t\t\t# Build logical object and map entrance cells to the room\n\t\t\t\troom_obj = RoomBranch.new(room_cells)\n\t\t\t\troom_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n \n c_try += 1\n end\n \n end", "def make_draw(round, format)\n\t\t\t@num_rooms_assigned = 0;\n\t\t\tround.tournament.update(progress: 0.0); #reset progress to 0\n\t allocate_rooms(sort_teams_and_adjs(round), round, format); #make rooms\n\t\tend", "def initialize\n \t@grid_w = 50\n \t@grid_h = 40\n \t@grid = []\n\t\n\t\t@player_x = 0\n\t\t@player_y = 0\n\t\t@has_enviroment_rendered=false\n\t\t#setup and fill grid with walls\n \t@grid_w.times.with_index do |x|\n \t\t@grid[x] = []\n\t\t\t@grid_h.times.with_index do |y|\n \t\t\t@grid[x][y]= 1\n \t \tend\n \tend\n\t\tmin_rooms = 2\n\t\tmax_rooms = 10\n\t\t#setup number of rooms that will exist\n\t\t@n_rooms = rand(max_rooms - min_rooms) + min_rooms\n\t\tputs \"n rooms #{@n_rooms}\"\n\t\trooms = []\n\t\t#define the size of each room\n\t\t@n_rooms.times.with_index do |room|\n\t\t\trooms[room] = make_room 8,10\n\t\tend\n\t\n\t\t#clears the walls from where rooms will be \n\t\trooms.each_with_index do |r,i| \n\t\t\t(r[:x]..r[:x] + r[:w]).each do |x|\n\t\t\t\t(r[:y]..r[:y] + r[:h]).each do |y|\n\t\t\t\t\t@grid[x][y]= 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#create pathways towards the next room\n\t\trooms.each_cons(2) do |(cur_room, next_room)|\n\t\t\t#find the center of each room \n\t\t\tcenter_x = cur_room[:x] + cur_room[:w].idiv(2)\n\t\t\tcenter_y = cur_room[:y] + cur_room[:h].idiv(2)\n\n\t\t\tnext_center_x = next_room[:x] + next_room[:w].idiv(2)\n\t\t\tnext_center_y = next_room[:y] + next_room[:h].idiv(2)\n\n\t\t\t#loops between each rooms X and Y positions \n\t\t\t#this can be approached differently\n\t\t\t(min(center_x,next_center_x)..max(center_x,next_center_x)).each do |x|\n\t\t\t\t(min(center_y,next_center_y)..max(center_y,next_center_y)).each do |y|\n\t\t\t\t\t#checking if this position is in-line with either rooms x or y centres\n\t\t\t\t\t@grid[x][y] = 0 if y == center_y || y == next_center_y || x == center_x || x == next_center_x\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@new_grid = []\n\t\t#set new grid to prune unneeded walls to improve performance\n\t\t@grid_w.times.with_index do |x|\n\t \t@new_grid[x] = []\n\t \t@grid_h.times.with_index do |y|\n \t\t\t@new_grid[x][y]= @grid[x][y]\n\t\t\tend\n\t end\n\t\t#set up values\n\t\t@grid_w.times.with_index do |x|\n \t\t@grid_h.times.with_index do |y|\n\t\t\t\t#if surrounded it should not be filled in\n\t\t\t\tif check_surrounding_tiles x,y\n\t\t\t\t\t@grid[x][y] = 0\n\t\t\t\tend\n \t\tend\n \tend\n\t\t#this will set the players starting position to a known safe area\n\t\t@player_x = rooms[0][:x] + rooms[0][:w].idiv(2)\n\t\t@player_y = rooms[0][:y] + rooms[0][:h].idiv(2)\n\t\t@grid[@player_x][@player_y] = 2\n\tend", "def place_room(w, h, room_id)\n\n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n\n # if checks ok, build the room and the perimeter\n if !failed\n # Probability falls so there are an average of 2 doors per room\n per = 2*(w+h)\n door_chance = Dungeon::ROOM_DOORS/per\n\n # Prep for building a logical object ready for dead end removal\n room_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n # If perimeter wall, assign door if random number is under the threshold\n if i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1\n @cells[i][j].type = Cell::PERIMETER\n if i.odd? || j.odd?\n @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n end\n end\n\n # Store the room cells read for assignment to logical structure\n room_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n # Build logical object and map entrance cells to the room\n room_obj = RoomBranch.new(room_cells)\n room_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n\n c_try += 1\n end\n\n end", "def place_rooks\r\n $board[0][0] = Rook.new('white')\r\n\t\t$board[7][0] = Rook.new('white')\r\n\t\t$board[0][7] = Rook.new('black')\r\n\t\t$board[7][7] = Rook.new('black')\r\n end", "def draw_piece(x,y,peice)\n co_x, co_y = get_co_x_y(x,y)\n stroke blue\n strokewidth 4\n fill black if peice.color.eql?('black')\n fill white if peice.color.eql?('white')\n oval top: co_y, left: co_x, radius: 40, center:true\nend", "def pbRoamPokemon(ignoretrail=false)\n # Start all roamers off in random maps\n if !$PokemonGlobal.roamPosition\n $PokemonGlobal.roamPosition={}\n for i in 0...RoamingSpecies.length\n species=getID(PBSpecies,RoamingSpecies[i][0])\n next if !species || species<=0\n keys=pbRoamingAreas(i).keys\n $PokemonGlobal.roamPosition[i]=keys[rand(keys.length)]\n end\n end\n $PokemonGlobal.roamHistory=[] if !$PokemonGlobal.roamHistory\n $PokemonGlobal.roamPokemon=[] if !$PokemonGlobal.roamPokemon\n # Roam each Jermon in turn\n for i in 0...RoamingSpecies.length\n pbRoamPokemonOne(i,ignoretrail)\n end\nend", "def createRoom()\n\t\twidth = rand(@areaWidth * 0.5 .. @areaWidth * 0.7).floor\n\t\theight = rand(@areaHeight * 0.5 .. @areaHeight * 0.7).floor\n\t\t@room = [\n\t\t\trand(@areaX + @areaWidth * 0.15 .. @areaX + @areaWidth - width * 1.15).ceil,\n\t\t\trand(@areaY + @areaHeight * 0.15 .. @areaY + @areaHeight - height * 1.15).ceil,\n\t\t\twidth,\n\t\t\theight,\n\t\t]\n\tend", "def champagne_tower(gp, qr, qc)\n pyramid = []\n (1..qr + 1).each do |i|\n pyramid << Array.new(i, 0)\n end\n pyramid[0][0] = gp\n (0..qr + 1).each do |r|\n (0..r + 1).each do |c|\n q = (pyramid[r][c] - 1.0) / 2.0\n if q > 0\n pyramid[r + 1][c] += q\n pyramid[r + 1][c + 1] += q\n end\n end\n end\n return min(1, pyramid[qr][qc])\nend", "def draw\n # clear the terminal\n system(\"clear\")\n # draw the top rail\n puts '-' * self.length\n # draw each horse in it's own lane\n self.horses.each do |horse|\n # draw .......all the way up to the position of the horse\n print '.' * horse.position + horse.print\n puts\n # draw the bottom rail\n puts '-' * self.length\n end\n end", "def draw_player_pieces args\n #$gtk.log \"INFO: RENDERING GAME PIECES...\"\n args.state.player.pieces.each do |p|\n if p[:onboard]\n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x],\n y: args.state.board.y + args.state.tiles[p[:tile]][:y],\n w: 100,\n h: 100,\n path: \"sprites/circle-indigo.png\"\n }.sprite\n \n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x] + 35,\n y: args.state.board.y + args.state.tiles[p[:tile]][:y] + 75,\n text: p[:order],\n size_enum: 16,\n alignment_enum: 0,\n r: 0,\n g: 0,\n b: 0,\n a: 255\n }.label\n end\n end\nend", "def move_party_horn\n\t\tif face_left?\n\t\t\t@party_horn.x = @x + \n\t\t\t\t\t\t\t(TILE_WIDTH/4 - PartyHorn::PARTY_HORN_TILE_WIDTH)\n\t\telse\n\t\t\t@party_horn.x = @x + 3 * TILE_WIDTH/4\n\t\tend\n\t\t@party_horn.y = @y + 3 * TILE_HEIGHT/5\n\t\t@party_horn.angle = @angle\n\tend", "def move_grue(direction)\n next_grue_room = @grue_room.door_destination(direction)\n\n @grue_room.move_grue_from\n @grue_room = get_room_by_name(next_grue_room)\n @grue_room.move_grue_to\n end", "def get_object\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n return if next_x < 0 || next_x > 14 || next_y < 0 || next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n if next_square == CHAR_POTION || next_square == CHAR_CHEST || next_square == CHAR_IDOL\n @room[next_x][next_y] = CHAR_FLOOR\n draw_map(next_x,next_y)\n @potions += 1 if next_square == CHAR_POTION\n @treasure += 1 if next_square == CHAR_CHEST\n @idol_found = true if next_square == CHAR_IDOL\n @stats[:experience] += 0.25\n end\n end", "def add_rook(player, row, col)\n game.pieces << Rook.create(piece(player, row, col))\n end", "def full_pyramid\n build_pyramid(ask_floor)\nend", "def groom\n end", "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end", "def projectile\n end", "def draw\n\t\t@party_horn.draw\n\t\tangle = draw_angle(face_left?)\n\t\tprawn_img = @@tiles[@tile_idx]\n\t\tprawn_img.draw_rot(@x+TILE_WIDTH/2, \n\t\t\t\t\t\t @y+TILE_HEIGHT/2, \n\t\t\t\t\t\t PRAWN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\n\t\tprawn_skin = @@skins[@tile_idx] \n\t\tprawn_skin.draw_rot(@x + TILE_WIDTH/2, \n\t\t\t\t\t\t @y + TILE_HEIGHT/2, \n\t\t\t\t\t\t PRAWN_Z + @player.z, \n\t\t\t\t\t\t angle, \n\t\t\t\t\t\t 0.5, # Default center_x \n\t\t\t\t\t\t 0.5, # Default center_y\n\t\t\t\t\t\t 1, # Default scale_x\n\t\t\t\t\t\t 1, # Default scale_y\n\t\t\t\t\t\t @player.colour)\n\tend", "def move(io_h)\n if io_h[:left]\n @x -= 10\n end\n if io_h[:right]\n @x += 10\n end\n if io_h[:up]\n @y -= 10\n end\n if io_h[:down]\n @y += 10\n end\n \n @x %= 640\n @y %= 480\n end", "def output_moves(piece_type, location, moves)\n #setting up location coordinates\n location_coords = location.split(//)\n x = location_coords[0].ord - 96\n y = location_coords[1].to_i\n\n if x < 1 || y < 1 || y > 8 || x > 8 || location.length!=2\n puts 'please provide a valid location for the piece'\n exit\n end\n\n#calculating possible moves of rook\n all_possible_moves = moves[piece_type].flat_map do |move|\n (1..move[:steps]).collect do |step|\n new_x = x + (move[:x] * step)\n new_y = y + (move[:y] * step)\n [new_x, new_y]\n end\n end.sort do |m1, m2|\n c = (m1[1] <=> m2[1])\n c == 0 ? (m1[0] <=> m2[0]) : c\n end\n\n board_possible_moves = all_possible_moves.reject { |p| p[0] < 1 || p[1] < 1 || p[0] > 8 || p[1] > 8 }\n movesList = []\n board_possible_moves.collect { |m|\n x = (m[0] + 96).chr\n y = m[1]\n movesList<< x + y.to_s\n }\n movesList\nend", "def print_plateau(rovers)\n (0..boundary_y).reverse_each do |y|\n grid = \"\"\n (0..boundary_x).each do |x|\n roverNames = \"\"\n rovers.each_with_index do |rover, index|\n roverNames = \" #{index+1}\" if rover.position_x == x && rover.position_y == y\n end\n grid += roverNames.empty? ? \" +\" : roverNames\n end\n puts grid\n end\n end", "def build_ship\n r = Random.new\n ok=false\n while !ok do\n horv=r.rand(1..2) # 1 = vertical 2 = Horiz\n x1=r.rand(1..6)\n y1=r.rand(1..6)\n\n ok= !self.check_ship(horv,x1,y1)\n end #while\n\n if horv==1 #build in vertical position row increases\n (x1..x1+4).each { |r| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == r && s.colid==y1}\n sq.empty=false\n sq.ship=true\n }\n else\n (y1..y1+4).each { |c| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == x1 && s.colid==c}\n sq.empty=false\n sq.ship=true\n }\n end #if\n end", "def motor\n\t\tbase = outline.linear_extrude(height:(@motor_height/6)*4,center:true).color(\"DimGray\")\n\n\t\tbase+= outline.linear_extrude(height:(@motor_height/6),center:true).translate(z:(@motor_height/1.5+@motor_height/6-0.1)/2).color(\"LightGrey\") \t\t\n\t\tbase+= outline.linear_extrude(height:(@motor_height/6),center:true).translate(z:-(@motor_height/1.5+@motor_height/6-0.1)/2).color(\"LightGrey\") \t\t\n\t\t\n\t\tflange=cylinder(d:@motor_flange_dia,h:@motor_flange_height,center:true).translate(z:(@motor_height+@motor_flange_height-0.01)/2).color(\"LightGrey\")\n\t\t\t\t\n\t\tshaft = cylinder(d:@motor_shaft_OD,h:@motor_shaft_height,center:true).translate(z:(@motor_shaft_height+@motor_height+@motor_flange_height)/2).color(\"WhiteSmoke\")\n\n\t\t# screw holes\n\t\t[-1,1].each do |i|\t\n\t\t\t[-1,1].each do |f|\t\n\t\t\t\tbase-= cylinder(d:@motor_mounting_hole_diam,h:@motor_height+1,center:true).translate(x:i*@motor_mounting_hole_distance/2,y:f*@motor_mounting_hole_distance/2,z:@motor_height-8).color(\"DimGray\")\n\t\t\tend\n\t\tend\n\n\n\t\tmotor = base+flange+shaft\n\t\t# move motor that z is 0\n\t\tmotor.translate(z:@motor_height/2)\t\t\n\tend", "def ring; end", "def ring; end", "def new_round\n init_board()\n end", "def create_game2(state, substate, money, life, fights, respect)\n\n game = GameController.new(money,life,fights,respect)\n\n\n########################################################################################################################################\n##Room 7\n\n move = Move.new(0, \"Para entrar dirigete al norte\" , \n Proc.new{|room, game| game.go_state(40) ; \"Estas entrando\"} , nil,nil, nil)\n room1 = Room.new(7,\"Despiertas en un lugar lugubre, lo unico que alcanzas a ver es un letrero que dice Bienvenido a Ecatepec\")\n room1.state = move\n room1.add_state(move)\n game.set_state(7, room1)\n\n########################################################################################################################################\n##Room 40\n room40 = Room.new(40,\"Comienzas a caminar, huele a drogas en el aire\")\n move = Move.new(0, \"Te espantas así que tienes dos opciones: ir al sur para huir, o entrar a una tienda que encuentras abierta al este\" , \n nil , Proc.new{|room, game| game.go_state(7) ; \"Has Huido\"} , Proc.new{|room, game| game.go_state(29) ; game.respect+=5; \"Entraste a la tienda, tu respeto aumentó\"} , nil)\n room40.state = move\n room40.add_state(move)\n game.set_state(40, room40)\n\n\n\n########################################################################################################################################\n##Room 29\n room29 = Room.new(29,\"La tienda tiene rastros de que hubo una pelea aqui\")\n coin1 = CoinFlipper.new(0,\"Tira una moneda para probar tu suerte\", \n Proc.new{|room, game| room.go_sub(1); \"Encontraste una cartera\"} , \n Proc.new{|room, game| room.go_sub(2); \"Alguien te ha retado\"})\n coin2 = CoinFlipper.new(1,\"Tira una moneda para probar tu suerte\", \n Proc.new{|room, game| game.money += 200; room.go_sub(4); \"Encontraste 200 varos\"} , \n Proc.new{|room, game| room.go_sub(2); \"Alguien viene\"}) \n fight1 = Fight.new(2, \"La Britney te ha retado a unos navajasos, puedes huir si le das 50 varos o puedes pelear con ella\" , \n Proc.new{|room, game| room.go_sub(3); \"Estas entrando a la pelea...\"} , \n Proc.new{|room, game| \n if game.money >= 50 \n game.money -=50\n game.respect -=5\n room.go_sub(4)\n \"Has huido, tu respeto baja\"\n else \n \"No puedes huir\"\n end\n })\n coin3 = CoinFlipper.new(3,\"Tira una moneda para probar tu suerte en la pelea\", \n Proc.new{|room, game| room.go_sub(4); game.respect +=15 ; game.fights += 1; \"Has derrotado a la Britney, tu respeto aumenta\"} , \n Proc.new{|room, game| room.go_sub(4); game.life-=15; \"La britney te ha derrotado y tu vida baja 15 puntos\"})\n move = Move.new(4, \"Para salir de la tienda ve al norte , para ir a otro lado y probar tu suerte ve al este.\" , \n Proc.new{|room, game| game.go_state(40) ; \"Sales de la tienda\"} , nil, Proc.new{|room, game| game.go_state(6) ; \"Entras al este\"}, nil)\n\n room29.state= coin1\n room29.add_state(coin1).add_state(coin2).add_state(fight1).add_state(coin3).add_state(move)\n game.set_state(29, room29)\n\n########################################################################################################################################\n##Room 6\n\n room6 = Room.new(6,\"Sales a una avenida principal con forma de L, ves a drogadictos tirados en el piso pidiendo dinero.\")\n coin1 = CoinFlipper.new(0,\"Hay un sonido repentino, giras. Tira una moneda\", \n Proc.new{|room, game| game.go_state(43); \"Te diriges al oeste\"} , \n Proc.new{|room, game| room.go_sub(1); \"Solo hay una ventana\"})\n move = Move.new(1, \"Si quieres asomarte ve al este si quieres seguir por la calle ve al norte \" , \n Proc.new{|room, game| game.go_state(29) ; \"Sigues por la calle\"} , nil, Proc.new{|room, game| game.go_state(28) ; \"Decides asomarte\"}, nil)\n room6.state = coin1\n room6.add_state(coin1).add_state(move)\n game.set_state(6, room6)\n\n########################################################################################################################################\n##Room 28\n\n\n room28 = Room.new(28,\"Alcanzas a ver un Mercado artesanal a la distancia, intentas ver que hay y encuentras la puerta a un edificio que parece tener un teléfono\")\n move = Move.new(0, \"Ve hacia el este\" , \n nil, nil, Proc.new{|room, game| game.go_state(6) ; \"Te diriges al este\"}, nil)\n room28.state = move\n room28.add_state(move)\n game.set_state(28, room28)\n\n\n########################################################################################################################################\n##Room 43\n room43 = Room.new(43, \"El barrio esta cada vez más lugubre\")\n coin1 = CoinFlipper.new(0,\"El lider de los metalicos llamado “El brayan” te reta a unos navajazos a muerte, tira una moneda\", \n Proc.new{|room, game| room.go_sub(1); \"El Brayan ha intentado picarte pero lo esquivaste\"} , \n Proc.new{|room, game| game.go_state(36); game.respect= 0; game.life -= 30; \"El Brayan te ha soltado un navajazo mortal y se ha ido. Has perdido todo tu respeto y tu vida baja 30 puntos\"})\n coin2 = CoinFlipper.new(1,\"La pelea sigue, tira otra moneda para probar tu suerte\", \n Proc.new{|room, game| room.go_sub(2); game.respect+=100; game.fights+=1; \"Esquivaste otro najajazo y lograste vencerlo, tu respeto aumenta considerablemente\"} , \n Proc.new{|room, game| game.go_state(36); game.respect= 0; game.money = 0; game.life -= 30; \"El Brayan te derrotó con una patada mortal. Has perdido todo tu respeto y dinero, tu vida baja 30 puntos\"})\n coin3 = CoinFlipper.new(2,\"El brayan soltó una mona de guayaba, la tomas, tira una moneda\", \n Proc.new{|room, game| game.go_state(36); game.life = 100; \"La mona tiene grandes poderes curativos, tu vida está al máximo\"} , \n Proc.new{|room, game| game.go_state(36); game.life -= 5; \"La mona tiene malos efectos, tu vida baja\"})\n room43.state = coin1\n room43.add_state(coin1).add_state(coin2).add_state(coin3)\n game.set_state(43, room43)\n\n\n########################################################################################################################################\n##Room 36\n room36 = Room.new(36, \"Sigues caminando por la calle, ves una Fuente en donde varias personas se estan bañando\")\n coin1 = CoinFlipper.new(0,\"Tira una moneda\", \n Proc.new{|room, game| game.go_state(41); \"Ahora te diriges al norte\"} , \n Proc.new{|room, game| game.go_state(15); \"Ahora te dirijes al sur\"})\n room36.state = coin1\n room36.add_state(coin1)\n game.set_state(36, room36);\n \n\n\n########################################################################################################################################\n##Room 41\n room41 = Room.new(41, \"Dejas la fuente atras y descubres una calle llena de cholos\")\n coin1 = CoinFlipper.new(0,\"Tira una moneda para decidir a que cholo dirigirte\", \n Proc.new{|room, game| room.go_sub(1); game.respect+=20; \"Le has caido bien al cholo, se ponen a bailar cholocumbia y tu respeto aumenta\"} , \n Proc.new{|room, game| room.go_sub(1); game.life-=15; \"El cholo te ha mordido y tu vida baja 15 puntos\"})\n move = Move.new(1, \"Dirigete al sur\" , \n nil , Proc.new{|room, game| game.go_state(35) ; \"Caminas hacia el sur\"} ,nil, nil)\n #35\n room41.state = coin1\n room41.add_state(coin1).add_state(move)\n game.set_state(41, room41)\n\n########################################################################################################################################\n##Room 15\n\n room15 = Room.new(15, \"En la misma calle descubres una gasolinera\")\n move = Move.new(0, \"Si quieres explorar la gasolinera ve hacia el norte. Si quieres huir ve hacia el sur\" , \n Proc.new{|room, game| game.go_state(12) ; \"Caminas hacia el norte para explorar\"} , Proc.new{|room, game| game.go_state(24) ; \"Caminas hacia el sur\"} ,nil, nil)\n room15.state = move\n room15.add_state(move)\n game.set_state(15, room15)\n\n########################################################################################################################################\n##Room 12\n\n room12 = Room.new(12, \"Entras al edificio de la gasolinera lentamente, huele a mona de guayaba\")\n coin1 = CoinFlipper.new(0,\"Has encontrado una mochila, puede contener buenas cosas. Prueba tu suerte tirando una moneda\", \n Proc.new{|room, game| game.go_state(42); game.respect+=3; \"Has encontrado una navaja legendaria, tu respeto incrementará\"} , \n Proc.new{|room, game| game.go_state(42); game.life-=3; \"La mochila contenía jeringas usadas, te picas con una de ellas y tu vida baja. Escapas de ese lugar por el sur\"})\n\n room12.state = coin1\n room12.add_state(coin1)\n game.set_state(12, room12)\n\n########################################################################################################################################\n##Room 24 \n room24 = Room.new(24, \"Este lugar es totalmente diferente a todos los demás, un hermoso y limpio jardín en donde descansar\")\n move = Move.new(0, \"Por lugar para descansar, tu vida subiera a 90 puntos cuando decidas salirte. camina hacia el Sur\" , \n nil , Proc.new{|room, game| game.go_state(42); game.life=90; \"Caminas hacia el sur\"} ,nil, nil)\n\n room24.state= move\n room24.add_state(move)\n game.set_state(24, room24)\n\n########################################################################################################################################\n##Room 35\n\n room35 = Room.new(35, \"Llegas al cuarto principal de la bodega, ahi se encuentra el jardin “magico” lleno de droga\")\n coin1 = CoinFlipper.new(0,\"Hay un obstaculo en el camino, tira una moneda para probar tu suerte\", \n Proc.new{|room, game| game.go_state(8); \"Te haz tropezado y causado un alboroto en la otra sala\"} , \n Proc.new{|room, game| game.go_state(9); \"Has pasado el obstaculo y ahora sales de la sala\"})\n room35.state = coin1\n room35.add_state(coin1)\n game.set_state(35, room35)\n\n########################################################################################################################################\n##Room 42\n\nroom42 = Room.new(42, \"Has llegado al zócalo de Ecatepec, el lugar esta muy concurrido y hay diferentes calles y una casa que llama mucho la atención \")\n move = Move.new(0, \"Para observar lo que hay dentro de la casa, camina hacia el Sur. \n Si quieres dirigirte al estacionamiento ve hacia el Este. \n Camina hacia el Norte si deseas ir a la calle de enfrente, o al Oeste para la calle de a lado \",\n Proc.new{|room, game| game.go_state(9); \"Vas en camino hacia la calle que sigue\"},\n Proc.new{|room, game| game.go_state(26); \"Caminas hacia la casa extraña\"},\n Proc.new{|room, game| game.go_state(13); \"Te acercas al estacionamiento\"},\n Proc.new{|room, game| game.go_state(38); \"Vas camino a la calle de a lado\"} )\n room42.state = move\n room42.add_state(move)\n game.set_state(42, room42)\n\n########################################################################################################################################\n##Room 8\nroom8 = Room.new(8, \"Estas en la sala especialde la bodega, aqui todos parecen sospechosos\")\ncoin1 = CoinFlipper.new(0, \"Un chaca llamado “El aletz” te ataca con un picahielo. Tira una moneda para ver que pasa\",\n Proc.new{|room, game| game.go_state(43); game.life-=15; \"El aletz te ha clavado, tu vida baja y escapas del lugar\"},\n Proc.new{|room, game| game.go_state(43); game.respect+=20; \"Has derrotado al aletz, y sales inmediatamente de la sala\"})\nroom8.state = coin1\nroom8.add_state(coin1);\ngame.set_state(8, room8)\n\n########################################################################################################################################\n##Room 9\n\nroom9 = Room.new(9, \"Sigues en la gran bodega y encuentras varias cajas\")\nmove = Move.new(0, \"Tienes la opción de seguir en la pbodega por el Este, o salir por el Sur\",\n nil ,\n Proc.new{|room, game| game.go_state(41); \"Estas saliendo del lugar\"},\n Proc.new{|room, game| game.go_state(8); \"Te adentras más a la bodega\"}, nil)\nroom9.state = move\nroom9.add_state(move)\ngame.set_state(9, room9)\n\n\n########################################################################################################################################\n##Room 13\n\n room13 = Room.new(13, \"Te encuentras en un estacionamiento bastante oscuro y con poco carros, el olor a gasolina emana de todos lados\")\n coin1 = CoinFlipper.new(0, \"Un viene viene con un flow violento te ataca. Tira una moneda para ver si puedes vencerlo\",\n Proc.new{|room, game| game.go_state(42); game.respect+=10; \"Le has vencido y tu respeto aumenta\"},\n Proc.new{|room, game| game.go_state(42); game.life-=10; \"El viene viene te ha derrotado, tu vida baja 10 puntos \"})\n room13.state = coin1\n room13.add_state(coin1)\n game.set_state(13, room13)\n\n\n########################################################################################################################################\n##Room 26\n\n room26 = Room.new(26, \"La casa es bastante extraña y hay unos sujetos con cara de pocos amigos\")\n fight1 = Fight.new(0, \"Para pasar de ahi tienes dos opciones, huir y dales 100 varos a los sujetos o pelear con ellos\",\n Proc.new{|room, game| game.go_state(42); game.life -=20 ; game.respect+=50; \"Los sujetos te atacan con todas sus armas y pierdes mucha vida\"},\n Proc.new{|room, game| game.go_state(42); game.money-=100 ; \"Le pagas su moche a todos y te vas\"})\n room26.state = fight1\n room26.add_state(fight1)\n game.set_state(26, room26)\n\n########################################################################################################################################\n##Room 38\n \n room38 = Room.new(38, \"Esta parece ser una avenida principal, hay mucho trasporte publico por aquí\")\n coin1 = CoinFlipper.new(0, \"A lo lejos encuentras el TrasnporTEC, tira una moneda para ver si lo alcanzas\",\n Proc.new{|room, game| game.go_state(14); \"Lo has alcanzado, estas salvado\"},\n Proc.new{|room, game| game.go_state(6); \"Lastima, te ha dejado el camión y ahora estas perdido\"})\n room38.state = coin1\n room38.add_state(coin1)\n game.set_state(38, room38)\n\n########################################################################################################################################\n##Room 14\n\n room14 = Room.new(14, \"Lo has logado, sobreviviste a Ecatepec. Ahora estas comodamente en el camión camino a tu nueva aventura en los examenes finales, Buena suerte\")\n move = Move.new(0, \"Disfruta tu camino al Tec\" ,\n Proc.new{\"Relajate, para qué te mueves? Todo esta bien\"},\n Proc.new{\"Relajate, para qué te mueves? Todo esta bien\"},\n Proc.new{\"Relajate, para qué te mueves? Todo esta bien\"},\n Proc.new{\"Relajate, para qué te mueves? Todo esta bien\"})\n room14.state = move\n room14.add_state(move)\n game.set_state(14, room14)\n\n\n\n\n\n game.go_state(state)\n game.state.go_sub(substate)\n game\n\nend", "def horloges_parties\n cmd = []\n cmd << %Q{-stroke gray50 -fill -pointsize 6.5 -strokewidth 2}\n # Pour le paradigme absolu\n decs = [0,30,60,90,120] # on en aura besoin ci-dessous\n decs.each do |dec|\n h = Horloge.new(horloge:realtime(dec).to_horloge, top:self.class.top_horloge_part_absolue, left:realpos(dec), bgcolor:'gray50', color:'gray90')\n cmd << h.magick_code\n end\n\n # Pour le paradigme propre au film\n [ne(:dv), ne(:d2)||ne(:cv), ne(:dn)].each_with_index do |neu, idx|\n next if neu.nil?\n dec = decs[idx+1]\n leftpos = realpos(dec)\n top = self.class.top_horloge_part_relative\n h = Horloge.new(horloge:neu.time.to_i.to_horloge, top:top, left:leftpos, bgcolor:'gray20', color:'white')\n cmd << h.magick_code\n # Pour le décalage\n leftdec = realpos(dec + 2.5)\n diff = neu.time.to_i - realtime(dec)\n pref = diff > 0 ? '+' : '−'\n cmd << %Q{-stroke black -fill black -draw \"text #{leftdec},#{top+LINE_HEIGHT/5} '#{pref}#{diff.abs.to_horloge}'\"}\n end\n\n return cmd.join(' ')\nend", "def draw(view)\r\n # show the wall base outline\r\n\r\n # draw the outline of the wall\r\n @corners = [] if not defined?(@corners)\r\n @corners[0] = @pts[0]\r\n @corners[1] = @pts[1]\r\n (a, b) = MM_HouseBuilder.draw_outline(view, @pts[0], @pts[1], @wall.width, @wall.justify, \"gray\")\r\n # puts \"a = \" + a.inspect\r\n @corners[2] = b\r\n @corners[3] = a\r\n @corners[4] = @pts[0]\r\n vec = @pts[1] - @pts[0]\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n if (defined?(@selected_obj) && (obj == @selected_obj))\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"red\", 3)\r\n else\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n end\r\n \r\n if ((@state == STATE_PICK) || (@state == STATE_MOVING))\r\n if (@pt_to_move)\r\n view.draw_points(@pt_to_move, 10, 1, \"red\");\r\n end\r\n if (@state == STATE_MOVING)\r\n view.set_color_from_line(@start_input_point.position, @pt_to_move)\r\n view.line_stipple = \".\" # dotted line\r\n view.draw(GL_LINE_STRIP, @start_input_point.position, @pt_to_move)\r\n end\r\n end\r\n \r\n @drawn = true\r\nend", "def make_circles\n command.speed = -2 # takes a value between -5 to 5\n command.heading = sensors.heading + 0.01\n end", "def rob\n\t\tself.cycle.robs.find_by(number: self.destination)\n\tend", "def room; end", "def initialize\n @board = create_board\n @god_mode = false\n end", "def home\n @heading = 0.0\n @xy = [0.0, 0.0]\n @pen_is_down = false\n end", "def moves_rook(color, a, b)\n \t_moves = []\n \t(continue_up(color, a, b)).each{|move| _moves << move} \n \t(continue_down(color, a, b)).each{|move| _moves << move}\n \t(continue_right(color, a, b)).each{|move| _moves << move}\n \t(continue_left(color, a, b)).each{|move| _moves << move}\n \t_moves.compact\n end", "def setup_blueprint_rooms\n # hardcoded layout\n @corridors << @fort_entrance\n\n fx = @fort_entrance.x\n fy = @fort_entrance.y\n\n fz = @fort_entrance.z1\n setup_blueprint_workshops(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_utilities(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_stockpiles(fx, fy, fz, [@fort_entrance])\n \n 2.times {\n fz = @fort_entrance.z1 -= 1\n setup_blueprint_bedrooms(fx, fy, fz, [@fort_entrance])\n }\n end", "def setup_blueprint_rooms\n # hardcoded layout\n @corridors << @fort_entrance\n\n fx = @fort_entrance.x\n fy = @fort_entrance.y\n\n fz = @fort_entrance.z1\n setup_blueprint_workshops(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_utilities(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_stockpiles(fx, fy, fz, [@fort_entrance])\n \n 2.times {\n fz = @fort_entrance.z1 -= 1\n setup_blueprint_bedrooms(fx, fy, fz, [@fort_entrance])\n }\n end", "def create_weapon_show (mirror, x, y, z, angle)\n @spr = Sprite.new\n @spr.bitmap = Cache.character(FalInt::GunSnipe) \n dx = ($game_map.adjust_x($game_player.x)*32 ) + x\n dy = ($game_map.adjust_y($game_player.y)*32 ) + y \n @spr.x = dx \n @spr.y = dy \n @spr.z = z \n @spr.angle = angle \n @spr.mirror = mirror\n @spr.src_rect = Rect.new( 0 , 0 , 29, 10) \n end", "def draw(interface)\n output \" | | \"\n output \" #{@squares[interface[:top_left]]} | #{@squares[interface[:top]]} | #{@squares[interface[:top_right]]} \"\n output \" | | \"\n output \"-----+-----+-----\"\n output \" | | \"\n output \" #{@squares[interface[:left]]} | #{@squares[interface[:middle]]} | #{@squares[interface[:right]]} \"\n output \" | | \"\n output \"-----+-----+-----\"\n output \" | | \"\n output \" #{@squares[interface[:bottom_left]]} | #{@squares[interface[:bottom]]} | #{@squares[interface[:bottom_right]]} \"\n output \" | | \"\n end", "def roster\n end", "def create_reductio(x, y, number, reductio_level)\n board = Board.new(@datas, @base_width, @base_height, reductio_level)\n board.flatten_cells.each_with_index{ |cell, i| cell.copy(flatten_cells[i]) }\n board.groups.each_with_index{ |group, i| group.copy(@groups[i]) }\n board.cells[y][x].set_reductio(number)\n return board\n end", "def setup \n size 640, 360\n no_stroke\n frame_rate 30 \n @x, @y = 0.0, 0.0\n @size = 80.0\nend", "def place_private piece, orientation, c\n return nil unless fits?(piece, orientation, c)\n case orientation\n when :vertical_up\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row + 1][c.left] = piece.id if piece.size > 1\n @a[c.face][c.row + 2][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row + piece.size - 1, c.left)\n\n when :vertical_down\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row - 1][c.left] = piece.id if piece.size > 1\n @a[c.face][c.row - 2][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row - piece.size + 1, c.left)\n\n when :sideways_right\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row][c.left + 1] = piece.id if piece.size > 1\n @a[c.face][c.row][c.left + 2] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row, c.left + piece.size - 1)\n\n when :sideways_left\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row][c.left - 1] = piece.id if piece.size > 1\n @a[c.face][c.row][c.left - 2] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row, c.left - piece.size + 1)\n\n when :long_far\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face + 1][c.row][c.left] = piece.id if piece.size > 1\n @a[c.face + 2][c.row][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face + piece.size - 1, c.row, c.left)\n\n when :long_near\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face - 1][c.row][c.left] = piece.id if piece.size > 1\n @a[c.face - 2][c.row][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face - piece.size + 1, c.row, c.left)\n end\n\n return true, string_end\n end", "def rotate\n g = Grid.new\n self.each do |point,v|\n g[Point.new(point.y,point.x)] = v\n end\n (0..g.height - 1).each do |y|\n ( 0..g.width/2.ceil - 1 ).each do |x|\n tmp = g[Point.new(x,y)]\n g[Point.new(x,y)] = g[Point.new(g.width - x - 1, y )]\n g[Point.new(g.width - x - 1,y)] = tmp\n end\n end\n g\n end", "def moves_n_turns(the_plateau,paint_color)\n\t\t\t@moves_n_turns.each do |n|\n\n\t\t\t\tcase n\n\t\t\t\twhen \"L\"\n\t\t\t\t\tcase @direction\n\t\t\t\t\t\twhen \"N\"\n\t\t\t\t\t\t\t@direction = \"W\"\n\t\t\t\t\t\twhen \"W\"\n\t\t\t\t\t\t\t@direction = \"S\"\n\t\t\t\t\t\twhen \"S\"\n\t\t\t\t\t\t\t@direction = \"E\"\n\t\t\t\t\t\twhen \"E\"\n\t\t\t\t\t\t\t@direction = \"N\"\n\t\t\t\t\tend\n\n\t\t\t\twhen \"R\"\n\t\t\t\t\tcase @direction\n\t\t\t\t\t\twhen \"N\"\n\t\t\t\t\t\t\t@direction = \"E\"\n\t\t\t\t\t\twhen \"W\"\n\t\t\t\t\t\t\t@direction = \"N\"\n\t\t\t\t\t\twhen \"E\"\n\t\t\t\t\t\t\t@direction = \"S\"\n\t\t\t\t\t\twhen \"S\"\n\t\t\t\t\t\t\t@direction = \"W\"\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\twhen \"M\"\n\n\t\t\t\t\tcase @direction\n\t\t\t\t\t\twhen \"N\"\n\t\t\t\t\t\t\t@ycoord = @ycoord.to_i + 1\n\t\t\t\t\t\t\tthe_plateau.plot_rover(@xcoord,@ycoord,paint_color)\n\t\t\t\t\t\twhen \"W\"\n\t\t\t\t\t\t\t@xcoord = @xcoord.to_i - 1\n\t\t\t\t\t\t\tthe_plateau.plot_rover(@xcoord,@ycoord,paint_color)\n\t\t\t\t\t\twhen \"E\"\n\t\t\t\t\t\t\t@xcoord = @xcoord.to_i + 1\n\t\t\t\t\t\t\tthe_plateau.plot_rover(@xcoord,@ycoord,paint_color)\n\t\t\t\t\t\twhen \"S\"\n\t\t\t\t\t\t\t@ycoord = @ycoord.to_i - 1\n\t\t\t\t\t\t\tthe_plateau.plot_rover(@xcoord,@ycoord,paint_color)\n\t\t\t\t\tend # End of Case direction\n\t\t\t\tend # End of case n\n\n\t\t\t\tthe_plateau.plot_rover_final_position(@xcoord,@ycoord,@direction,paint_color)\n\n\t\t\tend # End of Method Moves_n_turns\n\t\tend", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def build_game_instance\n @roulette_wheel = (0..36).to_a # Establishes array of possible numbers\n @roulette_wheel.push(\"00\") # Adds 00\n @roulette_wheel.each_with_index do |number,index|\n @roulette_wheel[index] = number.to_s # converts each number to a string\n end\n\n @bet_options = [\"Any Single Number\",\"00\",\"red\",\"black\",\"odd\",\"even\",\"1-18\",\n \"19-36\",\"1-12\",\"13-24\",\"25-36\"]\n\n # Combines all options into one array, and flattens this array \n @bet_options.push((0..36).to_a)\n @bet_options.flatten!\n \n # Makes sure everything is a string\n @bet_options.each_with_index do |number,index|\n @bet_options[index] = number.to_s\n end\n \n # Builds arrays for red and black colors on the roulette table\n @red = [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36]\n @black = [2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,32,33,35]\n end", "def draw_cell(window, cell, is_player, grid_length)\n cell_width = window.width / grid_length\n cell_draw_x = cell.grid_x * cell_width\n cell_draw_y = cell.grid_y * cell_width\n\n\n window.draw_rect(cell_draw_x, cell_draw_y, cell_width, cell_width, Gosu::Color.argb(DARK_GRAY_COLOR)) if cell.show_base_background\n\n if cell.grid_y == grid_length - 1 && cell.grid_x == grid_length - 1\n window.draw_rect(cell_draw_x + PLATFORM_MARGIN,\n cell_draw_y + PLATFORM_MARGIN,\n cell_width - + PLATFORM_MARGIN * 2,\n cell_width - PLATFORM_MARGIN * 2,\n Gosu::Color.argb(LIGHT_GREEN_COLOR))\n end\n\n if is_player\n window.draw_rect(cell_draw_x + PLAYER_MARGIN,\n cell_draw_y + PLAYER_MARGIN,\n cell_width - PLAYER_MARGIN * 2,\n cell_width - PLAYER_MARGIN * 2,\n Gosu::Color.argb(PLAYER_COLOR))\n end\n\n draw_cell_walls(window, cell, cell_width, MAZE_WALL_THICKNESS, Gosu::Color.argb(LIGHT_GRAY_COLOR))\n\nend", "def robin; end", "def rotate(right,down)\n Cell.new((@x + right) % @w,\n (@y + down) % @h,\n @w,\n @h)\n end", "def setup \n size 640, 360 \n no_stroke\n rect_mode CENTER \n frame_rate 30 \n @a, @s = 0.0, 0.0\nend", "def setup_blueprint_outdoor_farms(want)\n @fort_entrance.maptile.spiral_search([df.world.map.x_count, df.world.map.y_count].max, 9, 3) { |_t|\n next unless sf = surface_tile_at(_t)\n sd = sf.designation\n if (-1..1).all? { |dx| (-1..1).all? { |dy|\n tt = sf.offset(dx, dy) and\n td = tt.designation and\n ((sd.subterranean and td.subterranean) or\n (not sd.subterranean and not td.subterranean and\n sd.biome == td.biome)) and\n tt.shape_basic == :Floor and\n tt.designation.flow_size == 0 and\n [:GRASS_DARK, :GRASS_LIGHT, :SOIL].include?(tt.tilemat)\n } }\n @rooms << Room.new(:farmplot, [:food, :cloth][want % 2], sf.x-1, sf.x+1, sf.y-1, sf.y+1, sf.z)\n @rooms.last.misc[:users] = []\n @rooms.last.misc[:outdoor] = true\n want -= 1\n true if want == 0\n end\n }\n end", "def pbRandomRoam(index)\n if $PokemonGlobal.roamPosition\n keys=pbRoamingAreas(index).keys\n $PokemonGlobal.roamPosition[index]=keys[rand(keys.length)]\n end\nend", "def valid_white_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if white_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x-1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y+1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y-1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n return false\n end", "def draw_board_start\n #Places the pawns\n 8.times do |x|\n @b[x][1] = @WP\n @b[x][6] = @BP\n end\n #white, on bottom, the opaque pieces\n @b[0][0] = @WR; @b[7][0] = @WR\n @b[1][0] = @WK; @b[6][0] = @WK\n @b[2][0] = @WB; @b[5][0] = @WB\n @b[3][0] = @WQ\n @b[4][0] = @WKg\n #black, on top, the filled in pieces\n @b[0][7] = @BR; @b[7][7] = @BR\n @b[1][7] = @BK; @b[6][7] = @BK\n @b[2][7] = @BB; @b[5][7] = @BB\n @b[3][7] = @BQ\n @b[4][7] = @BKg\n \n #TESTING PIECES HERE\n\n\n draw_board\n end", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n\n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd?\n place_room(r_w, r_h, room_id)\n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n end", "def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end", "def render_board\n\n\t\t# So, we'll rebuild the render target from scratch\n\t\t(0...@height).each do |row|\n\t\t\t(0...@width).each do |col|\n\n\t\t\t\t# Save myself some typing, and some math cycles...\n\t\t\t\tcell_idx = (row*@width)+col\n\n\t\t\t\t# Check to see if this cell is covered\n\t\t\t\tif @cell_status[cell_idx] == :status_covered\n\t\t\t\t\tcell = @cover_png\n\t\t\t\telsif @cell_status[cell_idx] == :status_gold\n\t\t\t\t\tcell = @gold_png\n\t\t\t\telse\n\t\t\t\t\tif @dragons[cell_idx] == DRAGON\n\t\t\t\t\t\tcell = @dragon_png\n\t\t\t\t\telse\n\t\t\t\t\t\tcell = @cell_png[@dragons[cell_idx]]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# We know what to draw, so draw it\n\t\t\t\t$gtk.args.render_target( :board ).width = @board_w\n\t\t\t\t$gtk.args.render_target( :board ).height = @board_h\n\t\t\t\t$gtk.args.render_target( :board ).sprites << {\n\t\t\t\t\tx: (col*@cell_size), y: (row*@cell_size),\n\t\t\t\t\tw: @cell_size, h: @cell_size, path: cell,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\tend\n\n\tend", "def create_in_direction dir\n new_room = Room.create({:created_at=>Time.now, :x=>self.x, :y=>self.y, :z=>self.z})\n \n case dir\n when \"north\",:north, 0\n new_room.y += 1\n when \"east\", :east, 1\n new_room.x += 1\n when \"south\",:south, 2\n new_room.y -= 1\n when \"west\",:west, 3\n new_room.x -= 1\n when \"up\",:up, 4\n new_room.y += 1\n when \"down\",:down, 5\n new_room.y -= 1\n end\n \n create_exit(dir, new_room, true) # two way exit\n return new_room\n end", "def create_rover(c)\n @rover_bay = []\n c.each_with_index do |x,i|\n @rover_bay.push(Rover.new(x.movement,x.position,i+1))\n end\n end", "def valid_black_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if black_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x-1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y+1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y-1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n return false\n end", "def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end", "def generate\n # Vælg et tilfældigt koordinat til at starte med.\n random_start = [@prng.rand(@width),@prng.rand(@height)]\n \n # Opret en stak og læg det tilfældige koordinat på stakken.\n stack = Array.new\n stack.push random_start\n until stack.empty?\n # Tag koordinaterne fra det øverste element på stakken.\n x,y = stack.last\n # Marker cellen som besøgt.\n @grid[y][x].visited = true\n # Gem alle cellens nabo-celler.\n neighbors = Array.new\n neighbors.push [x, y-1] unless y-1 < 0 # Nord\n neighbors.push [x+1, y] unless x+1 >= @width # Øst\n neighbors.push [x, y+1] unless y+1 >= @height # Syd\n neighbors.push [x-1, y] unless x-1 < 0 # Vest\n # Sorter de naboer fra der allerede er blevet besøgt af algoritmen.\n neighbors.delete_if {|x, y| @grid[y][x].visited }\n # tjek om der er nogle ubesøgte naboer.\n if neighbors.any?\n # Vælg en tilfældig ubesøgt nabo.\n random_neighbor = neighbors.sample(random:@prng)\n # Forbind denne celle med den tilfældige nabo.\n connect stack.last, random_neighbor\n # Læg den tilfældige nabo øverst på stakken.\n stack.push random_neighbor\n else\n # Hvis der ingen naboer er, så tager den en celle af stakken.\n stack.pop\n end\n end\n end", "def setup\n size 640, 360\n background 0\n stroke_weight 8\n (5 ... width/2).step(5) do |i|\n i.even? ? draw_short(i) : draw_long(i)\n end\nend", "def draw(view)\r\n # show the wall base outline\r\n\r\n # draw the outline of the wall\r\n @corners[0] = @wall.origin\r\n @corners[1] = @wall.endpt\r\n (a, b) = MM_HouseBuilder.draw_outline(view, @corners[0], @corners[1], @wall.width, @wall.justify, \"gray\")\r\n # puts \"a = \" + a.inspect\r\n @corners[2] = b\r\n @corners[3] = a\r\n @corners[4] = @corners[0]\r\n vec = @corners[1] - @corners[0]\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n if (defined?(@selected_obj) && (obj == @selected_obj))\r\n if (@state != STATE_MOVING)\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"red\", 3)\r\n end\r\n else\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n end\r\n if (@state == STATE_MOVING)\r\n MM_HouseBuilder.draw_outline(view, @start_pt, @end_pt, @wall.width, @wall.justify, \"red\", 2)\r\n end\r\n \r\n @drawn = true\r\nend", "def setup \n size 640, 360 \n\tbackground 127 \n\tno_stroke\t\n\t(0...height).step(20) do |i|\n\t\tfill 0 \n\t\trect 0, i, width, 10 \n\t\tfill 255 \n\t\trect i, 0, 10, height \n\tend\nend", "def build_quilt\n\t\t# Output variables used\n\t\tputs \"\\nBuilding quilt...\"\n\t\tputs \"\\n-----------------------------------------\"\n\t\tputs \"Dimensions: #{@needed_columns} columns by #{@needed_rows} rows\"\n\t\tputs \"Using squares of #{@square_size} by #{@square_size} with #{@all_colors.length} colors\"\n\t\tputs \"-----------------------------------------\"\n\t\tputs \"\\nBuilding left side...\"\n\t\tprint \"Quilt row: \"\n\t\t@quilt_board = []\n\t\ttries = 0\n\t\t# Continue loop until all rows have been built\n\t\tloop do \n\t\t\t# Stop loop when all rows are made\n\t\t\tbreak if @quilt_board.length == @needed_rows\n\t\t\t# Get the next row\n\t\t\trow, @quilt_board = get_row(@quilt_board, @square_size)[0..1]\n\t\t\t# If there are no options left...\n\t\t\tif row == false\n\t\t\t\t# Delete the last two rows and try again. Sometimes there will be no options depending on which rows it picked, so this will usually help\n\t\t\t\t@quilt_board.pop\n\t\t\t\t@quilt_board.pop\n\t\t\t\ttries += 1\n\t\t\t\t# If it has tried this three times, just start the current square over. This will fix it if it really gets stuck.\n\t\t\t\tif tries % 3 == 0\n\t\t\t\t\tif @quilt_board.length < @square_size\n\t\t\t\t\t\t@quilt_board = []\n\t\t\t\t\telse\n\t\t\t\t\t\t# Only delete the current square, not the whole thing\n\t\t\t\t\t\thow_many_full_blocks = @quilt_board.length / @square_size\n\t\t\t\t\t\t(@quilt_board.length - (how_many_full_blocks * @square_size)).times { @quilt_board.pop }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# Row is valid, so add it to quilt\n\t\t\t\t@quilt_board << row\n\t\t\t\t# Print which row it just built\n\t\t\t\tprint \"#{@quilt_board.length} \"\n\t\t\tend\n\t\tend\n\t\t# If the quilt is wider than one block, build the right side\n\t\tif @needed_columns > @square_size\n\t\t\tbuild_right\n\t\tend\n\t\t# If the quilt is wider than two blocks, build the far right side\n\t\tif @needed_columns > @square_size * 2\n\t\t\tbuild_far_right\n\t\tend\n\t\t# Show the quilt\n\t\tshow_quilt\n\t\t# Build html page for the quilt\n\t\tbuild_index\n\tend", "def draw(x_position, y_position)\n $app.fill(rgb(255,255,255))\n\t$app.title(@number)\n #$app.oval(x_position * Game::PIECE_SIZE + Game::PIECE_SIZE, y_position * Game::PIECE_SIZE + Game::PIECE_SIZE, \n # Game::PIECE_SIZE * Game::PIECE_SCALE_FACTOR)\n #update the coordinates of the piece\n @x = x_position\n @y = y_position\n end", "def rover_positions_as_string\n @maxX = @file[0]\n @maxY = @file[1]\n while @more\n\n set_initial_position\n move_rover(@file[1 + 4 * @roverCount])\n puts \"#{@x} #{@y} #{@face}\"\n if @file[6 + 3 * @roverCount] == nil\n @more = false\n else\n @roverCount = @roverCount + 1\n end\n end \n end", "def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end", "def setup\n size 640, 360\n stroke_weight 10\n no_loop\nend", "def init_pos\r\n reset_board_variables\r\n colors = {:white => 0, :black => 7}\r\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\r\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\r\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\r\n # set pieces \r\n colors.each do |k_col, v_col|\r\n # iterate each color\r\n key_color_array = key_pieces[k_col]\r\n pieces.each do |k_pie, v_pie|\r\n # iterate each piece\r\n v_pie.each do |ix_piece|\r\n #p v_col, ix_piece, k_pie, k_col\r\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[v_col][ix_piece] \r\n end\r\n end#end pieces\r\n \r\n # now set pawn for this color\r\n ix_col = 1\r\n ix_col = 6 if k_col == :black\r\n [0,1,2,3,4,5,6,7].each do |ix_piece|\r\n #p ix_col, ix_piece\r\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \r\n end\r\n end \r\n #p @pieces\r\n #p @infosquare\r\n #p @pieces.size\r\n #p @pieces[:white].first\r\n end", "def initialize\r\n super\r\n #print \"Se crea un pez\\n\"\r\n @image = Image[\"pez3.png\"]\r\n # Hacer que el pez se mueva\r\n @animation = Chingu::Animation.new(:file => \"pezcompleto_50x33.bmp\")\r\n @animation.frame_names = { :izquierda => 0...2, :derecha => 2...4 }\r\n @frame_name = :izquierda\r\n\r\n @direccion = Direccion.new($window.width, $window.height, 10, @image.width, @image.height)\r\n @pez_vivo = true\r\n # print @image.width.to_s + \", \" + @image.height.to_s + \" -- \"\r\n # print $window.width.to_s + \", \" + $window.height.to_s + \"\\n\"\r\n @z = 1\r\n @nombre = rand.to_s\r\n @ultimo = self\r\n @genero = 1\r\n @vida = 5\r\n @vida_inicio = Time.now\r\n @vida_desviacion = rand(5)\r\n @reproducir = 2 # tiempo que espera para reproducirse\r\n @reproducir_veces1 = 0 # veces que se ha reproducido\r\n @reproducir_veces2 = 5 # maximo de veces que puede reproducirse\r\n @reproducir_puede = false\r\n @reproducir_inicio = Time.now\r\n @reproducir_desviacion = rand(5)\r\n @libre = true # Es para saber si el pez se puede mover hacia otra comida\r\n @perseguido = false # Es para saber si el pez debe evitar una coordenada\r\n @evitarx = 0 # Coordenadas a evitar si es perseguido\r\n @evitary = 0 # Coordenadas a evitar si es perseguido\r\n\r\n end", "def rec_build(level, direction, rotation, fractal_list)\r\n # At the lowest level, add an actual piece to the array\r\n if (level == 0)\r\n fractal_list.push((direction + rotation) % 360)\r\n return\r\n end\r\n \r\n # At higher levels, we need to define the shape of the fractal\r\n for piece_direction in @base_fractal\r\n rec_build(\r\n level - 1, # Drill down to the next level\r\n piece_direction, # Take direction from the base array\r\n (direction + rotation) % 360, # Rotate lower-level according to higher level structure\r\n fractal_list) # Append to the list\r\n end\r\n end", "def build_right\n \t\tputs \"\\n\\nBuilding right side...\"\n \t\tprint \"Quilt row: \"\n\t\t@quilt_board_right = []\n\t\ttries = 0\n\t\tcheck_options = nil\n\t\t# Continue loop until all rows have been made\n\t\tloop do \n\t\t\tblock_length = @quilt_board_right.length\n\t\t\t# Break loop when done\n\t\t\tbreak if block_length == @needed_rows\n\t\t\t# Calculate how wide block should be\n\t\t\tif @needed_columns - @square_size <= @square_size\n\t\t\t\twidth = @needed_columns - @square_size\n\t\t\telse\n\t\t\t\twidth = @square_size\n\t\t\tend\n\t\t\t# Get next potential row\n\t\t\tpotential_row, @quilt_board_right, opt_length = get_row(@quilt_board_right, width)\n\t\t\t# If there are no options left...\n\t\t\tif potential_row == false\n\t\t\t\t# Delete the last two rows and start again\n\t\t\t\t@quilt_board_right.pop\n\t\t\t\t@quilt_board_right.pop\n\t\t\t\ttries += 1\n\t\t\t\t# If this has been tried a few times start the square over\n\t\t\t\tif tries % 3 == 0\n\t\t\t\t\tif block_length < @square_size\n\t\t\t\t\t\t@quilt_board_right = []\n\t\t\t\t\telse\n\t\t\t\t\t\t# Only delete the current square, not the whole thing\n\t\t\t\t\t\thow_many_full_blocks = @quilt_board_right.length / @square_size\n\t\t\t\t\t\t(@quilt_board_right.length - (how_many_full_blocks * @square_size)).times { @quilt_board_right.pop }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# The current row satisfies the current block, not the left side of the quilt, so check that here. Make sure left edge of the row doesn't match the right edge of the left side.\n\t\t\t\t# This is for the top row\n\t\t\t\tif block_length == 0 && potential_row[0] != @quilt_board[0][-1] && potential_row[0] != @quilt_board[1][-1]\n\t\t\t\t\t@quilt_board_right << potential_row\n\t\t\t\t\tprint \"#{@quilt_board_right.length} \"\n\t\t\t\t# This is for the middle rows\n\t\t\t\telsif block_length.between?(1, (@needed_rows - 2)) && potential_row[0] != @quilt_board[block_length - 1][-1] && potential_row[0] != @quilt_board[block_length][-1] && potential_row[0] != @quilt_board[block_length + 1][-1]\n\t\t\t\t\t@quilt_board_right << potential_row\n\t\t\t\t\tprint \"#{@quilt_board_right.length} \"\n\t\t\t\t# This is for the last row\n\t\t\t\telsif block_length == (@needed_rows - 1) && potential_row[0] != @quilt_board[-2][-1] && potential_row[0] != @quilt_board[-1][-1]\n\t\t\t\t\t@quilt_board_right << potential_row\n\t\t\t\t\tprint \"#{@quilt_board_right.length} \"\n\t\t\t\telse\n\t\t\t\t\t# Sometimes the right side block gets stuck and comes up with the same options (say, 3) over and over. The block itself still has options, but none that satisfy the left side of the quilt. If it does this 10 times delete the last two rows of the block.\n\t\t\t\t\tif check_options == opt_length\n\t\t\t\t\t\ttries += 1\n\t\t\t\t\t\tif tries % 10 == 0\n\t\t\t\t\t\t\t@quilt_board_right.pop\n\t\t\t\t\t\t\t@quilt_board_right.pop\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tcheck_options = opt_length\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def possible_rook_moves(start_arr)\n\t\tx = start_arr[1]\n\t\ty = start_arr[0]\n\t\tcandidates = []\n\t\t# Checks how many spaces rook can move up\n\t\tmove_up = true\n\t\ti = 1\t\t\n\t\twhile move_up && i < 8\n\t\t\tpos = [y+i, x]\n\t\t\tif pos[0] >= 8\t\n\t\t\t\tmove_up = false\n\t\t\telse\t\n\t\t\t\tif !(@board[pos] == \"*\")\n\t\t\t\t\tif @board[pos].color == @board[start_arr].color\n\t\t\t\t\t\tmove_up = false\n\t\t\t\t\telsif !( @board[pos].color == @board[start_arr].color )\n\t\t\t\t\t\tcandidates << pos\n\t\t\t\t\t\tmove_up = false\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tcandidates << pos\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Checks how many spaces rook can move down\n\t\tmove_down = true\t\t\n\t\ti = 1\t\n\t\twhile move_down && i < 8\n\t\t\tpos = [y-i, x]\n\t\t\tif pos[0] < 0\t\n\t\t\t\tmove_down = false\n\t\t\telse\t\n\t\t\t\tif !(@board[pos] == \"*\")\n\t\t\t\t\tif @board[pos].color == @board[start_arr].color\n\t\t\t\t\t\tmove_down = false\n\t\t\t\t\telsif !( @board[pos].color == @board[start_arr].color )\n\t\t\t\t\t\tcandidates << pos\n\t\t\t\t\t\tmove_down = false\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tcandidates << pos\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Checks how many spaces rook can move right\n\t\tmove_right = true\t\t\n\t\ti = 1\t\n\t\twhile move_right && i < 8\n\t\t\tpos = [y, x+1]\n\t\t\tif pos[1] > 7\t\n\t\t\t\tmove_right = false\n\t\t\telse\t\n\t\t\t\tif !(@board[pos] == \"*\")\n\t\t\t\t\tif @board[pos].color == @board[start_arr].color\n\t\t\t\t\t\tmove_right = false\n\t\t\t\t\telsif !( @board[pos].color == @board[start_arr].color )\n\t\t\t\t\t\tcandidates << pos\n\t\t\t\t\t\tmove_right = false\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tcandidates << pos\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Checks how many spaces rook can move left\n\t\tmove_left = true\t\t\n\t\ti = 1\t\n\t\twhile move_left && i < 8\n\t\t\tpos = [y, x+1]\n\t\t\tif pos[1] > 7\t\n\t\t\t\tmove_left = false\n\t\t\telse\t\n\t\t\t\tif !(@board[pos] == \"*\")\n\t\t\t\t\tif @board[pos].color == @board[start_arr].color\n\t\t\t\t\t\tmove_left = false\n\t\t\t\t\telsif !( @board[pos].color == @board[start_arr].color )\n\t\t\t\t\t\tcandidates << pos\n\t\t\t\t\t\tmove_left = false\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tcandidates << pos\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\t\t\n\t\tcandidates\n\tend", "def make_other_piece(piece_pos, color)\n\n col = piece_pos[1]\n\n case col\n when 0, 7\n Rook.new(:R, piece_pos, color)\n when 1, 6\n Knight.new(:N, piece_pos, color)\n when 2, 5\n Bishop.new(:B, piece_pos, color)\n when 3\n Queen.new(:Q, piece_pos, color)\n when 4\n King.new(:K, piece_pos, color)\n end\n end", "def render\n (\"A\"..\"H\").each { |col| print \" #{col}\"}\n print \"\\n\\n\"\n\n (0...8).each do |row|\n # Start counting downwards - rows are upside down in ChessBoard\n row_idx = (7 - row) % @board.rows.count + 1\n print \"#{row_idx} \"\n\n (0...8).each do |col|\n pos = [row, col]\n render_piece(pos)\n end\n\n print \"\\n\\n\"\n end\n\n debug_info if @debug\n print_controls\n end", "def ro_1\n am = Sketchup.active_model\n cns = Sketchup::RenderingOptions\n\n # create a hash of ro keys\n @@h_ro = {}\n am.rendering_options.each { |k,v|\n val = v.kind_of?(Sketchup::Color) ? v.to_s.slice(-20,20) : v\n @@h_ro[k] = val\n }\n\n # hash @@roc = RenderingOptions constants\n # key is constant value\n # value is constant name, with some spacing added by RegEx\n @@roc = Hash.new(\"** No Constant! **\")\n # get all the constants, parse names, add to hash\n cns.constants.each { |c|\n text = c.to_s.dup\n if ( text =~ /^ROPSet/ ) ; text.sub!(/^ROPSet/, 'ROPSet ')\n elsif ( text =~ /^ROP/ ) ; text.sub!(/^ROP/ , 'ROP ')\n end\n @@roc[cns.const_get(c)] = text\n }\n\n # dump hash to console\n cnsl = '-----------------------------------------'\n puts cnsl + ' ro_1()'\n prev = -1\n @@roc.sort.each { |r|\n num = r[0].to_s.rjust(3) + ((prev + 1 != r[0]) ? \"*\" : \" \")\n puts \"#{num} #{r[1]}\"\n prev = r[0]\n }\n puts cnsl\n\n # create a RenderingOptionsObserver instance & add callback method\n @obs_ro1 = Sketchup::RenderingOptionsObserver.new\n @obs_ro1.instance_eval {\n @tmr_stopped = true\n def onRenderingOptionsChanged(ro, type)\n # timer puts line breaks between ro changes when multiple ocurr\n if (@tmr_stopped)\n @tmr_stopped = false\n UI.start_timer(0.100) { @tmr_stopped = true ; puts }\n end\n\n # Loop thru ro's and find changes, load into s_val\n s_val = ''\n ro.each { |k,v|\n val = v.kind_of?(Sketchup::Color) ? v.to_s.slice(-20,20) : v\n if (@@h_ro[k] != val)\n @@h_ro[k] = val\n val = \"%e\" % v if (v.class == Float)\n s_val << \"#{val.to_s.rjust(20)} #{k}\"\n end\n }\n # finally put info to console\n puts \"#{type.to_s.rjust(2)} #{@@roc[type].ljust(32)} #{s_val}\"\n end\n }\n # attach the observer\n am.rendering_options.add_observer(@obs_ro1)\n end", "def rams_to_destroy_wall\n wall = (buildings.wall || '0').to_i\n\n results = {}\n results[0] = 0\n results[1] = 2\n results[2] = 7\n results[3] = 13\n results[4] = 20\n results[5] = 28\n results[6] = 37\n results[7] = 48\n results[8] = 60\n results[9] = 74\n results[10] = 90\n results[11] = 108\n results[12] = 129\n results[13] = 153\n results[14] = 180\n results[15] = 211\n results[16] = 246\n results[17] = 286\n results[18] = 330\n results[19] = 380\n results[20] = 437\n\n results[wall]\n end", "def render_cut gcode, x, y\n radius = @config[:corner_radius]\n left = x\n bottom = y\n right = x+@config[:tile_size][0]\n top = y+@config[:tile_size][1]\n\n gcode.instance_eval do\n if radius && radius > 0\n jog :x => left, :y => bottom+radius\n move :x => left, :y => top-radius, :laser => true\n turn_cw :x => left+radius, :y => top, :i => radius\n move :x => right-radius, :y => top\n turn_cw :x => right, :y => top-radius, :j => -radius\n move :x => right, :y => bottom+radius\n turn_cw :x => right-radius, :y => bottom, :i => -radius\n move :x => left+radius, :y => bottom\n turn_cw :x => left, :y => bottom+radius, :j => radius\n nc :laser => false\n else\n jog :x => left, :y => bottom\n move :x => left, :y => top, :laser => true\n move :x => right, :y => top\n move :x => right, :y => bottom\n move :x => left, :y => bottom\n nc :laser => false\n end\n end\n end", "def render_cut gcode, x, y\n radius = @config[:corner_radius]\n left = x\n bottom = y\n right = x+@config[:tile_size][0]\n top = y+@config[:tile_size][1]\n\n gcode.instance_eval do\n if radius && radius > 0\n jog :x => left, :y => bottom+radius\n move :x => left, :y => top-radius, :laser => true\n turn_cw :x => left+radius, :y => top, :i => radius\n move :x => right-radius, :y => top\n turn_cw :x => right, :y => top-radius, :j => -radius\n move :x => right, :y => bottom+radius\n turn_cw :x => right-radius, :y => bottom, :i => -radius\n move :x => left+radius, :y => bottom\n turn_cw :x => left, :y => bottom+radius, :j => radius\n nc :laser => false\n else\n jog :x => left, :y => bottom\n move :x => left, :y => top, :laser => true\n move :x => right, :y => top\n move :x => right, :y => bottom\n move :x => left, :y => bottom\n nc :laser => false\n end\n end\n end", "def draw(view)\r\n # Show the current input point\r\n if (@ip.valid? && @ip.display?)\r\n @ip.draw(view)\r\n @drawn = true\r\n end \r\n\r\n # draw the outline of the wall\r\n MM_HouseBuilder.draw_outline(view, @wall.origin, @wall.endpt, @wall.width, @wall.justify, \"gray\")\r\n vec = @end_pt - @start_pt\r\n # draw the outline of each door and window\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n MM_HouseBuilder.draw_outline(view, @start_pt, @end_pt, @wall.width, @wall.justify, \"orange\", 2)\r\n @drawn = true\r\nend", "def towerBuilder(n_floors)\n layer = width = n_floors + (n_floors - 1)\n result = []\n\n while layer > 0\n result.unshift((\"*\" * layer).center(width))\n layer -= 2\n end\n result\nend", "def draw_route\n # Delete all sprites in drawing of path\n @arrow_path.each{|a| a.dispose}\n @arrow_path = []\n \n return if @passed_positions.empty?\n start_pos = [@unit.x, @unit.y]\n new_pos = start_pos\n type = \"\"\n # Get direction from unit to first tile in path\n last_dir = case [@passed_positions[0].x - @unit.x, @passed_positions[0].y - @unit.y]\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n # Loop through path positions, evaluating two elements at a time\n for i in 0...@passed_positions.size\n p1 = @passed_positions[i]\n p1 = [p1.x, p1.y]\n p2 = (@passed_positions[i+1] == nil ? 0 : @passed_positions[i+1])\n if p2.is_a?(MoveTile)\n p2 = [p2.x, p2.y] \n # Figure out the direction taken to get from p1 to p2\n dir = [p2[0] - p1[0], p2[1] - p1[1]]\n dir = case dir\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n else\n dir = 0\n end\n # Evaluate the last direction taken to get to current spot\n case last_dir\n when 2\n new_pos[1] += 1\n type = case dir\n when 0 then \"d\"\n when 2 then \"v\"\n when 4 then \"ru\"\n when 6 then \"lu\"\n end\n when 4\n new_pos[0] -= 1\n type = case dir\n when 0 then \"l\"\n when 2 then \"ld\"\n when 4 then \"h\"\n when 8 then \"lu\"\n end\n when 6\n new_pos[0] += 1\n type = case dir\n when 0 then \"r\"\n when 2 then \"rd\"\n when 6 then \"h\"\n when 8 then \"ru\"\n end\n when 8\n new_pos[1] -= 1\n type = case dir\n when 0 then \"u\"\n when 4 then \"rd\"\n when 6 then \"ld\"\n when 8 then \"v\"\n end\n end\n last_dir = dir\n @arrow_path.push(Arrow_Sprite.new($spriteset.viewport1, type, new_pos))\n end\n end", "def move(direction) \n # Exit map check\n if direction == 'up' && @pos_y == 2 && @pos_x == 1\n ProfBirchHome.new(@player, 'top').begin\n # If interacting with Prof Birch Child in first time instance, do a speech & animation\n elsif @player.profbirchhomeupstairs == 'first' \n if (direction == 'up' && @pos_y == 8 && @pos_x == 3) || (direction == 'right' && @pos_y ==7 && @pos_x == 2) || (direction == 'left' && @pos_x == 2 && @pos_y == 9)\n slowly(\"POKEMON fully restored!\\nItems ready, and... Huh?\")\n reset_map\n slowly(\"Huh? Who... Who are you?\")\n reset_map\n slowly(\"... ... ... ... ... ... ... ...\\n... ... ... ... ... ... ... ...\")\n reset_map\n slowly(\"Oh, you're #{ @player.name }.\\nSo your move was today.\")\n reset_map\n slowly(\"Um... I'm #{ @player.other_name }.\\nGlad to meet you!\")\n reset_map\n slowly(\"I...\\nI have this dream of becoming friends\")\n slowly(\"with POKEMON all over the world.\")\n reset_map\n slowly(\"I... I heard about you, #{ @player.name }, from\\nmy dad, PROF. BIRCH.\")\n reset_map\n slowly(\"I was hoping that you would be nice,\\n#{ @player.name }, and that we could be friends.\")\n reset_map\n slowly(\"On, this is silly, isn't it?\\nI... I've just met you, #{ @player.name }.\")\n reset_map\n slowly(\"Eheheh...\")\n reset_map\n slowly(\"Oh, no! I forgot!\")\n reset_map\n slowly(\"I was supposed to go help Dad catch\\nsome wild POKEMON!\")\n reset_map\n slowly(\"#{ @player.name }, I'll catch you later!\")\n @map[2][8] = 'S'\n if @pos_y != 7\n print_map\n @map[2][7] = 'other_icon'\n reset_map 0.5\n @map[2][7] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n else\n @map[3][8] = 'other_icon'\n reset_map 0.5\n @map[3][8] = 'S'\n @map[3][7] = 'other_icon'\n reset_map 0.5\n @map[3][7] = 'S'\n @map[3][6] = 'other_icon'\n reset_map 0.5\n @map[3][6] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n end\n @map[2][6] = 'S'\n @map[2][5] = 'other_icon'\n reset_map 0.5\n @map[2][5] = 'S'\n @map[2][4] = 'other_icon'\n reset_map 0.5\n @map[2][4] = 'S'\n @map[2][3] = 'other_icon'\n reset_map 0.5\n @map[2][3] = 'S'\n @map[2][2] = 'other_icon'\n reset_map 0.5\n @map[2][2] = 'S'\n @map[1][2] = 'other_icon'\n reset_map 0.5\n @map[1][2] = 'S'\n reset_map 0.5\n @player.profbirchhomeupstairs = 'second'\n @player.littleroot = 'third'\n end\n end\n super\n end", "def new_piece\n next_tetromino\n\n col = @columns / 2 - 1\n row = 0\n\n @falling_piece.x = col * @block_size + self.screen_x\n @falling_piece.y = row * @block_size + self.screen_y\n\n @falling_piece.grid_position.x = col + 1\n @falling_piece.grid_position.y = row\n\n if collides?\n game_over\n end\n end", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n \n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd? \n place_room(r_w, r_h, room_id) \n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n \n puts \"Alloc: #{allocated_cells} Placed:#{taken_cells}\"\n\n end", "def turnright(degrees: 90)\n send_command 0x74, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end", "def start_projectile\n subj = (@setup[PROJ_REVERSE] ? @target : @subject)\n subj = @subject if @target.is_a?(Array)\n ypos = 0\n xpos = 0\n if subj.is_a?(Array)\n size = subj.size\n xpos = subj.inject(0) {|r,battler| r + battler.screen_x}/size \n ypos = subj.inject(0) {|r,battler| r + battler.screen_y}/size \n xpos += @setup[PROJ_STARTPOS][0]\n else\n spr_subj = subj.sprite\n case @setup[PROJ_START]\n when PROJ_POSITION_HEAD; ypos = subj.y - spr_subj.height\n when PROJ_POSITION_MID; ypos = subj.y - spr_subj.height/2\n when PROJ_POSITION_FEET; ypos = subj.y\n when PROJ_POSITION_NONE; ypos = xpos = 0\n else; ypos = subj.y;\n end\n xpos = subj.x + @setup[PROJ_STARTPOS][0]\n end\n ypos += @setup[PROJ_STARTPOS][1]\n @angle = (self.mirror ? 360 - @setup[PROJ_ANGLE] : @setup[PROJ_ANGLE])\n set_point(xpos, ypos)\n @point.continue = @setup[PROJ_PIERCE] \n @afterimage_opac = @setup[PROJ_AFTOPAC]\n @afterimage_rate = @setup[PROJ_AFTRATE]\n @anim_top = @setup[PROJ_ANIMPOS]\n if @setup[PROJ_ANIMSTART]\n if @setup[PROJ_ANIMSTART] == PROJ_ANIMDEFAULT\n anim = $data_animations[item.animation_id] \n else\n anim = $data_animations[@setup[PROJ_ANIMSTART]]\n end\n @anim_start.start_animation(anim,subj.flip)\n end\n @anim_start.target_sprite = [subj.sprite] if @setup[PROJ_FLASH_REF][0]\n apply_item(target, target.is_a?(Array)) if @setup[PROJ_DAMAGE_EXE] == -1\n make_aim(@dur, @jump)\n end", "def project_to_plane\n end", "def create_child\n Walker.new(x, y, direction + 2*rand(2) - 1)\n end", "def generate!\n total_width = self.column_width + self.gutter_width\n height = @baseline_height\n RVG::dpi = 100\n\n width_in_inches = (total_width.to_f/RVG::dpi).in\n height_in_inches = (height.to_f/RVG::dpi).in\n rvg = RVG.new(width_in_inches, height_in_inches).viewbox(0, 0, total_width, height) do |canvas|\n canvas.background_fill = \"white\"\n end\n\n white = ChunkyPNG::Color.from_hex(\"ffffff\")\n background = ChunkyPNG::Color.from_hex(\"e8effb\")\n line = ChunkyPNG::Color.from_hex(\"e9e9e9\")\n\n png = ChunkyPNG::Image.new(total_width, height, white)\n png.rect(0, 0, column_width - 1, height, background, background)\n png.rect(0, height - 1, total_width, height - 1, line, line)\n\n FileUtils.mkdir(self.output_path) unless File.exists?(self.output_path)\n png.save(File.join(self.output_path, \"grid.png\"))\n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def rectilinear_obstruction_array(destination_row, destination_col)\n # Store initial variables\n new_row_position = current_row_index\n new_column_position = current_column_index\n obstruction_array = []\n # Determine horizontalincrements\n if new_row_position == destination_row # protector piece is on same row with king\n # begin moving across column positions\n column_increment = destination_col > new_column_position ? 1 : -1\n new_column_position += column_increment\n while (destination_col - new_column_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_column_position += column_increment\n end\n elsif new_column_position == destination_col # protector piece is on same column with king\n # begin moving across row positions\n row_increment = destination_row > new_row_position ? 1 : -1\n new_row_position += row_increment\n while (destination_row - new_row_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_row_position += row_increment\n end\n end\n # return obstruction array (values will be checked later )\n obstruction_array\n end" ]
[ "0.6354594", "0.5781628", "0.5752095", "0.5700253", "0.5664831", "0.56490976", "0.5595787", "0.5559825", "0.55082494", "0.55057144", "0.54815394", "0.5457765", "0.5420635", "0.53916895", "0.5374106", "0.535739", "0.5341124", "0.5339041", "0.5324495", "0.5281059", "0.52662855", "0.5266042", "0.52646995", "0.526393", "0.5257381", "0.5250977", "0.52376825", "0.5232111", "0.5228508", "0.5228508", "0.5219397", "0.5215759", "0.5209574", "0.52043074", "0.52039474", "0.5196715", "0.5186722", "0.517577", "0.51640636", "0.51364666", "0.5133161", "0.5133161", "0.5128514", "0.51270103", "0.51250124", "0.5122242", "0.5122128", "0.5114728", "0.51061326", "0.50997126", "0.50881773", "0.50838774", "0.50781524", "0.5077411", "0.5071067", "0.5068566", "0.5068412", "0.50660723", "0.5056721", "0.50543463", "0.5049915", "0.50483876", "0.5043588", "0.50427145", "0.50403166", "0.503955", "0.5037133", "0.5029423", "0.502839", "0.5028237", "0.5028079", "0.5018555", "0.5017372", "0.50134254", "0.50099593", "0.5007336", "0.50034237", "0.49952668", "0.4993361", "0.49932355", "0.4989229", "0.4982874", "0.4980045", "0.49759278", "0.497392", "0.49703395", "0.49703395", "0.49696243", "0.49686593", "0.4966563", "0.49634334", "0.4963197", "0.4962936", "0.4957182", "0.49567825", "0.4956706", "0.49561936", "0.4950218", "0.49477467", "0.49448544" ]
0.5013272
74
buid and then move gable roof porch
def create_gr(entities) if($gr_side == "SW1") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees t = Geom::Transformation.new [$gr_offset,0,$gr_height] build_gr(entities,r,t) end if($gr_side == "SW2") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees t = Geom::Transformation.new [$length-$gr_offset,$width,$gr_height] build_gr(entities,r,t) end if($gr_side == "EW1") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees t = Geom::Transformation.new [0,$width-$gr_offset,$gr_height] build_gr(entities,r,t) end if($gr_side == "EW2") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees t = Geom::Transformation.new [$length,$gr_offset,$gr_height] build_gr(entities,r,t) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def move_grue(direction)\n next_grue_room = @grue_room.door_destination(direction)\n\n @grue_room.move_grue_from\n @grue_room = get_room_by_name(next_grue_room)\n @grue_room.move_grue_to\n end", "def move\n \n end", "def move\n \n end", "def move; end", "def move; end", "def move\n\n end", "def move(rover)\n rover.command.each do |m|\n remove_rover(rover)\n rover.move(m)\n place_rover(rover)\n end\n end", "def move\n super\n gravitize\n end", "def move()\n if @direction == \"up\"\n move_up()\n elsif @direction == \"down\"\n move_down()\n else\n #check if anyone is on current floor- which way do majority want to go from here?\n @direction = people_on_current_floor()\n if @direction == \"up\" #were more ppl on this floor wanting to go up\n move_up()\n elsif @direction == \"down\"\n move_down()\n else #no one on this floor, decide direction based on pending rqsts above and below...\n decide_direction()\n end\n end\n end", "def move(direction) \n # Exit map check\n if direction == 'up' && @pos_y == 2 && @pos_x == 1\n ProfBirchHome.new(@player, 'top').begin\n # If interacting with Prof Birch Child in first time instance, do a speech & animation\n elsif @player.profbirchhomeupstairs == 'first' \n if (direction == 'up' && @pos_y == 8 && @pos_x == 3) || (direction == 'right' && @pos_y ==7 && @pos_x == 2) || (direction == 'left' && @pos_x == 2 && @pos_y == 9)\n slowly(\"POKEMON fully restored!\\nItems ready, and... Huh?\")\n reset_map\n slowly(\"Huh? Who... Who are you?\")\n reset_map\n slowly(\"... ... ... ... ... ... ... ...\\n... ... ... ... ... ... ... ...\")\n reset_map\n slowly(\"Oh, you're #{ @player.name }.\\nSo your move was today.\")\n reset_map\n slowly(\"Um... I'm #{ @player.other_name }.\\nGlad to meet you!\")\n reset_map\n slowly(\"I...\\nI have this dream of becoming friends\")\n slowly(\"with POKEMON all over the world.\")\n reset_map\n slowly(\"I... I heard about you, #{ @player.name }, from\\nmy dad, PROF. BIRCH.\")\n reset_map\n slowly(\"I was hoping that you would be nice,\\n#{ @player.name }, and that we could be friends.\")\n reset_map\n slowly(\"On, this is silly, isn't it?\\nI... I've just met you, #{ @player.name }.\")\n reset_map\n slowly(\"Eheheh...\")\n reset_map\n slowly(\"Oh, no! I forgot!\")\n reset_map\n slowly(\"I was supposed to go help Dad catch\\nsome wild POKEMON!\")\n reset_map\n slowly(\"#{ @player.name }, I'll catch you later!\")\n @map[2][8] = 'S'\n if @pos_y != 7\n print_map\n @map[2][7] = 'other_icon'\n reset_map 0.5\n @map[2][7] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n else\n @map[3][8] = 'other_icon'\n reset_map 0.5\n @map[3][8] = 'S'\n @map[3][7] = 'other_icon'\n reset_map 0.5\n @map[3][7] = 'S'\n @map[3][6] = 'other_icon'\n reset_map 0.5\n @map[3][6] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n end\n @map[2][6] = 'S'\n @map[2][5] = 'other_icon'\n reset_map 0.5\n @map[2][5] = 'S'\n @map[2][4] = 'other_icon'\n reset_map 0.5\n @map[2][4] = 'S'\n @map[2][3] = 'other_icon'\n reset_map 0.5\n @map[2][3] = 'S'\n @map[2][2] = 'other_icon'\n reset_map 0.5\n @map[2][2] = 'S'\n @map[1][2] = 'other_icon'\n reset_map 0.5\n @map[1][2] = 'S'\n reset_map 0.5\n @player.profbirchhomeupstairs = 'second'\n @player.littleroot = 'third'\n end\n end\n super\n end", "def move_upper_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 8))\n move_follower_to_character\n @x -= 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend", "def move(direction)\n \n end", "def moving!\n end", "def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end", "def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end", "def update\n space.fall(self) if should_fall?\n move\n end", "def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientation\n when DIRECTION_EAST\n @position[:x] += 1 if @position[:x] < @map.width\n when DIRECTION_WEST\n @position[:x] -= 1 if @position[:x] > 0\n when DIRECTION_NORTH\n @position[:y] += 1 if @position[:y] < @map.height\n when DIRECTION_SOUTH\n @position[:y] -= 1 if @position[:y] > 0\n end\n puts \"DEBUG: position after move: #{@position}\" if DEBUG\n end", "def class_update\n if can_drop_bomb? and closest_target\n drop_bomb if on_top_of?(closest_target)\n if facing_right_of?(closest_target)\n turn_left\n end\n if facing_left_of?(closest_target)\n turn_right\n end\n end\n go_forward\n loop_position\n end", "def move_upper_right\n unless @direction_fix\n @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 6)) ||\n (passable?(@x, @y, 6) && passable?(@x + 1, @y, 8))\n move_follower_to_character\n @x += 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_right\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def move_party_horn\n\t\tif face_left?\n\t\t\t@party_horn.x = @x + \n\t\t\t\t\t\t\t(TILE_WIDTH/4 - PartyHorn::PARTY_HORN_TILE_WIDTH)\n\t\telse\n\t\t\t@party_horn.x = @x + 3 * TILE_WIDTH/4\n\t\tend\n\t\t@party_horn.y = @y + 3 * TILE_HEIGHT/5\n\t\t@party_horn.angle = @angle\n\tend", "def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end", "def go!\n send_position_to_engine\n move_piece(bestmove)\n end", "def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end", "def move\n if !destination.alive\n Game.scene.remove_object self\n else\n d_x, d_y = *destination.position\n b_x, b_y = *position\n \n if d_x.round == b_x.round and d_y.round == b_y.round\n finished\n else\n vlen = Math.sqrt((d_x - b_x)*(d_x - b_x) + (d_y - b_y)*(d_y - b_y))\n\t \n\t m_x = (d_x - b_x)*speed/vlen\n\t m_y = (d_y - b_y)*speed/vlen\n\t \n\t position[0] += m_x\n\t position[1] += m_y\n end\n end\n end", "def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend", "def move_west\n @x -= 1\n end", "def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end", "def move_hero\n #get next square\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n next_x = 0 if next_x < 0\n next_x = 14 if next_x > 14\n next_y = 0 if next_y < 0\n next_y = 14 if next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n draw_map(next_x,next_y)\n #don't move onto it if next square is an object that can't be walked over\n if next_square == CHAR_FLOOR || next_square == CHAR_IN || next_square == CHAR_OUT ||\n next_square == CHAR_TRAP || next_square == CHAR_SAFE\n #walked into trap, keep on trap unless strong and lucky\n if @room[@cur_x][@cur_y] == CHAR_TRAP &&\n @stats[:strength] <= (@orig_stats[:strength] * 0.8) &&\n @stats[:luck] <= Random.rand(15)\n next_x = @cur_x\n next_y = @cur_y\n end\n #increase health on any move\n @stats[:strength] += (@stats[:vitality] / 200.0) if @stats[:strength] < @orig_stats[:strength]\n #move the character\n if next_x != @cur_x || next_y != @cur_y\n draw_map(@cur_x, @cur_y)\n @cur_x = next_x\n @cur_y = next_y\n draw_map(@cur_x, @cur_y)\n end\n #if on exit door then decend to next level if have enough experience\n if next_square == CHAR_OUT\n load_dungeon_file(@current_level+1)\n end\n end\n #cause damage if walked into wall\n if next_square == CHAR_WALL\n @stats[:strength] -= 0.3\n end\n\n #dead\n end", "def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend", "def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end", "def move_to!(new_x, new_y, real_move = true)\n return false unless valid_move?(new_x, new_y)\n castling = (x_coord - new_x).abs == 2\n\n # Call the move_to! method within the Piece model and move the king.\n return false unless super\n\n # If all of the requirements are met for valid_move? AND the intention is to castle;\n # place the rook in its appropriate position to complete the castling move.\n if castling\n rook_origin_file = (new_x == 3) ? 1 : 8\n rook_destination_file = (new_x == 3) ? 4 : 6\n castled_rook = game.piece_at(rook_origin_file, new_y)\n castled_rook.update_attributes(x_coord: rook_destination_file,\n y_coord: new_y,\n moved: true)\n end\n true\n end", "def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend", "def move\n if inside_table?(next_move_x_y(next_move))\n update_position!(next_move_x_y(next_move))\n else\n almost_die\n end\n end", "def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend", "def moveto(x, y)\n super\n center(x, y)\n make_encounter_count\n vehicle.refresh if vehicle\n @followers.synchronize(x, y, direction)\n end", "def truck(view, time)\n direction = view.camera.direction * Z_AXIS\n direction.reverse! if( (@keys & LEFT_ARROW) != 0 )\n self.move(view, time, direction, @speedx)\nend", "def explore\n rover_bay.each do |r|\n if pass_path_check?(r)\n move(r)\n else\n raise \"There is a collision\\nin placement #{r.coordinate.inspect}, please revise instruction set #{r.command.inspect}\"\n end\n end\n end", "def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend", "def update\n accelerate(0, 1) if should_fall?\n move\n end", "def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end", "def moveUp\n if @y > 1\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n let @y = @y - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n end\n end", "def move(io_h)\n if io_h[:left]\n @x -= 10\n end\n if io_h[:right]\n @x += 10\n end\n if io_h[:up]\n @y -= 10\n end\n if io_h[:down]\n @y += 10\n end\n \n @x %= 640\n @y %= 480\n end", "def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end", "def move_up()\n floor_before_move = @building.floors[@current_floor]\n floor_before_move.board_elevator(self)\n @current_floor += 1\n exit_passengers(@current_floor)\n new_floor = @building.floors[@current_floor]\n new_floor.board_elevator(self)\n if num_passengers == 0\n @direction = \"stationary\"\n end \n end", "def kick_wall(wall)\n wall.moveTo(@new_x, @new_y)\n #or wall.moveTo(:direction)\n end", "def kick_bomb(bomb)\n bomb_manager.getBomb(bomb).moveTo(@new_x, @new_y)\n #or bomb.moveTo(:direction)\n end", "def move\n move_by a, m\n end", "def move_lower_right\n unless @direction_fix\n @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)\n end\n if (passable?(@x, @y, 2) && passable?(@x, @y + 1, 6)) ||\n (passable?(@x, @y, 6) && passable?(@x + 1, @y, 2))\n move_follower_to_character\n @x += 1\n @y += 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_lower_right\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def castle_move\r\n return false if @sx.abs != 2\r\n # If the king is moving two spaces to the left:\r\n if @x1 < @x0\r\n @target_rook = game.pieces.where(x_position: 1, y_position: @y0).first\r\n # If the king is moving two spaces to the right:\r\n else\r\n @target_rook = game.pieces.where(x_position: 8, y_position: @y0).first\r\n end\r\n return false if @target_rook.nil?\r\n # Neither the king nor the rook have moved:\r\n return false if !first_move? || !@target_rook.first_move?\r\n # Move the rook to the other side of the moved king:\r\n if @target_rook.x_position == 1\r\n @target_rook.update_attributes(x_position: 4)\r\n Move.create(game_id: game.id, piece_id: @target_rook.id, move_count: 1, old_x: 1, new_x: 4, old_y: @y0, new_y: @y0)\r\n else\r\n @target_rook.update_attributes(x_position: 6)\r\n Move.create(game_id: game.id, piece_id: @target_rook.id, move_count: 1, old_x: 8, new_x: 6, old_y: @y0, new_y: @y0)\r\n end\r\n true\r\n end", "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end", "def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend", "def move_down\n\t\tmove([0,1])\n\tend", "def next_move(bot_pos_x, bot_pos_y, princess_position)\n case\n when princess_position[0] - bot_pos_x < 0 then move = 'UP'\n when princess_position[0] - bot_pos_x > 0 then move = 'DOWN'\n when princess_position[1] - bot_pos_y < 0 then move = 'LEFT'\n when princess_position[1] - bot_pos_y > 0 then move = 'RIGHT'\n end\n move\nend", "def chase_preceding_character\r\r\n return if self.command_holding?\r\r\n unless moving? && !@force_chase\r\r\n dist = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE / 32.0\r\r\n mrgn = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE_MARGIN / 32.0\r\r\n \r\r\n far_dist = distance_preceding_character\r\r\n \r\r\n if far_dist > 3\r\r\n type = 1\r\r\n prevent_bug_cnt = 0\r\r\n else\r\r\n type = 2\r\r\n end\r\r\n \r\r\n if !move_poll.empty? && distance_preceding_leader < 0.8\r\r\n move_poll.clear\r\r\n end\r\r\n \r\r\n \r\r\n if type == 1 && move_poll.empty?\r\r\n reachable = false\r\r\n \r\r\n $game_player.followers.each do |follower|\r\r\n follower.move_poll.clear\r\r\n if follower.move_poll.empty? && follower.distance_preceding_leader > 3\r\r\n reachable = follower.move_to_position($game_player.x,$game_player.y)\r\r\n if move_poll.empty? || !reachable\r\r\n follower.moveto($game_player.x,$game_player.y) \r\r\n end\r\r\n \r\r\n end\r\r\n end\r\r\n elsif type == 2\r\r\n \r\r\n goal = @preceding_character\r\r\n sx = distance_x_from(goal.x)\r\r\n sy = distance_y_from(goal.y)\r\r\n sd = Math.hypot(sx, sy)\r\r\n if @board\r\r\n @x = goal.x\r\r\n @y = goal.y\r\r\n @board = false\r\r\n elsif(sd > dist && sx.abs > mrgn && sy.abs > mrgn)\r\r\n @move_poll += [[(sx > 0 ? -1 : 1) + (sy > 0 ? 8 : 2), true]]\r\r\n elsif sx.abs > dist && sx.abs > sy.abs\r\r\n @move_poll+=[[sx > 0 ? 4 : 6, true]]\r\r\n elsif sy.abs > dist && sx.abs < sy.abs\r\r\n @move_poll+=[[sy > 0 ? 8 : 2, true]]\r\r\n end\r\r\n end\r\r\n \r\r\n end\r\r\n end", "def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend", "def move\n case @status\n when Dead\n @position += @direction * DeadFishFloatSpeed\n when Idle\n coin = rand(1000.0)\n if coin <= (@direction_change_factor/1000)\n turn = rand(10)\n setup_turn(Turning,turn)\n else\n @position += @direction * @speed\n end\n when Avoiding\n self.turn\n when Turning \n self.turn\n when Pursuing\n speed = \n case @target.type\n when Food\n 5*@speed\n when Salmon\n 2*@speed\n when Shark\n 4*@speed\n end\n @position += @direction * speed\n end\n @position = Position.new(@position.a)\n # update the state of the fish:\n @virility += (@virility >= 9999) ? 1 : 0 \n health_to_subtract = (rand>(@resilience/10.0)) ? 1 : 0\n @health -= health_to_subtract\n @age += (rand<0.2) ? 1 : 0\n self.die if @health<=0 or @age >= MaxAge\n end", "def move_up(turn_enabled = true)\n\n @move_angle = 0\n\n # Turn up\n if turn_enabled\n turn_up\n end\n # If passable\n if passable?(@x, @y, 8)\n # Turn up\n turn_up\n\n # Remove from cache\n $scene.map.cache_clear(@x,@y,self)\n\n # Update coordinates\n pt = terrain_tag\n @y -= 1\n\n $scene.map.cache_push(@x,@y,self)\n\n # Increase steps\n increase_steps\n\n if self == $player && $party.leader != 'ship'\n\n tt = terrain_tag\n $audio.queue('ladder/ladder1',10,0.15) if tt == 3 && pt == 3\n $audio.queue('ladder/ladder1',24,0.15) if tt == 4\n $audio.queue('ladder/ladder1',24,0.15) if tt == 3\n\n $audio.queue(\"steps/foot#{rand(8)}\",12,0.4) if tt != 3\n $audio.queue('steps/foot5',12,0.6) if tt == 2\n\n end\n\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x, @y-1)\n end\n end", "def drive\n\t\t@commands.each do |cmd|\n\t\t\tunless cmd == 'M'\n\t\t\t\tveer cmd\n\t\t\telse\n\t\t\t\tunless @car.toBeOverFlow?\n\t\t\t\t\tmove\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def move\n self.speed += random_vector(0.5)\n self.position.x -= window.current_speed/4\n bounce_off_border_y\n on_hitting_x { destroy!; return }\n end", "def move_B\r\n 2.times { move_down( @deck.index( 'B' ) ) }\r\n end", "def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end", "def handle_castling(piece, end_pos)\n castling_pos = [\n [0,2],\n [7,2],\n [0,6],\n [7,6]\n ]\n\n if (castling_pos.include?(end_pos))\n if (end_pos == castling_pos[0] || end_pos == castling_pos[1])\n rook = self[[piece.position[0], piece.position[1]-4]]\n\n if (!rook.nil? && rook.moved == false)\n self[[piece.position[0], piece.position[1]-4]] = nil\n rook.moved = true\n self[[piece.position[0], piece.position[1]-1]] = rook\n rook.update_position([piece.position[0], piece.position[1]-1])\n end\n else\n rook = self[[piece.position[0], piece.position[1]+3]]\n\n if (!rook.nil? && rook.moved == false)\n self[[piece.position[0], piece.position[1]+3]] = nil\n rook.moved = true\n self[[piece.position[0], piece.position[1]+1]] = rook\n rook.update_position([piece.position[0], piece.position[1]+1])\n end\n end\n end\n end", "def move_home_all\n Status.current.info_target_x = 0\n Status.current.info_target_y = 0\n Status.current.info_target_z = 0\n @ramps_arduino.execute_command('G28', true, false)\n end", "def pedestal(view, time)\n direction = Geom::Vector3d.new(0,0,1)\n direction.reverse! if( (@keys & DOWN_ARROW) != 0 )\n self.move(view, time, direction, @speedy)\nend", "def move_right\n\t\tmove([1,0])\n\tend", "def commit_move!(start_pos, end_pos, count = true)\n self.turn_count = 1 + turn_count.to_i if count\n current_piece = self[start_pos]\n self[end_pos].move_to([10,10]) if self[end_pos].is_a?(Piece)\n swap_positions(start_pos, end_pos, current_piece, EmptySquare.new, true)\n promote_last_lines\n end", "def move_to_graveyard\n update(channel: 0)\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_box = [org[0] + (dest[0]-org[0])/2 , org[1] + (dest[1]-org[1])/2]\n @pieces[captured_box[0]][captured_box[1]].remove\n end\n\n @pieces[org[0]][org[1]].remove\n @pieces[dest[0]][dest[1]] = draw_piece(dest[0],dest[1],@board.state[dest[0]][dest[1]])\nend", "def move_one_patch\n target = patch_ahead 1\n\n # faced patch desirable\n # faced patch force move\n #\n # find desirable neighboring patch\n # no desirable, about face\n\n if passable?(target)\n if patch_desirable?(target)\n walk_forward 1\n self.random_walk_suitable_count += 1\n elsif should_leave?\n walk_forward 1\n self.random_walk_unsuitable_count += 1\n else\n select_forage_patch_and_move\n end\n else\n select_forage_patch_and_move\n end\n end", "def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end", "def move(start, finish)\n\t\ta, b = start\n\t\tx, y = finish\n\t\tif @board[a][b].piece.class.name == \"Pawn\"\n\t\t\t@board[a][b].piece.double = \"false\"\n\t\t\tif y - b == 2 || y - b == -2\n\t\t\t\t@board[a][b].piece.en_passant = true\n\t\t\tend\n\t\tend\n\t\tif @board[a][b].piece.class.name == \"King\" || @board[a][b].piece.class.name == \"Rook\"\n\t\t\t@board[a][b].piece.castling = false\n\t\tend\n\t\tif @board[a][b].piece.class.name == \"King\" && (x - a >= 2 || x - a <= 2)\n\t\t\tif (x - a >= 2)\n\t\t\t\tcastle_right(a, b, x, y)\n\t\t\telse\n\t\t\t\tcastle_left(a, b, x, y)\n\t\t\tend\n\t\t\treturn\n\t\tend\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\tremove_en_passant(x, y)\n\t\tif @board[x][y].piece.class.name == \"Pawn\"\n\t\t\tcheck_promotion(x, y)\n\t\tend\n\tend", "def living_move\n simulate_move(opponent)\n end", "def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end", "def move_ears(left, right)\n message.posleft = left if left\n message.posright = right if right\n nil\n end", "def move\n\t\tunless @y >= 0 then\n\t\t\t@y += 1\n\t\tend\n\t\tif @x_total <= 150 and @y_total <= 150 then\n\t\t\t@x += 1\n\t\t\t@y += 1\n\t\t\t@x_total +=1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total > 150 and @y_total > 150 and @x_total < 300 and @y_total < 300 then\n\t\t\t@y -= 1\n\t\t\t@x_total += 1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total > 298 and @y_total > 298 and @x_total < 450 and @y_total < 450 then\n\t\t\t@y +=1\n\t\t\t@x -= 1\n\t\t\t@x_total += 1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total > 448 and @y_total > 448 and @x_total < 600 and @y_total < 600 then\n\t\t\t@y -= 1\n\t\t\t@x_total += 1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total == 599 and @y_total == 599 then\n\t\t\t@x_total = @y_total = 0\n\t\tend\n\tend", "def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end", "def move( turn )\n RC[pot[(rand*pot.length).to_i]] # random for basic player\n end", "def move(x, y)\n if y != 0\n @y += y\n bounce if game_state.first_terrain_collision(self)\n end\n \n if x != 0\n @x += x\n turn if game_state.first_terrain_collision(self)\n end\n end", "def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end", "def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n\n # What if they follow more aggressively on harder difficulty?\n\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n\n end", "def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end", "def move(board)\n \trandom_move(board)\n\tend", "def move_type_toward_player\n if near_the_player?\n case rand(6)\n when 0 then move_toward_player\n when 1 then move_toward_player\n when 2 then move_toward_player\n when 3 then move_toward_player\n when 4 then move_random\n when 5 then move_forward\n end\n else\n move_random\n end\n end", "def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end", "def play_move(from, to)\n #create duplicate of board, to correct pass by reference error\n #add top disk on from tower to the top of to tower\n to_dup = @board[to].dup\n to_dup.unshift(@board[from][0]) \n @board[to] = to_dup\n @board[from].shift\n \n if won?\n render\n puts \"congratulations you won!\\n\\n\"\n else\n get_move\n end\n end", "def move()\n #first it checks if it is on an edge\n if (\n @model.x >= Window.width-@size ||\n @model.x <= 0 ||\n @model.y >= Window.height-@size ||\n @model.y <= 0\n )\n #if the bullet is on the edge then it will die\n self.kill()\n end\n #this moves the bullet by the velocity of the bullet\n @pos.x += @vel.x\n @pos.y += @vel.y\n #moves the bullets model\n @model.x = @pos.x\n @model.y = @pos.y\n end", "def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end", "def move_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n return if sx == 0 && sy == 0\n\n abs_sx = sx.abs\n abs_sy = sy.abs\n if abs_sx == abs_sy\n rand(2) == 0 ? abs_sx += 1 : abs_sy += 1\n end\n\n if abs_sx > abs_sy\n sx > 0 ? move_left : move_right\n unless moving? || sy == 0\n sy > 0 ? move_up : move_down\n end\n else\n sy > 0 ? move_up : move_down\n unless moving? || sx == 0\n sx > 0 ? move_left : move_right\n end\n end\n end", "def move_to(x, y); end", "def setup_move\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n mx = @map_char.real_x + @acts[1]\n my = @map_char.real_y + @acts[2]\n goto(mx, my, @acts[3], @acts[4], @acts[5] || 0)\n end", "def move\n if @x + @x_vel < 0\n net_move = (-2 * @x) - @x_vel\n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n elsif @x + @x_vel > (1280 - @w)\n net_move = (2 * (1280 - @w - @x)) - @x_vel \n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n else\n @truex += @x_vel\n @x += @x_vel\n end\n\n if @y + @y_vel < 0\n net_move = (-2 * @y) - @y_vel\n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n elsif @y + @y_vel > (720 - @h)\n net_move = (2 * (720 - @h - @y)) - @y_vel \n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n else\n @truey += @y_vel\n @y += @y_vel\n end\n end", "def moves_through!\n @moves_through = true\n end", "def castle!(x,y)\n if castle_kingside?(x,y)\n castle_rook_kingside.update_attributes(x_position: 5, y_position: y_position)\n end\n if castle_queenside?(x,y)\n castle_rook_queenside.update_attributes(x_position:3, y_position: y_position)\n end\n update_attributes(x_position: x, y_position: y)\n end" ]
[ "0.6974971", "0.696928", "0.69300437", "0.69300437", "0.69243485", "0.69243485", "0.6862953", "0.6851237", "0.67749286", "0.67503613", "0.674247", "0.6709658", "0.6690329", "0.6687613", "0.6668253", "0.6660968", "0.66357386", "0.6634525", "0.6631319", "0.659654", "0.6551682", "0.653039", "0.6523986", "0.6516614", "0.6473035", "0.64684", "0.64242375", "0.64037424", "0.6395606", "0.6389694", "0.637963", "0.63533217", "0.6348082", "0.6326161", "0.6316974", "0.6304743", "0.6298456", "0.6276471", "0.62743205", "0.62487715", "0.62470734", "0.6243184", "0.62363887", "0.6233681", "0.6224466", "0.6221548", "0.62181175", "0.62152797", "0.62134", "0.6211906", "0.6204234", "0.61910176", "0.6188331", "0.6185945", "0.6181882", "0.61799663", "0.6173126", "0.61708003", "0.61574924", "0.614273", "0.6142299", "0.6136052", "0.6131997", "0.6130782", "0.61273706", "0.61261994", "0.61194766", "0.61154044", "0.6108686", "0.6107583", "0.60906947", "0.60753644", "0.60741425", "0.6073261", "0.6072879", "0.6065131", "0.6056555", "0.6056004", "0.6054904", "0.6054202", "0.6051903", "0.6047357", "0.6044103", "0.60433435", "0.60413575", "0.60409796", "0.6040956", "0.6040213", "0.60346484", "0.6034574", "0.6028824", "0.60182005", "0.6012755", "0.5999652", "0.5988365", "0.5985809", "0.59842616", "0.5981938", "0.5981259", "0.5973305", "0.5969412" ]
0.0
-1
create_gr here build lean to
def build_lean(entities,r,t) lean_group = entities.add_group lean_group.entities.add_dimension_linear([0,0,0],[0,$lean_length,0], [-30,0,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH lean_group.entities.add_dimension_linear([0,0,0],[$lean_width,0,0], [0,-60,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH lean_group.entities.add_text("Lean-to", [$lean_width/2,$lean_length/2,-2]) o = Geom::Point3d.new(-$lean_overjet,-$lean_overhang,$lean_height-$lean_overhang*$lean_pitch/12) h = Geom::Vector3d.new(0,$lean_length+$lean_overhang, ($lean_length+$lean_overhang)*$lean_pitch/12) f = Geom::Vector3d.new(0,0,$facia) v = Geom::Vector3d.new($lean_width+2*$lean_overjet,0,0) p1 = o p2 = o + v p3 = o + v + h p4 = o + h p5 = o + f p6 = o + f + v p7 = o + f + v + h p8 = o + f + h lean_group.entities.add_face(p5,p6,p7,p8).material = $roofColor lean_group.entities.add_face(p1,p4,p8,p5).material = $faciaColor lean_group.entities.add_face(p2,p3,p7,p6).material = $faciaColor lean_group.entities.add_face(p1,p2,p6,p5).material = $faciaColor lean_group.entities.add_face(p1,p2,p3,p4) lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,-$lean_overhang,0]) lean_group.entities.add_cline([$lean_width+$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,$lean_length,0]) lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[-$lean_overjet,$lean_length,0]) if($lean_wall[0] == 1) pl1 = [$lean_width, 0, 0] pl2 = [$lean_width, $lean_length,0] pl3 = [$lean_width,$lean_length,$lean_height+$lean_length*$lean_pitch/12] pl4 = [$lean_width,0,$lean_height] lean_group.entities.add_face(pl1,pl2,pl3,pl4).material = $wallColor end if($lean_wall[1] == 1) pm1 = [$lean_width,0,0] pm2 = [0,0,0] pm3 = [0,0,$lean_height] pm4 = [$lean_width,0,$lean_height] a = lean_group.entities.add_face(pm1,pm2,pm3,pm4) a.back_material = $wallColor a.material = $wallColor end p = 6 if($lean_wall[1] >= 2) c = 7 #$lean_width = $lean_width-2*$lean_overhang lean_group.entities.add_face([0,$lean_length,0],[0,0,0],[$lean_width,0,0],[$lean_width,$lean_length,0],[$lean_width-c,$lean_length,0],[$lean_width-c,c,0],[c,c,0],[c,$lean_length,0],[0,$lean_length,0]).pushpull -3 lean_group.entities.add_line([0,$lean_length,0],[c,$lean_length,0]).faces[0].erase! n = $lean_wall[1] # entities.add_face([0,0,0,],[0,p,0],[p,p,0],[p,0,0]).pushpull -$lean_height-$facia # entities.add_face([$lean_width,0,0],[$lean_width,p,0],[$lean_width-p,p,0],[$lean_width-p,0,0]) d = ($lean_width - p*n)/(n-2+1) for i in 0..n-1 a = lean_group.entities.add_face([i*(p+d),0,0,],[i*(p+d),p,0],[i*(p+d)+p,p,0],[i*(p+d)+p,0,0]) end d = $lean_width/(n-1) if n>2 for i in 0..n-2 lean_group.entities.add_dimension_linear([i*d,0,0],[(i+1)*d,0,0], [0,-30,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH end end end if($lean_wall[2] == 1) pr1 = [0,0,0] pr2 = [0,$lean_length,0] pr3 = [0,$lean_length,$lean_height+$lean_length*$lean_pitch/12] pr4 = [0,0,$lean_height] lean_group.entities.add_face(pr1,pr2,pr3,pr4).back_material = $wallColor end entities.transform_entities r, lean_group entities.transform_entities t, lean_group end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gr(entities)\n\tif($gr_side == \"SW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees\n\t\tt = Geom::Transformation.new [$gr_offset,0,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"SW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees\n\t\tt = Geom::Transformation.new [$length-$gr_offset,$width,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"EW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees\n\t\tt = Geom::Transformation.new [0,$width-$gr_offset,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"EW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees\n\t\tt = Geom::Transformation.new [$length,$gr_offset,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\t\nend", "def build_gr(entities,r,t)\n\ngr_group = entities.add_group\n\norigin = Geom::Point3d.new(0,0,0)\nv1 = Geom::Vector3d.new($gr_width/2,0,0)\nv2 = Geom::Vector3d.new(0,0,$gr_width*$gr_pitch/12)\nv3 = Geom::Vector3d.new(0, $gr_length,0)\n\nf1 = gr_group.entities.add_face(origin,origin-v3,origin-v3+v2+v1,origin+v2+v1)\nf1.material = $roofColor\nf2 = gr_group.entities.add_face(origin-v3+v2+v1,origin+v2+v1, origin+v1+v1, origin+v1+v1-v3)\nf2.material = $roofColor\n\nif($gr_wall[1] == 2)\n\tf5 = gr_group.entities.add_face([0,-$gr_length,0],[6, -$gr_length,0],[6, 6-$gr_length,0],[0,6-$gr_length,0])\n\tf5.pushpull $gr_height\n\tf6 = gr_group.entities.add_face([$gr_width,-$gr_length,0],[$gr_width-6, -$gr_length,0],[$gr_width-6, 6-$gr_length,0],[$gr_width,6-$gr_length,0])\n\tf6.pushpull $gr_height\nend\n\nif($gr_wall[0] == 1)\n\tf3 = gr_group.entities.add_face([0,0,0],[0,0,-$gr_height],[0,-$gr_length, -$gr_height],[0, -$gr_length,0])\n\tf3.material = $wallColor\nend\n\nif($gr_wall[2] == 1)\n\tf3 = gr_group.entities.add_face([$gr_width,0,0],[$gr_width,0,-$gr_height],[$gr_width,-$gr_length, -$gr_height],[$gr_width, -$gr_length,0])\n\tf3.material = $wallColor\nend\n\nentities.transform_entities r, gr_group\nentities.transform_entities t, gr_group\n\nend", "def build; end", "def build\r\n end", "def build\r\n end", "def build(params); end", "def generate; end", "def generate; end", "def generate_wd_images rname=nil\n return {} unless rname\n \n start_time = Time.now\n \n @selected_room_name = rname\n @room_name = @selected_room_name.gsub('#', '_')\n # rinfo \"Starting Image generation : %s\"%(@selected_room_name)\n\n #Pre Operation things\n exception_raised = false\n #-----------Get previous stuffs--------------------------\n curr_active_layer = Sketchup.active_model.active_layer\n edge_render_option = Sketchup.active_model.rendering_options[\"EdgeColorMode\"]\n active_camera = Sketchup.active_model.active_view.camera\n cam_perspective = Sketchup.active_model.active_view.camera.perspective?\n unit_display = Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]\n\n Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]=true\n Sketchup.active_model.active_view.camera.perspective=false\n Sketchup.active_model.rendering_options[\"EdgeColorMode\"] = 0\n \n begin\n # puts \"--------------------------hide\"\n Sketchup::active_model::start_operation \"RIO Image Generation\"\n DP::hide_all_entities\n\n view_details_h = get_floor_view_comps\n \n view_details_h[\"top_view\"] = {:top_room_image => get_top_room_image}\n rescue Exception => e\n # rerror \"Exception raised during image generation\"\n raise e\n Sketchup.active_model.abort_operation\n exception_raised = true\n ensure\n DP::unhide_all_entities\n\n Sketchup.active_model.rendering_options[\"EdgeColorMode\"] = edge_render_option\n Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]=unit_display\n Sketchup.active_model.active_view.camera=active_camera\n Sketchup.active_model.active_view.camera.perspective=cam_perspective\n Sketchup.active_model.active_view.zoom_extents\n Sketchup.active_model.commit_operation\n end\n\n end_time = Time.now\n # puts \"Time taken : #{end_time - start_time}\"\n result = exception_raised ? {} : view_details_h\n end", "def build!\n end", "def generate\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_credit_payout\n create_bands\n end", "def build\n end", "def build=(_arg0); end", "def build_calculation(geometry, control, args)\n begin\n # a hash to store the user defined variables\n vars = parse_vars(args)\n # Load the project variables\n p = project\n calc = AimsProject::Calculation.create(p, geometry, control, vars)\n puts \"Created #{calc.calculation_directory}\"\n rescue \n puts $!.message\n puts $!.backtrace\n end\nend", "def build\n end", "def build_shape\n no_stroke\n bez = create_shape\n bez.begin_shape(QUAD_STRIP)\n bez.fill(192, 192, 192)\n bez.ambient(20, 20, 20)\n bez.specular(30)\n (0 ... RESI - 1).each do |i|\n (0 ... RESJ).each do |j|\n if (!auto_normals)\n bez.normal(*normp[i][j])\n end\n bez.vertex(*outp[i][j])\n bez.vertex(*outp[i+1][j])\n end\n end\n bez.end_shape\n return bez\nend", "def create_graphics\n create_viewport\n create_base\n create_ui\n end", "def generate\n end", "def generate_graph\n end", "def build_gem; end", "def createGroup _args\n \"createGroup _args;\" \n end", "def build_gems; end", "def builder\n\n add_breadcrumb \"SOGR Capital Project Analyzer\"\n\n # Select the asset seed that they are allowed to build\n\n @asset_seed = []\n asset_class_name = Rails.application.config.asset_base_class_name == 'TransamAsset' ? 'TransitAsset' : Rails.application.config.asset_base_class_name\n\n asset_class_name.constantize.asset_seed_class_name.constantize.active.each do |seed|\n assets = asset_class_name.constantize.where(seed.class.to_s.underscore => seed)\n if assets.where(organization: @organization_list).count > 0\n @asset_seed << {id: seed.id, name: seed.to_s, orgs: @organization_list.select{|o| assets.where(organization_id: o).count > 0}}\n else\n @asset_seed << {id: seed.id, name: seed.to_s, orgs: []}\n end\n end\n\n @fiscal_years = get_fiscal_years(Date.today)\n @range_fiscal_years = ((1..14).to_a + (3..10).to_a.map{|x| x * 5}).map{|x| [\"#{x} years\", x-1]}\n @scenarios = Scenario.where(organization: current_user.viewable_organizations)\n @builder_proxy = BuilderProxy.new\n\n @has_locked_sogr_this_fiscal_year = CapitalPlanModule.joins(:capital_plan_module_type, :capital_plan).where(capital_plan_module_types: {name: ['Unconstrained Plan', 'Constrained Plan']}, capital_plans: {organization_id: @organization_list, fy_year: current_planning_year_year}).where('capital_plan_modules.completed_at IS NOT NULL').pluck('capital_plans.organization_id')\n\n if @organization_list.count == 1\n if @has_locked_sogr_this_fiscal_year && (@has_locked_sogr_this_fiscal_year.include? @organization_list.first)\n @fiscal_years = @fiscal_years[(@fiscal_years.index{|x| x[1]==current_planning_year_year}+1)..-1]\n end\n @builder_proxy.start_fy = current_planning_year_year\n else\n @has_sogr_project_org_list = CapitalProject.joins(:organization).where(organization_id: @organization_list).sogr.group(:organization_id).count\n end\n\n @message = \"Creating SOGR capital projects. This process might take a while.\"\n\n end", "def create_generations\n @generations.each do |g|\n create_generation(g) unless Generation.find_by(name: g['name'])\n end\n end", "def builder; end", "def builder; end", "def builder; end", "def build(document)\n document.geom_type = geom_type\n document.format = format\n end", "def initial_generate\n \n end", "def group_builder; end", "def build_gpx stations, create_trk, create_wpt\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.gpx(xmlns: 'http://www.topografix.com/GPX/1/1') do\n if create_trk\n stations.each do |callsign, reports|\n xml.trk do\n xml.name callsign\n xml.trkseg do\n reports.each do |report|\n xml.send('trkpt', lat: report.position.latitude, lon: report.position.longitude) do\n xml.name report.comment\n xml.time report.date.strftime('%FT%TZ')\n end\n end\n end\n end\n end\n end\n if create_wpt\n stations.each do |callsign, reports|\n last = reports.last\n reports.each do |report|\n xml.send('wpt', lat: report.position.latitude, lon: report.position.longitude) do\n xml.name report.callsign\n xml.desc report.comment\n xml.time report.date.strftime('%FT%TZ')\n xml.type 'WPT'\n xml.sym report == last ? 'triangle' : 'circle'\n end\n end\n end\n end\n end\n end\n builder.to_xml\nend", "def make_gr_env(env, length = 512)\n length_1 = (length - 1).to_f\n make_vct!(length) do |i|\n envelope_interp(i / length_1, env)\n end\nend", "def build_pack_materials_grid(data_set,can_create_run)\n\n\n\n column_configs = Array.new\n\n\tcolumn_configs[0] = {:field_type => 'text',:field_name => 'retail_item_pack_material_code'}\n\tcolumn_configs[1] = {:field_type => 'text',:field_name => 'retail_unit_pack_material_code'}\n\tcolumn_configs[2] = {:field_type => 'text',:field_name => 'trade_unit_pack_material_code'}\n\tcolumn_configs[3] = {:field_type => 'text',:field_name => 'pallet_pack_material_code'}\n\tcolumn_configs[4] = {:field_type => 'text',:field_name => 'fg_product_code'}\n\tcolumn_configs[5] = {:field_type => 'text',:field_name => 'carton_setup_code'}\n\tcolumn_configs[6] = {:field_type => 'text',:field_name => 'created_at'}\n\n\n\n return get_data_grid(data_set,column_configs)\nend", "def generate!\n total_width = self.column_width + self.gutter_width\n height = @baseline_height\n RVG::dpi = 100\n\n width_in_inches = (total_width.to_f/RVG::dpi).in\n height_in_inches = (height.to_f/RVG::dpi).in\n rvg = RVG.new(width_in_inches, height_in_inches).viewbox(0, 0, total_width, height) do |canvas|\n canvas.background_fill = \"white\"\n end\n\n white = ChunkyPNG::Color.from_hex(\"ffffff\")\n background = ChunkyPNG::Color.from_hex(\"e8effb\")\n line = ChunkyPNG::Color.from_hex(\"e9e9e9\")\n\n png = ChunkyPNG::Image.new(total_width, height, white)\n png.rect(0, 0, column_width - 1, height, background, background)\n png.rect(0, height - 1, total_width, height - 1, line, line)\n\n FileUtils.mkdir(self.output_path) unless File.exists?(self.output_path)\n png.save(File.join(self.output_path, \"grid.png\"))\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_sub_background\n create_trainer_sprite\n create_badge_sprites\n create_texts\n end", "def make; end", "def build_assets\n end", "def build\r\n raise \"Not implemented\"\r\n end", "def generate(name); end", "def create_graphics\n super()\n create_background\n create_type_background\n create_pokemon_battler_stack\n create_pokemon_text_boxes\n create_congratulation_text_boxes\n create_pokemon_stars_animation\n create_graveyard_anim\n create_turning_ball\n create_party_battler_stack\n create_league_champion_text_box\n create_trainer_infos_text_box\n create_end_stars\n end", "def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end", "def create\n # USELESS\n end", "def create\n # USELESS\n end", "def make_draw(round, format)\n\t\t\t@num_rooms_assigned = 0;\n\t\t\tround.tournament.update(progress: 0.0); #reset progress to 0\n\t allocate_rooms(sort_teams_and_adjs(round), round, format); #make rooms\n\t\tend", "def build(*args)\n model = generate(*args)\n model.save\n model\n end", "def build(opts)\n uuid = SecureRandom.uuid\n\n bag = BagIt::Bag.new File.join(@output_directory, uuid)\n path = File.join File.expand_path(opts[:location]), \"**\", \"*\"\n Dir.glob(path).each do |filepath|\n bag.add_file(File.basename(filepath), filepath)\n end\n\n dpn_info_opts = {\n dpnObjectID: uuid,\n localName: \"#{opts[:name]}\",\n ingestNodeName: @ingest_node_name,\n ingestNodeAddress: @ingest_node_address,\n ingestNodeContactName: @ingest_node_contact_name,\n ingestNodeContactEmail: @ingest_node_contact_email,\n version: 1,\n firstVersionObjectID: uuid,\n bagTypeName: opts[:type].to_s.downcase,\n interpretiveObjectIDs: opts[:interpretive],\n rightsObjectIDs: opts[:rights]\n }\n\n dpn_info_txt = Bookbag::DPNInfoTxt.new(dpn_info_opts)\n\n bag.add_tag_file(File.join(Bookbag::Settings[:bag][:dpn_dir], Bookbag::Settings[:bag][:dpn_info][:name])) do |io|\n io.puts dpn_info_txt.to_s\n end\n\n bag.write_bag_info(@bag_info)\n\n bag.manifest!\n end", "def generate_build_shields(outdir, build_db, version)\n FileUtils.rm_rf outdir\n FileUtils.mkdir_p outdir\n data = File.readlines(build_db)\n packages = data.map{|i| i.split('#').first}.uniq\n site_config = YAML.load_file(\"./config.yaml\")\n if (version == \"devel\")\n activebuilders = site_config[\"active_devel_builders\"].values\n else\n activebuilders = site_config[\"active_release_builders\"].values\n end\n\n colors = {\"OK\" => \"green\", \"WARNINGS\" => \"yellow\",\n \"ERROR\" => \"red\", \"TIMEOUT\" => \"AA0088\"}\n\n srcdir = File.join(\"assets\", \"images\", \"shields\", \"builds\")\n\n for package in packages\n relevantAll = data.find_all{|i| i =~ /^#{package}#/}\n builderName = relevantAll.map {|i| i.split('#')[1]}\n relevant = Array.new\n indexKeepLog = builderName.map {|i| activebuilders.include?(i) }\n indexKeepLog.each_index.select{|i|\n if (indexKeepLog[i] == true)\n relevant.push(relevantAll[i])\n end\n }\n statuses = relevant.map {|i| i.split(' ').last.strip}\n statuses = statuses.reject{|i| i == \"NotNeeded\"}\n statuses = statuses.uniq\n if statuses.length == 1 and statuses.first == \"OK\"\n final_status = \"OK\"\n elsif statuses.include? \"ERROR\"\n final_status = \"ERROR\"\n elsif statuses.include? \"TIMEOUT\"\n final_status = \"TIMEOUT\"\n elsif statuses.include? \"WARNINGS\"\n final_status = \"WARNINGS\"\n elsif statuses.include? \"NA\"\n final_status = \"OK\"\n elsif statuses.include? \"skipped\"\n final_status = \"OK\"\n else\n raise \"Logic fail!\"\n end\n color = colors[final_status]\n puts(\"creating shield for #{package} in #{outdir}...\") # remove me?\n FileUtils.cp(File.join(srcdir, \"#{final_status}.svg\"), File.join(outdir, \"#{package}.svg\"))\n sleep(1)\n end\nend", "def generate_constructions\n # TODO? delete and re-create or check that it exists and update?\n # self.construct_assemblies.destroy_all\n # self.materials.destroy_all\n # self.fenestration_constructions.destroy_all\n # self.door_construction.destroy_all\n\n # model names\n constructions = %w(UndergroundWall UndergroundFloor InteriorWall InteriorFloor ExteriorWall ExteriorFloor Roof)\n fenestrations = %w(Window Skylight)\n doors = ['Door']\n space_ids = []\n\n # get all building -> stories -> spaces (that's what constructions are attached to)\n stories = building.building_stories\n spaces = []\n stories.each do |story|\n story.spaces.each do |space|\n spaces << space\n end\n end\n space_ids = spaces.collect(&:id)\n logger.debug(\"*****SPACES: #{space_ids.inspect} *****\")\n\n project_cas = []\n project_mats = []\n project_fens = []\n project_doors = []\n\n # to find doors, windows, skylights\n int_wall_ids = []\n ext_wall_ids = []\n roof_ids = []\n\n # assign regular constructions\n constructions.each do |con|\n con_model = con.constantize\n instances = con_model.any_in(space_id: space_ids)\n\n if con === 'InteriorWall'\n int_wall_ids = instances.collect(&:id)\n elsif con === 'ExteriorWall'\n ext_wall_ids = instances.collect(&:id)\n elsif con === 'Roof'\n roof_ids = instances.collect(&:id)\n end\n\n # puts \"#{instances.size} instances of #{con}\"\n # logger.info \"#{instances.size} instances of #{con}\"\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Construction.find(instance.construction_library_id)\n\n # TODO: check that it doesn't exist yet or skip?\n ca = construct_assemblies.find_or_create_by(name: lib.name)\n ca.compatible_surface_type = lib.compatible_surface_type\n # save other attributes here (for floors)\n ca.slab_type = lib.slab_type\n ca.slab_insulation_orientation = lib.slab_insulation_orientation\n ca.slab_insulation_thermal_resistance = lib.slab_insulation_thermal_resistance\n\n material_refs = []\n # material references\n logger.debug(\"!!!!! LAYERS: #{lib['layers']}\")\n unless lib['layers'].nil?\n lib.layers.each do |layer|\n mat = materials.find_or_create_by(name: layer['name'])\n mat.code_category = layer['code_category']\n mat.code_item = layer['code_item']\n # save framing_configuration and material (required)\n mat.framing_depth = layer['framing_depth']\n mat.framing_configuration = layer['framing_configuration']\n mat.framing_material = layer['framing_material']\n mat.framing_material = layer['framing_material']\n mat.cavity_insulation = layer['cavity_insulation_r_value']\n\n mat.save\n material_refs << mat.name\n # only save unique records to project\n match = project_mats.find { |m| m['name'] === mat.name }\n logger.info(\"MATCH: #{match}, for material #{mat.name}\")\n project_mats << mat if match.nil?\n end\n end\n\n # save material references to construction assembly\n ca.material_reference = material_refs\n ca.save\n # only save unique records to project\n match = project_cas.find { |m| m['name'] === ca.name }\n # puts \"MATCH: #{match} for ca #{ca.name}\"\n logger.info \"MATCH: #{match} for ca #{ca.name}\"\n project_cas << ca if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.construct_assembly_reference = ca.name\n instance.save\n end\n end\n end\n\n\n logger.info \"Exterior Wall ids are #{ext_wall_ids}\"\n\n # assign doors\n door_instances = Door.or({:interior_wall_id.in => int_wall_ids}, {:exterior_wall_id.in => ext_wall_ids})\n\n logger.info(\"Door instances: #{door_instances.size}\")\n door_instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = DoorLookup.find(instance.construction_library_id)\n dc = door_constructions.find_or_create_by(name: lib.name)\n # add other lib fields\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n dc[key] = value\n end\n end\n dc.save\n\n # only save unique records to project\n match = project_doors.find { |m| m['name'] === dc.name }\n logger.info(\"MATCH: #{match} for door construction #{dc.name}\")\n project_doors << dc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.door_construction_reference = dc.name\n instance.save\n end\n end\n\n # assign fenestrations\n fenestrations.each do |fen|\n fen_model = fen.constantize\n if fen === 'Window'\n instances = fen_model.any_in(exterior_wall_id: ext_wall_ids)\n else\n # skylight\n instances = fen_model.any_in(roof_id: roof_ids)\n end\n # puts \"#{instances.size} instances of #{fen}\"\n # logger.info(\"#{instances.size} instances of #{fen}\")\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Fenestration.find(instance.construction_library_id)\n # TODO: check that it doesn't exist yet or skip?\n fc = fenestration_constructions.find_or_create_by(name: lib.name)\n # save all lib attributes to construction instance\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n fc[key] = value\n end\n end\n fc.save\n\n # only save unique records to project\n match = project_fens.find { |m| m['name'] === fc.name }\n logger.info(\"MATCH: #{match} for fen construction #{fc.name}\")\n project_fens << fc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.fenestration_construction_reference = fc.name\n instance.save\n end\n end\n end\n\n # save all to project\n self.door_constructions = project_doors\n self.fenestration_constructions = project_fens\n self.construct_assemblies = project_cas\n self.materials = project_mats\n self.save!\n end", "def build(file_name)\n end", "def generate_comprehensive\n\n end", "def gv_make_image(name=nil)\n return unless gv_object\n name = gv_object.name unless name\n file = \"#{name}.png\"\n gv_object.output(:png => file)\n file\n end", "def build(document)\n document.geom_types = geom_types\n document.format = format\n end", "def spawn attributes={}\n child = self.dup\n self.work_groups.each do |wg|\n new_wg = WorkGroup.new(:institution=>wg.institution,:project=>child)\n child.work_groups << new_wg\n wg.group_memberships.each do |gm|\n new_gm = GroupMembership.new(:person=>gm.person, :work_group=>wg)\n new_wg.group_memberships << new_gm\n end\n end\n child.assign_attributes(attributes)\n child.avatar=nil\n child.lineage_ancestor=self\n child\n end", "def crew _args\n \"crew _args;\" \n end", "def create_build( build_def, changesets, duration, message, number, start, status,uri )\r\n\r\n\t\t@logger.debug(\"Creating build.\")\r\n\t\r\n\t\tfields = {\r\n\t\t\t:build_definition => build_def,\r\n\t\t\t:changesets => changesets,\r\n\t\t\t:duration => duration,\r\n\t\t\t:message => message,\r\n\t\t\t:number => number,\r\n\t\t\t:start => start,\r\n\t\t\t:status => status,\r\n\t\t\t:uri => uri\t\r\n\t\t}\r\n\t\t@logger.debug(\"Creating build #{fields}\")\r\n\t\t\r\n\t\tbuild = @rally.create(:build, fields)\r\n\t\t@logger.debug(\"Created build #{fields}\")\r\n\r\n\t\r\n\tend", "def crear_actualizar_grupo(ldapgr, prob)\n cn = ldapgr.cn[0]\n d = ldapgr.respond_to?(:description) ? ldapgr.description[0] : cn\n grupo = Msip::Grupo.where(cn: cn).take\n if grupo.nil?\n grupo = Msip::Grupo.new(fechacreacion: Date.today)\n if grupo.nil?\n prob << 'No pudo crear grupo: ' + prob\n return nil\n end\n end\n grupo.cn = cn\n grupo.nombre = d\n grupo.gidNumber = valor_campo_ldap(ldapgr, :gidNumber)\n grupo.ultimasincldap = Date.today\n grupo.fechadeshabilitacion = nil\n grupo.save\n if (grupo.errors.messages.length > 0)\n prob << grupo.errors.messages.to_s\n return nil\n end\n return grupo\n end", "def init_create\n init_dict()\n @grid = Array.new(self.size) { Array.new(self.size, nil) }\n init_first_word()\n self.finished = false\n end", "def build_factory\n\t\trequire 'rgeo'\n\t\trequire 'rgeo/geo_json'\n\n\t\t#Using a web mercator projection here because the data was added to the map in this projection, and the two are very close in latitude, so the errors are similar.\n\t\t@geo_projected_factory = RGeo::Geographic.projected_factory(:projection_proj4=>'+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs <>')\n\t\n\t\t#TODO\n\t\t#Add different factories for better, more realistic calculations\n\tend", "def gen_prj\n filename = \"#{@work_dir}/#{@module_name}.prj\"\n printf(\"@I:Generate Prj File(%s)\\n\",filename)\n f = File.open(\"#{filename}\",\"w\")\n tmp = Array.new\n tmp << @file_name\n tmp.uniq!\n tmp.each{|file|\n f.printf(\"verilog work \\\"%s\\\"\\n\",file)\n }\n f.close\n end", "def process_and_build_components \n end", "def build_vars\n\n end", "def generateRDoc\r\n rSuccess = true\r\n\r\n logOp('Generating RDoc') do\r\n # This was used by modifications to RDoc for Muriel's template.\r\n # Consider it as obsolete now.\r\n # TODO: Remove/Adapt when Muriel's template is a well written RDoc gem.\r\n# $project_info = {\r\n# :Name => @ReleaseInfo.project_info[:name],\r\n# :version => @ReleaseVersion,\r\n# :tags => @ReleaseTags,\r\n# :Date => Time.now,\r\n# :dev_status => @ReleaseInfo.project_info[:dev_status],\r\n# :Author => @ReleaseInfo.author_info[:name],\r\n# :AuthorMail => @ReleaseInfo.author_info[:email],\r\n# :AuthorURL => @ReleaseInfo.author_info[:web_page_url],\r\n# :HomepageURL => @ReleaseInfo.project_info[:web_page_url],\r\n# :image_url => @ReleaseInfo.project_info[:image_url],\r\n# # TODO: Do not hardcode SF anymore\r\n# :DownloadURL => \"https://sourceforge.net/projects/#{@ReleaseInfo.sf_info[:project_unix_name]}/files/#{@ReleaseVersion}/#{@GemName}/download\",\r\n# :browse_source_url => @ReleaseInfo.project_info[:browse_source_url],\r\n# :favicon_url => @ReleaseInfo.project_info[:favicon_url],\r\n# # For the documentation, the Root dir is the Release dir as files have been copied there and the rdoc will be generated from there.\r\n# :RootDir => @ReleaseDir\r\n# }\r\n # Create the created.rid file as otherwise rdoc will not finish\r\n FileUtils::mkdir_p(\"#{@DocDir}/rdoc\")\r\n File.open(\"#{@DocDir}/rdoc/created.rid\", 'w') do |oFile|\r\n end\r\n gem 'rdoc'\r\n require 'rdoc/rdoc'\r\n lRDocOptions = [\r\n '--line-numbers',\r\n '--tab-width=2',\r\n \"--title=#{@ReleaseInfo.project_info[:name].gsub(/'/,'\\\\\\\\\\'')} v#{@ReleaseVersion}\",\r\n '--hyperlink-all',\r\n '--charset=utf-8',\r\n '--exclude=.svn',\r\n '--exclude=.git',\r\n '--exclude=nbproject',\r\n '--exclude=Done.txt',\r\n '--exclude=Releases',\r\n '--force-update',\r\n \"--output=#{@DocDir}/rdoc\"\r\n ]\r\n # Bug (RDoc): Sometimes it does not change current directory correctly (not deterministic)\r\n change_dir(@ReleaseDir) do\r\n # First try with Muriel's template\r\n begin\r\n RDoc::RDoc.new.document( lRDocOptions + [ '--fmt=muriel' ] )\r\n rescue Exception\r\n log_warn \"Exception while generating using Muriel's templates: #{$!}: #{$!.backtrace.join(\"\\n\")}\"\r\n # Then try with default template\r\n RDoc::RDoc.new.document( lRDocOptions )\r\n end\r\n end\r\n end\r\n\r\n return rSuccess\r\n end", "def build_for_creation(address, path, script, xpubs = [])\n build_inputs([address])\n total, fee = build_fee(:create)\n output_amount = total - fee.to_i\n create(inputs: @inputs,\n path: path,\n address: address,\n output_amount: output_amount,\n script: script,\n xpubs: xpubs)\n end", "def create\n \n end", "def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end", "def generate\n # Vælg et tilfældigt koordinat til at starte med.\n random_start = [@prng.rand(@width),@prng.rand(@height)]\n \n # Opret en stak og læg det tilfældige koordinat på stakken.\n stack = Array.new\n stack.push random_start\n until stack.empty?\n # Tag koordinaterne fra det øverste element på stakken.\n x,y = stack.last\n # Marker cellen som besøgt.\n @grid[y][x].visited = true\n # Gem alle cellens nabo-celler.\n neighbors = Array.new\n neighbors.push [x, y-1] unless y-1 < 0 # Nord\n neighbors.push [x+1, y] unless x+1 >= @width # Øst\n neighbors.push [x, y+1] unless y+1 >= @height # Syd\n neighbors.push [x-1, y] unless x-1 < 0 # Vest\n # Sorter de naboer fra der allerede er blevet besøgt af algoritmen.\n neighbors.delete_if {|x, y| @grid[y][x].visited }\n # tjek om der er nogle ubesøgte naboer.\n if neighbors.any?\n # Vælg en tilfældig ubesøgt nabo.\n random_neighbor = neighbors.sample(random:@prng)\n # Forbind denne celle med den tilfældige nabo.\n connect stack.last, random_neighbor\n # Læg den tilfældige nabo øverst på stakken.\n stack.push random_neighbor\n else\n # Hvis der ingen naboer er, så tager den en celle af stakken.\n stack.pop\n end\n end\n end", "def build_templates_and_labels\n \n #--------------------------------------------------------------\n #Fetch data needed for build operations\n #--------------------------------------------------------------\n self.production_schedule_code = self.carton_setup.production_schedule_code\n self.org = self.carton_setup.org\n self.color_percentage = self.carton_setup.color_percentage\n self.grade_code = self.carton_setup.grade_code\n self.std_count = self.carton_setup.standard_size_count_value\n self.sequence_number = self.carton_setup.sequence_number\n self.order_number = self.carton_setup.order_number\n \n \n @rmt_setup = RmtSetup.find_by_production_schedule_name(self.production_schedule_code)\n self.transaction do\n build_carton_template\n build_carton_label \n build_pallet_template\n build_pallet_label\n \n self.carton_setup.update\n end\n \n end", "def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend", "def generate\n super\n end", "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "def create_project(name, description, client)\n\n\tproject = create(:project,\n\tname: name,\n\tstart_date: Date.today - rand(0..60),\n\tdeadline: Date.today + rand(30..60), \n\tdescription: description,\n\tclient: client)\n\n\t# Assign all three users to the project\n\tproject.users << User.all\n\n\t# Tasks\n\tget_tasks.each do |task|\n\t\tcreate(:project_task, project: project, task: task, hours_planned: rand(10..120))\n\tend\n\t\n\t# Some inputs\n\tinputs_count = rand(20..40)\n\tinputs_count.times do\n\t\tproject_task = project.project_tasks.all.sample\n\t\tuser = User.all.sample\n\t\tinput_date = Date.today - rand(-2..20)\n\t\thours = rand(1..24)\n\n\t\tcreate(:input, project_task: project_task, user: user , input_date: input_date, hours: hours)\n\tend\nend", "def build \n configure_directories\n \n @spec['collision'] = 'destroy'\n \n \n jobs = []\n \n # Recon\n recon_options = {'rawdir' => @rawdir, 'epi_pattern' => /(Rest|Task)/i, }\n config_step_method(recon_options, 'recon') if @config['custom_methods']\n jobs << ReconJobGenerator.new(recon_options).build\n \n # Preproc\n preproc_options = {'scans' => jobs.first['scans']}\n config_step_method(preproc_options, 'preproc') if @config['custom_methods']\n jobs << PreprocJobGenerator.new(preproc_options).build\n \n # Stats\n stats_options = {\n 'scans' => jobs.first['scans'],\n 'conditions' => @config['conditions'],\n 'responses_dir' => @config['responses_dir'],\n 'subid' => @spec['subid']\n }\n config_step_method(stats_options, 'stats') if @config['custom_methods']\n jobs << StatsJobGenerator.new(stats_options).build\n \n @spec['jobs'] = jobs\n \n return @spec\n end", "def generate_xml\n\t\n\t\tbuilder = Nokogiri::XML::Builder.new do |xml|\n \t\t\txml.randomGeneratedData {\n \t\t\txml.parameters(nbStations: @inputs.nb_stations, nbDemands: @inputs.nb_demands)\n xml.stations {\n @list_stations.each do |s|\n\t\t\t\t\t\t\txml.station(\n\t\t\t\t\t\t\t\tid: s.id, \n\t\t\t\t\t\t\t\txPos: s.xPos, \n\t\t\t\t\t\t\t\tyPos: s.yPos,\n\t\t\t\t\t\t\t\tmaxSize: s.maxSize\n\t\t\t\t\t\t\t)\n end\n }\n \t\t\t\txml.demands {\n @list_demands.each do |d|\n \t\t\t\t\t\txml.demand(\n\t\t\t\t\t\t\t id: d.id,\n\t\t\t\t\t\t\t\tidsOrigin: d.sOrigin.id, \n\t\t\t\t\t\t\t\tidsDestination: d.sDestination.id, \n\t\t\t\t\t\t\t\tnbDemand: d.nbDemand,\n\t\t\t\t\t\t\t\tdepartureTime: d.departureTime_TS,\n\t\t\t\t\t\t\t\tarrivalTime: d.arrivalTime_TS\n \t\t\t\t\t\t)\n end\n \t\t\t\t}\n \t\t\t}\n\t\tend\n\t\t\n\t\treturn builder.to_xml\n\tend", "def create!\n misc = GroupCategory.find_by(slug: 'misc').id\n GROUP_NAMES.each do |name|\n # Make the group\n group = Group.where(\n name: name\n ).first_or_create(category_id: misc)\n # Set up an initial owner\n GroupMember.create!(user: owner, group: group, rank: :admin)\n end\n\n # Build up neighborhood, so the aozora groups have each other as neighbors\n GROUP_NAMES.permutation(2) do |from, to|\n src = Group.find_by(name: from)\n dst = Group.find_by(name: to)\n GroupNeighbor.create!(source: src, destination: dst)\n end\n end", "def generate\n populate\n @parlour.send(@mode)\n end", "def createGroup\n call :createGroup\n end", "def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_pocket_ui\n create_scroll_bar\n create_bag_sprite\n create_item_list\n create_arrow\n create_info\n create_shadow\n create_search\n create_frame # Should always be last\n end", "def create\n generate\n save\n end", "def create\r\n\r\n\r\n end", "def generate(status)\n @build_status.shield(status, true)\nend", "def bulk_generate\n\n end", "def build(**)\n raise NotImplementedError\n end", "def gv_object\n return @gv_object if @gv_object\n return unless defined? GraphViz\n @gv_object = GraphViz.new gv_graph_name, :type => :digraph\n @gv_object.node_attrs[:style] = 'filled, solid'\n\n each_task do |task|\n next unless task.node == gv_filter_node if gv_filter_node\n gv_node = @gv_object.add_node task.to_s\n gv_node.fillcolor = gv_task_color(task)\n end\n\n each_task do |task|\n task.each_dependency do |dep_task|\n next unless dep_task.node == gv_filter_node if gv_filter_node\n next unless @gv_object.find_node dep_task.to_s and @gv_object.find_node task.to_s\n @gv_object.add_edges dep_task.to_s, task.to_s\n end\n end\n @gv_object\n end", "def generate_project!(attributes={})\n identifier = \"a\" + Redmine::Utils.random_hex(6)\n Project.generate!(\n {\n :identifier => identifier,\n :name => identifier,\n :tracker_ids => [],\n :enabled_module_names => []\n }.merge(attributes)\n )\n end", "def create_pop_group( name ) \n return \"Group #{name} already exists.\" if NodeGroup.find_by_name( name )\n \n unless File.exists?( SpkDashboard::DATA_PATH + \"/data_#{name}\" )\n return \"No params file found to create group #{name}. FILE: #{SpkDashboard::DATA_PATH + \"/data_#{name}\"}\"\n end\n \n params = self.read_group_params( name )\n \n nodegroup = NodeGroup.new(\n :name => name,\n :node_group_names => [ \"spk_base\" ],\n :parameter_attributes => params )\n \n if nodegroup.save \n return \"Successfully created group #{name}\"\n else\n return \"Failed to create group #{pop}\"\n end\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 generateBoardReaderMain( generatorCode, destinations_fhicl,dataDir, routingCode, withGanglia = 0, withMsgFacility = 0, withGraphite = 0)\n\n brConfig = String.new( \"\\\n daq: {\n fragment_receiver: {\n\tmpi_sync_interval: 50\n\n\t%{generator_code}\n\n\tdestinations: {\n\t %{destinations_fhicl}\n\t}\n\n\trouting_table_config: {\n\t %{routing_code}\n\t}\n }\n\n metrics: {\n\tbrFile: {\n\t metricPluginType: \\\"file\\\"\n\t level: 3\n\t fileName: \\\"%{datadir}/boardreader/br_%UID%_metrics.log\\\"\n\t uniquify: true\n\t}\n\t%{ganglia_metric} ganglia: {\n\t%{ganglia_metric} metricPluginType: \\\"ganglia\\\"\n\t%{ganglia_metric} level: %{ganglia_level}\n\t%{ganglia_metric} reporting_interval: 15.0\n\t%{ganglia_metric} \n\t%{ganglia_metric} configFile: \\\"/etc/ganglia/gmond.conf\\\"\n\t%{ganglia_metric} group: \\\"ARTDAQ\\\"\n\t%{ganglia_metric} }\n\t%{mf_metric} msgfac: {\n\t%{mf_metric} level: %{mf_level}\n\t%{mf_metric} metricPluginType: \\\"msgFacility\\\"\n\t%{mf_metric} output_message_application_name: \\\"ARTDAQ Metric\\\"\n\t%{mf_metric} output_message_severity: 0 \n\t%{mf_metric} }\n\t%{graphite_metric} graphite: {\n\t%{graphite_metric} level: %{graphite_level}\n\t%{graphite_metric} metricPluginType: \\\"graphite\\\"\n\t%{graphite_metric} host: \\\"localhost\\\"\n\t%{graphite_metric} port: 20030\n\t%{graphite_metric} namespace: \\\"artdaq.\\\"\n\t%{graphite_metric} }\n }\n}\"\n)\n \n brConfig.gsub!(/\\%\\{generator_code\\}/, String(generatorCode))\n brConfig.gsub!(/\\%\\{routing_code\\}/, String(routingCode))\n brConfig.gsub!(/\\%\\{destinations_fhicl\\}/, destinations_fhicl)\n \n brConfig.gsub!(/\\%\\{datadir\\}/, dataDir)\n if Integer(withGanglia) > 0\n\tbrConfig.gsub!(/\\%\\{ganglia_metric\\}/, \"\")\n\tbrConfig.gsub!(/\\%\\{ganglia_level\\}/, String(withGanglia))\n else\n\tbrConfig.gsub!(/\\%\\{ganglia_metric\\}/, \"#\")\n end\n if Integer(withMsgFacility) > 0\n\tbrConfig.gsub!(/\\%\\{mf_metric\\}/, \"\")\n\tbrConfig.gsub!(/\\%\\{mf_level\\}/, String(withMsgFacility))\n else\n\tbrConfig.gsub!(/\\%\\{mf_metric\\}/, \"#\")\n end\n if Integer(withGraphite) > 0\n\tbrConfig.gsub!(/\\%\\{graphite_metric\\}/, \"\")\n\tbrConfig.gsub!(/\\%\\{graphite_level\\}/, String(withGraphite))\n else\n\tbrConfig.gsub!(/\\%\\{graphite_metric\\}/, \"#\")\n end\n \n return brConfig\nend", "def generate\n conf = {\n port: datastore['LPORT'],\n host: datastore['LHOST'],\n retry_count: datastore['StagerRetryCount'],\n sleep_seconds: datastore['StagerRetryWait'],\n }\n\n # Generate the advanced stager if we have space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n end\n\n generate_reverse_tcp(conf)\n end", "def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend", "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end", "def generate\n conf = {\n port: datastore['LPORT'],\n host: datastore['LHOST'],\n retry_count: datastore['StagerRetryCount'],\n sleep_seconds: datastore['StagerRetryWait'],\n }\n\n # Generate the advanced stager if we have space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n end\n\n generate_reverse_tcp(conf)\n end", "def build_work(w_hsh)\n title = Array(w_hsh[:title])\n creator = Array(w_hsh[:creator])\n rights = Array(w_hsh[:rights])\n desc = Array(w_hsh[:description])\n methodology = w_hsh[:methodology]\n subject = Array(w_hsh[:subject])\n contributor = Array(w_hsh[:contributor])\n date_created = Array(w_hsh[:date_created]) \n rtype = Array(w_hsh[:resource_type] || 'Dataset')\n\n gw = GenericWork.new( title: title, creator: creator, rights: rights,\n description: desc, resource_type: rtype,\n methodology: methodology, subject: subject,\n contributor: contributor, date_created: date_created ) \n paths_and_names = w_hsh[:files].zip w_hsh[:filenames]\n fsets = paths_and_names.map{|fp| build_file_set(fp[0], fp[1])}\n fsets.each{|fs| gw.ordered_members << fs}\n gw.apply_depositor_metadata(user_key)\n gw.owner=(user_key)\n gw.save!\n return gw\n end", "def make_grp_prj_nodes\n grp = {}; prj = {}\n @nodes_fields.each do |node|\n grp[node] = '$' + node\n prj[node] = '$_id.' + node\n end\n return [grp, prj]\n end", "def build()\n \n #check dir exists, if not, make it\n if(!File.exists?(@path))\n Dir.mkdir(@path)\n end\n \n #build directory structure\n puts 'Building directory structure'\n build_skeleton(@template.directory_structure)\n \n #execute build tasks\n puts 'Running build tasks'\n execute_tasks(@template.tasks,@template.path)\n \n puts 'Skeleton built'\n \n end", "def start_generation\n Nanite.request(\"/nanny/generate\", self.id)\n end", "def generate\n raise \"must implement\"\n end", "def create_geometry(p1, p2, view)\n puts \"create_geometry called\"\n## puts \"create_geometry called\"\n \t\t# if @state < 2 ##then we haven't yet created any geometry, so create the cross-section face\n\t\t\t# @model = Sketchup.active_model\n\t\t\t# @model.start_operation(\"DrawFraming\")\n \t\t# @state = 2 ## Waiting for pick or VCB entry to define length of component\n \n # @@df_tool_id = @model.tools.active_tool_id ## Remember DrawFraming tool_id\n # Create an empty component definition\n # @ents = @model.definitions\n # @comp_defn = @ents.add(\"comp\")\n\n # Create an empty group to draw into\n\t\t\t# @grp = @model.active_entities.add_group()\n\t\t\t# @ents = @grp.entities\n\n # Define cross-section and name it\n\t\t\t# comp_defn_name = UI.inputbox [\"Component name \"],[\"Frame element\"],\"Name this component \" \n\t\t\t# if comp_defn_name ## inputbox was not cancelled)\n # @comp_defn.name = @n_size[@chosen_size][0] + \" \" + comp_defn_name[0].to_s\n\t\t\t\t# @comp_defn.description = @n_size[@chosen_size][0] + \" \" +comp_defn_name[0].to_s\n \n # Insert face into new component definition\n # ents = @comp_defn.entities\n# puts \"@comp_defn class = \" + @comp_defn.class.to_s \n\n # @face = ents.add_face(@profile_points3)\n\n # Insert an instance of the component at the origin\n # @model.active_entities.add_instance(@comp_defn, @tf_identity)\n# puts \"@face.vertices = \" + @face.vertices.inspect.to_s\n\n\t\t\t\t# @last_drawn = [@comp_defn]\n\n # Orient face normal to @reported_normal and correctly oriented: four steps\n # 1. Rotate the cross-section around Z_AXIS at world or component origin \n # to align with @face.normal\n\t\t\t\t# @comp_defn.instances[-1].transform!(@tf3)\n\n # 2. Revolve around normal to the Z_AZIS and the @face.normal\n # @comp_defn.instances[-1].transform!(@tf4)\n\n # 3. Rotate by 90 degrees about @reported_normal @quad times\n # i=1\n # while i <= @quad do\n # @comp_defn.instances[-1].transform!(@rotate90_la)\n # i += 1\n # end\n \n # 4. Move inserted component face from origin to pick point\n\t\t\t\t# @comp_defn.instances[-1].transform!(@tf2)\t\t\t \n\n # Select only the newly created face inside the component\n\t\t\t\t# @model.selection.clear\n\t\t\t\t# @model.selection.add @face \n\n # If operation cancelled \n\t\t\t# else\n # @model.abort_operation ## alternative way to cancel\n # self.reset(view)\n\t\t\t# end ## if comp_name\n\t\t# end ## if @state < 2 \n# ------------------------\n # if @state == 3 && @face ## a component face has been drawn\n # Pushpull cross-section to length\n# puts \"create_geometry called state 3\"\n # if @face.normal == @reported_normal\n # @face.pushpull @frame_length \n # else ## reverse direction to pushpull\n # @face.pushpull -@frame_length\n # end\n# puts \"@comp_defn.instances[-1] = \" + @comp_defn.instances[0].to_s\n # @comp_defn.name = @profile[0] + \" \" + @n_size[@chosen_size][0] + \" x \" + @frame_length.to_l.to_s\n # @model.selection.clear\n # self.reset(view)\n # @model.commit_operation\n # end ## if @state == 3\n\n end", "def create(project_name, repo_name, description) ; end" ]
[ "0.6889002", "0.64691114", "0.6070615", "0.5987288", "0.5987288", "0.5930228", "0.58209604", "0.58209604", "0.57958984", "0.5751213", "0.5704248", "0.5702218", "0.56889445", "0.5668715", "0.5663841", "0.566208", "0.5626885", "0.56018114", "0.56017745", "0.5522825", "0.546196", "0.5453849", "0.5412085", "0.5411038", "0.54099166", "0.5387527", "0.5387527", "0.5387527", "0.5387323", "0.5385444", "0.53695947", "0.5302801", "0.5293226", "0.5292123", "0.52911454", "0.52848357", "0.5280802", "0.52770966", "0.52766305", "0.5245572", "0.5244002", "0.5243979", "0.52426213", "0.52426213", "0.52403665", "0.5226854", "0.52161604", "0.5212014", "0.52092963", "0.52033347", "0.5182618", "0.5176628", "0.5173102", "0.5163069", "0.5151983", "0.51500833", "0.51458204", "0.5144977", "0.5143898", "0.5132505", "0.51209074", "0.51181316", "0.5117684", "0.51161695", "0.511173", "0.5111393", "0.5109654", "0.5105371", "0.5104626", "0.5093738", "0.5090515", "0.50873363", "0.50843734", "0.50817376", "0.50789016", "0.50763434", "0.50693965", "0.5060283", "0.50599504", "0.5056373", "0.5054913", "0.50404644", "0.50398976", "0.5035017", "0.50270355", "0.5024795", "0.50214607", "0.50209033", "0.5019927", "0.50192857", "0.5018785", "0.5018067", "0.50180274", "0.5012069", "0.5006968", "0.5005103", "0.5004598", "0.50017285", "0.5000216", "0.4996699" ]
0.58847266
6
build and move lean to
def create_lean(entities) if($lean_height > 0) if($lean_side == "SW1") r = Geom::Transformation.rotation [0,0,0],[0,0,1],360.degrees t = Geom::Transformation.new [$lean_offset,-$lean_length,0] build_lean(entities, r, t) end if($lean_side == "SW2") r = Geom::Transformation.rotation [0,0,0],[0,0,1],180.degrees t = Geom::Transformation.new [$length-$lean_offset,+$width+$lean_length,0] build_lean(entities, r, t) end if($lean_side == "EW1") r = Geom::Transformation.rotation [0,0,0],[0,0,1],270.degrees t = Geom::Transformation.new [-$lean_length,+$width-$lean_offset,0] build_lean(entities, r, t) end if($lean_side == "EW2") r = Geom::Transformation.rotation [0,0,0],[0,0,1],90.degrees t = Geom::Transformation.new [$length+$lean_length,$lean_offset,0] build_lean(entities, r, t) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def prep_build\n stdout.out_success(\"\\nPreparing build dir at: '#{settings['build_dir']}'\")\n stdout.verbose(\"Removing build dir at: #{settings['build_dir']}\")\n FileUtils.rm_rf(settings['build_dir'])\n # create the build dir\n stdout.verbose(\"Creating build dir at: #{settings['build_dir']}\")\n FileUtils.mkdir(settings['build_dir'])\n end", "def build_to_temp_dir\n @builder.build_project\n\n # Copy build files to temporary directory\n @task.shell.mute do\n @task.directory @project.build_path, ::File.join(@project.package_path, @package_name), :force => true\n end\n end", "def cleanup(build_dir)\n build_dir = Pathname(build_dir)\n tmp_build_dir = Pathname('.temp-build')\n\n # copy over files we need to keep\n if File.directory?(build_dir)\n build_dir.glob(\"**/all-product-headers.yaml\").each do |file|\n intermediate = Pathname(file).relative_path_from(build_dir).dirname\n destination_dir = tmp_build_dir + intermediate\n\n FileUtils.mkdir_p(destination_dir)\n FileUtils.mv(file, destination_dir)\n end\n\n build_dir.rmtree if build_dir.directory?\n FileUtils.mv(tmp_build_dir, build_dir)\n end\nend", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def build\n clean_build_directory\n copy_templates\n copy_functions\n copy_includes\n build_assets\n end", "def build\n system(\"make build\", :chdir => self.config['destination'], :out => :err)\n end", "def remove_structure\n rm_rf target_dir\n end", "def move_binaries\n Dir.mkdir(RESULT_DIR) unless Dir.exist?(RESULT_DIR)\n changes = Dir.glob(\"#{BUILD_DIR}/../*.changes\")\n\n changes.reject! { |e| e.include?('source.changes') }\n\n unless changes.size == 1\n warn \"Not exactly one changes file WTF -> #{changes}\"\n return\n end\n\n system('dcmd', 'mv', '-v', *changes, 'result/')\n end", "def move_dirs\n \n end", "def prepare\n if not File.exists?(OBS_BUILD_DIR)\n FileUtils.mkdir_p OBS_BUILD_DIR\n end\n cleanup\n end", "def prepare_working_dir\n FileUtils.mkdir_p @working_dir unless File.directory?(@working_dir)\n FileUtils.rm_rf Dir[\"#{@working_dir}/*\"] if @force_rebuild\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def run!\n project.mode = :release\n\n # Validate paths\n validate_paths!\n\n # Extract mockup\n copy_source_path_to_build_path!\n\n validate_stack!\n\n # Run stack\n run_stack!\n\n # Cleanup\n cleanup! if config[:cleanup_build]\n ensure\n project.mode = nil\n end", "def clean\n #rm_r(srcdir)\n rm_r(blddir)\n #rm_r(libdir)\n end", "def build_here\n cp_a File.join(root_dir, \"test\", \"setup\", \"#{name}.svn.gz\"), \".\"\n\n puts `gzip -f -d #{name}.svn.gz`\n raise unless $? == 0\n puts `svnadmin create #{name}`\n raise unless $? == 0\n puts `svnadmin load #{name} < #{name}.svn`\n raise unless $? == 0\n end", "def prepare\n #let's mark ourselves as dirty if any of our dependents are dirty\n if dependents.values.detect(&:'dirty?')\n mark_dirty\n end\n dependents.values.each {|child| child.prepare}\n\n if dirty?\n delete_clean_dir\n end\n\n #if the directory is there, we don't need to do anything\n if !File.exist?(clean_dir)\n Dir.chdir clean_dir_parent do\n mark_dirty\n if pristine_exists? && !pristine_dirty?\n copy_pristine_here\n else\n build_here\n end\n unmark_dirty\n\n copy_clean_to_pristine\n end\n end\n end", "def build()\n \n #check dir exists, if not, make it\n if(!File.exists?(@path))\n Dir.mkdir(@path)\n end\n \n #build directory structure\n puts 'Building directory structure'\n build_skeleton(@template.directory_structure)\n \n #execute build tasks\n puts 'Running build tasks'\n execute_tasks(@template.tasks,@template.path)\n \n puts 'Skeleton built'\n \n end", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def clean\n needs_cleaning = File.exist?(project_dir)\n if needs_cleaning\n log.info(log_key) { \"Cleaning project directory `#{project_dir}'\" }\n FileUtils.rm_rf(project_dir)\n end\n create_required_directories\n deploy\n needs_cleaning\n end", "def clean\n build addl_cmake_bld_args: '--target clean'\n end", "def build\n sync\n output_dir.mkpath\n outputs.each(&:build)\n output_dir.touch\n end", "def clean(ant)\n @build_dir.delete\n end", "def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n makeDirCmd = \"mkdir casava_fastq\"\n `#{makeDirCmd}`\n moveCmd = \"mv *.fastq.gz ./casava_fastq\"\n `#{moveCmd}`\n end", "def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n makeDirCmd = \"mkdir casava_fastq\"\n `#{makeDirCmd}`\n moveCmd = \"mv *.fastq.gz ./casava_fastq\"\n `#{moveCmd}`\n end", "def create_source_tree2\n if !File.exist?(@sourceDir2)\n FileUtils.rm_rf(@sourceDir2)\n FileUtils.cp_r(@sourceDir,@sourceDir2)\n end\n # Remove any existing repository file\n FileUtils.rm_rf(@repoFile2)\n end", "def destination_rel_dir\n replace_build_path(super)\n end", "def setup_skeleton\r\n self.destination_root = File.join(path, name)\r\n @class_name = name.classify\r\n @guid = UUIDTools::UUID.timestamp_create.to_s\r\n directory(\"base_app/\", self.destination_root)\r\n copy_file File.join(self.destination_root, \"blend_solution.sln\"), File.join(self.destination_root, \"#{@class_name}.sln\")\r\n copy_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\"), File.join(self.destination_root, \"src\", \"#{@class_name}.Controls.csproj\")\r\n remove_file File.join(self.destination_root, \"blend_solution.sln\")\r\n remove_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\")\r\n\r\n store_component_config('.components')\r\n end", "def rebuild\n build addl_cmake_bld_args: '--clean-first'\n end", "def build_archive # @location == LOCATION(group, user, mtime, experiment_id)\n restore_dir = Dir.pwd\n @mount_dir ||= ::ArchiveRoot\n FileUtils.mkdir_p(File.join(@mount_dir, @location))\n Dir.chdir(File.join(@mount_dir, @location))\n # cp the config file from the higher level down\n @@build_directories.each do |dir|\n FileUtils.mkdir dir unless Dir.exist?(dir)\n end\n Dir.chdir(restore_dir)\n # Find a config file and move it down to this directory... right?\n end", "def configure_redist_dir(output, zip_file_name, platforms, compiler)\n\tworking_dir = File.join(RedistDirName, zip_file_name)\n\tmakedirs working_dir\n\n\toutput.from \".\"\n\toutput.to File.join(working_dir, zip_file_name)\n\t\n\tConfigurations.each do |configuration|\n\t\tfor platform in platforms\n\t\t\toutput.file \"lib/#{platform}/#{configuration}/hlsl2glsl.lib\"\n\t\t\toutput.file \"build/#{compiler}/#{platform}/#{configuration}/hlsl2glsl.pdb\", :as => \"lib/#{platform}/#{configuration}/hlsl2glsl.pdb\"\n\t\tend\n\tend\n\t\n\toutput.dir \"include\"\n\toutput.file \"LICENSE.txt\"\n\toutput.file \"README.md\"\nend", "def build_directory root\n root += \"/\" if not root.end_with? \"/\" # add backslash for later concatenation\n if not caller[0] =~ /.*build_directory.*/\n puts \"Building in #{root + @name}.\"\n puts \"Warning. No files in this package tree.\" if file_count == 0\n end\n Dir.mkdir(root + @name) if not File.exist? root + @name # make root dir if not already present\n @files.each do |file|\n puts \"Copying file #{File.basename file} to #{root + @name}.\" if @verbose\n begin\n if @verbose and File.exists? root + @name\n puts \"File already present.\"\n end\n cp file, root + @name \n rescue ArgumentError # raised if files are identical\n puts \"Warning: Can't copy #{File.basename file}. Source and destination are identical.\"\n end\n end\n @subpackages.each_value do |p| # recursively build directory tree\n p.build_directory root + @name\n end\n end", "def move_to(target)\n target.parent.mkdirs\n factory.system.move_dir(@path, target.path)\n end", "def create_build_directories\n root_dir = generate_build_location(\"\")\n Dir.mkdir root_dir unless Dir.exists?(root_dir)\n img_dir = generate_image_location(\"\",\"\").split(\"/\")[0...-1].join(\"/\")\n Dir.mkdir img_dir unless Dir.exists?(img_dir)\n end", "def setup(target)\n Dir.mkdir(target) unless File.directory?(target)\nend", "def initialize_target_directory\n # create result directory\n Dir.mkdir(@target_dir) unless Dir.exists?(@target_dir)\n\n # copy vendor assets\n vendor_dir = File.expand_path('../../../vendor/assets', __FILE__)\n FileUtils.cp_r(vendor_dir, @target_dir, remove_destination: true)\n\n # copy local assets\n assets_dir = File.expand_path('../templates/assets', __FILE__)\n FileUtils.cp_r(assets_dir, @target_dir)\n end", "def tidy_up\n return if DEBUG\n\n puts heading(\"Tidying up PWD\")\n\n FileUtils.remove(Dir[\"#{FileUtils.pwd}/bugsnag-*.tgz\"])\nend", "def flatten_source_directory\n system(\"find #{@source} -mindepth 2 -type f -exec mv -i '{}' #{@source} ';'\")\n end", "def prepare\n FileUtils.mkdir_p(veewee_autoyast_dir) unless veewee_autoyast_dir.directory?\n FileUtils.cp(sources_dir.join(\"postinstall.sh\"), veewee_autoyast_dir)\n end", "def archive_build_if_necessary(target_directory)\n # Nothing here in superclass\n end", "def build_dir\n @build_dir ||= File.join(Crate.project.build_dir, name )\n end", "def preclean_project\n # Clean-up non-useful files (if any)\n clean_msg = `make clean 2>&1`\n @log_file.puts \"\\nNettoyage du répertoire :\\n\\n#{clean_msg}\"\n \n # I want to be sure...\n FileUtils::rm_f Dir.glob(\"*.o\")\n FileUtils::rm_f Dir.glob(\"*~\")\n end", "def clean_build_directory\n FileUtils.rm_rf Dir.glob(File.join(@project.build_path, '*'))\n end", "def build_directory\n File.expand_path(config['build_directory'])\n end", "def build_root\n Pathname.new(ENV[\"OBJDIR\"] || \"build\")\n end", "def move_document\n Dir.mkdir(target_dir) if (!File.directory?(target_dir))\n # Only want to move the .html, .css, .png and .js files, not the .haml templates.\n html_css_files = temp_dir(\"*.{html,css,js,png}\")\n Dir[html_css_files].each { |f| mv f, target_dir }\n mv temp_dir + \"/resources\", target_dir, :force => true if (File.directory?(temp_dir + \"/resources\"))\n mv temp_dir + \"/assets\", target_dir, :force => true if (File.directory?(temp_dir + \"/assets\"))\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def build_archive_dir\n out = config_source['build-archive-dir']\n out = nil if (out != nil && out.downcase == 'none')\n out = FilePath.new(out) unless out.nil?\n out\n end", "def build_dir\n Rscons.application.build_dir\n end", "def build!\n test_git!\n\n file_list = Dir.glob(\"#{@source}*\").sort # Pull the file list before creating the target directory\n\n setup_target\n\n add_runner\n\n file_list.each do |infile_name|\n rewrite_animation_frame infile_name\n create_commit infile_name\n end\n end", "def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend", "def run!\n # Ensure the package directory exists and is purged\n purge_directory(package_dir)\n\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n\n # Ensure the temporary directory is removed at the end of a successful\n # run. Without removal, successful builds will \"leak\" in /tmp and cause\n # increased disk usage.\n #\n # Instead of having this as an +ensure+ block, failed builds will persist\n # this directory so developers can go poke around and figure out why the\n # build failed.\n remove_directory(staging_dir)\n end", "def compile\n Milkrun.say \"Cleaning and assembling a new #{task} build\"\n `./gradlew clean assemble#{task}`\n @assembled = true\n Milkrun.say \"Package built to #{path}\"\n path\n end", "def run_stage_one \n\t# directory tools is needed by stage on, be sure it does not exist yet\n\tif File.exists?(\"/tools\")\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > EXIT! Directory or softlink /tools already exists\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > Too risky for me to continue. Remove /tools, then\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > try again.\"\n\t\t$stdout.flush\n\t\traise \"SoftlinkAlreadyThere\"\n\tend\n\t# File.symlink(@builddir + \"/stage01/chroot/tools\", \"/tools\")\n\tsystem(\"mkdir /tools\")\n\tsystem(\"mkdir -p \" + @builddir + \"/stage01/chroot/tools\")\n\tsystem(\"mount -o bind \" + @builddir + \"/stage01/chroot/tools /tools\")\n\t[ \"/stage01\", \"/stage01/build\",\"/stage01/chroot\",\"/stage01/chroot/tools\", \"/tmp\" ].each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 01 abfrühstücken\n\t# Alle Scripte in stage01 suchen\n\tstage_one_objs = get_stage_one_objs\n\t# Download first\n\tstage_one_objs.each { |i| i.download }\n\t# Unpack\n\tstage_one_objs.each { |i|\n\t\ti.unpack\n\t\t### Dir.chdir(@workdir)\n\t\ti.patch(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.build(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.install(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.filecheck\n\t\t### Dir.chdir(@workdir)\n\t}\n\tsystem(\"umount /tools\")\nend", "def build\n safesystem \"autoreconf -vfi\"\n configure :prefix => prefix\n make\n end", "def pack_clouds_dot_rb_and_expected_directories\n %w(lib plugins).each do |dir|\n if File.directory?(d = cloud.clouds_dot_rb_dir/dir)\n dputs(\"Adding local path: #{d}\")\n FileUtils.cp_r d, cloud.tmp_path/cloud.base_config_directory, :verbose => true, :remove_destination => true # req'd for symlinks\n end\n end\n FileUtils.cp cloud.clouds_dot_rb_file, cloud.tmp_path/\"/etc/poolparty/clouds.rb\"\n end", "def build_for_demo \n `elm make elm/Main.elm --output assets/js/elm.js`\n `minify assets/js/elm.js assets/js/elm.min.js`\n FileUtil.cp \"assets/js/elm.js\" \"../demo-elm-doc-builder/assets/js/elm.js\"\n FileUtil.cp \"assets/js/elm.min.js\" \"../demo-elm-doc-builder/assets/js/elm.min.js\"\nend", "def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend", "def build!\n create_output_directory\n spec.source_directories.each { |d| simple_compile_directory(d) }\n compile_files(spec.all_javascript_paths)\n compile_files(spec.all_stylesheet_paths)\n write_manifest\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end", "def main\r\n puts \"Started\"\r\n Dir.foreach(@rootdir) {|filename|\r\n if filename =~ /.*[.]pbl/i\r\n this_filename = File.basename(filename.downcase, '.pbl')\r\n unless this_filename == @applpbl.downcase\r\n pathname = (@rootdir + '\\\\' + filename).downcase\r\n new_dir = @rootdir + '\\\\' + File.basename(filename.downcase, '.pbl') + '\\\\'\r\n puts pathname\r\n puts new_dir\r\n Dir.mkdir new_dir\r\n FileUtils.move pathname, new_dir\r\n end\r\n end \r\n }\r\n update_lib_path_file\r\n puts \"Done\"\r\nend", "def move_to!(dest)\n Pow(dest).parent.create_directory\n move_to(dest)\n end", "def prepare_target_dir\n begin\n FileUtils.mkdir(@output_dir)\n copy_default_files\n rescue Errno::EEXIST\n puts \"-- #{output_dir} already exists -- canceling initialization. \"\n return\n end\n end", "def target_dir\n without_parent_dir ? \".\" : package_name\n end", "def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend", "def compile_eth(dir, to)\n Dir.chdir(dir) do\n sh 'make'\n sh \"cp build/bin/geth #{to}/geth\"\n end\nend", "def clearDistributionDirectory(projectDir)\n distDir = projectDir.to_s + '/dist'\n FileUtils.rm_rf(distDir)\n FileUtils.mkdir_p(distDir)\nend", "def move_package(name, new_dir)\n Autoproj.workspace.manifest.move_package(name, new_dir)\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def build_files_command\n \"middleman build\"\n end", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def build_repo_structure()\n #if there isn't a dvcs folder\n if check_folder_contents(\"dvcs\")\n #build and enter the dvcs folder\n if (new_folder(\"dvcs\") and system(\"cd dvcs\"))\n #build folders inside the dvcs folder\n if (new_folder(\"hooks\") and new_folder(\"info\") and new_folder(\"objects\") and new_folder(\"refs\"))\n #build files inside the dvcs folder\n if (new_file(\"config\") and new_file(\"description\") and new_file(\"HEAD\") and new_file(\"index\"))\n #if everything works, navigate back out, and return success.\n system(\"cd ..\")\n true\n end\n else\n puts(\"error building folders\")\n false\n end\n else\n puts(\"error building dvcs folder\")\n false\n end\n else\n puts(\"Error: dvcs folder already exists\")\n false\n end\n end", "def prep_build(version)\n # Reset back to master and ensure the build branch is removed\n %x( cd #{@work_dir} && git checkout -f master && git branch -D build &> /dev/null )\n\n # Checkout version as build branch\n %x( cd #{@work_dir} && git checkout #{version} -b build )\n\n # Clean everything\n %x( cd #{@work_dir} && git clean -f -d -x )\n end", "def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end", "def define\n fail \"Version required (or :noversion)\" if @version.nil?\n @version = nil if :noversion == @version\n\n desc \"Build all the packages\"\n task :package\n\n desc \"Force a rebuild of the package files\"\n task repackage: [:clobber_package, :package]\n\n desc \"Remove package products\"\n task :clobber_package do\n rm_r package_dir rescue nil\n end\n\n task clobber: [:clobber_package]\n\n [\n [need_tar, tgz_file, \"z\"],\n [need_tar_gz, tar_gz_file, \"z\"],\n [need_tar_bz2, tar_bz2_file, \"j\"],\n [need_tar_xz, tar_xz_file, \"J\"]\n ].each do |need, file, flag|\n if need\n task package: [\"#{package_dir}/#{file}\"]\n file \"#{package_dir}/#{file}\" =>\n [package_dir_path] + package_files do\n chdir(working_dir) { sh @tar_command, \"#{flag}cvf\", file, target_dir }\n mv \"#{package_dir_path}/#{target_dir}\", package_dir if without_parent_dir\n end\n end\n end\n\n if need_zip\n task package: [\"#{package_dir}/#{zip_file}\"]\n file \"#{package_dir}/#{zip_file}\" =>\n [package_dir_path] + package_files do\n chdir(working_dir) { sh @zip_command, \"-r\", zip_file, target_dir }\n mv \"#{package_dir_path}/#{zip_file}\", package_dir if without_parent_dir\n end\n end\n\n directory package_dir_path => @package_files do\n @package_files.each do |fn|\n f = File.join(package_dir_path, fn)\n fdir = File.dirname(f)\n mkdir_p(fdir) unless File.exist?(fdir)\n if File.directory?(fn)\n mkdir_p(f)\n else\n rm_f f\n safe_ln(fn, f)\n end\n end\n end\n self\n end", "def run_dir\n run_base + \"/g4.#{geant_version}_cms_#{cmssw_version}/#{build_type}/CMSSW_#{cmssw_version}/src\"\n end", "def setup\n switch_dir\n end", "def autorun_cmd(repo_name)\n [\"cp -Rf #{STARTDIR}/components/autogen/#{repo_name}/* .\",\n \"touch Makefile\"]\nend", "def clean!\n FileUtils.rm(self[:build_path]) if File.exist?(self[:build_path])\n FileUtils.rm(self[:staging_path]) if File.exist?(self[:staging_path])\n return self\n end", "def prepare(module_name, version)\n return if @target.directory?\n\n begin\n @target.mkpath\n Puppet.notice _(\"Created target directory %{dir}\") % { dir: @target }\n rescue SystemCallError => orig_error\n raise converted_to_friendly_error(module_name, version, orig_error)\n end\n end", "def build_intermediate_apk( target ) \n cp @intermediate_apk, target\n end", "def setup\n # wipe and recreate .test directory \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n # NOTE: I don't think we want to kill .repository in pwd from running test\n if File.exist?('.repository')\n FileUtils.rm_rf('.repository')\n end\n Dir.mkdir('.test')\n Dir.chdir('.test')\n end", "def output_path\n \"build\"\n end", "def install\n mkdir \"build\" do\n system \"meson\", \"..\"\n system \"meson\", \"configure\", \"--prefix\", prefix\n system \"ninja\", \"--verbose\"\n system \"ninja\", \"install\", \"--verbose\"\n end\n end", "def destination(base_directory); end", "def common_build\n copy_gems\n end", "def common_build\n copy_gems\n end", "def proc_dir_toinst(new_dir, root_new_files)\n @log.debug(\"Processing dir: #{new_dir}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dest_dir = File.join(app_dir_dst, new_dir)\n if File.directory?(old_dest_dir)\n # old dir backup\n time_form = Time.now.strftime(\"%y%m%d%H%M%S\")\n old_dest_bckdir = \"#{old_dest_dir}_#{time_form}\"\n FileUtils.mv(old_dest_dir, old_dest_bckdir)\n @log.info(\"moved directory #{old_dest_dir} to backup dir #{old_dest_bckdir}\")\n else\n @log.debug(\"#{old_dest_dir} not a directory\")\n end\n # copy source directory in to destination recursively\n src_dir = File.join(root_new_files, new_dir)\n FileUtils.cp_r(src_dir ,old_dest_dir)\n @log.debug(\"Copy dir #{src_dir} to #{old_dest_dir}\")\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def run\n\t\tif File.exists? @outdir then\n\t\t\t$stderr.puts \"*error: #{@outdir} exists\"\n\t\t\t$stderr.puts \"Remove/move, just do something!\"\n\t\t\texit 1\n\t\tend\n\n\t\twriteInitialContents\n\t\texpandContents\n\t\tperformEquation\n\n\t\tDir.mkdir @outdir\n\t\twritePlist\n\t\twriteHints\n\t\tclean\n\tend", "def in_build\n source_dir, build_dir = find_dirs\n FileUtils.mkdir_p(build_dir) unless File.directory?(build_dir)\n Dir.chdir build_dir do\n yield(source_dir)\n end\nend", "def mirror_engine_files\n \n begin\n initialize_base_public_directory\n \n log.debug \"Attempting to copy public engine files from '#{source_public_dir}'\"\n \n # if there is no public directory, just return after this file\n return if !File.exist?(source_public_dir)\n\n source_files = Dir[source_public_dir + \"/**/*\"]\n source_dirs = source_files.select { |d| File.directory?(d) }\n source_files -= source_dirs \n \n log.debug \"source dirs: #{source_dirs.inspect}\"\n\n # Create the engine_files/<something>_engine dir if it doesn't exist\n if !File.exists?(self.destination_public_dir)\n # Create <something>_engine dir with a message\n log.debug \"Creating #{self.destination_public_dir} public dir\"\n FileUtils.mkdir_p(self.destination_public_dir)\n end\n\n # create all the directories, transforming the old path into the new path\n source_dirs.uniq.each { |dir|\n begin \n # strip out the base path and add the result to the public path, i.e. replace \n # ../script/../vendor/plugins/engine_name/public/javascript\n # with\n # engine_name/javascript\n #\n relative_dir = dir.gsub(File.join(root, \"public\"), name)\n target_dir = File.join(Engines.public_dir, relative_dir)\n unless File.exist?(target_dir)\n log.debug \"Creating directory '#{target_dir}'\"\n FileUtils.mkdir_p(target_dir)\n end\n rescue Exception => e\n raise \"Could not create directory #{target_dir}: \\n\" + e\n end\n }\n\n # copy all the files, transforming the old path into the new path\n source_files.uniq.each { |file|\n begin\n # change the path from the ENGINE ROOT to the public directory root for this engine\n target = file.gsub(File.join(root, \"public\"), destination_public_dir)\n unless File.exist?(target) && FileUtils.identical?(file, target)\n log.debug \"copying file '#{file}' to '#{target}'\"\n FileUtils.cp(file, target)\n end \n rescue Exception => e\n raise \"Could not copy #{file} to #{target}: \\n\" + e \n end\n }\n rescue Exception => e\n log.warn \"WARNING: Couldn't create the engine public file structure for engine '#{name}'; Error follows:\"\n log.warn e\n end\n end", "def move_package\n begin\n package_file = File.join(@tmpdir, 'pkg', \"#{@plugin.vendor}-#{@package_name}-#{@plugin.metadata[:version]}.tar.gz\")\n FileUtils.cp(package_file, '.')\n rescue => e\n puts 'Could not copy package to working directory'\n raise e\n end\n end", "def create_moab_dirs()\n target_path = manifest_path(self.object.id, self.version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{self.object.id} version #{self.version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(self.object.id, self.version),\n metadata_path(self.object.id, self.version),\n content_path(self.object.id, self.version)\n ]\n )\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def make_directories!\n @sprites_path.mkpath unless @sprites_path.directory?\n @sources_path.mkpath unless @sources_path.directory?\n end", "def copy_source\n copy_source_tree('source')\n return unless Dir.exist?(\"#{@build_dir}/source/debian\")\n\n FileUtils.rm_rf(Dir.glob(\"#{@build_dir}/source/debian\"))\n end", "def run\n setup\n build_vm\n package_stemcell\n cleanup\n @target\n end" ]
[ "0.634293", "0.63083297", "0.62256676", "0.60302633", "0.59844935", "0.59618795", "0.59475106", "0.59402823", "0.5935131", "0.58598554", "0.5839795", "0.581325", "0.5798213", "0.57734096", "0.57610893", "0.576103", "0.57606065", "0.57559466", "0.5743505", "0.5731001", "0.5729902", "0.5701656", "0.57009834", "0.56869394", "0.56869394", "0.5682174", "0.5660708", "0.5656009", "0.56451404", "0.5630311", "0.5609384", "0.55790347", "0.557823", "0.55667806", "0.556542", "0.5564566", "0.55622125", "0.5551434", "0.55252045", "0.5519803", "0.5518139", "0.55165297", "0.5510796", "0.5506193", "0.5501027", "0.5492729", "0.5492527", "0.5491084", "0.54843205", "0.5460012", "0.54490715", "0.5441954", "0.5434402", "0.54298675", "0.5424832", "0.54185385", "0.5410713", "0.5407364", "0.5402901", "0.5401277", "0.5400011", "0.53851306", "0.537931", "0.5372354", "0.53602004", "0.53587526", "0.53539765", "0.53495574", "0.5345165", "0.5340023", "0.53396916", "0.53396916", "0.5331336", "0.5330494", "0.5316137", "0.5310714", "0.531011", "0.5302982", "0.53013086", "0.5296594", "0.52927643", "0.5290621", "0.529037", "0.52805054", "0.52759564", "0.52595717", "0.525933", "0.5250243", "0.5246641", "0.5246641", "0.5244773", "0.52444667", "0.52303195", "0.5227903", "0.52208644", "0.5218395", "0.52133983", "0.5204522", "0.51940835", "0.5190749", "0.51889336" ]
0.0
-1
build hydraulic and move
def create_hydraulic(entities) # r = Geom::Transformation.rotation [$porch_width/2, 0, 0], [0,0,1], 180.degrees # t = Geom::Transformation.new [$porch_offset,0, $porch_height] # entities.transform_entities r, porch_group # entities.transform_entities t, porch_group if($hydraulic_side == "SW1") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees t = Geom::Transformation.new [$hydraulic_offset+$hydraulic_width,0, -6] build_hydraulic(entities,r,t) end if($hydraulic_side == "SW2") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees t = Geom::Transformation.new [$length-$hydraulic_offset-$hydraulic_width,$width, -6] build_hydraulic(entities,r,t) end if($hydraulic_side == "EW2") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees t = Geom::Transformation.new [$length,$hydraulic_offset+$hydraulic_width, -6] build_hydraulic(entities,r,t) end if($hydraulic_side == "EW1") r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees t = Geom::Transformation.new [0,$width-$hydraulic_offset-$hydraulic_width, -6] build_hydraulic(entities,r,t) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n @hydra.run\n end", "def run\n @hydra.run\n end", "def hydra\n if !@hydra\n @hydra = Typhoeus::Hydra.hydra\n end\n @hydra\n end", "def install_engine\n generate 'hydra:head -f'\n end", "def build\n raise FedoraMigrate::Errors::MigrationError, \"No qualified targets found in #{source.pid}\" if target.nil?\n\n # create target, and apply depositor metadata\n obj = target.new\n\n obj.apply_depositor_metadata @depositor_utln\n obj.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n\n user = User.find_by_user_key(@depositor_utln)\n# CurationConcerns::Workflow::ActivateObject.call(target: obj, comment: 'activate object', user: user)\n\n create_and_add_payload(obj, @payload_primary, @depositor_utln)\n\n #deal with 2 primary datastream objects, storing second object in a new file set\n create_and_add_payload(obj, @payload_secondary, @depositor_utln) unless @payload_secondary.nil?\n\n #handle a case of bad hand created data on old records\n create_and_add_payload(obj, \"ARCHIVAL_SOUND\", @depositor_utln) if @payload_primary == \"ARCHIVAL_WAV\"\n\n # back up old data\n #create_and_add_fcrepo3_set obj\n\n process_desc_metadata obj\n process_admin_metadata obj\n process_technical_metadata obj\n process_relsext_metadata obj\n\n# obj.save\n\n process_collection_metadata obj\n\n active_workflow = Sipity::Workflow.find(2)\n Sipity::Entity.create!(proxy_for_global_id: obj.to_global_id.to_s,\n workflow: active_workflow,\n workflow_state: nil)\n\n obj\n end", "def build()\n \n #check dir exists, if not, make it\n if(!File.exists?(@path))\n Dir.mkdir(@path)\n end\n \n #build directory structure\n puts 'Building directory structure'\n build_skeleton(@template.directory_structure)\n \n #execute build tasks\n puts 'Running build tasks'\n execute_tasks(@template.tasks,@template.path)\n \n puts 'Skeleton built'\n \n end", "def run\n @hydra.run\n status\n end", "def build; end", "def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend", "def hydra\n @hydra ||= Typhoeus::Hydra.new(:max_concurrency => 1)\n end", "def build!\n test_git!\n\n file_list = Dir.glob(\"#{@source}*\").sort # Pull the file list before creating the target directory\n\n setup_target\n\n add_runner\n\n file_list.each do |infile_name|\n rewrite_animation_frame infile_name\n create_commit infile_name\n end\n end", "def colonize(op)\n \n # read operation inputs\n old_items = op.input_array(\"Hydra\").items\n old_object_type = old_items.first.object_type.name\n new_object_type = op.output(\"Hydra\").item.object_type.name\n \n # Prepare operation by retrieving equipment and hydra strain items\n show do\n title \"Preparation\"\n \n note \"Obtain the following:\"\n bullet \"Graduated Cylinder\" if old_object_type == 'Hydra Tray'\n bullet \"#{old_items.size} empty #{old_object_type.pluralize(old_items.size)}\"\n bullet \"Pasteur Pipette\"\n \n if old_items.size == 1\n note \"Obtain #{old_object_type} #{old_items.first.id} from #{old_items.first.location}\"\n else\n note \"Obtain the following #{old_object_type.pluralize}\"\n old_items.each{|item| check \"Item #{item.id} at #{item.location}\"}\n end\n end\n \n # Create new item of the desired output type and store it\n if new_object_type == \"Unverified Hydra Well\"\n new_item = new_uvhw(op.output(\"Hydra\").sample)\n store_uvhw(new_item)\n else \n new_item = item = op.output(\"Hydra\").sample.make_item new_object_type\n end\n new_item.save\n new_item.store\n \n # Move the desired number of hydra into the new item\n show do\n title \"Colonize Hydra\"\n \n if new_object_type == \"Hydra Tray\"\n note \"Add 600mL of hydra medium into the new hydra tray\"\n else\n note \"Fill the new #{new_object_type} halfway with hydra medium\"\n end\n old_items.each do |item|\n check \"Pipette #{op.input(\"Number of Hydra\").val} hydra from item #{item.id} in the new #{new_object_type}\"\n end\n note \"Label the new #{new_object_type} with the id <bf>#{new_item.id}</bf>\"\n note \"Place the new #{new_object_type} into 18C incubator\"\n end\n \n # Ask which old items are empty\n data = show do\n title \"Select Empty Item(s)\"\n if old_items.size == 1\n note \"Select whether the old #{old_object_type} is empty\"\n else\n note \"Select which of the old #{old_object_type.pluralize} are empty\"\n end\n old_items.each do |item|\n select [ \"not empty\", \"empty\" ], var: \"item#{item.id}\", label: \"Item #{item.id}\", default: 1\n end\n end\n empty_items = old_items.select{|item| data[\"item#{item.id}\".to_sym] == \"empty\"}\n \n # sak the user to clean the empty items, then delete them\n if empty_items.size > 0\n \n if old_object_type == \"Hydra Tray\"\n show do\n title \"Bleach #{\"Tray\".pluralize(empty_items.size)}\"\n note \"Rinse the following #{\"tray\".pluralize(empty_items.size)} with 10% bleach solution\"\n empty_items.each{ |item| check \"Item #{item.id}\" }\n end\n empty_items.each{|item| item.mark_as_deleted}\n end\n \n if old_object_type == \"Hydra Dish\"\n show do\n title \"Toss #{\"Dish\".pluralize(empty_items.size)}\"\n note \"Toss the following #{\"dish\".pluralize(empty_items.size)} into the biohazard rubbish\"\n empty_items.each{ |item| check \"Item #{item.id}\" }\n end\n empty_items.each{|item| item.mark_as_deleted}\n end\n \n if old_object_type == \"Unverified Hydra Well\"\n empty_items.each{|item| store_uvhw(item)} if debug\n empty_items.each{|item| remove_uvhw(item)}\n bleach_empty_uvhp()\n end\n end\n\n end", "def setup\n setup_major_pieces\n setup_pawns\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def make; end", "def setup()\n create_directories\n end", "def prepare\n if not File.exists?(OBS_BUILD_DIR)\n FileUtils.mkdir_p OBS_BUILD_DIR\n end\n cleanup\n end", "def build\n sync\n output_dir.mkpath\n outputs.each(&:build)\n output_dir.touch\n end", "def setup\n switch_dir\n end", "def build\n puts \"---> erase_old_files\" if verbose\n erase_old_files\n puts \"---> load_source\" if verbose\n load_source\n puts \"---> compose\" if verbose\n compose\n puts \"---> save_lilypond_file\" if verbose\n save_lilypond_file\n\n # Production du PDF ou du PNG\n res = case output_format\n when :pdf, nil\n puts \"---> output_as_pdf\" if verbose\n output_as_pdf\n when :png\n puts \"---> output_as_png\" if verbose\n output_as_png\n else\n puts \"Format de sortie inconnu (#{output_format}). Je sors en pdf\" if verbose\n output_as_pdf\n end\n\n if res === false || verbose\n App::show_debug\n end\n end", "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def build_iso(iso_path, output_path)\n log.info \"Creating DUD\"\n dud_path = cache_dir.join(\"#{version}.dud\")\n dud_dir = base_dir.join(\"share\", \"build_iso\", \"dud\", version)\n cmd = format(MKDUD_CMD, dud_path: dud_path, dud_dist: dud_dist,\n dud_method: dud_method, dud_dir: dud_dir, rpms_dir: cache_dir)\n log.info \"Command: #{cmd}\"\n system cmd\n\n log.info \"Syncing to disk\"\n system \"sync\"\n\n log.info \"Creating new ISO image with the updated packages\"\n FileUtils.mkdir_p(output_path.dirname) unless output_path.dirname.directory?\n cmd = format(MKSUSECD_CMD, output_path: output_path, dud_path: dud_path,\n iso_path: iso_path)\n cmd << \" #{boot_dir}\" if boot_dir.directory?\n log.info \"Command: #{cmd}\"\n system cmd\n end", "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def createEphem(targetName)\n\n cmd = \"#{$cmdPre}ataephem \" + targetName;\n doCmd(cmd);\n cmd = \"#{$cmdPre}atawrapephem \" + targetName + \".ephem\";\n doCmd(cmd);\n\n return targetName + \".ephem\"\n\nend", "def prep\n client.run_ohai\n client.load_node # from the server\n client.build_node\n end", "def build(output_path = nil)\n cleanup\n iso_path = download_iso\n fetch_obs_packages\n fetch_local_packages\n build_iso(iso_path, output_path || AYTests.obs_iso_path)\n end", "def setup_skeleton\r\n self.destination_root = File.join(path, name)\r\n @class_name = name.classify\r\n @guid = UUIDTools::UUID.timestamp_create.to_s\r\n directory(\"base_app/\", self.destination_root)\r\n copy_file File.join(self.destination_root, \"blend_solution.sln\"), File.join(self.destination_root, \"#{@class_name}.sln\")\r\n copy_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\"), File.join(self.destination_root, \"src\", \"#{@class_name}.Controls.csproj\")\r\n remove_file File.join(self.destination_root, \"blend_solution.sln\")\r\n remove_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\")\r\n\r\n store_component_config('.components')\r\n end", "def run_stage_one \n\t# directory tools is needed by stage on, be sure it does not exist yet\n\tif File.exists?(\"/tools\")\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > EXIT! Directory or softlink /tools already exists\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > Too risky for me to continue. Remove /tools, then\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > try again.\"\n\t\t$stdout.flush\n\t\traise \"SoftlinkAlreadyThere\"\n\tend\n\t# File.symlink(@builddir + \"/stage01/chroot/tools\", \"/tools\")\n\tsystem(\"mkdir /tools\")\n\tsystem(\"mkdir -p \" + @builddir + \"/stage01/chroot/tools\")\n\tsystem(\"mount -o bind \" + @builddir + \"/stage01/chroot/tools /tools\")\n\t[ \"/stage01\", \"/stage01/build\",\"/stage01/chroot\",\"/stage01/chroot/tools\", \"/tmp\" ].each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 01 abfrühstücken\n\t# Alle Scripte in stage01 suchen\n\tstage_one_objs = get_stage_one_objs\n\t# Download first\n\tstage_one_objs.each { |i| i.download }\n\t# Unpack\n\tstage_one_objs.each { |i|\n\t\ti.unpack\n\t\t### Dir.chdir(@workdir)\n\t\ti.patch(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.build(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.install(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.filecheck\n\t\t### Dir.chdir(@workdir)\n\t}\n\tsystem(\"umount /tools\")\nend", "def setup()\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def generateplatform(edgefile,platformbase,opts)\n\n #===========================================================\n # Check inputs\n #===========================================================\n \n nodeperswitch=1;\n if opts.has_key?(:nodeperswitch)\n nodeperswitch=opts[:nodeperswitch].to_i;\t\n end\n corepernode=1;\n if opts.has_key?(:corepernode)\n corepernode=opts[:corepernode].to_i;\t\n end\n if !opts.has_key?(:networkmodel)\n opts[:networkmodel]=\"SMPI\"\n end\n if !opts.has_key?(:collselector)\n opts[:collselector]=\"mvapich2\"\n end\n if !opts.has_key?(:machinepower)\n # case Socket.gethostname\n # when /calc[0-9]/\n # opts[:machinepower]=50e9\n # STDOUT.puts \"Detected calcXX computer, hence I will assume host has #{opts[:machinepower]} Flops/sec power.\"\n # else\n # opts[:machinepower]=10e9\n # STDOUT.puts \"Unknown computer, hence using baseline host power #{opts[:machinepower]} Flops/sec\"\n # end\n opts[:machinepower]=NODEPOWER\n end\n if !opts.has_key?(:power)\n opts[:power]=NODEPOWER\n end\n if !opts.has_key?(:cablebw)\n opts[:cablebw]=CABLEBW\n end\n if !opts.has_key?(:switchbw)\n opts[:switchbw]=SWITCHBW\n end\n if !opts.has_key?(:switchlat)\n opts[:switchlat]=SWITCHLAT\n end\n if !opts.has_key?(:defaultdistance)\n opts[:defaultdistance]=DEFAULTDISTANCE\n end\n if !opts.has_key?(:unidirectional) && (edgefile.end_with?(\".unidir.edges\") || edgefile.end_with?(\"bFalse.edges\")) \n opts[:unidirectional]=true;\n end\n\t\n checkfile(edgefile,\"edgefile\")\n conn = MyMatrix.new.load_edgelist(edgefile,!(opts[:unidirectional]));\n\n \n #Not sure that the edge file provides the physical distance between racks.. So we say that if a length is below default distance, we force the default distance \n conn.map{ |d|\n if(d>0 && d< opts[:defaultdistance] )\n d=opts[:defaultdistance]\n end\n }\n STDOUT.puts \"Found #{conn.row_size} nodes in file #{edgefile}\"\n \n #Generate SimGrid platform\n simgridfile = File.new( \"#{platformbase}.xml\", 'w' )\n\n #Generate the platform configuration element string\n\n configString=\n\"<?xml version='1.0'?>\n<!DOCTYPE platform SYSTEM 'http://simgrid.gforge.inria.fr/simgrid.dtd'>\n<platform version='3'>\n <config>\n <prop id='maxmin/precision' value='1e-4'/> \n <prop id='network/model' value='#{opts[:networkmodel]}'/>\n <!-- Negative values enable auto-select... -->\n <prop id='contexts/nthreads' value='1'/>\n <!-- Power of the executing computer in Flop per seconds. Used for extrapolating tasks execution time by SMPI [default is 20000]-->\n <prop id='smpi/running_power' value='#{opts[:machinepower]}'/>\n <!-- Display simulated timing at the end of simulation -->\n <prop id='smpi/display_timing' value='1'/>\n <prop id='cpu/optim' value='Lazy'/>\n <prop id='network/optim' value='Lazy'/>\n <prop id='smpi/coll_selector' value='#{opts[:collselector]}'/>\n <prop id='smpi/cpu_threshold' value='0.00000001'/>\"\n\n if(opts[:addproperties])\n if(opts[:addproperties].class==\"String\")\n props=opts[:addproperties].split(\",\");\n opts[:addproperties]=Array.new\n props.each{ |pair| opts[:addproperties].push(pair.split(\"=\"))}\n end\n opts[:addproperties].each{ |e| e.each{ |propname,propvalue|\n configString+='<prop id='#{propname}' value='#{propvalue}' />\\n'\n } \n }\n end\n\n if opts[:tracing]\n configString+=\"\n <prop id='tracing' value='yes'/> \n <prop id='tracing/smpi' value='yes'/> \n <prop id='tracing/smpi/computing' value='yes'/>\"\n end\n\n configString+=\"\n </config>\n <AS id='AS0' routing='Floyd'>\n </AS>\n</platform>\"\n\n\n\n connectedSwitches=[]\n doc = Document.new(configString)\n\n platformas= doc.root.elements[2];\n\n #STDERR.puts doc.root.elements[1].inspect\n \n #platformas.add_element(Rexml::Comment(\"List of switches and associated hosts\"))\n #Generate one switch and associated nodes/links\n for i in 0...conn.row_size\n #Check whether this node is completely disconnected. If yes, discard it with warning\n\n haslink=false\n conn.each_link{ |li,lj,dist|\n if li == i || lj == i\n haslink=true\n break\n end\n }\n\n if !haslink\n STDERR.puts \"WARNING: Could not find links onward node #{i}, could be your topology does not include all nodes in [0,#{conn.row_size}[ (which is OK), or could be that the input topology is disconnected (which is probably NOT OK)! This node will not be included in platform.\"\n next\n end\n\n connectedSwitches.push(i)\n \n for j in 1..nodeperswitch\n platformas.add_element \"host\", {\n \"id\" => \"n#{i*nodeperswitch+j}\",\n \"power\" => opts[:power],\n \"core\" => corepernode\n }\t\n platformas.add_element \"link\", {\n \"id\" => \"linkn#{i*nodeperswitch+j}s#{i}\",\n \"bandwidth\" => opts[:cablebw],\n \"latency\" => latency_of(0)\n }\t\n end\n\n\n platformas.add_element \"link\", {\n \"id\" => \"ls#{i}\",\n \"bandwidth\" => opts[:switchbw],\n \"latency\" => opts[:switchlat]\n }\t\n\n platformas.add_element \"router\", {\n \"id\" => \"s#{i}\"\n }\n\n\n #Generate routes -Step 1-\n \n \n end\n\n \n \n #Generate inter-switch links\n conn.each_link{ |i,j,dist|\n platformas.add_element \"link\", {\n \"id\" => \"links#{i}s#{j}\",\n \"bandwidth\" => opts[:cablebw],\n \"latency\" => latency_of(dist)\n }\n\n }\n\n\n \n #Generate routes\n #For each physical link, we nee to traverse:\n #-> A Simgrid link representing the physical link with id linksxxsyy or linknxxsyy\n #-> A Simgrid link representing the limitations of the physical router/switch with id lsxxx\n #Since we need to cross the link emulating physical switch only once (we chose on input), we need non symmetrical routes.\n #And naturally, unidirectionnal topoloies are created only by not setting up the reciprocal route (from yy to xx)\n\n connectedSwitches.each{ |i|\n #for switch to node\n for j in 1..nodeperswitch\n route=platformas.add_element \"route\", {\n \"src\" => \"n#{i*nodeperswitch+j}\",\n \"dst\" => \"s#{i}\",\n \"symmetrical\" => \"NO\"\n }\n route.add_element \"link_ctn\", { \"id\" => \"linkn#{i*nodeperswitch+j}s#{i}\"}\n route.add_element \"link_ctn\", { \"id\" => \"ls#{i}\"}\n route2=platformas.add_element \"route\", {\n \"src\" => \"s#{i}\",\n \"dst\" => \"n#{i*nodeperswitch+j}\",\n \"symmetrical\" => \"NO\"\n }\n route2.add_element \"link_ctn\", { \"id\" => \"linkn#{i*nodeperswitch+j}s#{i}\"}\n end\n\n }\n\n\n \n #for inter-switches\t\n conn.each_link{ |i,j,dist|\n route=platformas.add_element \"route\", {\n \"src\" => \"s#{i}\",\n \"dst\" => \"s#{j}\",\n \"symmetrical\" => \"NO\"\n }\n route.add_element \"link_ctn\", { \"id\" => \"links#{i}s#{j}\"}\n route.add_element \"link_ctn\", { \"id\" => \"ls#{j}\"}\n\n if !opts[:unidirectional]\n route2=platformas.add_element \"route\", {\n \"src\" => \"s#{j}\",\n \"dst\" => \"s#{i}\",\n \"symmetrical\" => \"NO\"\n }\n route2.add_element \"link_ctn\", { \"id\" => \"links#{i}s#{j}\"}\n route2.add_element \"link_ctn\", { \"id\" => \"ls#{i}\"}\n end\n\n }\n\n doc.write(simgridfile,1,false);\t\n\n\n\n #Generate dummy (S)MPI platform file\n File.open(\"#{platformbase}.txt\", 'w') { |file| \n connectedSwitches.each{ |i|\n for j in 1..nodeperswitch\n file.write(\"n#{i*nodeperswitch+j}:#{corepernode}\\n\")\n end \n }\n }\n\n\n \n\n end", "def run\n setup\n build_vm\n package_stemcell\n cleanup\n @target\n end", "def run\n setup\n build_vm\n package_stemcell\n cleanup\n @target\n end", "def compile_eth(dir, to)\n Dir.chdir(dir) do\n sh 'make'\n sh \"cp build/bin/geth #{to}/geth\"\n end\nend", "def init\n return if File.exists? data_path\n if parent.nil?\n Rugged::Repository.init_at barerepopath, :bare\n Rugged::Repository.clone_at barerepopath, satelliterepopath\n sym_hook\n else # it's a fork, therefore:\n Rugged::Repository.init_at barerepopath, :bare\n Rugged::Repository.clone_at parent.satelliterepopath, satelliterepopath\n end\n FileUtils.mkdir_p image_for('', 'mobile_inspire')\n FileUtils.mkdir_p image_for('', 'desktop_inspire')\n FileUtils.mkdir_p image_for('', 'thumbnails')\n FileUtils.mkdir_p image_for('', 'show_image_desk')\n FileUtils.mkdir_p image_for('', 'show_image_mob')\n FileUtils.mkdir_p image_for('', 'show')\n\n return if satelliterepo.empty?\n pushtobare\n copy_generated_images parent\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def prepare_for_configuration \n # clear_base_directory\n make_base_directory\n copy_misc_templates\n copy_custom_monitors\n store_keys_in_file\n Script.save!(self)\n # not my favorite...\n copy_ssh_key\n before_configuration_tasks\n end", "def run!\n project.mode = :release\n\n # Validate paths\n validate_paths!\n\n # Extract mockup\n copy_source_path_to_build_path!\n\n validate_stack!\n\n # Run stack\n run_stack!\n\n # Cleanup\n cleanup! if config[:cleanup_build]\n ensure\n project.mode = nil\n end", "def build_here\n cp_a File.join(root_dir, \"test\", \"setup\", \"#{name}.svn.gz\"), \".\"\n\n puts `gzip -f -d #{name}.svn.gz`\n raise unless $? == 0\n puts `svnadmin create #{name}`\n raise unless $? == 0\n puts `svnadmin load #{name} < #{name}.svn`\n raise unless $? == 0\n end", "def run\n\t\tif File.exists? @outdir then\n\t\t\t$stderr.puts \"*error: #{@outdir} exists\"\n\t\t\t$stderr.puts \"Remove/move, just do something!\"\n\t\t\texit 1\n\t\tend\n\n\t\twriteInitialContents\n\t\texpandContents\n\t\tperformEquation\n\n\t\tDir.mkdir @outdir\n\t\twritePlist\n\t\twriteHints\n\t\tclean\n\tend", "def define_tasks\n fail \"Version required (or :noversion)\" if @version.nil?\n @version = nil if :noversion == @version\n\n desc \"Build the disk image file\"\n task :dmg => \"#{package_dir}/#{dmg_file}\"\n\n file \"#{package_dir}/#{dmg_file}\" => dmg_dir_path do\n chdir package_dir do\n sh \"#{dmg_command} create #{dmg_options}\"\n end\n end\n\n directory package_dir\n\n file dmg_dir_path => source_files + extra_source_files.keys do\n prefix_to_strip = /^#{@strip}/ if @strip\n mkdir_p package_dir rescue nil\n source_files.each do |fn|\n fn_stripped = @strip == nil ? fn : fn.sub(prefix_to_strip, '')\n f = File.join(dmg_dir_path, fn_stripped)\n fdir = File.dirname(f)\n mkdir_p(fdir) if !File.exist?(fdir)\n if File.directory?(fn)\n mkdir_p(f)\n else\n rm_f f\n safe_ln(fn, f)\n end\n end\n extra_source_files.each do |k, v|\n f = File.join(dmg_dir_path, v)\n mkdir_p(File.dirname(f)) rescue nil\n rm_f f\n safe_ln k, f\n end\n end\n\n desc \"Remove the disk image files\"\n task :clobber_dmg do\n rm_r package_dir rescue nil\n end\n\n task :clobber => :clobber_dmg\n\n desc \"Force a rebuild of the disk image file\"\n task :rebuild_dmg => [:clobber_dmg, :dmg]\n\n self\n end", "def dress(commands, pre_or_post, stage)\n chdir = \"cd #{build_dir} && \"\n chdir = \"\" if [:prepare, :download].include?(stage)\n chdir = \"\" if stage == :extract and pre_or_post == :pre\n flatten(commands).collect { |command| \"bash -c '#{chdir}#{command} >> #{@package.name}-#{stage}.log 2>&1'\" }\n end", "def build\n clean_build_directory\n copy_templates\n copy_functions\n copy_includes\n build_assets\n end", "def hydra\n @hydra ||= begin\n opts = if options[:max_concurrency]\n { :max_concurrency => options[:max_concurrency] }\n end\n\n Typhoeus::Hydra.new(opts || {})\n end\n end", "def setup\r\n setup_wiki\r\n setup_host_map\r\n setup_host\r\n end", "def build\r\n end", "def build\r\n end", "def copy_clhep\n# the version below is used to copy the clhep AND geant4 areas; \n dirs = [\"clhep/#{clhep_release}\"]\n dirs.each do |dir|\n fork do\n\tputs \"Process #{Process.pid} will copy #{dir} from #{build_base} to #{run_base}\"\n\tresult = `umask 0002; cd #{build_base} && find #{dir} -path 'CVS' -prune -o -print | cpio -pdumL #{run_base}`\n#\tresult = `echo \"cd #{build_base} && find #{dir} -path 'CVS' -prune -o -print | cpio -pdumL #{run_base}\"`\n\tstatus = $?.exitstatus\n\tif status != 0\n\t puts \"Process #{Process.pid} failed\"\n\t puts result\n\tend\t\n end\n end\n children = Process.waitall\n children.each do |pid, status|\n if status.exitstatus == 0\n\tputs \"Process #{pid} OK\"\n else\n\traise Exception.new(\"Process #{pid} FAILED\")\n end\n end\n end", "def setup\r\n end", "def move(pid, num_punters, map, claimed, rem, setup=false, tbl=nil)\n sites = map['sites']\n rivers = map['rivers']\n mines = map['mines']\n _format = \"\"\"\nInvoke C++ program with the following format:\nn m k pid np\ns_1 t_1 c_1\n...\ns_m t_m c_m (edges)\na_1 ... a_k (mines)\nmode\nextra\n\n0 <= s_i, t_i < m\n-1 <= c_i < np (-1: not claimed)\n0 <= a_i < n\n\n\nif mode == 'state'\n extra == ''\n The C++ program should return\n 'tbl (state)'\n where state is a string representing a state (without spaces)\nif mode == 'run'\n extra looks like:\ntbl\nai_kind\n The C++ program should return\n 'pass'\n or\n 'claim s t'\n in one line.\n \"\"\"\n n = sites.size\n m = rivers.size\n k = mines.size\n np = num_punters\n edges = []\n cl = {}\n for c in claimed\n cl[[c[1], c[2]]] = c[0]\n end\n for e in rivers\n col = -1\n if cl[[e['source'], e['target']]]\n col = cl[[e['source'], e['target']]]\n end\n edges << [e['source'], e['target'], col]\n end\n io = IO.popen(File.expand_path(File.dirname($0)) + '/core', 'r+')\n io.puts(\"#{n} #{m} #{k} #{pid} #{np} #{rem}\")\n for i in 0 ... m\n io.puts(edges[i].join(' '))\n end\n mine_ids = []\n for i in 0 ... k\n mine_ids << (mines[i]).to_s\n end\n io.puts(mine_ids.join(' '))\n ai_kind = @ai_kind\n if ai_kind == 'hybrid'\n # Choose AI type by np, size, and so on\n if np == 2\n ai_kind = 'two_player_minmax'\n elsif np >= 4\n ai_kind = 'mine_connect'\n else\n ai_kind = 'greedy'\n end\n end\n if setup\n io.puts('setup')\n else\n io.puts('run')\n io.puts(tbl)\n io.puts(ai_kind)\n end\n io.close_write\n eval = 0\n STDERR.puts(\"playing as punter #{pid} (total = #{num_punters})\")\n while answer = io.gets.chomp.split\n if answer[0] != 'info'\n break\n end\n # info eval (turns) (value)\n if answer[1] == 'eval'\n turns = answer[2].to_i\n eval = answer[3].to_i\n if turns >= 0\n STDERR.puts(\"evaluation: turns=#{turns}, value=#{eval}\")\n else\n STDERR.puts(\"full evaluation: value=#{eval}\")\n end\n end\n end\n if answer[0] == 'pass'\n return {'pass' => {'punter' => pid}}, eval\n end\n if answer[0] == 'claim'\n s = answer[1].to_i\n t = answer[2].to_i\n return {'claim' => {'punter' => pid, 'source' => s, 'target' => t}}, eval\n end\n if answer[0] == 'tbl'\n STDERR.puts(\"Got tbl (tbl size = #{answer[1].size})\")\n return answer[1]\n end\n end", "def build_rake_step\n @rake_task << self.global_config # Open the rake Stek and get General Configuration information\n @rake_task << (self.render self.get_config_template) # get Specific Configuration. Defined in the [tool].rb module file (erb)\n @opt_parser.check_error # stop here if errors found in the configuration\n @rake_task << self.test_validation # step is already done ? Defined in the tool_template.rb file\n @rake_task << (self.render self.tool_template) # get specific Task Code. Defined in the [tool].rb module file (erb)\n @rake_task << self.write_validation # write the check file Defined in the tool_template.rb file\n @rake_task << self.close_step # To close the rake Step Defined in the tool_template.rb file\n end", "def setup(destination); end", "def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end", "def main\n\n\n operations.running.retrieve interactive: false\n save_user operations\n debug_setup(operations) if debug\n \n if KIT_NAME == \"uw kit\"\n if debug\n labels = \"ABCDEF\".split('')\n operations.each.with_index do |op, i|\n op.input(INPUT).item.associate(SAMPLE_KEY, labels[i]) \n op.input(INPUT).item.associate(COMPONENT_KEY, \"\") \n end\n end\n end\n \n save_temporary_input_values(operations, INPUT)\n operations.each do |op|\n op.temporary[:pack_hash] = PACK_HASH\n end\n save_temporary_output_values(operations)\n \n # reassign labels to sample numbers if uw kit\n if KIT_NAME == \"uw kit\"\n operations.each do |op|\n op.temporary[:output_sample] = {\"A\"=>1, \"B\"=>2}[op.temporary[:output_sample]]\n end \n end\n \n run_checks operations\n if KIT_NAME == \"uw kit\"\n uw_kit_introduction operations.running\n else\n kenya_kit_introduction operations.running\n end\n area_preparation \"pre-PCR\", MATERIALS, POST_PCR\n get_pcr_packages operations.running\n open_pcr_packages operations.running\n debug_table operations.running\n check_for_tube_defects sorted_ops.running\n # nuttada thaw\n # nuttada needs vortex + centrigure\n centrifuge_samples sorted_ops.running\n resuspend_pcr_mix sorted_ops.running\n add_template_to_master_mix sorted_ops.running\n cleanup sorted_ops\n start_thermocycler sorted_ops.running\n conclusion sorted_ops\n return {}\n end", "def execute(input)\n dsl = read_dsl\n output_dir = dsl.issen.output_dir\n create_root_dir(output_dir)\n create_files_and_dirs(input, output_dir)\n end", "def execute\n build_spec = Runner.make_build_spec(@source_provider, @build_spec_path)\n env = make_env(build_spec)\n\n container = nil\n begin\n container = Runner.make_container(@image, @source_provider, env)\n run_commands_on_container(container, build_spec)\n ensure\n unless container.nil?\n container.stop\n container.remove\n end\n end\n end", "def main\n pr = intro\n operations.group_by {|op| get_parameter(op: op, fv_str: MEASUREMENT_TYPE).to_sym}.each do |measurement_type, ops|\n new_mtype = true\n pr.measurement_type = measurement_type\n ops.group_by {|op| op.input(INPUT).sample.sample_type}.each do |st, ops|\n ops.group_by {|op| op.input(MEDIA).item}.each do |media_item, ops|\n ops.group_by {|op| get_uninitialized_output_object_type(op)}.each do |out_ot, ops|\n ops.make\n ops.group_by {|op| op.output(OUTPUT).collection}.each do |out_collection, ops|\n pr.setup_experimental_measurement(experimental_item: out_collection, output_fv: nil)\n new_mtype = setup_plate_reader_software_env(pr: pr, new_mtype: new_mtype)\n # Gather materials and items\n take_items = [media_item].concat([pr.experimental_item].flatten)\n gather_materials(empty_containers: [pr.measurement_item], transfer_required: pr.transfer_required, new_materials: ['P1000 Multichannel'], take_items: take_items)\n # Prep plate\n display_hash = get_transfer_display_hash(ops: ops, input_str: INPUT, output_str: OUTPUT, dilution_str: DILUTION)\n prefill_plate_w_media(collection: pr.measurement_item, media_sample: media_item.sample, media_vol_ul: nil, display_hash: display_hash) # media_vol_ul must be > 0 to run show block\n take ops.map {|op| op.input(INPUT).item}, interactive: true\n tech_transfer_cultures(collection: pr.measurement_item, display_hash: display_hash)\n tech_add_blanks(pr: pr, blanking_sample: media_item.sample, culture_vol_ul: 0.0, media_vol_ul: 300.0) # Cannot handle a plate without blanks, esp in processing of upload\n \n take_measurement_and_upload_data(pr: pr)\n \n dilution_factor_arr = ops.map {|op| get_dilution_factor(op: op, fv_str: DILUTION)}\n \n process_and_associate_data(pr: pr, ops: ops, blanking_sample: media_item.sample, dilution_factor: dilution_factor_arr)\n end\n keep_p_arr = ops.select {|op| op.input(KEEP_OUT_PLT).val.to_s.downcase == 'yes'}\n (keep_p_arr.empty?) ? pr.measurement_item.mark_as_deleted : pr.measurement_item.location = 'Bench'\n end\n end\n end\n end\n cleaning_up(pr: pr)\n end", "def perform\n validate_system_config\n\n deployment_name = \"#{system_config.system_name}-core\"\n\n manifest = base_manifest(\n deployment_name,\n bosh_config.target_uuid,\n system_config.bosh_provider,\n system_config.system_name,\n system_config.release_name,\n system_config.release_version,\n system_config.stemcell_name,\n system_config.stemcell_version,\n cloud_properties_for_server_flavor(system_config.core_server_flavor),\n system_config.core_ip,\n system_config.root_dns,\n system_config.admin_emails,\n system_config.common_password,\n system_config.common_persistent_disk,\n system_config.security_group\n )\n\n dea_config.build_into_manifest(manifest)\n system_config.services.each do |service_config|\n service_config.build_into_manifest(manifest)\n end\n\n chdir system_config.system_dir do\n mkdir_p(\"deployments\")\n File.open(\"deployments/#{system_config.system_name}-core.yml\", \"w\") do |file|\n file << manifest.to_yaml\n end\n end\n end", "def initialize(params)\n\t\tsuper\n\t\tbasename = requireParam(params, :name)\n\t\tmodpaths = requireParam(params, :modules)\n\t\t\n\t\tmodpaths.each {|path| addPrereq BuildEnv::src2build(System::mod2obj(path))}\n\t\taddTarget BuildEnv::src2build(System::mod2slib(basename))\n\t\t\t\n\t\t#symlink from the src tree to the build tree (even if our target is up-to-date, in case the symlink currently points to a file built with \n\t\t# different options, ie elsewhere in the build tree)\n\t\tSymlinkBuilder.new(:target => target(), :name => BuildEnv::build2src(target()))\n\t\t\n\t\t#flags for tasks that edit their own prereq lists before reinvoking themselves\n\t\t@cleanallRecurse = true #true before cleanall() is called from outside; false when it's called by itself\n\tend", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup(args)\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n args.state.renderer = Engine3D::Render.new 1280, 720, args.state.camera, 1.0, 300.0\n\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/debug.rb'\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/scene1.rb'\n args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/demo.rb'\n\n #args.state.angle = 0.01\n #args.state.camera_angle = 0.001\n\n # DEBUG :\n #args.state.frame_counter = 0\n\n args.state.setup_done = true\n\n puts \"setup finished!!!\"\nend", "def build_for_demo \n `elm make elm/Main.elm --output assets/js/elm.js`\n `minify assets/js/elm.js assets/js/elm.min.js`\n FileUtil.cp \"assets/js/elm.js\" \"../demo-elm-doc-builder/assets/js/elm.js\"\n FileUtil.cp \"assets/js/elm.min.js\" \"../demo-elm-doc-builder/assets/js/elm.min.js\"\nend", "def startup(workdir)\n validate_platform\n select_target\n setup\n get_remote_workdir\n end", "def move_dirs\n \n end", "def prepare_config_files\n #Create .config dir\n #Create tucotuco dir\n #Create short dir\n #Create info file\n end", "def run(build_step_name)\n spec.system_recipe = DebHelperRecipe.new spec\n spec.setup_recipes\n spec.system_recipe.exec 'dh_prep' if build_step_name.to_s == 'binary'\n spec.recipes.first.send build_step_name.gsub('binary-arch', 'binary').to_s\n end", "def build!\n create_output_directory\n spec.source_directories.each { |d| simple_compile_directory(d) }\n compile_files(spec.all_javascript_paths)\n compile_files(spec.all_stylesheet_paths)\n write_manifest\n end", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def setup!(delete=true)\n FileUtils.rm_rf(@root_dir) if File.exist?(@root_dir) and delete\n FileUtils.mkdir_p(@root_dir)\n FileUtils.mkdir_p(@files_dir)\n FileUtils.mkdir_p(@queues_dir)\n FileUtils.mkdir_p(@logs_dir)\n FileUtils.mkdir_p(@current_queue_dir)\n FileUtils.mkdir_p(@next_queue_dir)\n\n File.open(@error_log, 'w+') {|f|}\n File.open(@action_log, 'w+') {|f|}\n\n # the queue_version file contains the number of\n # switches from current->next queue.\n File.open(@queue_version, 'w+') {|f| f.puts \"0\"}\n end", "def bake()\n\t\tdebug \"Bake Start: #{arrayString(Process.times)}\"\n\t\tif(@clean)\n\t\t\tFileUtils.rm_r Dir.glob(\"#{@buildDestination}/*\")\n\t\t\tif(@mainTargets.empty?())\n\t\t\t\t#nothing was supposed to be compiled, we'll just abort here\n\t\t\t\texit\n\t\t\tend\n\t\tend\n\t\tdebug \"Bake Start Lex: #{arrayString(Process.times)}\"\n\t\trunLexers()\n\t\trunParsers()\n\n\t\tdebug \"Bake Start Maintargets: #{arrayString(Process.times)}\"\n\t\t#the roots of the dependency graph, the targets we were told to build\n\t\trootSet = Set.new()\n\t\t@mainTargets.each do |src| \n\t\t\t#ignore all but .ml and .mli files. \n\t\t\tif(['.ml', '.mli'].any? {|ext| File.extname(src) == ext})\n\t\t\t\trootSet << sourceToTarget(File.expand_path(src))\n\t\t\tend\n\n\t\tend\n\t\tdebug \"\\nMain Targets:\"\n\t\tdebug setString(rootSet)\n\n\t\tdebug \"Bake Start Dependencies: #{arrayString(Process.times)}\"\n\t\t#every key is a target filename, and it's value is an array of files it\n\t\t#depends on. leafSet are those targets with no dependencies\n\t\tdependencyHash, leafSet = calcDependencies(rootSet)\n\t\tdebug \"\\nDependencies:\"\n\t\tdebug setHashString(dependencyHash)\n\n\t\tdebug \"\\nLeaf Targets:\"\n\t\tdebug setString(leafSet)\n\n\t\tdebug \"Bake Start Invert Dep: #{arrayString(Process.times)}\"\n\t\t#every key is a filename, and it's value is an array of files that\n\t\t#require it to be built before it can be built\n\t\tneededByHash = invertDependencies(dependencyHash)\n\t\t#this will make traversing over the graph have more elegant end cases\n\t\trootSet.each do |t| \n\t\t\tunless (neededByHash.has_key?(t))\n\t\t\t\tneededByHash[t] = Set.new()\n\t\t\tend\n\t\tend\n\n\t\tdebug \"\\nDependents:\"\n\t\tdebug setHashString(neededByHash)\n\t\t\n\t\tdebug \"Bake Start Ordering: #{arrayString(Process.times)}\"\n\n\t\tmasterOrdering = findOrdering(neededByHash, leafSet)\n\t\tdebug \"\\nOrdering:\"\n\t\tdebug arrayString(masterOrdering)\n\n\t\t#determine the set of files that are stale, or are dependent on stale\n\t\t#files\n\t\tdebug \"Bake Start Stale: #{arrayString(Process.times)}\"\n\t\tstaleSet = findStaleTargets(neededByHash, dependencyHash, leafSet)\n\t\tputs \"\\nStale Targets:\"\n\t\tputs setString(staleSet) + \"\\n\"\n\n\t\tdebug \"Bake Start Compile: #{arrayString(Process.times)}\"\n\t\tdebug \"\\nStart Compiling\"\n\t\tcompileSources(masterOrdering, staleSet)\n\t\tdebug \"Done Compiling\"\n\t\tdebug \"buildExecutables: \\'#{@buildExecutables}\\'\"\n\t\tif(@buildExecutables) \n\t\t\tdebug \"\\nBuilding Executables\"\n\t\t\tbinSourceSet = Set.new()\n\t\t\t@mainTargets.each do |src| \n\t\t\t\t#ignore all but .ml files. \n\t\t\t\tif(File.extname(src) == \".ml\")\n\t\t\t\t\tdebug \"Queueing: #{src}\"\n\t\t\t\t\tbinSourceSet.add(File.expand_path(src))\n\t\t\t\tend\n\t\t\tend\n\t\t\tbuildExecs(binSourceSet, masterOrdering, dependencyHash, staleSet)\n\t\tend\n\t\tdebug \"Bake End: #{arrayString(Process.times)}\"\n\tend", "def process_and_build_components \n end", "def generator\n printf(\"%-10s %s\\n\",\"generator:\", \"generating.. (*hdls, *bmm, *scr, *prj)\")\n exitcode = 1\n FileUtils.rm_r Dir.glob(\"#{TMPDIR}/hdl/*.vhd\")\n FileUtils.rm_r Dir.glob(\"#{TMPDIR}/synthesis/*.vhd\")\n File.symlink(\"../pcores\", \"#{TMPDIR}/pcores\") unless File.symlink?(\"#{TMPDIR}/pcores\")\n pipe = IO.popen(\"platgen -od #{TMPDIR}/ -p xc4vfx100ff1152-10 -lang vhdl ../system.mhs\", \"r+\")\n # pipe = IO.popen(\"platgen -p xc4vfx12ff668-10 system.mhs\", \"r+\")\n pipe.each do |line|\n # puts line\n # do not synthesize\n if line =~ /Running XST synthesis/\n exitcode = 0\n Process.kill 'TERM', pipe.pid\n break\n end\n end\n unless exitcode == 0\n p \"# Error with platgen - check platgen.log\"\n exit\n end\n\n # he generated files under $PROJECT/TMPDIR/{hdl,synthesis}\n # copy them to $PROJECT/hdl/ under certain conditions (size differs & or abstence)\n FileUtils.mkdir('hdl') unless File.directory? 'hdl'\n FileUtils.mkdir('synthesis') unless File.directory? 'synthesis'\n FileUtils.mkdir_p(BMM_RESULTSDIR) unless File.directory? BMM_RESULTSDIR # output directory\n\n # move_files_if(\"#{TMPDIR}/hdl/*.vhd\")\n move_files_if(\"#{TMPDIR}/implementation/#{TOPLEVEL}.bmm\", BMM_RESULTSDIR)\n move_files_if(\"#{TMPDIR}/synthesis/*.scr\" )\n move_files_if(\"#{TMPDIR}/synthesis/*.prj\")\n Find.find(\"#{TMPDIR}/hdl\") do |path|\n move_files_if(path) if File.file? path\n end\n\n # move logfiles to scratch\n FileUtils.mkdir_p(GEN_SCRATCHDIR) unless File.directory? GEN_SCRATCHDIR\n [\"platgen.log\", \"platgen.opt\", \"#{TMPDIR}/clock_generator*.log\"].each { |t|\n FileUtils.mv(t, \"#{GEN_SCRATCHDIR}/\") if File.file? t\n }\n\n # change timestamps\n\nend", "def define_debug_tasks\n desc \"Create a fresh ~/.hoerc file.\"\n task :config_hoe do\n with_config do |config, path|\n File.open(path, \"w\") do |f|\n YAML.dump(Hoe::DEFAULT_CONFIG.merge(config), f)\n end\n\n editor = ENV[\"EDITOR\"] || \"vi\"\n system \"#{editor} #{path}\" if ENV[\"SHOW_EDITOR\"] != \"no\"\n end\n end\n\n desc \"Verify the manifest.\"\n task :check_manifest => :clean do\n check_manifest\n end\n\n desc \"Show information about the gem.\"\n task :debug_gem do\n puts spec.to_ruby\n end\n\n task :isolate # stub\n task :irb => :isolate do\n name = spec.name.gsub(\"-\", \"/\")\n file = (spec.files.grep(/^lib\\/#{name}\\.rb$/).first ||\n spec.files.grep(/^lib\\/[^\\/]*\\.rb$/).first)\n\n require = File.basename(file, \".rb\") if file\n require &&= \"-r#{require}\"\n\n ruby \"#{Hoe::RUBY_FLAGS} -S irb #{require}\"\n end\n end", "def build()\n HP.logger.debug(\"~ Build Mode: #{build_mode}\")\n HP.logger.debug(\"~ Source Root: #{source_root}\")\n HP.logger.debug(\"~ Build Root: #{build_root}\")\n build_entries(entries())\n end", "def prep_build\n stdout.out_success(\"\\nPreparing build dir at: '#{settings['build_dir']}'\")\n stdout.verbose(\"Removing build dir at: #{settings['build_dir']}\")\n FileUtils.rm_rf(settings['build_dir'])\n # create the build dir\n stdout.verbose(\"Creating build dir at: #{settings['build_dir']}\")\n FileUtils.mkdir(settings['build_dir'])\n end", "def setup_test\n\n assert(File.exist?(model_path))\n\n if !File.exist?(run_dir)\n FileUtils.mkdir_p(run_dir)\n end\n assert(File.exist?(run_dir)) \n\n if File.exist?(report_path)\n FileUtils.rm(report_path)\n end\n\n if !File.exist?(sql_path)\n puts \"Running EnergyPlus\"\n\n osw_path = File.join(run_dir, 'in.osw')\n osw_path = File.absolute_path(osw_path)\n\n workflow = OpenStudio::WorkflowJSON.new\n workflow.setSeedFile(File.absolute_path(model_path))\n workflow.setWeatherFile(File.absolute_path(epw_path))\n workflow.saveAs(osw_path)\n\n cli_path = OpenStudio.getOpenStudioCLI\n cmd = \"\\\"#{cli_path}\\\" run -w \\\"#{osw_path}\\\"\"\n puts cmd\n system(cmd)\n end\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def run_stage_three\n\tstage_three_dirs = [ \"/stage03\", \"/stage03/initramfs\", \"/stage03/build\", \"/stage03/squash\", \"/stage03/cdmaster\" ]\n\tstage_three_dirs.each { |d|\n\t\tif File.exists?(@builddir + d)\n\t\t\tputs sprintf(\"%015.4f\", Time.now.to_f) +\n\t\t\t\t\" error > Please remove the directories \" + \n\t\t\t\tstage_three_dirs.join(\" \") + \" in \" + @builddir + \" first!\"\n\t\t\t$stdout.flush\n\t\t\traise \"SomeDirectoriesTooMuch\"\n\t\tend\n\t}\n\tstage_three_dirs.each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 03 (Bau des Initramfs und der Container) abfruehstuecken\n\t# Alle Scripte in Stage03 suchen\n\n\tstage_three_scripts = []\n\tstage_three_objs = []\n\tDir.foreach(\"scripts/stage03\") { |f|\n\t\t# fcomps = File.split(f)\n\t\tif (f =~ /\\d+.*\\.xml$/ )\n\t\t\tif @unstable == true && File.exists?(\"scripts/stage03.unstable/\" + f)\n\t\t\t\tstage_three_scripts.push(f)\n\t\t\telse\n\t\t\t\tstage_three_scripts.push(f)\n\t\t\tend\n\t\tend\n\t}\n\tunless @nonfree.nil?\n\t\tDir.foreach(@nonfree + \"/scripts/stage03\") { |f|\n\t\t\tif (f =~ /\\d+.*\\.xml$/ )\n\t\t\t\tif @unstable == true && File.exists?(@nonfree + \"scripts/stage03.unstable/\" + f)\n\t\t\t\t\tstage_three_scripts.push(f)\n\t\t\t\telse\n\t\t\t\t\tstage_three_scripts.push(f)\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend\n\tpkg_list = nil\n\tpkg_list = read_pkglist(@pkg_list_file) unless @pkg_list_file.nil?\n\tdebug_pkglist = File.new(@builddir + \"/tmp/lesslinux_\" + @build_timestamp + \"_all_packages.txt\", 'w') \n\tdebug_skipped = File.new(@builddir + \"/tmp/lesslinux_\" + @build_timestamp + \"_skipped_packages.txt\" , 'w')\n\tstage_three_scripts.sort.each { |i| \n\t\t# puts sprintf(\"%015.4f\", Time.now.to_f) + \" info > Parsing \" + i\n\t\t# $stdout.flush\n\t\tthis_stage_three_obj = ThirdStage.new(i, @srcdir, @builddir, @unpriv, \"stage03\", @dbh, @unstable, @sqlite, @skiplist, @legacy, Array.new, Array.new, true, @nonfree, @mirror ) \n\t\tstage_two_found = true\n\t\tif this_stage_three_obj.pkg_version.nil?\n\t\t\tfvers = nil\n\t\t\t@stage_two_objs.each { |i| fvers = i.pkg_version if this_stage_three_obj.pkg_name.strip == i.pkg_name.strip }\n\t\t\tthis_stage_three_obj.fix_version(fvers)\n\t\tend\n\t\tdebug_pkglist.write(this_stage_three_obj.pkg_name + \"\\n\")\n\t\tif pkg_list.nil? || pkg_list.include?(this_stage_three_obj.pkg_name) \n\t\t\tstage_three_objs.push(this_stage_three_obj)\n\t\telse\n\t\t\tdebug_skipped.write(this_stage_three_obj.pkg_name + \"\\n\")\n\t\tend\t\t\n\t}\n\tdebug_pkglist.close\n\tdebug_skipped.close\n\t# Download first\n\tstage_three_objs.each { |i| i.download }\n\t# Calculate dependencies\n\tadditional_dependencies = Array.new\n\tprovided_libs = Array.new\n\tprovided_links = Array.new\n\tstage_three_objs.each { |i|\n\t\tdeps = i.calculate_deps\n\t\tlibs = i.show_libs\n\t\tlinks = i.show_links\n\t\tadditional_dependencies = additional_dependencies + deps\n\t\tprovided_libs = provided_libs + libs\n\t\tprovided_links = provided_links + links\n\t\t#puts \"foreign deps for \" + i.pkg_name + \" \" + deps.join(\", \")\n\t}\n\t\n\t#puts \"=== Dumping deps\"\n\t#additional_dependencies.each { |a|\n\t#\tputs a\n\t#}\n\t#puts \"=== Found links\"\n\t#provided_links.each { |a|\n\t#\tputs a\n\t#}\n\t\n\t# raise \"DebugBreakPoint\"\n\tadditional_dependencies.uniq!\n\tstill_required_libs = additional_dependencies.clone\n\tadditional_dependencies.each { |i|\n\t\tprovided_libs.each { |l|\n\t\t\tunless l.index(i).nil?\n\t\t\t\tstill_required_libs.delete(i)\n\t\t\tend\n\t\t}\n\t\tprovided_links.each { |l|\n\t\t\tunless l.index(i).nil?\n\t\t\t\tstill_required_libs.delete(i)\n\t\t\tend\n\t\t}\n\t}\n\n\tlibs_stage_two = Array.new\n\tlinks_stage_two = Array.new\n\treally_unmet_deps = still_required_libs.clone\n\tadditional_deps = Array.new\n\t@stage_two_objs.each { |i|\n\t\tstill_required_libs.each { |j|\n\t\t\ti.show_libs.each { |k|\n\t\t\t\tprovided_file = File.split(k)[1]\n\t\t\t\t# puts \"GCC contains \" + provided_file if i.pkg_name == \"gcc\"\n\t\t\t\t#if provided_file.index(j) == 0 || j.index(provided_file) == 0\n\t\t\t\t#\treally_unmet_deps.delete(j)\n\t\t\t\t#\tadditional_deps.push(i)\n\t\t\t\t#\tputs \"Found required lib: \" + j + \" as \" + provided_file + \" in stage two package \" + i.pkg_name\n\t\t\t\t#end\n\t\t\t\tunless k.index(j).nil?\n\t\t\t\t\treally_unmet_deps.delete(j)\n\t\t\t\t\tadditional_deps.push(i)\n\t\t\t\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" info > Found required lib: \" + j + \" in stage two package \" + i.pkg_name\n\t\t\t\t\t$stdout.flush\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\tlinks = i.show_links\n\t}\n\n\tadditional_names = additional_deps.collect { |x| x.pkg_name + \"-\" + x.pkg_version }\n\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" info > Adding required packages (minimal): \" + additional_names.uniq.join(\", \")\n\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" info > Still unmet dependencies: \" + really_unmet_deps.uniq.join(\", \")\n\t$stdout.flush\n\t\n\t# Now check for stage03 objects that do not have corresponding - i.e. name and \n\t# version matches - stage02 objects\n\t\n\tstage2missing = Array.new\n\t\n\tstage_three_objs.each { |i|\n\t\tvers_match = false\n\t\t@stage_two_objs.each { |j| vers_match = true if i.pkg_name == j.pkg_name && i.pkg_version == j.pkg_version }\n\t\tvers_match = true if i.allowfail == true\n\t\tif vers_match == false \n\t\t\tstage2missing.push(i.pkg_name + \" \" + i.pkg_version)\n\t\tend\n\t\t# raise \"CorrespondingStage2Missing\" if vers_match == false \n\t}\n\t\n\tif stage2missing.size > 0\n\t\tstage2missing.each { |i|\n\t\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > \" + i + \" matching stage2 package missing!\"\n\t\t}\n\t\t$stdout.flush\n\t\traise \"CorrespondingStage2Missing\"\n\tend\n\n\t# If a full install is selected, instead of doing a package install\n\tif @full_image == true\n\t\tThirdStage.full_install(@builddir)\n\tend\n\n\t# Retrieve the list of files to skip\n\tskipfiles, skipdirs = ThirdStage.read_skiplist(@skiplist)\n\n\t# raise \"DebugBreakPoint\"\n\t# Install all regularily selected stage 03 packages\n\n\tpkglist = File.new(@builddir + \"/stage03/pkglist.txt\", \"w\")\n\tstage_three_objs.each { |i|\n\t\t\n\t\ti.makedirs\n\t\ti.touchfiles\n\t\ti.scriptgen\n\t\ti.assemble_modules(@kernel_file, @modmodel)\n\t\ti.unpack\n\t\t\n\t\t### Dir.chdir(@workdir)\n\t\ti.install\n\t\t### Dir.chdir(@workdir)\n\t\ti.pkg_install( [\"minimal\",\"bin\",\"config\",\"localization\",\"tzdata\",\"uncategorized\",\"skel\"], [\"de\", \"en\"], skipfiles, skipdirs) unless @full_image == true\n\t\tpkglist.write(\"full\\t\" + i.pkg_name + \"\\t\" + i.pkg_version + \"\\n\")\n\t\t### Dir.chdir(@workdir)\n\t}\n\t# Create temporary buildscripts for stage02 packages not yet included\n\tadditional_deps.uniq.each { |a|\n\t\ta.dump_stage03_script\n\t\tdep = ThirdStage.new(\"added-dependency-\" + a.pkg_name + \".xml\", @srcdir, @builddir, @unpriv, \"stage03\", @dbh, @unstable, @sqlite, @skiplist, @legacy, Array.new, Array.new, true, @nonfree)\n\t\tdep.unpack\n\t\t### Dir.chdir(@workdir)\n\t\tdep.install\n\t\t### Dir.chdir(@workdir)\n\t\tdep.pkg_install( [\"minimal\",\"localization\" ], [\"de\", \"en\"], skipfiles, skipdirs) unless @full_image == true\n\t\t### Dir.chdir(@workdir)\n\t\tpkglist.write(\"mini\\t\" + a.pkg_name + \"\\t\" + a.pkg_version + \"\\n\")\n\t}\n\tpkglist.close\n\t\n\t# raise \"DebugBreakPoint\"\n\t# ThirdStage.create_softlinks(@builddir, @dbh)\n\tThirdStage.create_softlinks_ng(@builddir, @dbh) unless @full_image == true\n\tThirdStage.copy_firmware(@builddir)\n\t# raise \"DebugBreakPoint\"\n\tThirdStage.sync_root_overlay(@builddir, @overlays + \"/rootfs\")\n\tif @singlecontainer == true\n\t\tThirdStage.create_single_squashfs(@builddir, @kernel_file)\n\telse\n\t\tThirdStage.create_squashfs(@builddir, @kernel_file)\n\tend\n\t\n\t# include branding\n\tThirdStage.write_branding(@builddir, @branding, @brand_file, @build_timestamp)\n\tThirdStage.sync_overlay(@builddir, @overlays + \"/initramfs\")\n\tsystem(\"mv \\\"\" + @builddir + \"/stage03/pkglist.txt\\\" \\\"\" + @builddir + \"/stage03/initramfs/etc/lesslinux/\\\"\")\n\t#raise \"DebugBreakPoint\"\n\t\n\t# Build the initramfs' for kernel version independent stuff\n\tinitramfs_assembly = InitramfsAssembly.new(@srcdir, @builddir, @dbh, \"config/initramfs.xml\")\n\tinitrd_location = initramfs_assembly.build\n\n\t# Build the initramfs for kernel modules\n\tmod_locations = initramfs_assembly.assemble_modules(@kernel_file, @modmodel)\n\n\t# Synchronize Kernel and initramfs for modules to the CD build directory \n\t# Build the ISO-Image\n\tbootable = BootdiskAssembly.new(@srcdir, @builddir, @dbh, \"config/initramfs.xml\", @build_timestamp, @branding, @overlays, @full_image, @grub)\n\tBootdiskAssembly.sync_overlay(@builddir, @overlays + \"/bootdisk\")\n\tBootdiskAssembly.copy_version(@builddir)\n\t#raise \"DebugBreakPoint\"\n\tunless @skip_stages.include?(\"bootconf\")\n\t\tbootable.create_isoimage(@kernel_file, true)\n\telse\n\t\tbootable.create_isoimage(@kernel_file, false)\n\tend\n\t# clean up, remove added dependencies:\n\tsystem(\"rm scripts/stage03/added-dependency-*\")\n\t\nend", "def setup_test_2(test_name, epw_path)\n osw_path = File.join(run_dir(test_name), 'in.osw')\n osw_path = File.absolute_path(osw_path)\n\n workflow = OpenStudio::WorkflowJSON.new\n workflow.setSeedFile(File.absolute_path(model_out_path(test_name)))\n workflow.setWeatherFile(File.absolute_path(epw_path))\n workflow.saveAs(osw_path)\n\n cli_path = OpenStudio.getOpenStudioCLI\n cmd = \"\\\"#{cli_path}\\\" run -w \\\"#{osw_path}\\\"\"\n #puts cmd\n system(cmd)\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n Athenry::setup.target(\"fetchstage\", \"extractstage\", \"fetchsnapshot\", \"updatesnapshot\", \"copysnapshot\", \"copy_scripts\", \"copy_configs\")\n end" ]
[ "0.63316333", "0.6155988", "0.6005338", "0.5945435", "0.58963287", "0.5760178", "0.57461554", "0.56874657", "0.56812304", "0.5663725", "0.55958456", "0.55528474", "0.5534801", "0.5523696", "0.55129987", "0.5462892", "0.5458901", "0.5413829", "0.5402599", "0.5371124", "0.534708", "0.53399545", "0.53324896", "0.53196985", "0.52852607", "0.52830976", "0.5276027", "0.52726847", "0.5270347", "0.5267547", "0.5251911", "0.52501154", "0.52356315", "0.52355814", "0.5223195", "0.5211317", "0.52101153", "0.5209996", "0.5208992", "0.5191703", "0.518996", "0.5181894", "0.5180184", "0.5178883", "0.5175532", "0.51710147", "0.51709557", "0.51666415", "0.51666415", "0.51600635", "0.51595646", "0.5151403", "0.5148803", "0.5140684", "0.5123428", "0.5108456", "0.5106529", "0.5101995", "0.5100626", "0.50932914", "0.50896037", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5088089", "0.5065865", "0.5051379", "0.50469756", "0.5040302", "0.5032714", "0.5025287", "0.5015716", "0.5013343", "0.5013343", "0.5008528", "0.5006019", "0.50050074", "0.5004676", "0.5003699", "0.5000124", "0.4999458", "0.49939364", "0.4993301", "0.49928647", "0.49901512", "0.4983138", "0.4983138", "0.4983138", "0.4983138", "0.4983138", "0.4983138", "0.49805483" ]
0.61209726
2
slide_data.each do |slide| $slide_width = slide[0] $slide_height = slide[1] $slide_thickness = slide[2] $slide_wainscot = slide[3] $slide_type = slide[4] $slide_side = slide[5] $slide_offset = slide[6] $slide_color = slide[7] $slide_wainscotcolor = slide[8] $track_color = slide[9] create_slide_door(entities) end
def interior_steel(entities) #draw_rectangle("EW1",70*12, 14*12+8, 20*12, entities) if($interior_steel != "") if($oh1 >= $oh2) a = entities.add_line([0,0,$height],[0,$width,$height]) b = entities.add_line([0,0,$height],[0,0,$height1]) a.faces[0].back_material = $interior_steel # if($oh1 <= $oh2) # else # a.faces[1].back_material = $interior_steel # end #entities.add_line([$length,0,$height],[$length,0,$height1]) f = entities.add_line([$length,0,$height],[$length,0,$height1]) e = entities.add_line([$length,0,$height],[$length,$width,$height]) e.faces[1].back_material = $interior_steel entities.add_line([0,0,$height],[$length,0,$height]) d = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1]) d.find_faces d.faces[0].back_material = $interior_steel d.faces[2].back_material = $interior_steel if($height1 == $height2) d.faces[2].erase! end c = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2]) c.faces[0].back_material = $interior_steel end if($oh1 < $oh2) a = entities.add_line([0,0,$height],[0,$width,$height]) b = entities.add_line([0,$width,$height],[0,$width,$height2]) a.faces[0].back_material = $interior_steel # if($oh1 <= $oh2) # else # a.faces[1].back_material = $interior_steel # end #entities.add_line([$length,0,$height],[$length,0,$height1]) f = entities.add_line([$length,$width,$height],[$length,$width,$height2]) e = entities.add_line([$length,0,$height],[$length,$width,$height]) e.faces[1].back_material = $interior_steel entities.add_line([0,0,$height],[$length,0,$height]) d = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1]) d.find_faces d.faces[1].back_material = $interior_steel d.faces[0].back_material = $interior_steel #d.faces[2].back_material = $interior_steel if($height1 == $height2) d.faces[2].erase! end c = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2]) c.faces[0].back_material = $interior_steel end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of strings that will be displayed as bullet items.\n # title = 'Why Mac?'\n # content = ['Its cool!', 'Its light.']\n # @deck.add_textual_slide title, content\n\n # Creating an image Slide:\n # It will contain a title as string.\n # and an embeded image\n #title = 'Everyone loves Macs:'\n #subtitle = 'created by Steve Jobs'\n #content = ['Its cool!', 'Its light.']\n #image_path = ActionController::Base.helpers.asset_path('/app/assets/images/ss.png').to_s\n #image = view_context.image_path 'ss.png'\n #url = 'http://localhost:3000' + image\n #image = view_context.image_path 'https://res.cloudinary.com/indoexchanger/image/upload/v1501168483/qxbvro2yhvibid0ra5rp.jpg'\n #puts image\n #@deck.add_pictorial_slide title, url\n #@deck.add_textual_slide title, subtitle\n #\n\n # Specifying coordinates and image size for an embeded image.\n # x and y values define the position of the image on the slide.\n # cx and cy define the width and height of the image.\n # x, y, cx, cy are in points. Each pixel is 12700 points.\n # coordinates parameter is optional.\n # coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}\n # @deck.add_pictorial_slide title, image_path, coords\n\n # Saving the pptx file to the current directory.\n #@deck.save('mps.pptx')\n # @products = Product.all\n # \n \n @presentation = RubySlides::Presentation.new\n \n chart_title = \"Chart Slide exported from ruby\"\n chart_series = [\n {\n column: \"Col1\",\n rows: [\"Lorem\", \"Ipsum\", \"Dolar\", \"Ismet\"],\n values: [\"1\", \"3\", \"5\", \"7\"]\n },\n {\n column: \"Col2\",\n color: 'FF9800',\n rows: [\"A\", \"B\", \"C\", \"D\"],\n values: [\"2\", \"4\", \"6\", \"8\"]\n }\n ]\n @presentation.chart_slide chart_title, chart_series\n\n @presentation.save('mps.pptx')\n\n @products = Product.order('created_at DESC')\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"all_products.xlsx\"'\n }\n end\n end", "def initialize(slideshow)\n @sections = []\n @slideshow = slideshow\n# add_line line\n end", "def slides\n slides = Array.new\n move_dirs = slide_dirs\n\n move_dirs.length.times do |i|\n new_loc = [@location[0] + move_dirs[i][0], \n @location[1] + move_dirs[i][1]]\n \n next unless @board.valid_location?(*new_loc)\n slides << new_loc if @board[*new_loc].nil?\n end\n \n slides\n end", "def slide\n slde = { start_date: mk_date(start_year),\n end_date: mk_date((end_year.presence || start_year)),\n text: mk_text(body, name) }\n if image.attached?\n slde['media'] = { url: cover_url.to_s,\n link: url }\n end\n slde\n end", "def post_processing_slides( content )\r\n \r\n # 1) add slide break \r\n \r\n if (@markup_type == :markdown && @markdown_libs.first == 'pandoc-ruby') || @markup_type == :rest\r\n content = add_slide_directive_before_div_h1( content )\r\n else\r\n content = add_slide_directive_before_h1( content )\r\n end\r\n\r\n dump_content_to_file_debug_html( content )\r\n\r\n # 2) use generic slide break processing instruction to\r\n # split content into slides\r\n\r\n slide_counter = 0\r\n\r\n slides = []\r\n slide_source = \"\"\r\n \r\n content.each_line do |line|\r\n if line.include?( '<!-- _S9SLIDE_' ) or\r\n line.include?( '<!-- _S9TRANSITION_' ) then\r\n if slide_counter > 0 then # found start of new slide (and, thus, end of last slide)\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer\r\n end\r\n slide_counter += 1\r\n end\r\n slide_source << line\r\n end\r\n \r\n if slide_counter > 0 then\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer \r\n end\r\n\r\n ## split slide source into header (optional) and content/body\r\n ## plus check for (css style) classes\r\n\r\n slides2 = []\r\n transition = nil\r\n transitioncount = 0\r\n slides.each do |slide_source|\r\n slide = Slide.new\r\n\r\n ## check for css style classes \r\n from = 0\r\n while (pos = slide_source.index( /<!-- _S9(SLIDE|STYLE|TRANSITION)_(.*?)-->/m, from ))\r\n type = $1.downcase\r\n klass = $2.strip\r\n if $1 == 'TRANSITION'\r\n transition = klass\r\n transitioncount = 0\r\n klass = 'middle'\r\n logger.debug \\\r\n\" adding css classes (plus middle for #{transition}) from pi #{type}: #{klass}\"\r\n slide.transition = transition + '-title'\r\n else\r\n if transition\r\n transitioncount += 1\r\n slide.transition = \"#{transition}[#{transitioncount}]\"\r\n logger.debug \\\r\n\" adding css classes (plus #{transition}) from pi #{type}: #{klass}\"\r\n else\r\n logger.debug \" adding css classes from pi #{type}: #{klass}\"\r\n end\r\n end\r\n\r\n if slide.classes.nil?\r\n slide.classes = klass\r\n else\r\n slide.classes << \" #{klass}\"\r\n end\r\n \r\n from = Regexp.last_match.end(0)\r\n end\r\n \r\n # try to cut off header using non-greedy .+? pattern; tip test regex online at rubular.com\r\n # note/fix: needs to get improved to also handle case for h1 wrapped into div\r\n # (e.g. extract h1 - do not assume it starts slide source)\r\n if slide_source =~ /^\\s*(<h1.*?>.*?<\\/h\\d>)\\s*(.*)/m \r\n slide.header = $1\r\n slide.content = ($2 ? $2 : \"\")\r\n logger.debug \" adding slide with header:\\n#{slide.header}\"\r\n else\r\n slide.content = slide_source\r\n logger.debug \" adding slide with *no* header:\\n#{slide.content}\"\r\n end\r\n slides2 << slide\r\n end\r\n\r\n # for convenience create a string w/ all in-one-html\r\n # no need to wrap slides in divs etc.\r\n \r\n content2 = \"\"\r\n slides2.each do |slide| \r\n content2 << slide.to_classic_html\r\n end\r\n \r\n # make content2 and slide2 available to erb template\r\n # -- todo: cleanup variable names and use attr_readers for content and slide\r\n \r\n @slides = slides2 # strutured content \r\n @content = content2 # content all-in-one \r\n end", "def setup_slide\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n xpos = (flip && !@ignore_flip_point ? -@acts[1] : @acts[1])\n ypos = @acts[2]\n slide(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end", "def generate_wd_images rname=nil\n return {} unless rname\n \n start_time = Time.now\n \n @selected_room_name = rname\n @room_name = @selected_room_name.gsub('#', '_')\n # rinfo \"Starting Image generation : %s\"%(@selected_room_name)\n\n #Pre Operation things\n exception_raised = false\n #-----------Get previous stuffs--------------------------\n curr_active_layer = Sketchup.active_model.active_layer\n edge_render_option = Sketchup.active_model.rendering_options[\"EdgeColorMode\"]\n active_camera = Sketchup.active_model.active_view.camera\n cam_perspective = Sketchup.active_model.active_view.camera.perspective?\n unit_display = Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]\n\n Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]=true\n Sketchup.active_model.active_view.camera.perspective=false\n Sketchup.active_model.rendering_options[\"EdgeColorMode\"] = 0\n \n begin\n # puts \"--------------------------hide\"\n Sketchup::active_model::start_operation \"RIO Image Generation\"\n DP::hide_all_entities\n\n view_details_h = get_floor_view_comps\n \n view_details_h[\"top_view\"] = {:top_room_image => get_top_room_image}\n rescue Exception => e\n # rerror \"Exception raised during image generation\"\n raise e\n Sketchup.active_model.abort_operation\n exception_raised = true\n ensure\n DP::unhide_all_entities\n\n Sketchup.active_model.rendering_options[\"EdgeColorMode\"] = edge_render_option\n Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]=unit_display\n Sketchup.active_model.active_view.camera=active_camera\n Sketchup.active_model.active_view.camera.perspective=cam_perspective\n Sketchup.active_model.active_view.zoom_extents\n Sketchup.active_model.commit_operation\n end\n\n end_time = Time.now\n # puts \"Time taken : #{end_time - start_time}\"\n result = exception_raised ? {} : view_details_h\n end", "def return_slide_and_data\n target_sentence = nil\n loop do\n target_word = @enrolment_manager.next_word\n return { service: 'EMPTY' } if target_word.nil?\n target_sentence = @next_sentence_retriever.retrieve(target_word)\n break if target_sentence.present?\n @enrolment_manager.assign_status(target_word, EXHAUSTED)\n end\n SlideConstructor.new(@enrolment_manager, target_sentence).construct\n end", "def slide_params\n params.require(:slide).permit(\n :name,\n :template,\n :theme,\n :layout,\n :play_on,\n :stop_on,\n :show,\n :building_name,\n :menu_name,\n :organizer,\n :organizer_id,\n :duration,\n :heading,\n :subheading,\n :datetime,\n :location,\n :content,\n :feed_url,\n :background,\n :background_type,\n :background_sizing,\n :remove_background,\n :foreground,\n :foreground_type,\n :foreground_sizing,\n :background_cache,\n :foreground_cache,\n :remove_foreground,\n :sign_ids => [],\n :scheduled_items_attributes => [\n :id,\n :_destroy,\n :date,\n :time,\n :image,\n :content,\n :admission,\n :audience,\n :image_cache,\n :remove_image,\n :name,\n :play_on,\n :stop_on\n ]\n )\n end", "def setup_slide\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n xpos = (flip && !@ignore_flip_point ? -@acts[1] : @acts[1])\n ypos = @acts[2]\n slide(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n @acts[4].times do\n method_wait\n end\n end", "def slide_params\n params.require(:slide).permit(:inform_id, :user_id, :slide_tag, :stored, :description, :colored, :tagged, :covered, :slide_ids[])\n end", "def cal_slider_pos_arr(item_size, w, h)\n r = []\n page_size = (item_size.to_f/(h*w).to_f).ceil\n (1..page_size).each do |page|\n offset = (page-1) * (h*w)\n (1..w).each do |i|\n (1..h).each do |j|\n r<<(offset+i+(j-1)*w-1)\n end\n end\n end\n r\n end", "def main()\n \n for i in 0...$enemy_info.length do\n \n EditImage(\n $enemy_info[i][0],\n $enemy_info[i][2][0],\n $enemy_info[i][2][1],\n $enemy_info[i][2][2],\n $enemy_info[i][2][3],\n $enemy_info[i][3]\n )\n \n end \n\n\nend", "def slide(dir)\n @row, @col = slide_pos(dir)\n make_king\n nil\n end", "def create\n return false if !userCan :slide\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n if params[:projector_add] then\n params[:projector_add].each {|v|\n Projector.find(v).update_attributes(:slide_id => params[:id]);\n Message.Command(:id => \"projector-#{v}\", :cmd => \"load\", :slide => params[:id])\n }\n end\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_processing_slides( content )\n \n # 1) add slide breaks\n \n if config.slide? # only allow !SLIDE directives fo slide breaks?\n # do nothing (no extra automagic slide breaks wanted)\n else \n if (@markup_type == :markdown && Markdown.lib == 'pandoc-ruby') || @markup_type == :rest\n content = add_slide_directive_before_div_h1( content )\n else\n if config.header_level == 2\n content = add_slide_directive_before_h2( content )\n else # assume level 1\n content = add_slide_directive_before_h1( content )\n end\n end\n end\n\n\n dump_content_to_file_debug_html( content )\n\n # 2) use generic slide break processing instruction to\n # split content into slides\n\n slide_counter = 0\n\n slides = []\n slide_buf = \"\"\n \n content.each_line do |line|\n if line.include?( '<!-- _S9SLIDE_' )\n if slide_counter > 0 # found start of new slide (and, thus, end of last slide)\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer\n else # slide_counter == 0\n # check for first slide with missing leading SLIDE directive (possible/allowed in takahashi, for example)\n ## remove html comments and whitspaces (still any content?)\n ### more than just whitespace? assume its a slide\n if slide_buf.gsub(/<!--.*?-->/m, '').gsub( /[\\n\\r\\t ]/, '').length > 0\n logger.debug \"add slide with missing leading slide directive >#{slide_buf}< with slide_counter == 0\"\n slides << slide_buf\n slide_buf = \"\"\n else\n logger.debug \"skipping slide_buf >#{slide_buf}< with slide_counter == 0\"\n end\n end\n slide_counter += 1\n end\n slide_buf << line\n end\n \n if slide_counter > 0\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer \n end\n\n\n slides2 = []\n slides.each do |source|\n slides2 << Slide.new( source, config )\n end\n\n\n puts \"#{slides2.size} slides found:\"\n \n slides2.each_with_index do |slide,i|\n print \" [#{i+1}] \"\n if slide.header.present?\n print slide.header\n else\n # remove html comments\n print \"-- no header -- | #{slide.content.gsub(/<!--.*?-->/m, '').gsub(/\\n/,'$')[0..40]}\"\n end\n puts\n end\n \n \n # make content2 and slide2 available to erb template\n # -- todo: cleanup variable names and use attr_readers for content and slide\n\n ### fix: use class SlideDeck or Deck?? for slides array?\n \n content2 = \"\"\n slides2.each do |slide|\n content2 << slide.to_classic_html\n end\n \n @content = content2\n @slides = slides2 # strutured content\n end", "def setup\n @parallax = Chingu::Parallax.create(:x => 0, :y => 0, :z => -1, :rotation_center => :top_left)\n @parallax << { :image => \"fondo.bmp\", :repeat_x => true, :repeat_y => true}\n # @image = Image[\"fondo.png\"]\n # @x = 0\n # @y = 0\n # @z = 0\n @comida_inicio = Time.now\n if $configuracion != nil\n peces = $configuracion[0][1].to_i\n tiburones = $configuracion[1][1].to_i\n reproducir_veces = $configuracion[2][1].to_i\n pez_vida_tiempo = $configuracion[3][1].to_i\n tiburon_vida_tiempo = $configuracion[4][1].to_i\n @comida_tasa = $configuracion[5][1].to_i\n pez_reproducir_tiempo = $configuracion[6][1].to_i\n else\n # print \"No hay configuracion establecida aun...\\n\"\n peces = 5\n tiburones = 1\n reproducir_veces = 5\n pez_vida_tiempo = 5\n tiburon_vida_tiempo = 5\n @comida_tasa = 1\n pez_reproducir_tiempo = 2\n end # if\n (peces/2).times { Pez.create.definir_parametros(1, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo) }\n (peces/2).times { Pez.create.definir_parametros(2, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo) }\n tiburones.times { Tiburon.create.definir_parametros(tiburon_vida_tiempo) }\n\n # Cuando es un numero impar de peces, se genera un pez con genero al azar\n Pez.create.definir_parametros(rand(2)+1, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo) if peces % 2 != 0\n\n @tiempo_burbuja = Time.now\n\n end", "def create_hydraulic(entities)\n # r = Geom::Transformation.rotation [$porch_width/2, 0, 0], [0,0,1], 180.degrees\n\t\t# t = Geom::Transformation.new [$porch_offset,0, $porch_height]\n\t\t# entities.transform_entities r, porch_group\n\t\t# entities.transform_entities t, porch_group\n\tif($hydraulic_side == \"SW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees\n\t\tt = Geom::Transformation.new [$hydraulic_offset+$hydraulic_width,0, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n\tif($hydraulic_side == \"SW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees\n\t\tt = Geom::Transformation.new [$length-$hydraulic_offset-$hydraulic_width,$width, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n\tif($hydraulic_side == \"EW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees\n\t\tt = Geom::Transformation.new [$length,$hydraulic_offset+$hydraulic_width, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n\tif($hydraulic_side == \"EW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees\n\t\tt = Geom::Transformation.new [0,$width-$hydraulic_offset-$hydraulic_width, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n end", "def make_ivory_tower\n 5.times do |n| \n user = make_user\n journal = make_journal\n journal.save!\n publication = make_publication\n article = make_article\n section_array = []\n 3.times { |n| section_array << make_section }\n author = make_author\n journal.publications << publication\n publication.articles << article\n article.authors << author\n section_array.each { |section| article.sections << section }\n end\nend", "def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to slides_url, notice: '幻灯片创建成功.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n newparams = coerce(params) \n @slide = Slide.new(newparams[:slide])\n @slide.name = @slide.image_file_name\n @slide.position = @slide.presentation.slides.count + 1\n if @slide.save\n flash[:notice] = \"Successfully created slide.\"\n respond_to do |format| \n format.html {redirect_to @slide.presentation} \n format.json { render :json => { :result => 'success', :slide => slide_url(@slide) } }\n end\n else\n render :action => 'new'\n end\n end", "def setup_target_slide\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n args = [@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0]\n if area_flag\n target_array.each do |target|\n target.slide(*args)\n end\n return\n end\n target.slide(*args)\n end", "def store_next_cycle(*pins)\n options = pins.last.is_a?(Hash) ? pins.pop : {}\n options = {\n }.merge(options)\n pins = pins.flatten.compact\n if pins.empty?\n fail 'For STIL generation you must supply the pins to store/capture'\n end\n pins.each { |pin| pin.save; pin.capture }\n # Register this clean up function to be run after the next vector\n # is generated, cool or what!\n preset_next_vector do |vector|\n vector.contains_capture = true\n pins.each(&:restore)\n end\n end", "def index\n f = File.open(Rails.root.join(\"datas\",\"map2.yml\"))\n globalMap = Array.new\n f.each_line {|line| globalMap << line.split(' ')}\n\n\n x0 = Integer(params[\"x0\"])\n y0 = Integer(params[\"y0\"])\n width = Integer(params[\"width\"])\n height = Integer(params[\"height\"])\n\n x1 = x0 + width\n y1 = y0 + height\n\n @map = Array.new\n @poisMap = Array.new\n globalMap[y0...y1].each do |line|\n lineZE = Array.new\n width.times do\n lineZE << 0\n end\n @poisMap << lineZE\n @map << line[x0...x1]\n end\n\n @pois = Array.new\n Poi.all.each do |poi|\n if poi.x == nil\n continue\n end\n if poi.y == nil\n continue\n end\n if poi.x > (x0+1) && poi.x < (x1-3) && poi.y < y1 && poi.y > (y0+3)\n level = Integer((poi.lvl)/5)\n puts level\n\n begin\n\n arbres = Array.new\n arbres[0] = [[202,203],[210,211],[218,219]]\n arbres[1] = [[204,205],[212,213],[220,221]]\n arbres[2] = [[206,207],[214,215],[222,223]]\n arbres[3] = [[208,209],[216,217],[224,225]]\n\n #@poisMap[poi.y][poi.x] = 1 + level*5\n #@poisMap[poi.y][poi.x+1] = 2 + level*5\n #@poisMap[poi.y-1][poi.x] = 3 + level*5\n #@poisMap[poi.y-1][poi.x+1] = 4 + level*5\n #@poisMap[poi.y-2][poi.x] = 5 + level*5\n #@poisMap[poi.y-2][poi.x+1] = 6 + level*5\n\n @poisMap[poi.y-1][poi.x+1] = arbres[level][0][1]\n\n @poisMap[poi.y][poi.x] = arbres[level][0][0]\n @poisMap[poi.y][poi.x+2] = arbres[level][1][1]\n @poisMap[poi.y+1][poi.x+1] = arbres[level][1][0]\n @poisMap[poi.y+1][poi.x+3] = arbres[level][2][1]\n @poisMap[poi.y+2][poi.x+2] = arbres[level][2][0]\n rescue\n end\n #@pois << poi\n end\n end\n\n\n\n\n respond_to do |format|\n format.json { render :json => @map }\n format.xml {}\n format.html {}\n end\n end", "def setup_smooth_slide\n tx = @acts[1] + x || 0\n ty = @acts[2] + y || 0\n dur = @acts[3] || 25\n rev = @acts[4]\n rev = true if rev.nil?\n smooth_move(tx,ty,dur,rev)\n end", "def setup_smooth_slide\n tx = @acts[1] + x || 0\n ty = @acts[2] + y || 0\n dur = @acts[3] || 25\n rev = @acts[4]\n rev = true if rev.nil?\n smooth_move(tx,ty,dur,rev)\n end", "def create_spots\n number = 1\n remaining = self.length\n\n if remaining >= 20\n 5.times do |_|\n self.spots.create(number: number, width: 4)\n number += 1\n remaining -= 4\n end\n end\n \n if (remaining-2) % 3 == 0\n self.spots.create(number: number, width: 2)\n number += 1\n remaining -= 2\n end\n\n if (remaining-4) % 3 == 0\n 2.times do |_|\n self.spots.create(number: number, width: 2)\n number += 1\n remaining -= 2\n end\n end\n\n while remaining > 2\n self.spots.create(number: number, width: 3)\n number += 1\n remaining -= 3\n end\n end", "def loop_into_data_structure(number_of_instances)\n\tarray_moves = []\n\tn = 0\n\twhile n < number_of_instances\n\t\tarray_moves[n] = Dancer.new\n\t\tn += 1\n\tend\n\tp array_moves\nend", "def index\n @slides_grid = initialize_grid(Slide,:per_page => 10)\n end", "def set_rooks\n self[[0,0]] = SlidingPiece.new([0,0], :black, \"R \")\n self[[0,7]] = SlidingPiece.new([0,7], :black, \"R \")\n self[[7,0]] = SlidingPiece.new([7,0], :white, \"R \")\n self[[7,7]] = SlidingPiece.new([7,7], :white, \"R \")\n end", "def generate_pokemon\n Pokemon.destroy_all\n\n (1..POKEMON).to_a.each do |x|\n puts \"Getting Pokemon #{x}\"\n @pokeapi.get_pokemon(x.to_s)\n pokemon = @pokeapi.pokemon_complete\n p = Pokemon.new(name: pokemon[:name], first_type_id: PokemonType.find_by_name(pokemon[:types][0]).id)\n p.second_type_id = PokemonType.find_by_name(pokemon[:types][1]).id if pokemon[:types][1]\n\n scraper = PokeScraper.new\n poke_photo = Photo.new\n poke_pic = scraper.poke_pic(p.name)\n poke_photo.photo_from_url(poke_pic)\n poke_photo.save!\n p.photo_id = poke_photo.id\n p.save!\n end\nend", "def setup\n size 640, 360\n @xvals = Array.new width, 0\n @yvals = Array.new width, 0\n @bvals = Array.new width, 0\nend", "def push(slide)\n n = to_a.size + 1\n # Paths within the zip file of new files we have to write.\n slide_path = Pathname.new(\"/ppt/slides/slide#{n}.xml\")\n slide_rels_path = Pathname.new(\"/ppt/slides/_rels/slide#{n}.xml.rels\")\n slide_notes_path = Pathname.new(\"/ppt/notesSlides/notesSlide#{n}.xml\")\n slide_notes_rels_path = Pathname.new(\"/ppt/notesSlides/_rels/notesSlide#{n}.xml.rels\")\n\n # Update ./ppt\n # !!! CREATE !!!\n # ./slides\n # Create new files\n # ./slide(\\d+).xml file\n @doc.copy slide_path, slide.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.copy slide_rels_path, slide.rels.path\n # ./notesSlides\n # Create new files\n # ./notesSlide(\\d+).xml file\n @doc.copy slide_notes_path, slide.notes.path\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.copy slide_notes_rels_path, slide.notes.rels.path\n \n # !!! UPDATES !!!\n # Update the notes in the new slide to point at the new notes\n @doc.edit_xml slide_rels_path do |xml|\n # TODO - Move this rel logic into the parts so that we don't have to repeat ourselves when calculating this stuff out.\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Notes::REL_TYPE}']\")['Target'] = slide_notes_path.relative_path_from(slide_path.dirname)\n end\n\n # Update teh slideNotes reference to point at the new slide\n @doc.edit_xml slide_notes_rels_path do |xml|\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Slide::REL_TYPE}']\")['Target'] = slide_path.relative_path_from(slide_notes_path.dirname)\n end\n\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n types = xml.at_xpath('/xmlns:Relationships')\n types << Nokogiri::XML::Node.new(\"Relationship\", xml).tap do |n|\n n['Id'] = next_id\n n['Type'] = Slide::REL_TYPE\n n['Target'] = slide_path.relative_path_from(@doc.presentation.path.dirname)\n end\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n slides = xml.at_xpath('/p:presentation/p:sldIdLst')\n next_slide_id = slides.xpath('//p:sldId[@id]').map{ |n| n['id'] }.sort.last.succ\n slides << Nokogiri::XML::Node.new(\"p:sldId\", xml).tap do |n|\n # TODO - Fix the ID that's jacked up.\n n['id'] = next_slide_id\n n['r:id'] = next_id\n end\n end\n end\n\n # Update ./[Content-Types].xml with new slide link and slideNotes link\n @doc.edit_xml @doc.content_types.path do |xml|\n types = xml.at_xpath('/xmlns:Types')\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_path\n n['ContentType'] = Slide::CONTENT_TYPE\n end\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_notes_path\n n['ContentType'] = Notes::CONTENT_TYPE\n end\n end\n\n # Great, that's all done, so lets return the slide eh?\n slide slide_path\n end", "def create\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: \"Slide was successfully created.\" }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_slide\n @slide = Slide.find(params[:id])\n end", "def draw_range_query\n\n @points.each do\n |point|\n \n ellipse(point[0].to_f, point[1].to_f,5.0,5.0)\n \n end\n\n fill(0,127,0)\n line(@x,@y,@x,@y1)\n line(@x,@y,@x1,@y)\n line(@x1,@y,@x1,@y1)\n line(@x, @y1,@x1,@y1)\n\n\n range_query = construct_range_query\n \n #\n # Aqui van tu codigo\n # Solo debes de dibujar los puntos del arreglo range_query\n \nend", "def createFloorDoorsList\n for x in 1..@numberOfFloors do\n @floorDoorsList.append(Door.new(x, DoorStatus::CLOSED, x))\n # puts \"elevator#{@id} door floor #{@floorDoorsList[x - 1].id} created\"\n end\n end", "def create\n @lecture = Lecture.new(lecture_params)\n @lecture.my_file = params[:file]\n if @lecture.save\n @f = @lecture.my_file.to_s.downcase\n @pdf = Grim.reap(@lecture.my_file.to_s)\n @count = @pdf.count\n @filename = @lecture.my_file.to_s.split('/').last\n @counter = 0\n @pdf.each do |page|\n page.save(\"./#{@filename}page_#{ @counter }.png\")\n @lecture.slides.create(:urlpage => \"#{@filename}page_#{ @counter }.png\")\n @counter +=1\n end\n redirect_to 'index'\n\n\n\n end\n \n end", "def create_components\n [\"red\", \"green\", \"blue\", \"gray\"].each_with_index do |item, i|\n create_trackbar(item, i)\n create_fields(item, i)\n end \n end", "def reload_data(dungeon)\r\n #store the dungeon\r\n @dungeon = dungeon\r\n #Tables to hold dungeon floor data\r\n @maps = @dungeon.maps\r\n @data = @dungeon.data\r\n #Load the base data of the floors\r\n @floors = @dungeon.floors\r\n @width = @dungeon.width\r\n @height = @dungeon.height\r\n @ids = [@dungeon.map, @dungeon.compass, @dungeon.key, @dungeon.boss_key]\r\n @floor_names = @dungeon.floor_names\r\n @extras = @dungeon.extras\r\n #initialize cursor data\r\n @items = [ ]\r\n @xy_pos = [ ]\r\n #get the floor rectangle\r\n rect = Rect.new(FloorsRectangle)\r\n #store the cursor position item data\r\n @floors.times do i\r\n #store the floor number\r\n @items i\r\n #store the x and y position of the floors\r\n x = rect.x + rect.width 2\r\n h = 30\r\n y = rect.y + rect.height 2 + @floors h 2 - i h - h 2\r\n @xy_pos [x,y]\r\n end\r\n # Add the other cursor positions for the dungeon items\r\n @ids.each {id @items $data_items[id]}\r\n @xy_pos.push MapLocation, CompassLocation, KeysLocation, BossKeyLocation\r\n # Add the toggles\r\n @items += [ left_toggle, right_toggle ]\r\n @xy_pos += ToggleCoords\r\n # Get the current floor\r\n @current_floor = @dungeon.current_floor\r\n # Make cursor index the current floor\r\n @index = @items.index(@current_floor)\r\n # Draw the dungeon, floors, items and floor name\r\n draw_background('hdrdungeonmapscreenoot')\r\n draw_dungeon(@current_floor)\r\n draw_floors\r\n draw_items\r\n # Move the cursor to the correct position\r\n @cursor.x, @cursor.y = @xy_pos[@index][0], @xy_pos[@index][1]\r\n end", "def create_storm_bitmap\r\n @storm_bitmap = Bitmap.new(34, 64)\r\n 32.times do |i|\r\n @storm_bitmap.fill_rect(33-i, i*2, 1, 2, particle_color2)\r\n @storm_bitmap.fill_rect(32-i, i*2, 1, 2, particle_color1)\r\n @storm_bitmap.fill_rect(31-i, i*2, 1, 2, particle_color2)\r\n end\r\n end", "def slide_params\n params.require(:slide).permit(:start_time, :title, :image_id, :notes, :slide_type)\n end", "def set_pieces\n # white pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 2, color: 'white', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 1, color: 'white', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 1, color: 'white', active: true)\n King.create(game_id: id, x_position: 5, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 1, color: 'white', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 1, color: 'white', active: true)\n # black pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 7, color: 'black', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 8, color: 'black', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 8, color: 'black', active: true)\n King.create(game_id: id, x_position: 5, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 8, color: 'black', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 8, color: 'black', active: true)\n end", "def populate\n spots = @spaces.length**2\n asteroids = (spots * 0.3).round\n gravity_wells = (spots * 0.1).round\n empty_space = (spots * 0.6 ).round\n\n asteroids.times {fill_spot('A')}\n gravity_wells.times {fill_spot('G')}\n #Because we fill two empty space with start, end marks\n empty_space.times {fill_spot('.')}\n end", "def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def next_states\n states = []\n for direction in [\"up\", \"down\", \"left\", \"right\"] do\n new_rows = slide(direction)\n states << Grid.new(@x, @y, new_rows) unless new_rows.nil?\n end\n states\n end", "def doprops(props,block,boundary)\n for prop in props\n catchmentside = insideoutside(block,boundary,prop[\"full_address\"])\n sqft = prop[\"characteristics\"][\"improvement_area\"]\n description = prop[\"characteristics\"][\"description\"]\n myprops = prop[\"property_id\"]+\"\\t\"+prop[\"account_number\"]+\"\\t\"+prop[\"full_address\"] + \"\\t\" + sqft.to_s + \"\\t\" + description.to_s + \"\\t\" + catchmentside\n mydates = Array.new\n myprices = Array.new\n numsales = 0\n for sales in prop[\"sales_information\"]\n k,v = sales\n if k == 'sales_date'\n #/Date(1212120000000-0400)/\n if /\\((\\d+)/.match(v)\n datestrings = /\\((\\d+)/.match(v).captures\n datestring = datestrings[0]\n mydate = DateTime.strptime(datestring,'%Q').strftime(\"%Y-%m-%d\")\n else\n mydate = ''\n end\n mydates << mydate\n elsif k == 'sales_price'\n myprice = v.to_s\n myprices << myprice\n end\n end\n mydates.zip(myprices).each do |thisdate, thisprice|\n print myprops + \"\\t\" + thisdate + \"\\t\" + thisprice + \"\\n\"\n end\n end\nend", "def create_particles\n 200.times do\n @particle = Particle.new(@window, self)\n @particle_array.push(@particle)\n end\n 100.times do\n @particle = Particle.new(@window, self)\n @particle_array_2.push(@particle)\n end\n end", "def create\n # request.format = :json\n @slider = Slider.new(slider_params) \n print '----------!!!-----------'\n print slider_params \n print '----------!!!-----------'\n if slider_params[:slidetube] != \"\"\n ssil = slider_params[:slidetube] \n @slider.ssilka = slider_params[:slidetube]\n # @slider.save\n\n respond_to do |format|\n if @slider.save\n format.html { render :new }\n format.json { render :index, status: :created, location: @slider }\n else\n format.html { render :new }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n else\n\n respond_to do |format|\n if @slider.save\n format.html { render :crop, notice: 'Создано.' }\n format.json { render :index, status: :created, location: @slider }\n else\n format.html { render :new }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @slide = Slide.new(slide_params)\n respond_to do |format|\n if @slide.save\n @slide.take_screenshot\n @slide.create_activity(:create, owner: current_user, parameters: { name: @slide.menu_name })\n current_user.slides << @slide\n format.html { redirect_to edit_slide_path(@slide) }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def slider(count, options = {})\n return if options[:visibility] == :hide\n case count\n when :one\n image_1 = content_tag :img, nil, :src => \"assets/slide-1.png\"\n items =\n (content_tag :li, image_1)\n when :two\n image_1 = content_tag :img, nil, :src => \"assets/slide-1.png\"\n image_2 = content_tag :img, nil, :src => \"assets/slide-2.png\"\n items =\n (content_tag :li, image_1) +\n (content_tag :li, image_2)\n when :three\n image_1 = content_tag :img, nil, :src => \"assets/slide-1.png\"\n image_2 = content_tag :img, nil, :src => \"assets/slide-2.png\"\n image_3 = content_tag :img, nil, :src => \"assets/slide-3.png\"\n items =\n (content_tag :li, image_1) +\n (content_tag :li, image_2) +\n (content_tag :li, image_3)\n when :four\n image_1 = content_tag :img, nil, :src => \"assets/slide-1.png\"\n image_2 = content_tag :img, nil, :src => \"assets/slide-2.png\"\n image_3 = content_tag :img, nil, :src => \"assets/slide-3.png\"\n image_4 = content_tag :img, nil, :src => \"assets/slide-4.png\"\n items =\n (content_tag :li, image_1) +\n (content_tag :li, image_2) +\n (content_tag :li, image_3) +\n (content_tag :li, image_4)\n end\n list = content_tag :ul, items\n content_tag :div, list, :class => 'slider'\n end", "def index\n @images = get_approved\n @left_images = []\n @right_images = []\n @center_images = []\n counter = 0\n @images.each do |image|\n counter+=1\n if counter == 1\n @left_images << image\n elsif counter ==2\n @center_images << image\n elsif counter ==3\n counter = 0\n @right_images << image\n end\n end\n end", "def post_slide_params\n params.require(:post_slide).permit(:description, :position_id, :photo, :title, :black, :title2, :description2)\n end", "def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end", "def build_pieces\n (1..8).each do |i|\n Pawn.new(2, i, \"white\") \n end\n Rook.new(1, 1, \"white\")\n Knight.new(1, 2, \"white\")\n Bishop.new(1, 3, \"white\")\n Queen.new(1, 4, \"white\")\n King.new(1, 5, \"white\")\n Bishop.new(1, 6, \"white\")\n Knight.new(1, 7, \"white\")\n Rook.new(1, 8, \"white\")\n (1..8).each do |i|\n Pawn.new(7, i, \"black\") \n end\n Rook.new(8, 1, \"black\")\n Knight.new(8, 2, \"black\")\n Bishop.new(8, 3, \"black\")\n Queen.new(8, 4, \"black\")\n King.new(8, 5, \"black\")\n Bishop.new(8, 6, \"black\")\n Knight.new(8, 7, \"black\")\n Rook.new(8, 8, \"black\")\n end", "def create\n uploaded_io = params[:image_this]\n slide = Slide.new\n slide.user_id = current_user.id\n slide.file = uploaded_io\n if slide.save\n if params[:name].present?\n name = params[:name]\n else\n name = slide.file.to_s.split('/').last\n end\n\n if params[:tags].present?\n params[:tags].split(',').each do |tag|\n t = Tag.find_or_create_by(:name => tag)\n Tagging.create(:tag_id => t.id, :slide_id => slide.id, :user_id => current_user.id)\n end\n end\n\n slide.update_attributes(:name => name)\n out = 'success'\n else\n out = 'fail'\n end\n render :json => { :outcome => out, :url => slide.file.thumb.url }\n end", "def dynamic_range \n\t\tpage\n\t\tframes\n\t\tnum = 0\n\t\twhile num < 4 \n\t\t\tif page == frames[num] \n\t\t\t\t@destination = frames[num] \n\t\t\tend \n\t\t\tnum += 1 \n\t\tend\n\tend", "def powerpoint(options={\n :title => '',\n :author => '',\n :images => [],\n :titles => [],\n :notes => [],\n })\n args = {\n :title => options[:report_title],\n :author => options[:author],\n }\n\n images_and_titles = options[:images].zip(options[:titles], options[:notes])\n images_and_titles.each_with_index do |value, i|\n \n filename = value[0]\n title = value[1]\n notes = value[2]\n\n image_data = File.read(filename)\n encoded_image = Base64.encode64(image_data)\n args[\"slide_#{i}_image\"] = encoded_image\n args[\"slide_#{i}_title\"] = title\n args[\"slide_#{i}_notes\"] = notes\n end\n\n call_api('powerpoint', args)\n end", "def default_grid\n array = Array.new(8) { Array.new(8) }\n\n array[0][0] = Rook.new('white', [0,0], 'slide')\n array[1][0] = Knight.new('white', [1,0], 'step')\n array[2][0] = Bishop.new('white', [2,0], 'slide')\n array[3][0] = Queen.new('white', [3,0], 'slide')\n array[4][0] = King.new('white', [4,0], 'step')\n array[5][0] = Bishop.new('white', [5,0], 'slide')\n array[6][0] = Knight.new('white', [6,0], 'step')\n array[7][0] = Rook.new('white', [7,0], 'slide')\n array[0..7].each_with_index { |column, index| \n column[1] = Pawn.new('white', [index,1], 'step') }\n\n array[0][7] = Rook.new('black', [0,7], 'slide')\n array[1][7] = Knight.new('black', [1,7], 'step')\n array[2][7] = Bishop.new('black', [2,7], 'slide')\n array[3][7] = Queen.new('black', [3,7], 'slide')\n array[4][7] = King.new('black', [4,7], 'step')\n array[5][7] = Bishop.new('black', [5,7], 'slide')\n array[6][7] = Knight.new('black', [6,7], 'step')\n array[7][7] = Rook.new('black', [7,7], 'slide')\n array[0..7].each_with_index { |column, index| \n column[6] = Pawn.new('black', [index,6], 'step') }\n\n array\n end", "def show_image\n temp_floor_tile = Image.new('tiles\\tile_floor_1.png')\n hex_width = temp_floor_tile.width - 6\n hex_height = temp_floor_tile.width - 4\n temp_floor_tile.remove\n @hexArray.each_with_index do | line, x |\n bottom_y = hex_height * 11\n y_start = bottom_y - (11 - line.size) * (hex_height / 2)\n line.each_with_index do | hex, y |\n cur_x = x * hex_width\n cur_y = y_start - y * hex_height\n\n case hex.type\n when Hex::FLOOR_TYPE\n Image.new('tiles\\tile_floor_1.png', x:cur_x, y:cur_y)\n when Hex::LAVA_TYPE\n Image.new('tiles\\tile_liquid_1.png', x:cur_x, y:cur_y)\n when Hex::EXIT_TYPE\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n Image.new('tiles\\dung_ladderdown.png', x:cur_x, y:cur_y)\n else\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n end\n if hex.contained_object != nil && hex.contained_object.type == MovingObject::PLAYER_TYPE\n Image.new('tiles\\player.png', x:cur_x, y:cur_y)\n end\n end\n end\n end", "def populate_board!\n\n # Populate Pawns\n (0..7).each do |x|\n Pawn.create(x_coordinates: x, y_coordinates: 1, game_id: self.id, color: 'white', image: 'white-pawn.png', status: 'active') # White\n Pawn.create(x_coordinates: x, y_coordinates: 6, game_id: self.id, color: 'black', image: 'blk-pawn.png', status: 'active') # Black\n end\n\n # Populate Rook\n Rook.create(x_coordinates: 0, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-rook.png', status: 'active') # White\n Rook.create(x_coordinates: 7, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-rook.png', status: 'active') # White\n Rook.create(x_coordinates: 0, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-rook.png', status: 'active') # Black\n Rook.create(x_coordinates: 7, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-rook.png', status: 'active') # Black\n\n # Populate Knight\n Knight.create(x_coordinates: 1, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-knight.png', status: 'active' ) # White\n Knight.create(x_coordinates: 6, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-knight.png', status: 'active' ) # White\n Knight.create(x_coordinates: 1, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-knight.png', status: 'active' ) # Black\n Knight.create(x_coordinates: 6, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-knight.png', status: 'active' ) # Black\n\n # Populate Bishop\n Bishop.create(x_coordinates: 2, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-bishop.png', status: 'active') # White\n Bishop.create(x_coordinates: 5, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-bishop.png', status: 'active') # White\n Bishop.create(x_coordinates: 2, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-bishop.png', status: 'active') # Black\n Bishop.create(x_coordinates: 5, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-bishop.png', status: 'active') # Black\n\n # Populate Queen\n Queen.create(x_coordinates: 3, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-queen.png', status: 'active') # White\n Queen.create(x_coordinates: 3, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-queen.png', status: 'active') # Black\n\n # Populate King\n King.create(x_coordinates: 4, y_coordinates: 0, game_id: self.id, color: 'white', image: 'white-king.png', status: 'active') # White\n King.create(x_coordinates: 4, y_coordinates: 7, game_id: self.id, color: 'black', image: 'blk-king.png', status: 'active') # Black\n end", "def setup_cutin_slide\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n get_spriteset.cutin.slide(@acts[1], @acts[2], @acts[3])\n end", "def update_slider_images\n dir_name=\"app/assets/images/slider_images\"\n @slider_images=Dir.glob(dir_name+\"/*\").map do |f|\n File.basename f\n end.sort\n begin\n if slider_images_params[:slider_image_1]\n create_slider_image_file(\"slider_image_1\", slider_images_params[:slider_image_1], 1)\n end\n if slider_images_params &&slider_images_params[:slider_image_2]\n create_slider_image_file(\"slider_image_2\", slider_images_params[:slider_image_2], 2)\n end\n if slider_images_params &&slider_images_params[:slider_image_3]\n create_slider_image_file(\"slider_image_3\", slider_images_params[:slider_image_3], 3)\n end\n if slider_images_params &&slider_images_params[:slider_image_4]\n create_slider_image_file(\"slider_image_4\", slider_images_params[:slider_image_4], 4)\n end\n if slider_images_params && slider_images_params[:slider_image_5]\n create_slider_image_file(\"slider_image_5\", slider_images_params[:slider_image_5], 5)\n end\n redirect_to slider_images_path\n rescue\n redirect_to slider_images_path\n end\n end", "def init_variables\n\t\t@canvas = Magick::ImageList.new \n\t\t@canvas_width = 2880\n\t\t@canvas_height = 1800\n\t\t@quote = self.quote\n\t\t@citation = self.citation\n\t\t@highlight = self.colour_scheme.highlight\n\t\t@quote_marks = self.layout_scheme.quote_marks \n\t\t@font_size = self.layout_scheme.font_size.to_i\n\t\t@col = self.layout_scheme.col.to_i\n\t\t@position = self.layout_scheme.position\n\t\t@underline = self.layout_scheme.underline\n\tend", "def make_products_section\n\t$products_hash[\"items\"].each do |toy|\n\t\ttoy_name toy\n print_toy_name\n\t\ttoy_full_price toy\n\t print_toy_full_price\n \ttotal_purchases toy\n\t\tprint_total_purchases\n\t total_sales toy\n\t\tprint_total_sales\n \taverage_price toy\n\t\tprint_average_price\n \taverage_discount toy\n\t\tprint_average_discount\n\tend\nend", "def prepare_slider(element)\n renderables = []\n\n # The slider background\n renderables << create_rect_renderable(element.w, element.h, element_color)\n\n # Ensure the location of the cursor in the slider bar has been initialized\n element.cursor_pos ||= [element.x, element.y]\n\n # Determine the value of the slider and the position of its renderable\n slider_width = element.continuous ? self.slider_size : (element.w / element.values.size)\n slider_height = element.h\n\n slider_extremes = [slider_width / 2.0, element.w - (slider_width / 2.0)]\n total_slider = element.w - slider_width\n\n clamped_pos = [[element.cursor_pos[0].to_f, slider_extremes.min].max, slider_extremes.max].min\n position_ratio = (clamped_pos - slider_extremes.min) / total_slider\n\n if element.continuous\n value_range = element.values.max - element.values.min\n\n element.current_value = (value_range * position_ratio) + element.values.min\n else\n max_index = element.values.size - 1\n current_index = (max_index * position_ratio).round\n position_ratio = (current_index.to_f / max_index)\n\n element.current_value = element.values[current_index]\n end\n\n # The slider bar\n slider_pos = [(total_slider * position_ratio).to_i, 0]\n renderables << create_offset_rect_renderable(slider_width, slider_height, slider_pos[0], slider_pos[1], element_color)\n renderables.concat(create_border(slider_pos[0], slider_pos[1], slider_width, slider_height))\n\n # Add the slider extrema value labels\n add_left_aligned_text(element, element.values.min.to_s) if element.current_value != element.values.min\n add_right_aligned_text(element, element.values.max.to_s) if element.current_value != element.values.max\n add_text_at(element, slider_pos[0], slider_pos[1], slider_width, element.h, element.current_value.to_s)\n\n element.add_renderables(renderables)\n end", "def set_slide\n @slide = @presentation.slides.friendly.find(params[:id]) \n end", "def create_world\r\n count = 1\r\n @height.times do |j|\r\n @width.times do |i|\r\n\t #this creates half water and half earth positions\r\n\t create_position(\"water\", i + 1, j + 1) if (count <= ((@width*@height) / 2))\r\n\t\tcreate_position(\"earth\", i + 1, j + 1) if (count > ((@width*@height) / 2))\r\n\t\t#create_position(\"earth\", i + 1, j + 1)\r\n\t\tcount += 1\r\n end\r\n end\r\n\tif @log == true\r\n\t @logger.write \"created world\"\r\n\tend\r\n end", "def prepare\n puts \"Preparing #{@date.to_s}\"\n @graphic = ImageList.new\n \n #set background color\n bg_color = @color_scheme['main']\n @graphic.new_image(@calendar.width, @calendar.height) { self.background_color = bg_color }\n \n #add cloud background\n cloud = @graphic.read('cloud.png')\n \n #add daily tasks\n everyday_tasks\n dot\n weekly_task\n dot\n todos\n dot\n \n #add the date at the top\n date_header\n dot\n \n #add the special event\n special_event\n dot\n end", "def build_lean(entities,r,t)\n\n\n\n lean_group = entities.add_group\n\n lean_group.entities.add_dimension_linear([0,0,0],[0,$lean_length,0], [-30,0,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n lean_group.entities.add_dimension_linear([0,0,0],[$lean_width,0,0], [0,-60,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n lean_group.entities.add_text(\"Lean-to\", [$lean_width/2,$lean_length/2,-2])\n\n\n o = Geom::Point3d.new(-$lean_overjet,-$lean_overhang,$lean_height-$lean_overhang*$lean_pitch/12)\n h = Geom::Vector3d.new(0,$lean_length+$lean_overhang, ($lean_length+$lean_overhang)*$lean_pitch/12)\n f = Geom::Vector3d.new(0,0,$facia)\n v = Geom::Vector3d.new($lean_width+2*$lean_overjet,0,0)\n p1 = o\n p2 = o + v\n p3 = o + v + h\n p4 = o + h\n p5 = o + f\n p6 = o + f + v\n p7 = o + f + v + h\n p8 = o + f + h\n\n lean_group.entities.add_face(p5,p6,p7,p8).material = $roofColor\n lean_group.entities.add_face(p1,p4,p8,p5).material = $faciaColor\n lean_group.entities.add_face(p2,p3,p7,p6).material = $faciaColor\n lean_group.entities.add_face(p1,p2,p6,p5).material = $faciaColor\n lean_group.entities.add_face(p1,p2,p3,p4)\n\n lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,-$lean_overhang,0])\n lean_group.entities.add_cline([$lean_width+$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,$lean_length,0])\n lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[-$lean_overjet,$lean_length,0])\n\n\n if($lean_wall[0] == 1)\n pl1 = [$lean_width, 0, 0]\n pl2 = [$lean_width, $lean_length,0]\n pl3 = [$lean_width,$lean_length,$lean_height+$lean_length*$lean_pitch/12]\n pl4 = [$lean_width,0,$lean_height]\n lean_group.entities.add_face(pl1,pl2,pl3,pl4).material = $wallColor\n end\n\n if($lean_wall[1] == 1)\n pm1 = [$lean_width,0,0]\n pm2 = [0,0,0]\n pm3 = [0,0,$lean_height]\n pm4 = [$lean_width,0,$lean_height]\n a = lean_group.entities.add_face(pm1,pm2,pm3,pm4)\n a.back_material = $wallColor\n a.material = $wallColor\n end\n\n\n p = 6\n if($lean_wall[1] >= 2)\n c = 7\n #$lean_width = $lean_width-2*$lean_overhang\n lean_group.entities.add_face([0,$lean_length,0],[0,0,0],[$lean_width,0,0],[$lean_width,$lean_length,0],[$lean_width-c,$lean_length,0],[$lean_width-c,c,0],[c,c,0],[c,$lean_length,0],[0,$lean_length,0]).pushpull -3\n lean_group.entities.add_line([0,$lean_length,0],[c,$lean_length,0]).faces[0].erase!\n\n n = $lean_wall[1] \n # entities.add_face([0,0,0,],[0,p,0],[p,p,0],[p,0,0]).pushpull -$lean_height-$facia\n # entities.add_face([$lean_width,0,0],[$lean_width,p,0],[$lean_width-p,p,0],[$lean_width-p,0,0])\n d = ($lean_width - p*n)/(n-2+1)\n for i in 0..n-1 \n a = lean_group.entities.add_face([i*(p+d),0,0,],[i*(p+d),p,0],[i*(p+d)+p,p,0],[i*(p+d)+p,0,0])\n end\n d = $lean_width/(n-1)\n if n>2\n for i in 0..n-2\n lean_group.entities.add_dimension_linear([i*d,0,0],[(i+1)*d,0,0], [0,-30,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n end\n end\n\n \n\n\n\n end\n\n if($lean_wall[2] == 1)\n pr1 = [0,0,0]\n pr2 = [0,$lean_length,0]\n pr3 = [0,$lean_length,$lean_height+$lean_length*$lean_pitch/12]\n pr4 = [0,0,$lean_height]\n lean_group.entities.add_face(pr1,pr2,pr3,pr4).back_material = $wallColor\n end\n\n entities.transform_entities r, lean_group\n entities.transform_entities t, lean_group\n \nend", "def slider_params\n params.require(:slider).permit(:position, :slidetube, :slide_cache, :slide, :caption1, :caption2, :slider, :ssilka, :slider_cache, :remove_slider, :crop_x, :crop_y, :crop_w, :crop_h)\n end", "def slides=(v) Axlsx.validate_int v; @slides = v; end", "def render(slide)\n send(\"render_#{slide[1]}\", slide[0]) if slide[0] =~ /\\S/\nend", "def create\n @slide = Slide.new(params[:slide])\n\n # If we're creating a new slide from the slideshow editing page, add the\n # slide to the slideshow and then redirect to the slideshow edit screen.\n @slide.slideshows << (@slideshow = Slideshow.find(params[:slideshow_id])) if params[:slideshow_id]\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to (@slideshow ? edit_slideshow_path(@slideshow) : @slide), notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_circles(num)\n circle_image = circle_image()\n circles = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_circle(1.0, 10,10, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(SCREEN_WIDTH), rand(40) - 50)\n shape = CP::Shape::Circle.new(body, 10, CP::Vec2.new(0, 0))\n shape.e = 0.4\n shape.u = 0.4\n circles << AObject.new(circle_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return circles\n end", "def create_temp_holdings_for_processing(rec)\n # init_holdings is a hash of the parameters needed to create a\n # HoldingsRecord object.\n # Initially we set the first 4, which come from 999 92s\n init_holdings = {}\n occ = 0\n Traject::MarcExtractor.cached(\"999|92|\").each_matching_line(rec) do |field, spec, extractor|\n id = field['a']\n loc = field['b']\n next if loc.start_with?('e')\n ct = field['c']\n occ = occ += 1\n\n init_holdings[id] = [id, loc, ct, occ]\n end\n\n if init_holdings.length > 0\n # field_hash\n # key = holdings record id\n # value = array of MARC::DataFields created from 999 93s determined to\n # be relevant to subsequent display/processing\n field_hash = {}\n \n Traject::MarcExtractor.cached(\"999|93|\").each_matching_line(rec) do |field, spec, extractor|\n recid = field['0']\n\n df = new_data_field(field) if \n ( field['2'] == '852' && field['3'] == 'c' ) ||\n ( field['2'] =~ /85[345]/ && field['3'] == 'y' ) ||\n ( field['2'] =~ /86./ && field['3'] == 'h' )\n\n if df\n if field_hash.has_key?(recid)\n field_hash[recid] << df\n else\n field_hash[recid] = [df]\n end\n end\n end\n\n # field_hash values are appended to the relevant parameter array of init_holdings\n field_hash.each { |k, v| init_holdings[k] << v if init_holdings[k] }\n\n # create new HoldingsRecord object \n holdings_array = []\n init_holdings.each_value do |hdata|\n # if there are no relevant variable fields, we don't need to output holdings data\n if hdata.size == 5\n holdings_array << HoldingsRecord.new(hdata[0], hdata[1], hdata[2],\n hdata[3], hdata[4]) \n end\n end\n\n # make sure they are in ILS order\n return holdings_array.sort_by { |h| h.occ }\n end\n end", "def create\n @page_slide = Slide.new(params[:page_slide])\n\n respond_to do |format|\n if @page_slide.save\n format.html { redirect_to @page_slide, notice: 'Slide was successfully created.' }\n format.json { render json: @page_slide, status: :created, location: @page_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def partial_slide(step)\n [start_pos[0] + move_dir[0] * step, start_pos[1] + move_dir[1] * step]\n end", "def create_drops\n drops = []\n @number_of_drop_points.times do\n number_in_this_drop = rand(@max_particles - @min_particles) +\n @min_particles\n drops.push(Array.new(number_in_this_drop,\n Particle.new(@particle_stability_radius)))\n end\n\n drops\n end", "def create\n\n @pslide = Pslide.new(params[:pslide])\n markup_hash=Hash.new\n @pslide.markup=markup_hash\n\n respond_to do |format|\n if @pslide.save\n if params[:prez_id]\n @prez = Presentation.find(params[:prez_id])\n @prezpslide=PresentationsPslide.new\n if @lastsno=PresentationsPslide.find_last_by_presentation_id(@prez.id)\n @sno=@lastsno.sequence_number.to_i + 1\n else\n @sno=1\n end\n\n @prezpslide.presentation_id=@prez.id\n @prezpslide.pslide_id=@pslide.id\n @prezpslide.sequence_number=@sno\n @prezpslide.save\n\n format.html { redirect_to \"/#{@prez.name}/pslides/#{@pslide.id}\", notice: 'Pslide was successfully created.' }\n format.json { render json: @pslide, status: :created, location: @pslide }\n else\n format.html { redirect_to @pslide, notice: 'Pslide was successfully created.' }\n format.json { render json: @pslide, status: :created, location: @pslide }\n end\n else\n format.html { render view_presentation_path(@prez), notice: 'Pick a Ptemplate the next time' }\n format.json { render json: @pslide.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_slide\n @slide = Slide.find(params[:id])\n end", "def set_slide\n @slide = Slide.find(params[:id])\n end", "def set_slide\n @slide = Slide.find(params[:id])\n end", "def set_slide\n @slide = Slide.find(params[:id])\n end", "def set_slide\n @slide = Slide.find(params[:id])\n end", "def index\n @slides = Slide.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end", "def store_images #:nodoc:\n record = 0x00EC # Record identifier\n length = 0x0000 # Bytes to follow\n\n ids = @object_ids.dup\n spid = ids.shift\n\n images = @images_array\n num_images = images.size\n\n num_filters = @filter_count\n num_comments = @comments_array.size\n num_charts = @charts_array.size\n\n # Skip this if there aren't any images.\n return if num_images == 0\n\n (0 .. num_images-1).each do |i|\n row = images[i][0]\n col = images[i][1]\n name = images[i][2]\n x_offset = images[i][3]\n y_offset = images[i][4]\n scale_x = images[i][5]\n scale_y = images[i][6]\n image_id = images[i][7]\n type = images[i][8]\n width = images[i][9]\n height = images[i][10]\n\n width = width * scale_x unless scale_x == 0\n height = height * scale_y unless scale_y == 0\n\n # Calculate the positions of image object.\n vertices = position_object(col,row,x_offset,y_offset,width,height)\n\n if (i == 0)\n # Write the parent MSODRAWIING record.\n dg_length = 156 + 84*(num_images -1)\n spgr_length = 132 + 84*(num_images -1)\n\n dg_length += 120 * num_charts\n spgr_length += 120 * num_charts\n\n dg_length += 96 * num_filters\n spgr_length += 96 * num_filters\n\n dg_length += 128 * num_comments\n spgr_length += 128 * num_comments\n\n data = store_mso_dg_container(dg_length) +\n store_mso_dg(*ids) +\n store_mso_spgr_container(spgr_length) +\n store_mso_sp_container(40) +\n store_mso_spgr() +\n store_mso_sp(0x0, spid, 0x0005)\n spid = spid + 1\n data = data +\n store_mso_sp_container(76) +\n store_mso_sp(75, spid, 0x0A00)\n spid = spid + 1\n data = data +\n store_mso_opt_image(image_id) +\n store_mso_client_anchor(2, *vertices) +\n store_mso_client_data()\n else\n # Write the child MSODRAWIING record.\n data = store_mso_sp_container(76) +\n store_mso_sp(75, spid, 0x0A00)\n spid = spid + 1\n data = data +\n store_mso_opt_image(image_id) +\n store_mso_client_anchor(2, *vertices) +\n store_mso_client_data\n end\n length = data.length\n header = [record, length].pack(\"vv\")\n append(header, data)\n\n store_obj_image(i+1)\n end\n\n @object_ids[0] = spid\n end", "def set_slide\n @slide = Slide.nondraft.find(params[:id])\n end", "def index\n @slides = Slide.all\n end", "def slide_params\n params.require(:slide).permit(:title, :header, :number, :body, :presentation_id)\n end", "def init_pos\n reset_board_variables\n colors = {:white => 0, :black => 7}\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\n # set pieces \n colors.each do |k_col, v_col|\n # iterate each color\n key_color_array = key_pieces[k_col]\n pieces.each do |k_pie, v_pie|\n # iterate each piece\n v_pie.each do |ix_piece|\n #p v_col, ix_piece, k_pie, k_col\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[v_col][ix_piece] \n end\n end#end pieces\n \n # now set pawn for this color\n ix_col = 1\n ix_col = 6 if k_col == :black\n [0,1,2,3,4,5,6,7].each do |ix_piece|\n #p ix_col, ix_piece\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \n end\n end \n #p @pieces\n #p @infosquare\n #p @pieces.size\n #p @pieces[:white].first\n end", "def init_pos\r\n reset_board_variables\r\n colors = {:white => 0, :black => 7}\r\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\r\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\r\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\r\n # set pieces \r\n colors.each do |k_col, v_col|\r\n # iterate each color\r\n key_color_array = key_pieces[k_col]\r\n pieces.each do |k_pie, v_pie|\r\n # iterate each piece\r\n v_pie.each do |ix_piece|\r\n #p v_col, ix_piece, k_pie, k_col\r\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[v_col][ix_piece] \r\n end\r\n end#end pieces\r\n \r\n # now set pawn for this color\r\n ix_col = 1\r\n ix_col = 6 if k_col == :black\r\n [0,1,2,3,4,5,6,7].each do |ix_piece|\r\n #p ix_col, ix_piece\r\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \r\n end\r\n end \r\n #p @pieces\r\n #p @infosquare\r\n #p @pieces.size\r\n #p @pieces[:white].first\r\n end", "def index\n\n\n #@link_arr= []\n #(1..2).each do |i|\n # Five00px.new.five_px(i)\n # end\n @image = Unlimited.skip(rand(Unlimited.count)).first\n\n end", "def setup\n size 640, 300, P3D\n @lens_d = 160\n @lens_list = []\n @xx, @yy, @dx, @dy = 0, 0, 3, 3\n \n # Create buffered image for lens effect.\n @lens_effect = create_graphics(width, height, P2D)\n \n # Load background image.\n @lens_effect.begin_draw\n @lens_effect.image(load_image('red_smoke.jpg'), 0, 0, width, height)\n @lens_effect.end_draw\n image(@lens_effect, 0, 0, width, height)\n \n # Create buffered image for warping.\n @lens_image = create_graphics(@lens_d, @lens_d, P2D)\n @lens_image2 = create_graphics(@lens_d, @lens_d, P2D)\n \n compute_lens_transformation\nend", "def stories_page\n @stories_page = DefaultAd.find(2) \n @stories_page_left_top = DefaultAd.find(3) \n @stories_page_left_bottom = DefaultAd.find(4) \n @stories_page_right = DefaultAd.find(5) \nend", "def GenMountingHole(name) \n drilldia = GetScaledDrillDia()\n if drilldia < 1000 # 10 mil\n print \"GenMountingHole(#{name}): Drilldia too small!\\n\"\n end\n paddia = GetDim('pad-dia')\n silkdia = GetDim('silk-dia')\n if (silkdia != 0) and (silkdia < drilldia)\n silkdia = -1\n silkwidth = 0\n else\n silkwidth = GetDim('silkwidth')\n end\n if silkdia == 0\n silkoffset = GetDim('silkoffset')\n silkdia = [paddia, drilldia].max + 2 * silkoffset + silkwidth\n end\n tx = - [paddia, drilldia, silkdia + silkwidth].max / 2.0\n ty = tx - (PCB_DefaultTextSize + RefdesToSilkOffset) * GetCnt('refdessize')\n r = GenElementHeader(tx, ty, 0) + \"(\\n\"\n if paddia <= drilldia\n r += GenPin(0, 0, drilldia, drilldia, '', '', 'hole')\n else\n minpaddia = drilldia + 2000 # make pad of pin 20mil larger than drill to ensure minimal anular ring \n r += GenPin(0, 0, minpaddia, drilldia, 1, 1, '')\n if minpaddia < paddia \n r += PcbSmartPad(0, 0, 0, 0, paddia, 1, 1, '')\n r += PcbSmartPad(0, 0, 0, 0, paddia, 1, 1, 'onsolder')\n end\n end\n if silkdia > 0\n r += GenSilkArc(0, 0, silkdia / 2.0, silkdia / 2.0, 0, 360)\n end\n r += GenAttributes() + \")\\n\"\n WriteElementToFile(r, name)\nend", "def how_to_render_solids args\n # Render a square at 0, 0 with a width and height of 1\n args.nokia.solids << { x: 0, y: 0, w: 1, h: 1 }\n\n # Render a square at 1, 1 with a width and height of 2\n args.nokia.solids << { x: 1, y: 1, w: 2, h: 2 }\n\n # Render a square at 3, 3 with a width and height of 3\n args.nokia.solids << { x: 3, y: 3, w: 3, h: 3 }\n\n # Render a square at 6, 6 with a width and height of 4\n args.nokia.solids << { x: 6, y: 6, w: 4, h: 4 }\nend", "def verts(photos, name: \"Vert Aware\")\n # Let's say that we ahve only vertical ones.\n # Can we try a dumb way to see if we get anything better?\n # If s1 is large but s2 and s3 are small in a transition\n # then adding a vertical photo that has a large s2,s3 is optimal\n # how do we find that?\n\n # Is there some useful heuristic about having common and rare tags?\n slides = []\n\n tag_average = 0\n\n tag_count = 0\n\n photos.each do |photo|\n tag_count += photo.tags.size\n end\n\n included = {}\n\n tag_average = tag_count / photos.size\n tag_min = (tag_average / 3) * 2\n\n shorties = []\n photos.each do |photo|\n if photo.vertical? && photo.tags.size <= tag_min\n shorties << photo\n included[photo] = true\n end\n end\n\n index = 0\n while index < shorties.size\n p1 = shorties[index]\n p2 = shorties[index + 1]\n\n photo_array = [p1]\n\n if p2 != nil\n photo_array << p2\n end\n\n slides << Slide.new(photo_array)\n index += 2\n end\n\n photos.each do |photo|\n if !included.key?(photo)\n slides << Slide.new([photo])\n end\n end\n\n # We may need to break score down into a smaller piece\n\n # Find vertical photos on their own slide with low transition scores for slides before and after\n\n # Then extract those photos\n # Then add those to other slides where they can do good?\n\n # One of the general issues that we're having is that we don't\n # know if putting it there is gogin to be helpful before putting it there\n # Let's find the ideal place to put it before inserting it?\n\n # Seed by using another realtiveyl fast approach?\n\n SlideShow.new(slides: slides, name: name)\n end", "def create\n\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(width = 6, height = 7)\n @width = width\n @height = height \n \n @last_insert_x = 0\n @last_insert_y = 0\n @game_started = false\n\t\n @assignment = Array.new width\n\n width.times do |x|\n @assignment[x] = Array.new height\n end\n end", "def draw_data\n\n # Set font.\n font = \"SF Mono\"\n color = '000000'\n\n # Format dates.\n ship_date = Time.iso8601(@data[:date]).strftime(\"%m/%d/%y\")\n\n # Repeat format on all pages.\n self.repeat(:all) do\n\n # Carrier, shipper #s, and date.\n self.txtb(@data[:carrier], 1.171, 8.55 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:shipper], 6.75, 8.75 + 10.pt, 6.65, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(ship_date, 6.75, 8.55 + 10.pt, 6.65, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n\n # Ship to.\n if @data[:ship_to][:name].length == 2\n self.txtb(@data[:ship_to][:name][0], 1.006, 8.35 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:ship_to][:name][1], 1.006, 8.175 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n else\n self.txtb(@data[:ship_to][:name][0], 1.006, 8.175 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n end\n self.txtb(@data[:ship_to][:address], 1.006, 8 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:ship_to][:city_state], 1.006, 7.825 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:ship_to][:zip].to_s.rjust(5, '0'), 3.65, 7.825 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n\n # Ship from.\n self.txtb(@data[:initials], 7.65, 7.825 + 10.pt, 4, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n\n # Table.\n y = 7.1 + 10.pt\n 0.upto(8) do |i|\n self.txtb(@data[:units][i], 0.25, y, 1.25, 10.pt, size: 10, style: :bold, font: font, color: color) unless @data[:units][i] == 0\n self.txtb(@data[:hazardous][i], 1.5, y, 0.4, 10.pt, size: 10, style: :bold, font: font, color: color)\n self.txtb(@data[:descriptions][i], 1.95, y, 3.25, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:weights][i], 5.25, y, 1.25, 10.pt, size: 10, style: :bold, font: font, color: color)\n self.txtb(@data[:rates][i], 6.5, y, 0.6, 10.pt, size: 10, style: :bold, font: font, color: color)\n y -= 0.193\n end\n\n # Draw special instructions.\n self.txtb(@data[:special_instructions][0], 0.35, 3.67 + 10.pt, 7.8, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:special_instructions][1], 0.35, 3.5325 + 10.pt, 7.8, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(@data[:special_instructions][2], 0.35, 3.395 + 10.pt, 7.8, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n\n # Check box for collect.\n self.txtb(\"XX\", 7.377, 1.81 + 10.pt, 0.2, 0.2, size: 10, style: :bold, font: font, color: color) if @data[:collect]\n\n # Draw certification info.\n self.txtb(@data[:carrier], 4.95, 0.725 + 10.pt, 5, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n self.txtb(ship_date, 6.8, 0.575 + 10.pt, 5, 10.pt, size: 10, style: :bold, h_align: :left, font: font, color: color)\n\n # Draw signatures.\n if @data[:auto_sign]\n person = nil\n case @data[:user]\n when \"TERRY\"\n person = :terry_marshall\n when \"ROB\"\n person = :rob_caudill\n when \"TIM\"\n person = :tim_hudson\n when \"MITCH\"\n person = :mike_mitchell\n when \"CAP\"\n person = :gerald_cappelletti\n when \"DALLAS\"\n person = :dallas_roll\n when \"JAMES\"\n person = :james_hill\n end\n unless person.blank?\n self.signature(person, 4.35, 2.425, 2.05, 0.5)\n self.signature(person, 0.95, 0.8, 2.05, 0.25, h_align: :left)\n end\n end\n\n end\n\n end" ]
[ "0.56264323", "0.5537628", "0.5499458", "0.5494283", "0.54865897", "0.5468836", "0.54459476", "0.5443129", "0.53674376", "0.5361608", "0.531582", "0.530355", "0.52933854", "0.529307", "0.5272554", "0.5244953", "0.5215592", "0.52049714", "0.51958513", "0.51925784", "0.51759756", "0.5175183", "0.51623094", "0.5128286", "0.512483", "0.512483", "0.5104992", "0.5095492", "0.5094727", "0.508279", "0.50600606", "0.50578386", "0.50562656", "0.5047434", "0.5044616", "0.5036921", "0.5020348", "0.5008503", "0.5008124", "0.5004627", "0.5000433", "0.4999806", "0.49921274", "0.49711603", "0.49692607", "0.49672934", "0.49638402", "0.49637216", "0.49585405", "0.4950264", "0.49470562", "0.49467063", "0.49446833", "0.49428934", "0.49334848", "0.49281725", "0.492668", "0.49208862", "0.49193734", "0.49157813", "0.49153", "0.4911025", "0.49080524", "0.49032494", "0.48922324", "0.48917755", "0.48901814", "0.4885817", "0.4879403", "0.48766935", "0.48668346", "0.48634484", "0.48524633", "0.4849329", "0.48469675", "0.48460236", "0.48435724", "0.4843379", "0.4839", "0.4838891", "0.4837152", "0.4837152", "0.4837152", "0.4837152", "0.4837152", "0.483359", "0.48330334", "0.48306474", "0.4811464", "0.48068154", "0.48050785", "0.48016113", "0.47904366", "0.4785491", "0.477233", "0.47722068", "0.47706866", "0.47706255", "0.47696218", "0.47667512", "0.47586364" ]
0.0
-1
Valid coordinates to moves to follow a simple calculation added to the puzzle input. It is then convered to binary, if this value contains an even number of 1s then the move is valid
def valid(x, y) return false if x < 0 || y < 0 i = x*x + 3*x + 2*x*y + y + y*y + $input i.to_s(2).chars.count{|z| z == '1'}.even? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(board, position) == true\n return false\nelse \n return false\nend\nend", "def valid_move?(board, input)\n position = (input.to_i)-1\n if (position.between?(0,8))\n return !(position_taken?(board, position))\n else\n return false\n end\nend", "def valid_move?(position)\n position = position.to_i - 1\n if position_taken?(position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(position) == true\n return false\nelse \n return false\nend\nend", "def valid_move?(board,user_input)\n taken = position_taken?(board,user_input)\n valid_input = user_input.between?(0,8)\n valid_move = nil\n if(taken)\n valid_move = false\n else\n valid_move = true\n end\n if(valid_move && valid_input)\n true\n else\n false\n end\nend", "def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend", "def movement_validation(player_mov)\n\t\tcorrect_mov = []\n\t\tpiece_movs = {\n\t\t\t\"king\" => [[0,1], [1,1], [1,0], [1,-1], [0,-1], [-1,-1], [-1,0], [-1,1]],\n\t\t\t\"knight\" => [[-2,1], [-2,-1], [-1,-2], [1,-2], [2,-1], [2,1], [1,2], [-1,2]],\n\t\t\t\"rook\" => [[0,1], [1,0], [0,-1], [-1,0]],\n\t\t\t\"bishop\" => [[1,1], [1,-1], [-1,-1], [-1,1]],\n\t\t\t\"queen\" => [[0,1], [1,1], [1,0], [1,-1], [0,-1], [-1,-1], [-1,0], [-1,1]],\n\t\t\t\"pawn\" =>\t[[0,1], [0,-1], [1,1], [-1,1], [1,-1], [-1,-1], [0,2], [0,-2]]\n\t\t}\n\t\t\n\t\t#if the final move equals to one of the moves of the king or knight pieces.\n\t\tif [\"king\", \"knight\"].include?(@piece_name)\n\t\t\t#iterates through each basic move of the corresponding piece.\n\t\t\tpiece_movs[@piece_name].each do |mov|\n\t\t\t\t#if the final node color is nil or different from the start node color.\n\t\t\t\tif mov == player_mov && (@final_node.color != @current_player.color || @final_node.color == nil)\n\t\t\t\t\treturn true\n\t\t\t\t#if check analysis is in progress, the final node color equals to the current player color and the final node name is king.\n\t\t\t\telsif (mov == player_mov && @check_on_curse == true) && (@final_node.color == @current_player.color && @final_node.name == \"king\") \n\t\t\t\t\treturn true\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t#if the final move equals to one of the moves of the rook, bishop or queen pieces.\n\t\telsif [\"rook\", \"bishop\", \"queen\"].include?(@piece_name)\n\t\t\t#iterates through each basic move of the corresponding piece.\n\t\t\tpiece_movs[@piece_name].each do |mov|\n\t\t\t\t#iterates through number 1 to 7 multiplying the basics pieces moves and saving it.\n\t\t\t\t(1..7).each do |num|\n\t\t\t\t\titeration = [mov[0]*num, mov[1]*num]\n\t\t\t\t\t#if the final move equals to multiplication of a basic move by a certain number and the way to the destination square is clear.\n\t\t\t\t\tif iteration == player_mov && cleared_way?(mov) == true\t\t\t\n\t\t\t\t\t\treturn true\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t#if start node name is a pawn piece.\n\t\telsif @piece_name == \"pawn\"\n\t\t\t#one positive rank move from a white piece to a nil node.\n\t\t\tif piece_movs[\"pawn\"][0].include?(player_mov) && (@final_node.color == nil && @start_node.color == \"white\")\n\t\t\t\treturn true\n\t\t\t#one negative rank move from a black piece to a nil code.\n\t\t\telsif piece_movs[\"pawn\"][1].include?(player_mov) && (@final_node.color == nil && @start_node.color == \"black\")\n\t\t\t\treturn true\t\n\t\t\t#a positive diagonal move from a white piece to a node of the opponent color.\t\n\t\t\telsif (piece_movs[\"pawn\"][2..3].include?(player_mov) && @start_node.color == \"white\") && (@final_node.color != @current_player.color && @final_node.color != nil)\n\t\t\t\treturn true\t\n\t\t\t#a negative diagonal move from a black piece to a node of the opponent color.\n\t\t\telsif (piece_movs[\"pawn\"][4..5].include?(player_mov) && @start_node.color == \"black\") && (@final_node.color != @current_player.color && @final_node.color != nil)\n\t\t\t\treturn true\n\t\t\t#a double positive rank move from a white piece on rank 2 position to a nil color node.\n\t\t\telsif (piece_movs[\"pawn\"][6] == player_mov && @final_node.color == nil) && (@start_node.color == \"white\" && @first_coord_convertion[1] == \"2\")\n\t\t\t\treturn true\n\t\t\t#a double negative rank move from a black piece on rank 7 position to a nil color node.\n\t\t\telsif (piece_movs[\"pawn\"][7] == player_mov && @final_node.color == nil) && (@start_node.color == \"black\" && @first_coord_convertion[1] == \"7\")\n\t\t\t\treturn true\t\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def valid_move?(board, position)\n position = position.to_i - 1\n position_taken?(board, position) == false && position.between?(0,8) == true\nend", "def valid_move?(input)\n (0..8).include?(input) && !position_taken?(input)\n end", "def valid_move?(arr)\n arr[0] >= 0 && arr[0] <= 7 && arr[1] >= 0 && arr[1] <= 7 && @board[arr[0]][arr[1]][:piece].nil?\n end", "def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end", "def valid_move?(board,index)\n# The user_input was accepted, converted to an integer and reduced by 1 in #input_to_index. Now you are testing to make sure\n# that the value of the index is within the confines of the board array whose elements are 0-8. It also requires NOT #position_taken\n# which means that the test that was done in position_taken which resulted in TRUE is turned into a NOT by using !position_taken\nif index .between?(0,8) && !position_taken?(board,index)\n true\nend\n\nend", "def valid_move?\n board[selection.first][selection.last].is_a? Fixnum\n end", "def valid_move?(board, i)\n i.integer? &&\n i <= 8 && i >= 0 &&\n !position_taken?(board, i)\nend", "def valid_move?(input)\ninput.to_i.between?(1,9) && !position_taken?(input.to_i-1)\nend", "def valid_move?(board, position)\n if position_taken?(board, position) == false && position.to_i.between?(0,8)\n true\n else\n false\n end\n end", "def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n\nend", "def valid_moves\n\n end", "def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend", "def valid_move?(board, position)\n position = position.to_i\n if(position.between?(1,9))\n position -=1\n if(position_taken?(board, position))\n false\n else\n true\n end\n end\nend", "def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend", "def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend", "def valid_move?(board, new_index)\n if 8 < new_index || new_index < 0\n return false\n elsif position_taken?(board, new_index) == true\n return false\n else\n return true\n end\nend", "def validate_player_move(move)\r\n \r\n #Return a value of false is the square has already been\r\n #selected\r\n return false if move == \"A1\" && $A1 != \" \"\r\n return false if move == \"B1\" && $B1 != \" \"\r\n return false if move == \"C1\" && $C1 != \" \"\r\n return false if move == \"A2\" && $A2 != \" \"\r\n return false if move == \"B2\" && $B2 != \" \"\r\n return false if move == \"C2\" && $C2 != \" \"\r\n return false if move == \"A3\" && $A3 != \" \"\r\n return false if move == \"B3\" && $B3 != \" \"\r\n return false if move == \"C3\" && $C3 != \" \" \r\n \r\n #Return a value of true if the square is available\r\n return true\r\n \r\n end", "def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend", "def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end", "def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend", "def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend", "def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend", "def valid_move(start, stop, board)\r\n x_diff = (stop[0] - start[0]).abs\r\n y_diff = (stop[1] - start[1]).abs\r\n return true if (x_diff == 0 || x_diff == 1) && (y_diff == 0 || y_diff ==1)\r\n return false\r\n end", "def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend", "def valid_move?(new_x, new_y)\n true\n end", "def valid_move?( board, position )\n position_int = position.to_i\n position_ary = position_int - 1\n if !(position_taken?( board, position_ary )) && position_ary.between?( 0, 8 )\n true\n else\n false\n end\nend", "def valid_move?( board, position )\n position_int = position.to_i\n position_ary = position_int - 1\n if !(position_taken?( board, position_ary )) && position_ary.between?( 0, 8 )\n true\n else\n false\n end\nend", "def valid_black_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if black_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x-1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y+1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y-1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n return false\n end", "def valid_move?(board,position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=board.length && !position_taken?(board,position))\n return true\n end\n return false\nend", "def valid_move?(number_entered, board)\n number_entered.between?(0, 8) && !(position_taken?(board, number_entered))\nend", "def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend", "def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend", "def valid_move?(board, i)\n if board[i.to_i-1] == \"X\" || board[i.to_i-1] == \"O\" || i.to_i < 1 || i.to_i > 9\n valid = false\n else\n valid = true\n end\nend", "def valid_input?(move)\n if move.length == 2\n return move.all? do |pos| \n if pos.length == 2 \n return (\"a\"..\"h\").include?(pos[0]) && (\"1\"..\"8\").include?(pos[1])\n end\n false\n end\n end\n false\n end", "def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend", "def is_valid_move?(proposed_row, proposed_col, solution)\n return true\nend", "def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend", "def valid_move?(board, position)\n index = position.to_i\n if position_taken?(board, index) == false && index.between?(0, 8)\n return true\n else\n return false\n end\nend", "def obstructed?(current_pos,other_pos,board)\n # debugger\n tester = other_pos\n # puts tester\n # sleep 2\n\n #\n # (-1..1).each do |i|\n # (-1..1).each do |j|\n\n\n if other_pos[0] > current_pos[0] #New position is below us\n if other_pos[1] > current_pos[1] #new position is on our right--bishop move\n tester[0] -= 1\n tester[1] -= 1\n until tester == current_pos\n # puts board.grid[tester[0]][tester[1]]\n # puts !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n # sleep 2\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n # return false if the piece at tester is not a nul piece\n tester[0] -= 1\n tester[1] -= 1\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[0] -= 1\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n elsif other_pos[1] == current_pos[1] #new position is on our level horizontally\n until tester == current_pos\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n end\n\n elsif other_pos[0] < current_pos[0] #New position is above us\n if other_pos[1] > current_pos[1] #new position is on our right\n until tester == current_pos\n tester[0] += 1\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[0] += 1\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n else #new position is on our level horizontally\n until tester == current_pos\n tester[0] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n end\n\n else #new position is at our level vertically\n if other_pos[1] > current_pos[1] #new position is on our right\n until tester == current_pos\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n end\n end\n\n return false if board.grid[other_pos[0]][other_pos[1]].color == self.color\n # puts \"hello\"\n # sleep(2)\n true\n\n end", "def valid_move?(cur_pos, next_pos)\n return false if @all_positions[next_pos] # no need to add already seen pos \n cur_col, cur_row = cur_pos\n next_col, next_row = next_pos\n bool_1 = (next_col - cur_col).abs == 2 && (next_row - cur_row).abs == 1\n bool_2 = (next_row - cur_row).abs == 2 && (next_col - cur_col).abs == 1\n bool_1 || bool_2\n end", "def cleared_way?(correct_mov)\n\t\t#loops while the start node coordinate is different from the final node coordinate.\n\t\twhile @start_coord != @final_coord\n\t\t\t#sums the start node coordinate with the basic move of the corresponding piece.\n\t\t\t@start_coord = [@start_coord[0] + correct_mov[0], @start_coord[1] + correct_mov[1]]\n\t\t\tx_new = \"\"\n\t\t\t#transform the Y axis of the coordinate into a string.\n\t\t\ty_new = @start_coord[1].to_s\n\t\t\t#transform the X axis of the coordinate back into a letter.\n\t\t\t@letter_convertion.each do |key, value|\n\t\t\t\tif @start_coord[0] == value\n\t\t\t\t\tx_new = key\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#saves the new translation coordinate following the syntax letter+number.\n\t\t\t@mov_translation = x_new + y_new\n\t\n\t\t\t#returns false if the node in the new coordinate is not nil and if it is different from the final node coordinate.\n\t\t\tif @board[@mov_translation].name != nil && @mov_translation != @second_coord_convertion\n\t\t\t\treturn false\n\t\t\t#if the destination node color is different from the current player color and the translation coordinate equals to the final node coordinate.\n\t\t\telsif @board[@mov_translation].color != @current_player.color && @mov_translation == @second_coord_convertion\n\t\t\t\treturn true\n\t\t\t#if the destination node color equals to the current player color, check analyzing is in progress and the node name of the translation coordinate equals to king.\n\t\t\telsif @board[@mov_translation].color == @current_player.color && (@board[@mov_translation].name == \"king\" && @check_on_curse == true)\n\t\t\t\treturn true\t\n\t\t\tend\t\t\n\t\tend\n\tend", "def is_valid_move x,y\n return false unless (0..3) === x\n return false unless (0..3) === y\n return @field[x][y].player == 0\n end", "def bishop_check(board, current, destination)\n tx = 0\n ty = 0\n ob = 0\n temp = nil\n if current[0] < destination[0] && current[1] < destination[1]\n tx = current[0] + 1\n ty = current[1] + 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty <= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx += 1\n ty += 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n elsif current[0] > destination[0] && current[1] < destination[1]\n tx = current[0] - 1\n ty = current[1] + 1\n array_to_check = [tx, ty]\n while tx >= destination[0] && ty <= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx -= 1\n ty += 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n elsif current[0] < destination[0] && current[1] > destination[1]\n tx = current[0] + 1\n ty = current[1] - 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty >= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx += 1\n ty -= 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n\n elsif current[0] > destination[0] && current[1] > destination[1]\n tx = current[0] - 1\n ty = current[1] - 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty >= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx -= 1\n ty -= 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n end\n board\nend", "def valid_move?(board, index)\nif position_taken?(board, index)\nreturn false\nelsif !index.between?(0, 8)\n return false\n else\n return true\n end\nend", "def validate\n\n if self[:from_coord].blank? && @possible_movers && @possible_movers.length > 1\n errors.add :notation, \"Ambiguous move #{notation}. Clarify as in Ngf3 or R2d4, for example\"\n return \n end\n\n if self[:notation] && ( self[:from_coord].blank? || self[:to_coord].blank? )\n errors.add :notation, \"The notation #{notation} doesn't specify a valid move\" and return \n end\n \n #ensure the validity of the coordinates we have whether specified or inferred\n [from_coord, to_coord].each do |coord|\n errors.add_to_base \"#{coord} is not a valid coordinate\" unless Chess.valid_position?( coord )\n end\n\n #verify allowability of the move\n \n errors.add_to_base \"No piece present at #{from_coord} on this board\" and return if !@piece_moving\n\n unless @piece_moving.allowed_moves(@board).include?( to_coord.to_sym ) \n errors.add_to_base \"#{@piece_moving.function} not allowed to move to #{to_coord}\" \n end\n\n #can not leave your king in check at end of a move\n #new_board= @board.consider_move( Move.new( :from_coord => from_coord, :to_coord => to_coord ) )\n #if new_board.in_check?( @piece_moving.side )\n # errors.add_to_base \"Can not place or leave one's own king in check - you may as well resign if you do that !\" \n #end\n\n end", "def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend", "def valid_white_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if white_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x-1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y+1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y-1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n return false\n end", "def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend", "def valid_move?(board, index)\n \nif position_taken?(board, index) === false && index.between?(0, 8)\n return true\nelse \n return false\nend\nend", "def valid_move?(board, posn_str, team = \"X\")\n posn = posn_str.to_i\n posn -= 1\n if ((posn.between?(0,8)) && !(position_taken?(board,posn)))\n return true\n else\n return false\n end\nend", "def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend", "def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend", "def valid_moves(pos)\n valid_moves = []\n long = [-2,2]\n short = [1,-1]\n valid_moves += valid_moves_helper(pos, long, short)\n valid_moves += valid_moves_helper(pos, short, long)\n end", "def valid_move?(board, index)\nif !(index.between?(0,8))\n return false\nelsif position_taken?(board, index)\n return false \nelse \n return true\n end\nend", "def check_for_optimal_move(mark_value)\n @board.all_valid_moves.each do |valid_move|\n @board.mark_square(valid_move[0],valid_move[1],mark_value)\n marked_square=[valid_move[0],valid_move[1]]\n if @board.winner?\n return mark_value\n elsif @board.tie?\n return 0\n else\n check_for_optimal_move(mark_value = -mark_value)\n end\n end\nend", "def valid_move?(a,i)\r\n if i.between?(0,8) && !position_taken?(a,i)\r\n true\r\n else\r\n false\r\n end\r\nend", "def valid_input?(user_input)\n #regex for valid input\n proper_format = /^[a-zA-Z][1-8] [a-zA-Z][1-8]$/ #Example: A1 B2 or c3 G4\n if proper_format.match(user_input)\n move = user_input.split(\" \")\n if move[0] == move[1] #if start and end position are the same\n puts \"Not a valid move! The start and end positions are the same!\"\n puts\n return false\n else #else check other cases\n start_pos = [move[0][1].to_i - 1, @@file_num[move[0][0]]]\n end_pos = [move[1][1].to_i - 1, @@file_num[move[1][0]]]\n if !@board[start_pos] #if nothing at start position\n puts \"There is no piece at #{move[0]}!\"\n puts\n return false\n else #return the move if it passes all other cases\n puts\n return [start_pos, end_pos]\n end\n end\n else\n puts\n puts \"Not a valid input!\"\n puts\n return false\n end\n end", "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend", "def valid_move?(board, i)\n # check if position taken or 'out-of-bounds'\n if (position_taken?(board, i) == true) || (i > 8) || (i < 0)\n return false\n else \n return true\n end \nend", "def valid?(move,visited)\n return true if (move[0]>-1 && move[0]<8) && (move[1]>-1 && move[0]<8) && (!visited[move[0]][move[1]])\n end", "def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end", "def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend", "def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend", "def valid_move(action)\n\n if ((action.to_i > 8) || (action.to_i < 0)) # chosen number must be valid (0-8)\n puts \"The number chosen must be between 0 and 8\"\n return false\n\n elsif\n @board[action.to_i] == \"E\" # if the square is empty return true (it is a valid choice)\n return true\n\n else\n puts \"The square chosen is not empty. Please make another choice.\"\n show_board\n return false\n\n end # end of if statement\n\n end", "def valid_move?(board,index)\n \n if position_taken?(board, index) == false && \n index.between?(0, 8) == true \n return true\n else \n false\n end\n \n \n\nend", "def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend", "def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend", "def valid_move?( board, index )\n\n if (index.between?(0,8) ) && ( position_taken?(board, index) == false )\n return true\n else\n return false\n end\n\nend", "def valid_move?(current_obj, next_obj, current_cell, test_cell)\n cc_row = current_cell[0]\n cc_col = current_cell[1]\n tc_row = test_cell[0]\n tc_col = test_cell[1]\n\n next_obj == current_obj &&\n cc_row == tc_row - 1 && cc_col == tc_col - 1 || \\\n cc_row == tc_row - 1 && cc_col == tc_col || \\\n cc_row == tc_row - 1 && cc_col == tc_col + 1 || \\\n cc_row == tc_row && cc_col == tc_col + 1 || \\\n cc_row == tc_row + 1 && cc_col == tc_col + 1 || \\\n cc_row == tc_row + 1 && cc_col == tc_col || \\\n cc_row == tc_row + 1 && cc_col == tc_col - 1 || \\\n cc_row == tc_row && cc_col == tc_col - 1 \n end", "def enpassant_square(move_square)\n\n adjust = 0\n if move_square[0] == 5\n adjust = -1\n elsif move_square[0] == 2\n adjust = 1\n else\n return false\n end\n \n enp_square = @board_obj.board[move_square[0] + adjust][move_square[1]]\n\n if defined?(enp_square.moved_two_squares) && (enp_square.moved_two_squares)\n return true\n else\n return false\n end\n\n end", "def valid_move?(board,index)\n if !position_taken?(board,index) && index >= 0 && index <=8\n return true\n else \n return false\n end\nend", "def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend", "def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend", "def valid_move?(board, index)\n position = index.to_i - 1\n if !position_taken? && position.between?(0-8)\n true\n else\n false\n end\nend", "def move_valid?(x, y)\n (0...@columns).cover?(x) && (0...@rows).cover?(y) && !@visited[x][y]\n end", "def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend", "def check_diagonal\n RulesContracts.classic_model(@game_state_model)\n # testing for bitboard errors\n # (0..7).each { |y|\n # (0..7).each { |x|\n # if @grid[y][x] == 1 and y <= 4 and x >= 3\n # puts \" #{x}/#{y} #{@grid[y][x]} || #{x-1}/#{y+1} #{@grid[y + 1][x - 1]} || #{x-2}/#{y+2} #{@grid[y + 2][x - 2]} || #{x-3}/#{y+3} #{@grid[y + 3][x - 3]}\"\n # puts \"#{@grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1}\"\n # end\n # }\n # }\n \n (0..7).each { |y|\n (0..7).each { |x|\n if y <= 4 and x <= 4\n if @grid[y][x] == 2 and @grid[y + 1][x + 1] == 2 and @grid[y + 2][x + 2] == 2 and @grid[y + 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x + 1] == 1 and @grid[y + 2][x + 2] == 1 and @grid[y + 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y <= 4 and x >= 3\n if @grid[y][x] == 2 and @grid[y + 1][x - 1] == 2 and @grid[y + 2][x - 2] == 2 and @grid[y + 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1\n @winner = 0\n return true\n end\n end\n if y >= 3 and x <= 4\n if @grid[y][x] == 2 and @grid[y - 1][x + 1] == 2 and @grid[y - 2][x + 2] == 2 and @grid[y - 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x + 1] == 1 and @grid[y - 2][x + 2] == 1 and @grid[y - 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y >= 3 and x >= 3\n \n if @grid[y][x] == 2 and @grid[y - 1][x - 1] == 2 and @grid[y - 2][x - 2] == 2 and @grid[y - 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x - 1] == 1 and @grid[y - 2][x - 2] == 1 and @grid[y - 3][x - 3] == 1\n @winner = 0\n return true\n end \n \n end \n }\n }\n return false\n end", "def valid_move?(board, i)\n if i.between?(0,8) && !position_taken?(board, i)\n true\n end\n end", "def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend", "def valid_move?(board, position)\n position = position.to_i\n \n if (position_taken?(board, position) ==false) && position.between?(1,9)\n return true\n else\n return false\n end\nend", "def valid_move?(input)\n (1..9).include?(input.to_i) && !taken?(input)\n end", "def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend", "def valid_move?(position) ### changed from index to position - ER 2017\n\n if (position > 9) || (position < 0) #if index (position on board entered by user) is greater than 9 or less than 0, return false\n false\n elsif position_taken?(position) ###otherwise, if position on board is taken, return false\n false\n else position.between?(0, 8) ###finally, if the position isn't taken, and the index (position on board entered by user) is between 0 and 8, return true\n true\n end # end if...elsif statements\n end", "def valid_move?(row, col, queens)\n # Go through each of the current valid moves\n queens.each do |q_pos|\n # Grab the coords\n q_row, q_col = q_pos\n\n # If the coords to be checked land on either the same col or row as an existing\n # valid move, the coords are invalid\n return false if q_row == row || q_col == col\n # Check to see if the slope between the coords and any valid moves is equal to 1.\n # Having a slope of 1 on board means the two points are on the same diagonal line.\n return false if ((row - q_row) / (col - q_col).to_f).abs == 1\n end\n\n true\nend", "def valid_moves(pos)\n valid_moves =[]\n DELTAS.each do |delta_pair|\n valid_moves << [delta_pair[0] + pos[0], delta_pair[1] + pos[1]]\n end\n valid_moves.reject! { |coord| coord.any? { |x| x < 0 || x > 8} }\n end", "def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend", "def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend", "def valid_move?(board,index)\n if index >= 0 && index <= 8\n if !position_taken?(board, index)\n return true\n else \n return false\n end\n else \n return false\n end\nend", "def valid_move?(board,index)\n if position_taken?(board,index) == true\n return false\n elsif index > 8 or index < 0\n return false\n else\n return true\n end\n end", "def check_legal_move(y,x)\n\t\tif y > 7 || y < 0\n\t\t\treturn false\n\t\telsif x > 7 || x < 0\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n puts \"this is a valid move\"\n return true\n else\n return false\n end\nend", "def valid_move?(board,index)\n #arrayIndex = index.to_i - 0\n if index.between?(0, 8) && !position_taken?(board,index)\n true\n else\n false\n\n\n\n\n end\n\nend" ]
[ "0.6610477", "0.6495825", "0.6483554", "0.64672565", "0.6467207", "0.6446322", "0.6432521", "0.64227796", "0.6411345", "0.6408603", "0.6382389", "0.6356111", "0.6354934", "0.6344821", "0.6340223", "0.6334255", "0.6333621", "0.6317347", "0.6315776", "0.62930256", "0.62906605", "0.6284129", "0.6282766", "0.6277093", "0.6276826", "0.6273841", "0.62573487", "0.62526554", "0.62459755", "0.62452555", "0.6243945", "0.6239638", "0.6239638", "0.6237521", "0.62338525", "0.62313515", "0.6227785", "0.6226094", "0.6218083", "0.62113655", "0.62108225", "0.62089825", "0.61995184", "0.6197465", "0.619717", "0.6190318", "0.6186508", "0.61864924", "0.6185223", "0.6181853", "0.61814576", "0.61801", "0.6176763", "0.617512", "0.61735207", "0.6169749", "0.6161526", "0.615885", "0.6156002", "0.613898", "0.6136375", "0.61354536", "0.6133902", "0.6131316", "0.61273307", "0.61247706", "0.61226904", "0.6122488", "0.6122105", "0.6121331", "0.61177737", "0.6108692", "0.6108657", "0.61059237", "0.6105682", "0.6105403", "0.61044425", "0.6102029", "0.61015993", "0.60989195", "0.609649", "0.60879904", "0.6087605", "0.6087385", "0.60869396", "0.6086005", "0.6082722", "0.6080194", "0.60800034", "0.6076521", "0.6075549", "0.6074933", "0.6070389", "0.6070375", "0.6069733", "0.60637134", "0.6062593", "0.6061844", "0.6061814", "0.60611635", "0.60585064" ]
0.0
-1
The node is a unique state within the system e.g. x,y coordinate
def node [@x, @y] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xy\n state[\"xy\"]\n end", "def node(x, y)\n @nodes[y][x]\n end", "def xy=(value); self.state = { :xy => value }; end", "def position\n @state[\"position\"]\n end", "def get_next_state(matrix,x2,y2)\r\n if 1==matrix[[@x+x2,@y+y2]].state\r\n @live_neighbor=@live_neighbor.to_i+1\r\n end\r\n end", "def get_coords_from_node(node)\n\t\t[node.x,node.y]\n\tend", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def get_state_x(rect)\n rect.x + rect.width / 2\n end", "def node\n @node\n end", "def node\n @node\n end", "def draw_node(dx, dy, x, y, connections, type, scale)\n draw_x = dx + x*$node_size + $node_size / 2.0\n draw_y = dy + y*$node_size + $node_size / 2.0\n Node.create({:x => draw_x, :y => draw_y, :factor_x => scale, :factor_y => scale}, type)\n n, s, e, w = connections.values\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 0, :factor_x => scale, :factor_y => scale) if n == 1\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 180, :factor_x => scale, :factor_y => scale) if s == 1\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 90, :factor_x => scale, :factor_y => scale) if e == 1\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 270, :factor_x => scale, :factor_y => scale) if w == 1\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 0, :factor_x => scale, :factor_y => scale) if n == 2\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 180, :factor_x => scale, :factor_y => scale) if s == 2\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 90, :factor_x => scale, :factor_y => scale) if e == 2\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 270, :factor_x => scale, :factor_y => scale) if w == 2\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def node?\n (self.forestify_right_position - self.forestify_left_position) > 1\n end", "def get_state_x(rect)\n return rect.x + rect.width / 2\n end", "def status\n s = {}\n # any node that's error or unknown will cause the whole state to be in the other state \n my_nodes.each { |n| s[n.id] = n.status unless n.state == 0 }\n return s\n end", "def initialize(ox, oy, tx, ty)\n # pixel movement rate\n pix = $BlizzABS.pixel\n # coordinates\n @sx, @sy, @tx, @ty = ox / pix, oy / pix, tx / pix, ty / pix\n # additional data\n @x_off, @y_off = ox - @sx * pix, oy - @sy * pix\n # nodes yet to check\n @open = {[@sx, @sy] => -1}\n # checked nodes\n @closed = Table.new($game_map.width, $game_map.height)\n end", "def nx\n @nx\n end", "def state\n end", "def calc_next_state row,col\n neighbours=neighbour_count row,col\n @next_state[row][col]=next_life_state @current_state[row][col],neighbours\n end", "def neo_node_id\n @internal_node.getId()\n end", "def state=matrix\n @current_state=matrix\n end", "def state\n active = 0\n my_nodes.each do |n|\n # any node that's error or unknown will cause the whole state to be in the other state\n if n.state < 0 \n return ERROR\n elsif n.state > 0 \n active+=1\n elsif n.state == nil\n return UNKNOWN\n end\n end\n # if all the nodes fall through the tests above then the snapshot is ready or active\n return (active == 0 ? ACTIVE : TRANSITION)\n end", "def node=(_); end", "def node=(_); end", "def state\n board.state(index)\n end", "def to_state; \"(#{[@id, @points[0][:x], @points[0][:y], @points[1][:x], @points[1][:y]].join(\", \")})\" end", "def initialize(x, y)\n @x = x\n @y = y # Stores the Cartesian coordinates for this node.\n @g = 0 # Stores distance from the starting node to the current node\n @edges = [] # An array of edge structs storing references to any adjacent nodes.\n @enabled = true # If set to false, this node is 'impassible' and cannot be traversed.\n\n @hash = [@x, @y].hash # create a hash value used when storing the node as a hash key.\n end", "def next_y\n state.y + state.dy\n end", "def state\n Node.transaction do\n # first look for single items that change the whole node\n node_roles.each do |nr|\n return nr.state if [NodeRole::TRANSITION, NodeRole::ERROR, NodeRole::PROPOSED].include? nr.state\n end\n # then scan for secondary items (ordering could hide the earlier items)\n node_roles.each do |nr|\n return NodeRole::TODO if [NodeRole::BLOCKED, NodeRole::TODO].include? nr.state\n end\n end\n # fall through (all NRs must be active)\n return NodeRole::ACTIVE\n end", "def pos\n @pos ||= node.attr('pos')\n end", "def feed node\n return unless node.respond_to? :attributes\n value = Hash[node.attributes.map{|k,v|[k, typecasted(v.value) ]}] \n if @state_assigned\n feed_value value\n else\n assign_state value\n end \n end", "def state_obj; @_hegemon_states[@_hegemon_state]; end", "def node(node)\n true\n end", "def id\n @node.id\n end", "def find_node\n @grid.find_node(self.mouse_x, self.mouse_y)\n end", "def check_cell_status(x_coord, y_coord)\n\t\treturn @state[x_coord][y_coord].content\n\tend", "def get_node(node)\n\t\t\t@nodes[node]\n\t\tend", "def get_node_coords(node_city)\n @nodes[node_city].coords\n end", "def getState(x, y)\n if(@grid != nil)\n return @grid.getCell(x,y).getState\n end\n return nil\n end", "def node\n attributes['node']\n end", "def node\n attributes['node']\n end", "def x_location_vertex\n return @ob_vx_location\n end", "def random_node\n @vertices.shuffle.first\n end", "def pos\r\n { x: @tile.x,\r\n y: @tile.y }\r\n end", "def mouse_position\n mouse_state.position\n end", "def states; end", "def nodes\n unless @nodes\n events = state_machine.events.values\n @nodes = events.map{ |event| to_nodes(event) }.flatten\n end\n @nodes\n end", "def state; region; end", "def node_change(transition)\n\t\t@board[transition[1]] = @board[@player_play[0]]\n\t\t@board[transition[0]] = Node.new\n\t\tgame_conditions\n\tend", "def state\n @state\n end", "def initialize(source_instance,transition) \n @number=0 \n @nodecost=0\n @passby=false\n @instance=source_instance\n @transition=transition\n @neighbours=[]\n \n @name = \"NODE \" +source_instance + \" - \" + transition.to_s \n \n end", "def new_state\n newID = @@nextID\n @@nextID += 1\n @state[newID] = true\n @transition[newID] = {}\n newID \n end", "def new_state\n newID = @@nextID\n @@nextID += 1\n @state[newID] = true\n @transition[newID] = {}\n newID \n end", "def new_state\n newID = @@nextID\n @@nextID += 1\n @state[newID] = true\n @transition[newID] = {}\n newID \n end", "def coords; {:x => @x, :y => @y} end", "def add_state(node, user, params)\n # => Create a Node-State Object\n (n = {}) && (n[:name] = node)\n n[:created] = DateTime.now\n n[:creator] = user\n n[:type] = params['type'] if params['type']\n # => Build the Updated State\n update_state(n)\n # => Return the Added Node\n find_state(node)\n end", "def element_state; end", "def game_state\n end", "def state\n data.state\n end", "def state\n data.state\n end", "def node\n retract[:node]\n end", "def variable_node; end", "def node\n return @node\n end", "def state\n @state\n end", "def state_next_gen(matrix,next_matrix,x,y)\r\n #Get number of neighbors\r\n matrix[[x,y]].get_neighbor(matrix)\r\n #Rules for live cells\r\n if matrix[[x,y]].state==1\r\n if matrix[[x,y]].live_neighbor<2||matrix[[x,y]].live_neighbor>3\r\n next_matrix[[x,y]].die\r\n else next_matrix[[x,y]].live\r\n end\r\n #Rules for dead cells\r\n else\r\n if matrix[[x,y]].live_neighbor==3\r\n next_matrix[[x,y]].live\r\n else next_matrix[[x,y]].die\r\n end\r\n end\r\nend", "def initialize\n self.x, self.y = 0, 0\n end", "def node\n @context.node\n end" ]
[ "0.6662758", "0.66491944", "0.6284175", "0.60998195", "0.6007405", "0.59857213", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59740645", "0.59146446", "0.5908363", "0.5908363", "0.5892997", "0.5880969", "0.5880969", "0.5880969", "0.5880969", "0.5880969", "0.5880969", "0.5880969", "0.5880969", "0.5880598", "0.5870712", "0.58398646", "0.582043", "0.5738242", "0.5729693", "0.5723285", "0.571718", "0.57036173", "0.569306", "0.564071", "0.564071", "0.5635633", "0.56333613", "0.5604677", "0.5603922", "0.5601613", "0.55978566", "0.55938154", "0.55834144", "0.55797905", "0.5556203", "0.55429685", "0.552244", "0.55080324", "0.5502836", "0.54898214", "0.54889214", "0.54889214", "0.548736", "0.54856837", "0.547392", "0.54733396", "0.5467629", "0.5458652", "0.5453487", "0.5450034", "0.54458654", "0.5442446", "0.5438835", "0.5438835", "0.5438835", "0.5428104", "0.54261804", "0.5421909", "0.5417803", "0.54156286", "0.54156286", "0.5411926", "0.54082054", "0.5407592", "0.5407207", "0.5402386", "0.53771454", "0.53761417" ]
0.64549035
2
Move the specified amount and return a new object
def move(x, y) State.new(@x + x, @y + y, @distance + 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(accountid, moveto, amount, confirms = 6)\n raise # TODO\n end", "def move\n move_by a, m\n end", "def move_x amount\n\n # Do the full movement.\n @x += amount\n\n # Check that we didn't go past the destination\n if amount.positive?\n if @x > @dest_x\n @x = @dest_x\n end\n else\n if @x < @dest_x\n @x = @dest_x\n end\n end\n\n end", "def vshift(amount)\n @top += amount\n self\n end", "def move(amount, target)\n if amount.sign < 0\n raise ArgumentError, \"Can't move negative amounts!\"\n end\n\n current_balance = balance\n target_account_name = find_account_name target\n\n case\n when target_account_name == name\n raise ArgumentError, \"Can't move amount to own account!\"\n when current_balance < amount\n raise ArgumentError, \"Moving #{amount} would overdraw account!\"\n end\n\n rpc.move name, target_account_name, amount\n end", "def move(x,y)\n self.dup.move!(x,y)\n end", "def move(amount)\n case direction\n when :up\n @position_y -= amount\n when :down\n @position_y += amount\n when :left\n @position_x -= amount\n when :right\n @position_x += amount\n else\n throw ArgumentError.new\n end\n end", "def move(amount)\n case direction\n when :up\n @position_y -= amount\n when :down\n @position_y += amount\n when :left\n @position_x -= amount\n when :right\n @position_x += amount\n else\n throw ArgumentError.new\n end\n end", "def move( x, y=nil )\n self.dup.move!(x, y)\n end", "def change(move)\n value = self.dup\n value[0] += move[0]\n value[1] += move[1]\n Position.new(value)\n end", "def move; end", "def move; end", "def move_to(x, y)\n object.x = x\n object.y = y\n end", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def move!(x,y)\n self[0]+=x; self[1]+=y\n return self\n end", "def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)\n coind.move fromaccount, toaccount, amount, minconf, comment\n end", "def move(from_account, to_account, amount, minconf = 1, comment = nil)\n request :move, from_account, to_account, amount, minconf, comment\n end", "def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)\n @api.request 'move', fromaccount, toaccount, amount, minconf, comment\n end", "def move(type = :unknown)\n\t\tmovement = rand(MOVEMENT_AMOUNTS[type])\n\t\t@distance += movement\n\t\tmovement.abs\n\tend", "def move(new_position)\n yield(new_position, self) if block_given?\n self.position = new_position\n self.moved = true\n nil\n end", "def move\n \n end", "def move\n \n end", "def move\n\n end", "def move_to!(x, y, z)\n @a1[0] = @a2[0] = @b1[0] = @b2[0] = x\n @a1[1] = @a2[1] = @d1[1] = @d2[1] = y\n @a1[2] = @b1[2] = @c1[2] = @d1[2] = z\n @a2[2] = @b2[2] = @c2[2] = @d2[2] = @a2[2] + z\n @b1[1] = @b2[1] = @c1[1] = @c2[1] = @b2[1] + y\n @c1[0] = @c2[0] = @d1[0] = @d2[0] = @d2[0] + x\n self\n end", "def move_to(x, y); end", "def move(direction)\n @position += direction\n end", "def make_move(move)\n @current_state = @current_state.next_state(move)\n end", "def move(distance)\n self.position -= distance\n ensure_bounds\n end", "def move (animal)\n dir = animal.dir\n x = animal.x\n y = animal.y\n if (dir >= 2 && dir < 5)\n animal.x = (x + 1) % WIDTH\n elsif (dir == 1 || dir == 5)\n animal.x = x % WIDTH\n else\n animal.x = (x - 1) % WIDTH\n end\n if (dir >= 0 && dir < 3)\n animal.y = (y - 1) % HEIGHT\n elsif (dir >= 4 || dir < 7)\n animal.y = (y + 1) % HEIGHT\n else\n animal.y = y % HEIGHT\n end\n animal.energy = animal.energy - 1\nend", "def move_without_saving(vector)\n if vector.kind_of?(Hash)\n action, object = vector.keys[0], vector.values[0]\n else\n action = vector\n end\n\n # set the start position to 1 or, if offset in the list_options is :list, :first => X\n minpos = model.list_options[:first]\n\n # the previous position (if changed) else current position\n prepos = original_attributes[properties[:position]] || position\n\n # set the last position in the list or previous position if the last item\n maxpos = (last = list.last) ? (last == self ? prepos : last.position + 1) : minpos\n\n newpos = case action\n when :highest then minpos\n when :top then minpos\n when :lowest then maxpos\n when :bottom then maxpos\n when :higher,:up then [ position - 1, minpos ].max\n when :lower,:down then [ position + 1, maxpos ].min\n when :above\n # the object given, can either be:\n # -- the same as self\n # -- already below self\n # -- higher up than self (lower number in list)\n ( (self == object) or (object.position > self.position) ) ? self.position : object.position\n\n when :below\n # the object given, can either be:\n # -- the same as self\n # -- already above self\n # -- lower than self (higher number in list)\n ( self == object or (object.position < self.position) ) ? self.position : object.position + 1\n\n when :to\n # can only move within top and bottom positions of list\n # -- .move(:to => 2 ) Hash with FixNum\n # -- .move(:to => '2' ) Hash with String\n\n # NOTE:: sensitive functionality\n # maxpos is incremented above, so decrement by 1 to get true maxpos\n # minpos is fixed, so just take the object position value given\n # else add 1 to object position value\n obj = object.to_i\n if (obj > maxpos)\n [ minpos, [ obj, maxpos - 1 ].min ].max\n else\n [ minpos, [ obj, maxpos ].min ].max\n end\n\n else\n raise ArgumentError, \"unrecognized vector: [#{action}]. Please check your spelling and/or the docs\" if action.is_a?(Symbol)\n # -- .move(2) as FixNum only\n # -- .move('2') as String only\n if action.to_i < minpos\n [ minpos, maxpos - 1 ].min\n else\n [ action.to_i, maxpos - 1 ].min\n end\n end\n\n # don't move if already at the position\n return false if [ :lower, :down, :higher, :up, :top, :bottom, :highest, :lowest, :above, :below ].include?(action) && newpos == prepos\n return false if !newpos || ([ :above, :below ].include?(action) && list_scope != object.list_scope)\n return true if newpos == position && position == prepos || (newpos == maxpos && position == maxpos - 1)\n\n if !position\n list.all(:position.gte => newpos).adjust!({ :position => 1 }, true) unless action =~ /:(lowest|bottom)/\n elsif newpos > prepos\n newpos -= 1 if [:lowest,:bottom,:above,:below].include?(action)\n list.all(:position => prepos..newpos).adjust!({ :position => -1 }, true)\n elsif newpos < prepos\n list.all(:position => newpos..prepos).adjust!({ :position => 1 }, true)\n end\n\n self.position = newpos\n self.moved = true\n true\n end", "def move(x,y)\n @x +=x\n @y +=y\n end", "def move(direction)\n \n end", "def move\n unless moved?\n offset = @deltas.pop\n @moved = true\n end\n end", "def get_item(item)\n return item.move(@inventory)\n end", "def card10(player)\n player.position -= 3\n end", "def move_entity entity; end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def move\n @position += MOVMENT_ALTERATIONS[rand(0..1)]\n end", "def move_me\n new_loc = nil\n ploc = @partner[:loc]\n dir = @partner[:dir]\n dist = @partner[:dist]\n if dist == 30\n new_dist = 16\n else\n new_dist = dist / 2\n end\n log \"Moving me. Partner data: #{@partner}\"\n new_loc = [ploc[0] - dir[0] * new_dist, ploc[1] - dir[1] * new_dist]\n log \"Move me to #{new_loc}\"\n \n goto new_loc\n return new_loc\n end", "def hshift(amount)\n @left += amount\n self\n end", "def advance(distance = 1)\n @position.x += distance\n end", "def move(name_or_account, amount)\n to_name = if name_or_account.is_a?(Bitbank::Account)\n name_or_account.name\n else\n name_or_account\n end\n\n @client.request('move', name, to_name, amount)\n end", "def move_straight(step, x)\n comp(:position).add!(x * step)\n on_move\n end", "def move(board, roll)\n \n # Leave old location\n board.spaces[@location].remove_player(self)\n\n # Calculate next location and move\n times_passing_go = (@location + roll) / 40\n @location = (@location + roll) % 40\n\n # If player lands on go don't overpay\n times_passing_go = @location == 0 ? times_passing_go - 1 : times_passing_go \n \n # Found out if the player needs to be payed for passing go\n times_passing_go.times do\n board.spaces[0].pay_player(self)\n end\n\n if (board.check_special_move(@location) == -1)\n return board.send_to_jail(self)\n end\n\n board.spaces[@location].add_player(self)\n\n # Tell the property groups to update their rent rates if necessary\n board.update_property_groups(roll)\n\n return @location\n end", "def lower_position!(amount = 2)\n if position > 0\n update!(position: position - amount)\n end\n dashboard.reposition_cells\n position\n end", "def move_to(x, y, speed = 2)\n @new_x = x\n @new_y = y\n @speed = speed\n end", "def make_move\n roll = @sampler.sample\n @player_position = new_position(roll)\n @moves += 1\n\n # Update winning state if the player has finished the game\n @game_over = @player_position >= @squares\n end", "def move!( x, y=nil )\n raise \"can't modify frozen object\" if frozen?\n if y.nil?\n a = x.to_ary\n @x += a[0]\n @y += a[1]\n else\n @x += x\n @y += y\n end\n @hash = nil\n self\n end", "def move_to(dest_position)\n return if self.orderable_position == dest_position\n\n pos = orderable_attribute\n con = orderable_condition\n\n self.class.transaction do\n if orderable_position < dest_position\n adj = \"#{pos} = #{pos} - 1\"\n con = con + [ \"#{pos} > #{orderable_position}\", \"#{pos} <= #{dest_position}\" ]\n else\n adj = \"#{pos} = #{pos} + 1\"\n con = con + [ \"#{pos} < #{orderable_position}\", \"#{pos} >= #{dest_position}\" ]\n end\n self.class.update( adj, :condition => con.join(' AND ') )\n self.orderable_position = dest_position\n update_attribute(orderable_attribute)\n end\n\n self\n end", "def move\n return if next_stop.nil?\n return @destinations.shift if at_destination?\n\n if next_stop > @current_floor\n @current_floor += 1\n else\n @current_floor -= 1\n end\n\n @current_floor\n end", "def move_to(new_position)\r\n raise ArgumentError unless ar_object\r\n \r\n new_mi = MoebiusInterval.new(new_position)\r\n raise ArgumentError if new_mi.descendent_of?(self)\r\n \r\n move_matrix = MoebiusInterval.mmult(new_mi.to_a, self.inverse)\r\n subtree = [ar_object] + find_descendents\r\n subtree.each do |to_move|\r\n moved_a = MoebiusInterval.mmult(move_matrix, to_move.moebius_interval.to_a)\r\n to_move.moebius_interval = MoebiusInterval.new(moved_a)\r\n to_move.save!\r\n end\r\n end", "def move x, y\n put x, y # FIXME\n end", "def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end", "def move\n @speed = map1d(total_count, (5..25), (0.1..0.4))\n @speed = (0..10.0).clip speed\n @position[Y] += speed\n @position[Y] = -height if position[Y] > height * 2\n end", "def move_card(card, destination)\n card.location = destination\n card.save\n end", "def move_west\n @x -= 1\n end", "def move _obj, _args\n \"_obj move _args;\" \n end", "def move_joker_b\n b_pos = $deck.find_index('B')\n $deck.delete('B')\n if b_pos == 51\n $deck << 'B'\n else\n $deck.insert (b_pos + 2) % 53, 'B'\n end\nend", "def move(array,position,value = \"X\")\n array[position.to_i - 1] = value\nend", "def move_onto(a, b)\n reveal(a)\n reveal(b)\n move_single(a, b)\n end", "def move(*args)\n begin\n move_no_cleanup(*args)\n rescue Orp::MovementAlreadyComplete\n warn \"Attempted to complete already completed movement\"\n nil\n rescue\n delete\n raise\n end\n end", "def move_by_one(order)\n case co_ordinates[2]\n when \"N\"\n co_ordinates[1] += order[1]\n when \"S\"\n co_ordinates[1] -= order[1]\n when \"E\"\n co_ordinates[0] += order[1]\n when \"W\"\n co_ordinates[0] -= order[1]\n end\n puts \"move_by_one: co_ordinates = #{co_ordinates}\"\n end", "def move(vpoint)\n @position += vpoint\n end", "def move(x, y)\n return x, y+1\n end", "def move\n if @direction.north? then @y += 1\n elsif @direction.south? then @y -= 1\n elsif @direction.east? then @x += 1\n elsif @direction.west? then @x -= 1\n end\n return self\n end", "def make_move(move)\n @moves << move\n end", "def move(board, position, player=current_player(board))\n position = position.to_i\n board[position-1]=player\nend", "def payment(amount)\n @balance -= amount\n end", "def move_ilo(ilo, new_num)\n if (ilo.ilo_number < new_num)\n logger.debug \"Moving ILOs up #{ilo.ilo_number} to #{new_num}\"\n learning_outcomes.where(\"ilo_number > #{ilo.ilo_number} and ilo_number <= #{new_num}\").each { |ilo| ilo.ilo_number -= 1; ilo.save}\n elsif (ilo.ilo_number > new_num)\n learning_outcomes.where(\"ilo_number < #{ilo.ilo_number} and ilo_number >= #{new_num}\").each { |ilo| ilo.ilo_number += 1; ilo.save}\n end\n ilo.ilo_number = new_num\n ilo.save\n end", "def move( array, index, value=\"X\" )\n array[index] = value\nend", "def smove(source, destination, member); end", "def smove(source, destination, member); end", "def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n @target_x = @current_x + amount_x\n @target_y = @current_y + amount_y\n @target_z = @current_z + amount_z\n\n steps_x = amount_x * @axis_x_steps_per_unit + @current_x_steps\n steps_y = amount_y * @axis_y_steps_per_unit + @current_y_steps\n steps_z = amount_z * @axis_z_steps_per_unit + @current_z_steps\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end", "def shift(*args)\n check_corrupted\n\n if args[0]\n amount = args[0]\n else\n amount = 1\n end\n\n @eles ||= []\n cache_ele(amount - @eles.length) if @eles.length < amount\n res = @eles.shift(*args)\n\n # Since we are removing an element, the length should go down with the amount of elements captured.\n if args[0]\n @length_cache -= res.length\n else\n @length_cache -= 1\n end\n\n return res\n end", "def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end", "def move_up(n)\n self.y += n\n end", "def move_to(x, y, nb_frame)\n @moving = true\n @move_frame = nb_frame\n @move_total = nb_frame\n @new_x = x\n @new_y = y\n @del_x = self.x - x\n @del_y = self.y - y\n end", "def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend", "def move_joker_a\n a_pos = $deck.find_index('A')\n if a_pos == 53\n $deck.delete 'A'\n $deck.insert 1, 'A'\n else\n temp = $deck[a_pos + 1]\n $deck[a_pos + 1] = $deck[a_pos]\n $deck[a_pos] = temp\n end\nend", "def put_money(amount, player)\n if amount > player.money\n amount = player.money\n end\n if amount + player.in_pot_current > self.high_bet # if player is new high bet (bets more than current highest)\n self.high_bet = amount + player.in_pot_current\n self.high_better = player.location\n end\n player.money -= amount # puts money in correct places and takes from player's pot\n player.in_pot_current += amount\n player.in_pot_hand += amount\n self.pot += amount\n player.save\n self.save\n end", "def move(from, to)\n index = self.delete_at(from)\n self.insert(to, index)\n end", "def moveTo x, y\n\n\tend", "def apply_move piece, origin, dest\n node_at(origin).remove_piece\n\n dest_node = node_at(dest)\n dest_node.piece_captured_by(piece) if dest_node.occupied?\n dest_node.update_piece piece\n @last_move = { piece: piece, origin: origin, dest: dest }\n end", "def deposit(amount)\n @balance += amount\n @balance\n end", "def move_by a, m\n rad = a * D2R\n self.x += Math.cos(rad) * m\n self.y += Math.sin(rad) * m\n end", "def move_by(row_delta, col_delta)\n @row, @col = wrap(@row + row_delta, @col + col_delta)\n end", "def move_lower\n movement { self.position += 1 }\n end", "def place_bet(amount)\n @total_money -= amount\n end", "def move_higher\n movement { self.position -= 1 }\n end", "def move(from, delta)\n raise ArgumentError unless (0...@size).include?(from)\n\n if delta == 0\n puts \"#{@numbers[from]} does not move:\" if tracing?\n dump if tracing?\n return\n end\n\n puts \"#{@numbers[from]} moves ...:\" if tracing?\n want_to = nil\n loop do\n want_to = from + delta\n # break if (0...@size).include?(want_to)\n # but NO, it cannot end at position zero, W T F ! ! 1 !\n break if want_to > 0 && want_to < @size\n\n if want_to.abs > 2 * @size\n delta = delta % (@size - 1)\n # puts \"new delta #{delta}\"\n end\n\n # div, mod = delta.divmod(@size)\n # p [div, mod]\n # print \" \"\n # p delta.divmod(@size - 1)\n\n if delta < 0\n delta += @size - 1\n else\n delta -= @size - 1\n end\n puts \"WRAPPED, new delta #{delta}\" if tracing?\n end\n to = want_to\n delta = to - from\n\n dist = delta.abs\n delta1 = delta / dist # -1 or +1\n # puts \"D1 #{delta1}\"\n dist.times do\n swap(from, from + delta1)\n from += delta1\n end\n dump if tracing?\n end", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def move\n @tail = @location\n closest_food = detect_closest_food\n @location = calculate_next_location(closest_food)\n\n end", "def take_damage(_amount)\n\t\t@temp_hp -= _amount\n\t\tif (temp_hp < 0)\n\t\t\t@current_hp += @temp_hp\n\t\t\t@temp_hp = 0\n\t\tend\n\t\tleftover = @current_hp\n\t\t@current_hp = 0 if @current_hp < 0\n\t\tleftover\n\tend", "def move_by(x_delta, y_delta)\n if respond_to?(:x) && respond_to?(:y) && respond_to?(:x=) && respond_to?(:y=)\n if default_x?\n self.x_delta += x_delta\n else\n self.x += x_delta\n end\n if default_y?\n self.y_delta += y_delta\n else\n self.y += y_delta\n end\n end\n end", "def move_inventory!(transfer)\n updated_quantities = {}\n item_validator = Errors::InsufficientAllotment.new(\"Transfer items exceeds the available inventory\")\n transfer.line_items.each do |line_item|\n inventory_item = self.inventory_items.find_by(item: line_item.item)\n new_inventory_item = transfer.to.inventory_items.find_or_create_by(item: line_item.item)\n next if inventory_item.nil? || inventory_item.quantity == 0\n if inventory_item.quantity >= line_item.quantity\n updated_quantities[inventory_item.id] = (updated_quantities[inventory_item.id] || inventory_item.quantity) - line_item.quantity\n updated_quantities[new_inventory_item.id] = (updated_quantities[new_inventory_item.id] ||\n new_inventory_item.quantity) + line_item.quantity\n else\n item_validator.add_insufficiency(line_item.item, inventory_item.quantity, line_item.quantity)\n end\n end\n \n raise item_validator unless item_validator.satisfied?\n\n update_inventory_inventory_items(updated_quantities)\n end", "def move\n\t\tunless @y >= 0 then\n\t\t\t@y += 1\n\t\tend\n\t\tif @x_total <= 150 and @y_total <= 150 then\n\t\t\t@x += 1\n\t\t\t@y += 1\n\t\t\t@x_total +=1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total > 150 and @y_total > 150 and @x_total < 300 and @y_total < 300 then\n\t\t\t@y -= 1\n\t\t\t@x_total += 1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total > 298 and @y_total > 298 and @x_total < 450 and @y_total < 450 then\n\t\t\t@y +=1\n\t\t\t@x -= 1\n\t\t\t@x_total += 1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total > 448 and @y_total > 448 and @x_total < 600 and @y_total < 600 then\n\t\t\t@y -= 1\n\t\t\t@x_total += 1\n\t\t\t@y_total += 1\n\t\tend\n\t\tif @x_total == 599 and @y_total == 599 then\n\t\t\t@x_total = @y_total = 0\n\t\tend\n\tend", "def move(cakes, last)\n last == 1 ? 2 : 1 # I'm not greedy\n end", "def move_relative( amount_x, amount_y, amount_z)\n\n # calculate the number of steps for the motors to do\n\n Status.current.info_target_x = Status.current.info_current_x + amount_x\n Status.current.info_target_y = Status.current.info_current_y + amount_y\n Status.current.info_target_z = Status.current.info_current_z + amount_z\n\n steps_x = amount_x * @ramps_param.axis_x_steps_per_unit + Status.current.info_current_x_steps\n steps_y = amount_y * @ramps_param.axis_y_steps_per_unit + Status.current.info_current_y_steps\n steps_z = amount_z * @ramps_param.axis_z_steps_per_unit + Status.current.info_current_z_steps\n\n move_to_coord( steps_x, steps_y, steps_z )\n\n end", "def make_move(move)\n\t\t@board[move]= $current_player\n\tend", "def doMove _obj, _args\n \"_obj doMove _args;\" \n end" ]
[ "0.65250784", "0.6459328", "0.63935006", "0.63495505", "0.63173187", "0.6311894", "0.63017416", "0.63017416", "0.62991357", "0.62844497", "0.6075882", "0.6075882", "0.6068914", "0.6035086", "0.6034744", "0.603463", "0.59733987", "0.5848924", "0.5835359", "0.5815925", "0.58093023", "0.58093023", "0.58079463", "0.5800812", "0.5772567", "0.5760841", "0.5760172", "0.57535523", "0.5743144", "0.57419986", "0.5726465", "0.57162994", "0.57154626", "0.5689872", "0.5681005", "0.5680518", "0.5668446", "0.56647605", "0.5644284", "0.56404054", "0.5618602", "0.56131184", "0.56055146", "0.5557944", "0.5545525", "0.55391306", "0.5525112", "0.5523996", "0.5511363", "0.5511032", "0.54810286", "0.5476698", "0.5474589", "0.5468712", "0.54676056", "0.5448198", "0.5444443", "0.54434675", "0.543818", "0.5435658", "0.543332", "0.54247963", "0.54214305", "0.5421226", "0.54207474", "0.54087746", "0.54020536", "0.53989846", "0.5390972", "0.5389911", "0.5389054", "0.5389054", "0.5380468", "0.53795564", "0.5377612", "0.53676796", "0.53654593", "0.53653854", "0.53568375", "0.53415203", "0.5340162", "0.5329501", "0.53292096", "0.532909", "0.531196", "0.5311658", "0.53050685", "0.5304864", "0.5299935", "0.5288521", "0.5280467", "0.5274423", "0.5274071", "0.52728695", "0.52718246", "0.5271091", "0.5270815", "0.5268972", "0.526802", "0.52646685" ]
0.6003187
16
Given a field and an array of child fields, we need to recurse through them to get the last one
def get_child_entity_from_path_by(field, children) # the next child in the path child_value = children.shift # get the child entity child = self.send(:children).find {|child| child.send(field) == child_value} if child && children.size > 0 # we have some recursion to do - we're not at the end of the array # so call this method again with a smaller set of children child.get_child_entity_from_path_by(field, children) else return child #this is the final thing in the array - return it end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields_or_build(field)\n unless field.is_a? DelegationField\n field_slug = field.to_s\n field = DelegationField.where(slug: field_slug).first\n return nil if field.nil?\n end\n field_values = get_fields(field)\n if field_values.empty?\n field_values = [self.fields.build(delegation_field_id: field.id)]\n end\n field_values\n end", "def ancestor_field(field)\n return self[field] if self[field].present?\n\n return nil unless ancestor_docs.present?\n\n ancestor_ids.each do |ancestor_id|\n ancestor = ancestor_docs[ancestor_id]\n return ancestor[field] if ancestor && ancestor[field].present?\n end\n\n nil\n end", "def merged_fields(new_field)\n field_ids = []\n merged_fields = fields.each_with_object([]) do |field, fields|\n field.deep_merge!(new_field) if field.id == new_field.id\n fields << field\n field_ids << field.id\n end\n merged_fields << new_field unless field_ids.include?(new_field.id)\n merged_fields\n end", "def implode_parent(data_type)\n result = []\n if data_type[:base]\n parent_type = get_service_registry.get_type_signature(data_type[:base])\n result += implode_parent(parent_type)\n end\n data_type[:fields].each do |field|\n # If the parent type includes a field with the same name, overwrite it.\n result.reject! {|parent_field| parent_field[:name].eql?(field[:name])}\n result << field\n end\n return result\n end", "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end", "def last *a; self.child(*a) + ':last-child' end", "def effective_field field\n each do |container|\n return container.value.send(field) unless container.empty?\n end\n nil\n end", "def display_field(field, depth = 0, parents = [])\n my_parents = parents.dup\n field_str = ''\n name = field[:name]\n if field[:class] == BinData::Array\n field_str = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n array_field = parent.send(name)\n field_str << process_array_field(array_field, (depth + 1))\n else\n if my_parents.empty?\n label = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n if field[:class].ancestors.include? BinData::Record\n field_str = label\n else\n value = send(name)\n field_str = format '%-30s %s', label, value\n end\n else\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n value = parent.send(name)\n label = field[:label] || name.to_s.capitalize\n label = \"\\n\" + (\"\\t\" * depth) + label\n field_str = format '%-30s %s', label, value\n end\n end\n my_parents << name\n field[:fields].each do |sub_field|\n field_str << display_field(sub_field, (depth + 1), my_parents)\n end\n field_str\n end", "def get(*nested_field_names, &b)\n if nested_field_names.size == 1\n field_name = nested_field_names.first\n field = self.class.field_for_name(field_name)\n raise ArgumentError.new unless field\n unless self.value_for_tag?(field.tag)\n return b ? b.call : nil\n end\n return self.value_for_tag(field.tag)\n end\n last_proto = nested_field_names[0..-2].inject(self) do |sub_proto, ifield_name|\n sub_field = sub_proto.class.field_for_name(ifield_name)\n raise ArgumentError.new unless sub_field\n raise ArgumentError.new unless sub_field.is_a?(ProtocolBuffers::Field::MessageField)\n unless sub_proto.value_for_tag?(sub_field.tag)\n return b ? b.call : nil\n end\n sub_proto.value_for_tag(sub_field.tag)\n end\n last_field_name = nested_field_names.last\n last_field = last_proto.class.field_for_name(last_field_name)\n unless last_proto.value_for_tag?(last_field.tag)\n return b ? b.call : nil\n end\n last_proto.value_for_tag(last_field.tag)\n end", "def sub_object\n splits= @field.split('.')\n object_name = splits.first\n field_names = splits[1..-1] # all but the first\n return unless object_name && obj.respond_to?(object_name)\n object = obj.send(object_name)\n # Its a collection => invoice.items and access is done by ary index:\n # first item => [items.1.name]\n if object.nil?\n # empty relation\n @result.gsub!(@placeholder, '')\n elsif object.is_a?(Array) && ary_index = field_names.first[/\\A\\d*\\z/]\n field_names.delete_at(0) # remove entry from field_names ary\n # replace with empty string if the index does not exist or obj is empty\n @result.gsub!(@placeholder, '') unless object = object[ary_index.to_i-1]\n end\n\n # Recurse and let the referenced object do the expanding\n if object.respond_to?(:expand_placeholders)\n value = object.expand_placeholders(\"[#{field_names.join('.')}]\")\n @result.gsub!(@placeholder, value)\n end\n end", "def deep_each( &blk ) #:yields: a Field\n @fields.each {|atom|\n if atom.is_a? Binstruct\n atom.deep_each &blk unless atom.fields.empty?\n else\n yield atom\n end\n }\n end", "def first_unbound_field_alternatives\n @unbound_fields.first.last\n end", "def nested_path_by(field, opts = {})\n options = {delimiter: \"/\", prefix: \"\"}\n options.merge!(opts)\n delimiter = options[:delimiter]\n prefix = options[:prefix].empty? ? \"\" : \"#{options[:prefix]}#{delimiter}\"\n path = ([self] + ancestors).reverse.collect {|a| a.send(field)}.join(delimiter).gsub(prefix,\"\")\n return delimiter + path\n end", "def unwind(field)\n aggregation(field) do |pipeline|\n pipeline.unwind(field)\n end\n end", "def process_field(child)\n if ['complexContent', 'simpleContent', 'sequence', 'group', 'choice', 'extension', 'restriction'].include?(child.name)\n child.elements.each {|grandchild| process_field(grandchild)}\n elsif child.name == 'element'\n element = Element.new(child, self.schema, self)\n @elements[element.name] = element\n elsif child.name == 'attribute'\n attribute = Attribute.new(child, self.schema, self)\n @attributes[attribute.name] = attribute\n elsif child.name == 'complexType'\n type = ComplexType.build(child, self.schema)\n @types[type.name] = type\n elsif child.name == 'simpleType'\n type = SimpleType.build(child, self.schema)\n @types[type.name] = type\n elsif child.name == 'anyAttribute'\n @special_fields << SpecialField.new(\"##anyAttribute\")\n elsif child.name == 'anyElement'\n @special_fields << SpecialField.new(\"##anyElement\")\n elsif child.name == 'attributeGroup'\n # The only special case here...essentially we'll' transparently roll attribute groups into parent nodes,\n # while at the schema level global attribute groups get created as a type\n if self.kind_of?(Schema)\n type = ComplexType.build(child, self.schema)\n @types[type.name] = type\n else\n Type.find(child.attributes['ref'].value, nil, stix_version).attributes.each {|attrib| @attributes[attrib.name] = attrib}\n end\n else\n $logger.debug \"Skipping: #{child.name}\" if defined?($logger)\n end\n end", "def last\n @children.last\n end", "def normalize_output_field(output_data, fields_list, field_name)\n return nil if output_data.nil?\n\n process_attributes(output_data, true)\n\n field_definition = get_field_by_name(fields_list, field_name)\n if field_definition.nil?\n @api.logger.warn(\"Can not determine type for field: %s\" % field_name)\n return output_data\n end\n\n field_sym = field_name.to_sym\n field_data = normalize_type(output_data[field_sym], field_definition)\n output_data[field_sym] = field_data if field_data\n\n sub_type = get_full_type_signature(field_definition[:type])\n if sub_type and sub_type[:fields]\n # go recursive\n sub_type[:fields].each do |sub_type_field|\n field_data = output_data[field_sym]\n if field_data.is_a?(Array)\n field_data.each do |item|\n normalize_output_field(item, sub_type_field,\n sub_type_field[:name])\n end\n else\n normalize_output_field(field_data, sub_type_field,\n sub_type_field[:name])\n end\n end\n end\n return output_data\n end", "def fold_references_helper(entity, array_of_refs, organization)\n ref = array_of_refs.shift\n field = entity[ref]\n return if field.blank?\n\n # Follow embedment path, remplace if it's not an array or a hash\n case field\n when Array\n field.each do |f|\n fold_references_helper(f, array_of_refs.dup, organization)\n end\n when Hash\n fold_references_helper(entity[ref], array_of_refs, organization)\n else\n id = field\n entity[ref] = [id_hash(id, organization)]\n end\n end", "def json_field(json, field)\n return nil unless json\n fields = field.split('/')\n fields.each do |field|\n if json.is_a?(Array)\n json = json[field.to_i]\n else\n json = json[field]\n end\n return nil unless json\n end\n json\n end", "def push(fieldlet)\n \t\tfield = @fields[fieldlet.class::FIELD_ID].last\n \t\tif field && field.instance_id == fieldlet[:instance_id]\n \t\t\treturn field << fieldlet\n \t\tend \n \n \t\tfield = fieldlet.class::FIELD.new(@entity)\n \t\tfield << fieldlet\n \n \t\t@fields[fieldlet.class::FIELD_ID] << field\n \n return field\n \tend", "def subfield_value(field, subfield)\n sub = field.subfields.find {|s| s.code == subfield}\n if sub.nil?\n return nil\n end\n sub.value\nend", "def fields_for(child_association, collection=nil, options={}, &block)\n default_collection = self.object.send(child_association)\n collection ||= default_collection\n include_index = default_collection.respond_to?(:each)\n\n nested_options = { :parent => self, :association => child_association }\n Array(collection).each_with_index.inject(SafeBuffer.new) do |all,(child_instance,index)|\n nested_options[:index] = options[:index] || (include_index ? index : nil)\n all << @template.fields_for(child_instance, { :nested => nested_options, :builder => self.class }, &block) << \"\\n\"\n end\n end", "def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end", "def last_child\n children.max_by { |x| x.position}\n end", "def nested_form_field label_text, form, method, field, *args\n if form.is_a? Array\n if form.length > 1\n form.shift.fields_for form.first do |builder|\n form[0] = builder\n nested_form_field label_text, form, method, field, *args\n end\n else\n nested_form_field label_text, form.first, method, field, *args\n end\n else\n if label_text.nil?\n form.send method, field, *args\n else\n %Q(<div class=row>\n <div class=span4>#{label_text}</div>\n #{ form.send method, field, *args }\n </div>).html_safe\n end\n end\n end", "def recursive\n attributes.fetch(:recursive)\n end", "def last_for_value\n self.form_field_value.queries.last\n end", "def last_grouping_fields\n Java::CascadingTuple::Fields::VALUES\n end", "def bump(field_)\n name_ = _interpret_field(field_)\n return self unless name_ && @_values.include?(name_)\n values_ = []\n @_field_path.each do |fld_|\n oldval_ = @_values[fld_.name]\n if fld_.name == name_\n newval_ = fld_.bump_value(oldval_)\n return self if newval_ == oldval_\n values_ << newval_\n return Value.new(values_, @_format, @_unparse_params)\n else\n values_ << oldval_\n end\n end\n self\n end", "def last\n relationships = self.group_relations\n last_index = relationships.count - 1\n last_relationship = relationships.select { |child| child[:position] == last_index }.first\n return if last_relationship.nil?\n last_relationship.group\n end", "def but_last lst, &blk\n if null?(lst)\n NullType.new\n elsif null?(cdr(lst))\n block_given? ? list(blk.call(car(lst))) : NullType.new\n else\n cons(car(lst), but_last(cdr(lst), &blk))\n end\nend", "def recursive => nil", "def get_field_property(source, property, fields=Hamster::Set[])\n source.each_key do |key|\n item = source[key]\n # continue if of the correct object type\n if item.is_a?(Hash)\n # add key to Hamster::Set if found\n fields = fields.add(key) if item[property] === true\n # continue recursion\n fields = get_field_property(item, property, fields)\n end\n end\n fields\n end", "def get_coll_field_val(fedora_obj, desired_field)\n if (desired_field.is_a?(String))\n desired_field = desired_field.to_sym\n end\n if (fedora_obj.collections.size > 0)\n coll_obj = HypatiaCollection.load_instance(fedora_obj.collections[0].pid)\n return get_values_from_datastream(coll_obj, \"descMetadata\", desired_field).first\n elsif (fedora_obj.sets.size > 0)\n # we can load the parent object as a set because we are only going to check \"collections\" and \"sets\"\n return values = get_coll_field_val(HypatiaSet.load_instance(fedora_obj.sets[0].pid), desired_field)\n end\n return \"\"\n end", "def recursive\n @attributes[:recursive]\n end", "def recursive\n @attributes[:recursive]\n end", "def last_element_with_array_methods(array)\n array.last\nend", "def retrieve_last_element_from_array(array)\n array.last\nend", "def get_field_value(field)\n field_values = get_fields(field)\n return nil if field_values.blank?\n if field_values.first.delegation_field.multiple\n field_values.map(&:to_value)\n else\n field_values.first.to_value\n end\n end", "def parented_field_value(field)\n if parent_resource\n [parent_resource.send(field), resource.send(field)].flatten.compact.join(\", \")\n else\n resource.send(field)\n end\n end", "def retrieve_last_element_from_array(array)\n return array[-1]\nend", "def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= self.class\n fields_for(record_or_name_or_array, *(args << options), &block)\n end", "def sub_collection\n if match = @result.match(/\\[#{@field}\\](.*)\\[\\/#{@field}\\]/m) # the /m makes the dot match newlines, too!\n whole_group = match[0]\n inner_placeholders = match[1]\n inner_result = ''\n # Let the referenced object do the expanding by recursion if the collection knows placeholders\n @cur_collection.each do |item|\n inner_result << item.expand_placeholders(inner_placeholders)\n end if @cur_collection.first.respond_to?(:expand_placeholders)\n @result.gsub!(whole_group, inner_result)\n else\n @result.gsub!(@placeholder, \"END MISSING FOR #{@field}\")\n end\n end", "def pick_fields(*fields)\n self.values.inject({}) do |hsh, node|\n value = self[node.name].pick(*fields)\n if fields.size == 1\n value = value.values.first\n end\n hsh[node.name] = value\n hsh\n end\n end", "def fetch_field_direct(n)\n raise ClientError, \"invalid argument: #{n}\" if n < 0 or n >= @fields.length\n @fields[n]\n end", "def unwind(field_or_doc)\n unless field_or_doc.respond_to? :keys\n normalized = field_or_doc.to_s\n name = aliases[normalized] || normalized\n push(\"$unwind\" => name.__mongo_expression__)\n else\n push(\"$unwind\" => field_or_doc)\n end\n end", "def each_field\n @_field_path.each do |field_|\n yield(field_, @_values[field_.name])\n end\n end", "def fields(fields)\n if fields.nil?\n return nil\n elsif fields.is_a? Java::CascadingTuple::Fields\n return fields\n elsif fields.is_a? ::Array\n if fields.size == 1\n return fields(fields[0])\n end\n raise \"Fields cannot be nil: #{fields.inspect}\" if fields.include?(nil)\n end\n return Java::CascadingTuple::Fields.new([fields].flatten.map{ |f| f.kind_of?(Fixnum) ? java.lang.Integer.new(f) : f }.to_java(java.lang.Comparable))\n end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def using_last(array)\n array.last\nend", "def using_last(array)\n array.last\nend", "def deserialize_relationship(field, local_params = params, polymorphic: [], children: {})\n field_params = local_params[:data][field] or return\n child_class = field.to_s.singularize.classify.constantize\n\n return parse_object(child_class, field_params, polymorphic, children) unless field_params.is_a?(Array)\n\n field_params.map do |field_param|\n parse_object(child_class, field_param, polymorphic, children)\n end\n end", "def nested_field_set(f, assoc, options = {})\n wrapper_partial = \"shared/nested_fields_wrapper\"\n options[:inner_partial] ||= \"#{f.object.class.model_name.route_key}/#{assoc.to_s.singularize}_fields\"\n options[:multiple] = true unless options.has_key?(:multiple)\n\n wrapper_classes = [\"nested-fields\"]\n wrapper_classes << \"no-label\" if options[:label] == false\n wrapper_classes << \"multiple\" if options[:multiple]\n\n f.input(assoc, options.slice(:required)) do\n content_tag(:div, class: \"nested-field-set\") do\n f.simple_fields_for(assoc, wrapper: :nested_fields) do |f2|\n render(wrapper_partial, f: f2, options: options, classes: wrapper_classes)\n end <<\n if options[:multiple]\n content_tag(:span) do\n link_to_add_association(t(\"cocoon.add_links.#{assoc}\"), f, assoc,\n partial: wrapper_partial,\n render_options: {\n wrapper: :nested_fields, # Simple form wrapper\n locals: {options: options, classes: wrapper_classes}\n }\n )\n end\n end\n end\n end\n end", "def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end", "def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= @@builder\n fields_for(record_or_name_or_array, *(args << options), &block)\n end", "def next_differs_on? field\n if last?\n nil\n else\n element.send(field) != self.next.send(field) # need to self to differentiate from keyword\n end\n end", "def last_textfield\n result = _textfields_with_predicate.last\n raise _no_such_element if result.nil?\n\n result\n end", "def using_last(array)\narray.last\nend", "def select_last_field\n @active_index = nil \n select_prev_field\n end", "def last_of(array)\n return array[-1]\nend", "def tuple_fields(max_key_segments=3)\n # return @tuple_fields if @tuple_fields\n @tuple_fields = field_schemas.flat_map do |fn, fld|\n if (max_key_segments > 1) && fld[:type].respond_to?(:tuple_fields)\n fld[:type].tuple_fields(max_key_segments-1).map{|subfield| [fld, subfield].flatten }\n else\n [[fld]]\n end\n end\n end", "def max(field, opts={})\n opts = ::Hashie::Mash.new(opts)\n all(opts).inject(nil) do |max, item|\n val = item.send(field)\n max = val if !val.nil? && (max.nil? || val > max)\n max\n end\n end", "def get_last_item(arr)\n\treturn arr[-1]\nend", "def last(*input) \n input[-1].is_a?(String) ? input[-1][-1] : input.flatten[-1]\nend", "def build_self(build_once = true)\n self.result = @children.collect {|p| p.last.build }.uniq\n end", "def attributes_and_associations_ordered_by_nested_last\n model_or_association.attributes.select(&:is_attribute?) +\n model_or_association.attributes.select(&:is_association?).partition(&:is_nested?).flatten.reverse\n end", "def attributes_and_associations_ordered_by_nested_last\n model_or_association.attributes.select(&:is_attribute?) +\n model_or_association.attributes.select(&:is_association?).partition(&:is_nested?).flatten.reverse\n end", "def fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!.merge(:builder => self.class)\n super(record_or_name_or_array, *(args + [options]), &block)\n end", "def fields #:nodoc:\n f = @properties.to_a\n last = f.pop\n f.push @elements\n f.push last\n end", "def max(field = nil)\n block_given? ? super() : aggregates(field)[\"max\"]\n end", "def retrieve_last_element_from_array(array)\n array[array.length-1]\nend", "def last_item(elective_array)\n return elective_array[-1]\nend", "def hash\n @fields.last\n end", "def get_field_reference(content)\n segments, fragments = get_field_schema(content[:ref])\n # fragments first\n results = get_fragments(fragments) unless fragments.nil?\n # segments second\n unless segments.nil? || results\n results = get_segments(segments) unless segments.empty?\n end\n results\n end", "def last\n node = @tree.maximum\n node.nil? ? default : node.to_a\n end", "def find_grandchild_roles(roles, field_name)\n newroles = []\n roles.each do |role|\n if @grandchild_roles[role] && @grandchild_roles[role][field_name]\n newroles << @grandchild_roles[role][field_name]\n end\n end\n newroles\n end", "def process_header_repeatable_field_names_do_not_have_numbers(header)\n\n child_field_group = nil\n\n first_field, rest_of_header = header.split(':',2)\n\n if first_field == header\n\n # we have a field name, i.e. a dynamic field\n # puts \"we got a field name: \" + \"#{first_field}\"\n\n return add_child_field first_field\n\n else\n \n # error condition if there is nothing after the ':'\n return nil if rest_of_header == ''\n\n # puts \"First part of header: \" + \"#{first_field}\"\n # puts \"Second part of header: \" + \"#{rest_of_header}\"\n\n # we have a field_group name, i.e. a dynamic field group\n\n # If the child field group does not exist, create one if needed.\n # first, see if there is even one already created\n if !( @child_field_groups.has_key? first_field )\n\n puts \"Key: #{first_field} not found\"\n\n child_field_group = Hyacinth::Utils::DynamicFieldGroupBuilder.new first_field, self\n @child_field_groups[first_field] = child_field_group\n\n else\n\n # even though we already have a DynamicFieldGroupBuilder created for this type of dynamic field group,\n # this may be a repeatable field, which means we need to create a new one if needed. The heuristic we use\n # here is that if we try to set a field that already exists, then this must be the next instance in a \n # repeatable field group\n if (@child_field_groups[first_field].field_exists? rest_of_header)\n\n # field exists, so start a new dynamic field\n child_field_group = Hyacinth::Utils::DynamicFieldGroupBuilder.new first_field, self\n \n else\n\n # use existing one\n child_field_group = @child_field_groups[first_field]\n \n end\n\n end\n\n return @child_field_groups[first_field].process_header_repeatable_field_names_do_not_have_numbers(rest_of_header)\n \n end\n\n end", "def last(array)\n array[-1]\nend", "def last_sibling_in_list\n self.class.asc(:position).last\n end", "def child_structure\n # New records cannot have children\n raise Structure::StructureException.new('No child structure for new record. Save record before performing tree operations.') if new_record?\n v = \"#{self.send \"#{self.base_class.structure_column}_was\"}\"\n return id.to_s if v.blank?\n v.split(',').map{|x| x + '/' + id.to_s}.join(',')\n end", "def using_last(array)\n array.last\n# returns last item in array \nend", "def last_of(arr)\n return arr[-1]\nend", "def last_element(array)\n array[-1]\nend", "def serialize_fields(buffer, max_bson_size = nil)\n fields.each do |field|\n value = instance_variable_get(field[:name])\n if field[:multi]\n value.each do |item|\n if field[:type].respond_to?(:size_limited?)\n field[:type].serialize(buffer, item, max_bson_size)\n else\n field[:type].serialize(buffer, item)\n end\n end\n else\n if field[:type].respond_to?(:size_limited?)\n field[:type].serialize(buffer, value, max_bson_size)\n else\n field[:type].serialize(buffer, value)\n end\n end\n end\n end", "def my_controlled_flatten(n=1)\n #here\n return self if n < 1\n\n results = []\n self.each do |el|\n if el.class == Array\n #here\n results += el.my_controlled_flatten(n-1)\n else\n results << el\n end\n end\n\n results\n\n end", "def continue_field(value, owner_type, field, current_type, ast_node, next_selections, is_non_null, owner_object, arguments, result_name, selection_result) # rubocop:disable Metrics/ParameterLists\n if current_type.non_null?\n current_type = current_type.of_type\n is_non_null = true\n end\n\n case current_type.kind.name\n when \"SCALAR\", \"ENUM\"\n r = begin\n current_type.coerce_result(value, context)\n rescue StandardError => err\n schema.handle_or_reraise(context, err)\n end\n set_result(selection_result, result_name, r, false, is_non_null)\n r\n when \"UNION\", \"INTERFACE\"\n resolved_type_or_lazy = resolve_type(current_type, value)\n after_lazy(resolved_type_or_lazy, ast_node: ast_node, field: field, owner_object: owner_object, arguments: arguments, trace: false, result_name: result_name, result: selection_result) do |resolved_type_result|\n if resolved_type_result.is_a?(Array) && resolved_type_result.length == 2\n resolved_type, resolved_value = resolved_type_result\n else\n resolved_type = resolved_type_result\n resolved_value = value\n end\n\n possible_types = query.possible_types(current_type)\n if !possible_types.include?(resolved_type)\n parent_type = field.owner_type\n err_class = current_type::UnresolvedTypeError\n type_error = err_class.new(resolved_value, field, parent_type, resolved_type, possible_types)\n schema.type_error(type_error, context)\n set_result(selection_result, result_name, nil, false, is_non_null)\n nil\n else\n continue_field(resolved_value, owner_type, field, resolved_type, ast_node, next_selections, is_non_null, owner_object, arguments, result_name, selection_result)\n end\n end\n when \"OBJECT\"\n object_proxy = begin\n current_type.wrap(value, context)\n rescue GraphQL::ExecutionError => err\n err\n end\n after_lazy(object_proxy, ast_node: ast_node, field: field, owner_object: owner_object, arguments: arguments, trace: false, result_name: result_name, result: selection_result) do |inner_object|\n continue_value = continue_value(inner_object, owner_type, field, is_non_null, ast_node, result_name, selection_result)\n if HALT != continue_value\n response_hash = GraphQLResultHash.new(result_name, selection_result, is_non_null)\n set_result(selection_result, result_name, response_hash, true, is_non_null)\n gathered_selections = gather_selections(continue_value, current_type, next_selections)\n # There are two possibilities for `gathered_selections`:\n # 1. All selections of this object should be evaluated together (there are no runtime directives modifying execution).\n # This case is handled below, and the result can be written right into the main `response_hash` above.\n # In this case, `gathered_selections` is a hash of selections.\n # 2. Some selections of this object have runtime directives that may or may not modify execution.\n # That part of the selection is evaluated in an isolated way, writing into a sub-response object which is\n # eventually merged into the final response. In this case, `gathered_selections` is an array of things to run in isolation.\n # (Technically, it's possible that one of those entries _doesn't_ require isolation.)\n tap_or_each(gathered_selections) do |selections, is_selection_array|\n if is_selection_array\n this_result = GraphQLResultHash.new(result_name, selection_result, is_non_null)\n final_result = response_hash\n else\n this_result = response_hash\n final_result = nil\n end\n # reset this mutable state\n # Unset `result_name` here because it's already included in the new response hash\n st = get_current_runtime_state\n st.current_object = continue_value\n st.current_result_name = nil\n st.current_result = this_result\n\n # This is a less-frequent case; use a fast check since it's often not there.\n if (directives = selections[:graphql_directives])\n selections.delete(:graphql_directives)\n end\n call_method_on_directives(:resolve, continue_value, directives) do\n evaluate_selections(\n continue_value,\n current_type,\n false,\n selections,\n this_result,\n final_result,\n owner_object.object,\n )\n this_result\n end\n end\n end\n end\n when \"LIST\"\n inner_type = current_type.of_type\n # This is true for objects, unions, and interfaces\n use_dataloader_job = !inner_type.unwrap.kind.input?\n inner_type_non_null = inner_type.non_null?\n response_list = GraphQLResultArray.new(result_name, selection_result, is_non_null)\n set_result(selection_result, result_name, response_list, true, is_non_null)\n idx = nil\n list_value = begin\n value.each do |inner_value|\n idx ||= 0\n this_idx = idx\n idx += 1\n if use_dataloader_job\n @dataloader.append_job do\n resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type)\n end\n else\n resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type)\n end\n end\n\n response_list\n rescue NoMethodError => err\n # Ruby 2.2 doesn't have NoMethodError#receiver, can't check that one in this case. (It's been EOL since 2017.)\n if err.name == :each && (err.respond_to?(:receiver) ? err.receiver == value : true)\n # This happens when the GraphQL schema doesn't match the implementation. Help the dev debug.\n raise ListResultFailedError.new(value: value, field: field, path: current_path)\n else\n # This was some other NoMethodError -- let it bubble to reveal the real error.\n raise\n end\n rescue GraphQL::ExecutionError, GraphQL::UnauthorizedError => ex_err\n ex_err\n rescue StandardError => err\n begin\n query.handle_or_reraise(err)\n rescue GraphQL::ExecutionError => ex_err\n ex_err\n end\n end\n # Detect whether this error came while calling `.each` (before `idx` is set) or while running list *items* (after `idx` is set)\n error_is_non_null = idx.nil? ? is_non_null : inner_type.non_null?\n continue_value(list_value, owner_type, field, error_is_non_null, ast_node, result_name, selection_result)\n else\n raise \"Invariant: Unhandled type kind #{current_type.kind} (#{current_type})\"\n end\n end", "def using_last(array)\n last_element=array.last\nend", "def subfield(tag)\n subfields.find { |sf| sf.tag == tag.to_s }\n end", "def get_child!(children)\n children[1] || children\n end", "def process_header(header)\n\n first_field, rest_of_header = header.split(':',2)\n\n if first_field == header\n\n # we have a field name, i.e. a dynamic field\n # puts \"we got a field name: \" + \"#{first_field}\"\n\n return add_child_field first_field\n\n else\n \n # error condition if there is nothing after the ':'\n return nil if rest_of_header == ''\n\n # puts \"First part of header: \" + \"#{first_field}\"\n # puts \"Second part of header: \" + \"#{rest_of_header}\"\n\n # we have a field_group name, i.e. a dynamic field group\n\n # puts \"Here is the first_field: #{first_field}\"\n dynamic_field_group_type = first_field.gsub(/\\d*/,'')\n # puts \"Here is the dynamic_field_group_type: #{dynamic_field_group_type}\"\n @child_field_groups[first_field] ||= Hyacinth::Utils::DynamicFieldGroupBuilder.new first_field, self\n # @child_dynamic_field_groups_by_type[dynamic_field_group_type] = {first_field => @child_field_groups[first_field]}\n # @child_dynamic_field_groups_by_type[dynamic_field_group_type] = { first_field => @child_field_groups[first_field] }\n @child_dynamic_field_groups_by_type[dynamic_field_group_type] = \n Hash.new unless child_dynamic_field_groups_by_type.has_key? dynamic_field_group_type\n @child_dynamic_field_groups_by_type[dynamic_field_group_type][first_field] = @child_field_groups[first_field]\n # @child_dynamic_field_groups_by_type[dynamic_field_group_type].store [first_field] = @child_field_groups[first_field]\n\n return @child_field_groups[first_field].process_header(rest_of_header)\n \n end\n\n end", "def calc_of_parent_one(field_set)\n unless @@result_group[self.id].blank?\n @@result_group[self.id].map{|x| x.calc_of_parent_one(field_set)}\n sum_value = total_calc(@@result_group[self.id],field_set[0]) \n @@result_group[self.parent_id].map{|x| x.id == self.id && x[field_set[0]] = sum_value}\n end \n end", "def all_fields\n return @all_fields if defined? @all_fields\n\n @all_fields ||= fields.includes(field_set: [:catalog]).each_with_object([]) do |field, all|\n all << field\n next unless field.is_a?(Field::ChoiceSet)\n\n field.choices.includes(:category).each do |choice|\n category = choice.category\n next unless category&.not_deleted?\n\n additional_fields = category.fields.includes(field_set: [:catalog]).map do |f|\n f.category_choice = choice\n f.category_choice_set = field.choice_set\n f\n end\n all.concat(additional_fields)\n end\n end\n end", "def field_path *fields\n FieldPath.new(*fields)\n end", "def increment_greatest_value(nested_array)\n greatest_value = nested_array.flatten.min\n nested_array.each do |array|\n array.each do |current_value|\n if greatest_value < nil\n greatest_value = current_value\n end\n end\n end\n greatest_value += 1\nend", "def max(coll, field)\n @db[coll].find.sort(field => -1).limit(1).first\n end", "def last_of(arr)\n output = arr[-1]\n return output\nend", "def look_for_dependent_ons(parent_fieldset)\n output = []\n parent_fieldset.fieldset_children.each do |fieldset_child|\n if fieldset_child.child_type == \"DynamicFieldsets::Field\"\n if fieldset_child.dependencies.present?\n output.push fieldset_child\n end\n else # if child type is a fieldset, then recurse\n output += look_for_dependent_ons(fieldset_child.child)\n end\n end\n return output\n end", "def non_mutate(array)\n array.last\nend", "def next(field=nil)\n field = field || self.class.by_star_field\n self.class.future(self.send(field.to_s.split(\".\").last)) { { :order => \"#{field} ASC\" }}.first\n end", "def file_add_field_data(file=nil,field=nil,value=nil)\n\n #validate class types\n unless file.is_a?(Files) || (file.is_a?(String) && (file.to_i != 0)) || file.is_a?(Integer)\n warn \"Argument Error: Invalid type for first argument in \\\"file_add_field_data\\\" method.\\n\" +\n \" Expected Single Files object, Numeric string, or Integer for file id\\n\" +\n \" Instead got => #{file.inspect}\"\n return \n end \n\n unless field.is_a?(Fields) || (field.is_a?(String) && (field.to_i != 0)) || field.is_a?(Integer)\n warn \"Argument Error: Invalid type for second argument in \\\"file_add_field_data\\\" method.\\n\" +\n \" Expected Single Fields object, Numeric string, or Integer for field id\\n\" +\n \" Instead got => #{field.inspect}\"\n return \n end\n\n unless value.is_a?(String) || value.is_a?(Integer) || value.is_a?(Float)\n warn \"Argument Error: Invalid type for third argument in \\\"file_add_field_data\\\" method.\\n\" +\n \" Expected a String, Integer, or Float\\n\" +\n \" Instead got => #{value.inspect}\"\n return \n end\n\n current_file = nil\n current_field = nil\n current_value = value.to_s.strip\n nested_field = Struct.new(:id,:values)\n\n file_class = file.class.to_s\n field_class = field.class.to_s\n\n #set up objects\n if file_class == 'Files'\n current_file = file\n elsif file_class == 'String' || file_class == 'Integer' \n #retrieve Projects object matching id provided\n uri = URI.parse(@uri + \"/Files\")\n option = RestOptions.new\n option.add_option(\"id\",file.to_s)\n current_file = get(uri,option).first\n unless current_file\n warn \"ERROR: Could not find Project with matching id of \\\"#{file.to_s}\\\"...Exiting\"\n return\n end\n else\n warn \"Unknown Error retrieving Files. Exiting.\"\n return\n end\n\n if field_class == 'Fields'\n current_field = field\n elsif field_class == 'String' || field_class == 'Integer'\n uri = URI.parse(@uri + \"/Fields\")\n option = RestOptions.new\n option.add_option(\"id\",field.to_s)\n current_field = get(uri,option).first\n unless current_field\n warn \"ERROR: Could not find Field with matching id of \\\"#{field.to_s}\\\"\\n\" +\n \"=> Hint: It either doesn't exist or it's disabled.\"\n return false\n end\n unless current_field.field_type == \"image\"\n warn \"ERROR: Expected a Project field. The field provided is a \\\"#{current_field.field_type}\\\" field.\"\n return false\n end \n else\n warn \"Unknown Error retrieving Field. Exiting.\"\n return\n end\n\n #Prep endpoint to be used for update\n files_endpoint = URI.parse(@uri + \"/Files/#{current_file.id}/Fields\")\n\n #Check the field type -> if its option or fixed suggestion we must make the option\n #available first before we can apply it to the Files resource\n if RESTRICTED_LIST_FIELD_TYPES.include?(current_field.field_display_type)\n \n lookup_string_endpoint = URI.parse(@uri + \"/Fields/#{current_field.id}/FieldLookupStrings\")\n\n #Grab all the available FieldLookupStrings for the specified Fields resource\n field_lookup_strings = get(lookup_string_endpoint,nil)\n\n #check if the value in the third argument is currently an available option for the field\n lookup_string_exists = field_lookup_strings.find { |item| current_value.downcase == item.value.downcase }\n\n # add the option to the restricted field first if it's not there, otherwise you get a 400 bad \n # request error saying that it couldn't find the string value for the restricted field specified \n # when making a PUT request on the FILES resource you are currently working on\n unless lookup_string_exists\n data = {:value => current_value}\n response = post(lookup_string_endpoint,data,false)\n unless response.kind_of?(Net::HTTPSuccess)\n return\n end\n end\n\n # Now that we know the option is available, we can update the File we are currently working with\n index = current_file.fields.find_index { |nested_field| nested_field.id.to_s == current_field.id.to_s }\n\n if index\n current_file.fields[index].values = [current_value]\n else\n current_file.fields << nested_field.new(current_field.id,[current_value])\n end\n\n update_files(current_file,false)\n\n elsif current_field.field_display_type == \"date\"\n #make sure we get the right date format\n #Accepts mm-dd-yyyy, mm-dd-yy, mm/dd/yyyy, mm/dd/yy\n date_regex = Regexp::new('((\\d{2}-\\d{2}-(\\d{4}|\\d{2}))|(\\d{2}\\/\\d{2}\\/(\\d{4}|\\d{2})))')\n unless (value =~ date_regex) == 0\n warn \"ERROR: Invalid date format. Expected => \\\"mm-dd-yyyy\\\" or \\\"mm-dd-yy\\\"\"\n return\n end\n\n value.gsub!('/','-')\n date_arr = value.split('-') #convert date string to array for easy manipulation\n\n if date_arr.last.length == 2 #convert mm-dd-yy to mm-dd-yyyy format\n four_digit_year = '20' + date_arr.last\n date_arr[-1] = four_digit_year\n end\n #convert date to 14 digit unix time stamp\n value = date_arr[-1] + date_arr[-3] + date_arr[-2] + '000000'\n\n #Apply the date to our current Files resource\n data = {:id => current_field.id, :values => [value.to_s]}\n put(files_endpoint,data,false)\n\n\n elsif NORMAL_FIELD_TYPES.include?(current_field.field_display_type)\n #some fields are built into Files so they can't be inserted into\n #the Files nested fields resource. We get around this by using the\n #name of the field object to access the corresponding built-in field attribute\n #inside the Files object.\n if current_field.built_in.to_s == \"1\" #For built in fields\n files_endpoint = URI.parse(@uri + '/Files') #change endpoint bc field is built_in\n field_name = current_field.name.downcase.gsub(' ','_') #convert the current field's name\n #into the associated files' built_in attribute name\n \n #access built-in field\n unless current_file.instance_variable_defined?('@'+field_name)\n warn \"ERROR: The specified attirbute \\\"#{field_name}\\\" does not\" + \n \" exist in the File. Exiting.\"\n exit\n end\n \n current_file.instance_variable_set('@'+field_name, value)\n put(files_endpoint,current_file)\n else #For regular non-built in fields\n\n data = {:id => current_field.id, :values => [value.to_s]}\n put(files_endpoint,data,false)\n \n end\n\n elsif current_field.field_display_type == 'boolean'\n\n #validate value\n unless ALLOWED_BOOLEAN_FIELD_OPTIONS.include?(value.to_s.strip)\n msg = \"Invalid value #{value.inspect} for \\\"On/Off Switch\\\" field type.\\n\" +\n \"Acceptable Values => #{ALLOWED_BOOLEAN_FIELD_OPTIONS.inspect}\"\n logger.error(msg.red)\n return\n end\n \n \n #Interpret input\n #Even indicies in the field options array are On and Odd indicies are Off\n bool_val = \"\"\n if ALLOWED_BOOLEAN_FIELD_OPTIONS.find_index(value.to_s.strip).even?\n bool_val = \"1\"\n elsif ALLOWED_BOOLEAN_FIELD_OPTIONS.find_index(value.to_s.strip).odd?\n bool_val = \"0\"\n end\n\n #Prep the endpoint\n files_endpoint = URI.parse(@uri + '/Files')\n\n current_file.fields.each do |obj| \n if obj.id == current_field.id\n obj.values[0] = bool_val\n end\n \n end\n #udatte current variable for verbose statement\n current_value = bool_val\n #Actually do the update\n put(files_endpoint,current_file,false)\n else\n msg = \"The field specified does not have a valid field_display_type.\" +\n \"Value provided => #{field.field_display_type.inspect}\"\n logger.error(msg.red)\n return\n end\n\n if @verbose\n msg = \"Setting value: \\\"#{current_value}\\\" to \\\"#{current_field.name}\\\" field \" +\n \"for file => #{current_file.filename}\"\n logger.info(msg.green)\n end\n end" ]
[ "0.59080845", "0.56681645", "0.54430634", "0.5370381", "0.5351737", "0.5320911", "0.5302727", "0.5220414", "0.52140176", "0.5203989", "0.5203787", "0.51899236", "0.5187229", "0.5157163", "0.5131079", "0.5122954", "0.5122617", "0.51044697", "0.5096488", "0.5095738", "0.5076473", "0.50517106", "0.5037736", "0.503039", "0.5026436", "0.5018338", "0.49831438", "0.49805114", "0.49732053", "0.4959399", "0.49510968", "0.4947275", "0.49434066", "0.49262917", "0.4924116", "0.4924116", "0.4895589", "0.48908094", "0.48785153", "0.48783648", "0.4862367", "0.4850154", "0.4845027", "0.48395154", "0.4835019", "0.48313546", "0.48228994", "0.48158467", "0.48130912", "0.48081392", "0.48081392", "0.48065937", "0.4802265", "0.47866425", "0.47807527", "0.47805306", "0.47795236", "0.4778454", "0.4776833", "0.47682834", "0.47508162", "0.47467217", "0.47335744", "0.47227865", "0.47165218", "0.47023144", "0.47023144", "0.4698676", "0.46976426", "0.46957004", "0.46704072", "0.46626788", "0.466132", "0.465664", "0.46539268", "0.465371", "0.4647093", "0.46436554", "0.4642052", "0.46392384", "0.46357986", "0.4632366", "0.46292892", "0.462609", "0.46225545", "0.4610056", "0.46028236", "0.4590882", "0.45853177", "0.45808813", "0.45693594", "0.4566625", "0.45662898", "0.45644578", "0.45614007", "0.45534283", "0.45502308", "0.45376015", "0.45364425", "0.45351762" ]
0.62602544
0
Given a field (and optional delimiter), return a path to the current object. e.g. you'd end up with /path/to/page (where this object is 'page')
def nested_path_by(field, opts = {}) options = {delimiter: "/", prefix: ""} options.merge!(opts) delimiter = options[:delimiter] prefix = options[:prefix].empty? ? "" : "#{options[:prefix]}#{delimiter}" path = ([self] + ancestors).reverse.collect {|a| a.send(field)}.join(delimiter).gsub(prefix,"") return delimiter + path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_path *fields\n FieldPath.new(*fields)\n end", "def path\n position = document.atomic_position\n position.blank? ? field : \"#{position}.#{field}\"\n end", "def format_path(object)\n object.path.gsub('::', '_')\n end", "def path\n if value.is_a?(String)\n value\n else\n value.send(path_method, *path_arguments)\n end\n end", "def path_to(obj)\n end", "def path\n @type.pathto @id\n end", "def method_missing(method, *args)\n if method =~ /current_(.*)/\n return path_part( @parts[$1.to_sym] ) if @parts.has_key?($1.to_sym)\n end\n\n super\n end", "def [](value)\n return nil if value.nil?\n \n if not value.kind_of? String\n raise ArgumentInvalidTypeError.new 'value', value, String\n end\n \n current_path_part = self\n path_parts = value.split('.')\n counter = 1\n path_parts.each do |part|\n current_path_part = current_path_part.child_path_part(part)\n return nil if current_path_part.nil?\n end\n return current_path_part\n end", "def serialized_path(object); end", "def serialized_path(object); end", "def path\n @path\n end", "def path\n @path\n end", "def path\n return @path\n end", "def path_nav(obj, path = '', delimiter = '.', &block)\n case obj\n when Hash\n if obj.empty?\n yield path, obj\n else\n obj.each do |k, v|\n path_nav(\n v,\n (path ? [path, k.to_s.gsub(delimiter, \"\\\\#{delimiter}\")].join(delimiter) : k.to_s.gsub(delimiter, \"\\\\#{delimiter}\")).to_s,\n delimiter,\n &block\n )\n end\n end\n when Array\n if obj.empty?\n yield path, obj\n else\n obj.each_with_index do |ob, index|\n path_nav(\n ob,\n (path ? [path, \"[#{index}]\"].join(delimiter) : \"[#{index}]\").to_s,\n delimiter,\n &block\n )\n end\n end\n else\n yield path, obj\n end\n end", "def get_object(o)\n p = URI.unescape(URI(o.split(\" \")[1]).path)\n return File.join('./',p) # join on the current directory\nend", "def path(value)\n define_singleton_method(:path_value) { value.to_s }\n private_class_method :path_value\n end", "def path\n \"#{@parent.path}##{@name}\"\n end", "def path\n \"#{@parent.path}##{@name}\"\n end", "def split_path; end", "def path(value = nil)\n @path = value if value\n\n return @path if @path\n\n superclass.respond_to?(:path) ? superclass.path : nil\n end", "def path\n Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end", "def path\n @value[:value]\n end", "def split_path\n to_s.split_path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n ([*@options['path']].first.split(',').first || '/').strip\n end", "def path\n # FIXME: Do this without exception!\n #\"#{ @parent.path unless @parent == self }##{ ident }\"\n # rescue base path\n \"#{@parent.path rescue ''}##{ident}\"\n end", "def path\n\t\t@path\n\tend", "def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end", "def thing_path(model, object)\n id = object['ID'] || object['id']\n send(:\"admin_#{undersingularize(model)}_path\", id: id)\n end", "def path\n read_attribute(:path).sub(/^[^:]+:/,'').gsub(/^\\/+/,'')\n end", "def get_path\n request_object.path\n end", "def path(document)\n relation.path(document)\n end", "def path\n return get_path self\n end", "def property_path(prop_name)\n prop_name.split('.')\n end", "def path\n [name]\n end", "def to_partial_path\n \"/fields/belongs_to/#{page}\"\n end", "def tfs_path\n case @path[0]\n when \"$\"\n @path\n when \"/\"\n \"$#{@path}\"\n else\n \"$/#{@path}\"\n end\n end", "def path\n return @path\n end", "def path\n return @path\n end", "def path\n return @path\n end", "def path\n name = @resource.value(:name)\n if (attrs = self.class.all[name])\n attrs[:path]\n end\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a.send(e) unless a.nil? }\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a&.send(e) }\n rescue NoMethodError\n ''\n end", "def text_part\n return @seo_path if @seo_path\n # If there is more than one SEO column - prepare url \"text\" part\n if @klass.seo_columns.is_a?(Array)\n seo_parts = @klass.seo_columns.collect do |field|\n el = @instance.send(field)\n el.to_s.to_url if el\n end\n seo_parts.delete_if{|el| el.to_s.length == 0}\n @seo_path = seo_parts.join('-')\n else\n el = @instance.send(@klass.seo_columns)\n @seo_path = el ? el.to_s.to_url : ''\n end\n @seo_path\n end", "def things_path(object = nil)\n object ||= @route_name || controller_name\n send(:\"admin_#{underpluralize(object)}_path\")\n end", "def path\n ensure_valid\n @path\n end", "def path\n name = @resource.value(:name)\n # rubocop:disable Style/GuardClause\n if (attrs = self.class.all[name])\n # rubocop:enable Style/GuardClause\n attrs[:path]\n end\n end", "def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end", "def path ; @request.path_info ; end", "def query_path\n @attributes[:query_path]\n end", "def Path(arg)\n Path[arg]\nend", "def path_part(part)\n @_path_parts ||= Blog::UriTemplates.extract_params(blog_data.source_template, path)\n @_path_parts[part.to_s]\n end", "def path\n \"#{@parent.path}##{@aref}\"\n end", "def path\n \"#{@parent.path}##{@aref}\"\n end", "def to_s\n @path\n end", "def to_s\n @path\n end", "def to_s\n return \"\" if self.empty?\n @path.join(\":\")\n end", "def save_as_field(field, save_path = false)\n lambda do |release, links|\n links.map do |link|\n result = {\n link: link,\n field => link.content.delete('/')\n }\n result[:repo_url] = \"#{release[:url]}#{link[:href]}\" if save_path\n result\n end\n end\n end", "def instance_path(parent_path, ident)\n path = build_path(parent_path)\n path += ::File::SEPARATOR if not path.empty?\n path += ident.to_s\n end", "def path\n @pathname.to_s\n end", "def get_Path(initial)\n\tinitial.split(' ',3)[1]\nend", "def path\r\n @pathname.to_s\r\n end", "def path(options={}, &block)\n cur_page.path(options, &block)\n end", "def object_path(id)\n \"#{git_path}/objects/#{ id[0...2] }/#{ id[2..39] }\"\n end", "def path(request)\n request.path\n end", "def path\n # TODO: is this trip really necessary?!\n data.fetch(\"path\") { relative_path }\n end", "def path(path = nil)\n @path ||= path || low_name\n end", "def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end", "def path\n\t\t\t@path_elements.join(\"/\")\n\t\tend", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def path\n @attributes[:path]\n end", "def to_partial_path\n \"madmin/fields/#{self.class.to_s.split(\"Madmin::Field::\").last.underscore}\"\n end", "def path_string\n \"\\#{#{position}}\"\n end", "def path!\n model.dataset.select(:path).get_unfiltered_raw(id).try(:[], :path)\n end", "def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end", "def path\n parse_request! if @path.nil?\n @path\n end", "def delimiter\n @location.delimiter\n end", "def auto_path\n cur_page.auto_path\n end", "def object_for(path)\n # We do the traversal so that the user does not need to.\n path.split(\"/\").inject(self) {|tree, name|\n tree.objects.find {|obj| obj.name == name }\n }\n end", "def getDocPath(value)\n doc_array = @docs.find_one({:docname => value}).to_a\n return doc_array[2][1]\n end", "def path\n @data[\"path\"].to_s\n end", "def path\n Pathname(super)\n end", "def object_path(id)\n \"#{path}/objects/#{id[0...2]}/#{id[2..39]}\"\n end" ]
[ "0.7080905", "0.6715625", "0.58925784", "0.5880446", "0.5816501", "0.5636496", "0.56151146", "0.56148654", "0.5562594", "0.5562594", "0.5509637", "0.5509637", "0.5478027", "0.54699725", "0.5450733", "0.5439551", "0.539896", "0.539896", "0.5393265", "0.5374846", "0.53731406", "0.53584516", "0.5346336", "0.53334594", "0.53334594", "0.53334594", "0.53334594", "0.5313949", "0.53014416", "0.52859634", "0.52747995", "0.52735376", "0.52635974", "0.52581966", "0.52353644", "0.5206959", "0.51971763", "0.51919186", "0.5190957", "0.5189572", "0.5186061", "0.5186061", "0.5186061", "0.51800424", "0.5158301", "0.5158301", "0.5158301", "0.5158301", "0.5154924", "0.5148138", "0.51459014", "0.5142104", "0.5113907", "0.51130813", "0.51088697", "0.51001996", "0.5099813", "0.5095904", "0.509245", "0.5085857", "0.5085857", "0.50766045", "0.50766045", "0.5070329", "0.50658435", "0.5057885", "0.50488734", "0.5047019", "0.5044953", "0.50394446", "0.5038137", "0.50376695", "0.50374985", "0.50365573", "0.5032848", "0.50287175", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.5026624", "0.50255954", "0.5025449", "0.5024105", "0.50239515", "0.5020306", "0.5012487", "0.50099754", "0.5008381", "0.5005379", "0.5000416", "0.49931726", "0.4992979" ]
0.74437016
0
Checks if the attachment is restricted, because it is attached on restricted pages only
def restricted? pages.any? && pages.not_restricted.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted?\n page.restricted?\n end", "def attachments_permission\n @attributes[:attachments_permission]\n end", "def attachments_permission\n @attributes[:attachments_permission]\n end", "def has_attachments\n preneed_attachments.present?\n end", "def provision_attachments_permission\n @attributes[:provision_attachments_permission]\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def verify_access\n @photo = Photo.lock.find_by(id: params[:id])\n\n if @photo.nil? || (!@photo.visibility && @photo.owner != current_user)\n flash[:alert] = I18n.t(\"photos.access\")\n redirect_to gallery_path\n end\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def attachments?\n self.attachments.size > 0\n end", "def attachments?\n self.attachments.size > 0\n end", "def attachments?\n !attachments.empty?\n end", "def attachment?\n attachment.present? && attachment.readable?\n end", "def has_attachments?\n !attachments.empty?\n end", "def has_attachment?(attachment_name)\n !!(self['_attachments'] && self['_attachments'][attachment_name] && !self['_attachments'][attachment_name].empty?)\n end", "def has_attachments?\n !(attachments.nil? || attachments.empty? || attachments[0].empty?)\n end", "def attached?\n attachments.any?\n end", "def attachment?\n !!find_attachment\n end", "def ensure_attachment_present\n if attachments.empty?\n false\n else\n errors.add(:base, 'Attachment needed')\n true\n end\n end", "def restricted_by_location?\n rights.restricted_by_location?(file_name)\n end", "def has_attachment?\n !!attachment_ids && attachment_ids.any?\n end", "def user_owns_reflection?\n unless @reflection.student.uid == current_user.uid\n flash[:notice] = 'You may only edit your own reflections.'\n redirect_to reflections_url\n end\n end", "def attached?\n attachment.present?\n end", "def has_attachment?\n @has_attachment ||=\n mime_parts(\"text/plain\").any? do |type, fn, id, content|\n fn && (type !~ SIGNATURE_ATTACHMENT_TYPE)\n end\n end", "def accept_attachment?(attachment)\n if attachment.content_type.start_with?('image/') && attachment.content_disposition.start_with?('inline; ')\n false\n else\n super\n end\n rescue => e\n # log error\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"ERROR=#{e.message}\")\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"BACKTRACE=\\n#{e.backtrace.join(\"\\n\")}\")\n # raise error that can be catched by 'notify_invalid_mail_handler' plugin\n raise RedmineHtmlMailHandler::Error, e.message\n end", "def attachments?\n self.primary_attachment.file? || self.secondary_attachment.file?\n end", "def can_accept?(linkage)\n if (linkage.second_position == 0)\n return true\n end\n ! self.attachment_position_consumed?(linkage.second_position)\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def handle_content_exclusions\r\n @entry ||= Content.find(@content_id || params[:id])\r\n raise Kroogi::NotFound if @entry.class.name.to_s == 'ImageThumbnail'\r\n raise Kroogi::NotFound if @entry.featured_album?\r\n @entry.calc_in_inbox_by_user_data\r\n raise Kroogi::NotPermitted unless @entry.is_view_permitted? ||\r\n (permitted?(current_user, :moderate) && @entry.restriction_level >= Content.allow_moderators_to_view_this_circle_and_further) ||\r\n (current_user.admin? && params[:force_view])\r\n unless @entry.active?\r\n flash[:warning] = \"This content item has been blocked by the moderation team, and is no longer available for viewing\".t\r\n if permitted?(current_user, :moderate)\r\n return false\r\n else\r\n redirect_to(explore_path) and return false\r\n end\r\n end\r\n end", "def case_file_link?\n if params[:action]\n if params[:action] == \"admission\"\n return true\n end\n end\n\n return false\n end", "def audience_restricted?\n xml.attribute('audience_restricted') == 'true'\n end", "def attached?\n self.attachments.map(&:state).any? { |state| state == \"attached\" || state == \"attaching\" }\n end", "def restricted_should_authenticate\n authenticate_user! unless @document.public?\n end", "def show\n @document = Attached.find(params[:id])\n\n rootString = root_url.to_s.gsub(\"?locale=\", \"\")\n\n if request.referer\n if request.referer.include?(rootString + \"events/\" + @document.event_id.to_s) or request.referer.include?(rootString + \"manage_attached/\" + @document.event_id.to_s)\n data = open(@document.attached_url(:original)) \n send_data data.read, filename: @document.attached_file_name, type: @document.attached_content_type, disposition: 'inline', stream: 'true'\n return\n end\n end\n \n redirect_to root_url, alert: \"This document can only be viewed through the event page\"\n \n end", "def attachment_with_upload_method\n if method == \"upload\" && !attachment?\n errors.add(:base, \"Please make sure to upload your prescription.\")\n end\n end", "def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end", "def ensure_authorized_to_reply\n unless @listing.visible_to?(@current_user, @current_community)\n flash[:error] = t(\"layouts.notifications.you_are_not_authorized_to_view_this_content\")\n redirect_to root and return\n end\n end", "def ensure_authorized_to_reply\n unless @listing.visible_to?(@current_user, @current_community)\n flash[:error] = t(\"layouts.notifications.you_are_not_authorized_to_view_this_content\")\n redirect_to root and return\n end\n end", "def permitted_to_publish?\n @pcp_subject.user_is_owner_or_deputy?( current_user, @pcp_subject.current_step.acting_group_index )\n end", "def attachment?(file_name)\n frm.link(:text=>file_name).exist?\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def can_attach?(additional_size)\n\n return (additional_size <= (THETIS_MAIL_SEND_ATTACHMENT_MAX_KB*1024 - self.get_attach_size))\n end", "def safe_is_restricted_value(unsafe_is_restricted)\n if current_educator.can_view_restricted_notes?\n unsafe_is_restricted\n else\n false\n end\n end", "def has_files?\n attachments.count > 0\n end", "def ensure_authorized_to_reply\n unless @listing.visible_to?(@current_user, @current_community)\n flash[:error] = t(\"layouts.notifications.you_are_not_authorized_to_view_this_content\")\n redirect_to search_path and return\n end\n end", "def may_share_document?(document=nil)\n\t\t\tdocument && ( \n\t\t\t\tself.is_administrator? ||\n\t\t\t\t( document.owner && self == document.owner ) \n\t\t\t)\n\t\tend", "def attached?\n !!file\n end", "def check_access_settings\n redirect = request.referrer.nil? ? site_path : request.referrer\n downloads_enabled = AdminConfiguration.firecloud_access_enabled?\n if !downloads_enabled\n redirect_to redirect, alert: \"Study access has been temporarily disabled by the site adminsitrator. Please contact #{view_context.mail_to('single_cell_portal@broadinstitute.org')} if you require assistance.\" and return\n end\n end", "def attached?(filename); end", "def images_add?\r\n\t\tuser_allowed_to_object?(user, record, [:edit])\r\n\tend", "def image_upload_allowed?\n company = sender.company\n !!company.settings.recognition_editor_settings[:allow_uploading_images]\n end", "def remember_attachments? #:doc:\n @remember_attachments ? true : false\n end", "def permitted_for_research_object?(item = self)\n if item.is_downloadable?\n item.can_download?(nil)\n else\n item.can_view?(nil)\n end\n end", "def protection\n @photo=Photo.find(params[:id])\n if current_user != @photo.user\n redirect_to root_url, :alert => \"Not authorized for that.\"\n end\n end", "def authorized?\n if !@extra_page.editable_by? current_user, current_cookbook\n redirect_to sections_path, alert: \"You are not allowed to edit this extra page.\"\n end\n end", "def file_download_access?\n if license_delivery_contact == 'Yes'\n true\n end\n end", "def allowed_user\n unless current_user.id == Design.find(params[:design_id]).user.id\n flash[:notice] = 'Voce não tem permissão para fazer isso!'\n redirect_to root_url\n end\n end", "def accept_attachment?(attachment)\n @excluded ||= Setting.mail_handler_excluded_filenames.to_s.split(',').map(&:strip).reject(&:blank?)\n @excluded.each do |pattern|\n regexp = %r{\\A#{Regexp.escape(pattern).gsub(\"\\\\*\", \".*\")}\\z}i\n if attachment.filename.to_s =~ regexp\n logger.info \"MailHandler: ignoring attachment #{attachment.filename} matching #{pattern}\"\n return false\n end\n end\n true\n end", "def checkage_restriction_on_book\n @messsage = \"Your age criteria not satisfied to view that book.\"\n render :file => \"shared/message\" if current_user && current_user.age_restriction_on_resource(@book)\n end", "def license_allows_download?(document)\n document[:license_ss] =~ /(Creative Commons|No known restrictions)/\n end", "def priviledged?\n @priviledged\n end", "def item_only_attachments\n @relevant_object = convert_id_to_model(params[:id])\n @images = @relevant_object.media_items\n end", "def attached_file_valid?\n return false if file.nil?\n file_attacher.validate\n file_attacher.errors.each { |e|\n errors.add(:file, :invalid, message: e)\n }.empty?\n end", "def require_extraction_form_ownership\n \t\textraction_form_id = params[:extraction_form_id]\n \t\textraction_form = ExtractionForm.find(extraction_form_id, :select=>[\"creator_id\"])\n \t\tunless extraction_form.creator_id == current_user.id\n \t\t\tflash[:notice] = \"You do not have ownership of the extraction form, and therefore cannot make edits.\"\n \t\t\tredirect_to \"/extraction_forms/#{extraction_form_id.to_s}\"\n \t\t\treturn false\n \t\tend\n \tend", "def is_denied?\n (moderation_flag == false) ? true : false\n end", "def is_view_permitted?(given_user = nil)\r\n return false unless self.active?\r\n \r\n given_user ||= self.current_user\r\n \r\n # If item is public, no need for further permission checks\r\n return true if self.public? && self.user && self.user.public? \r\n \r\n # Base case of identity, no need to check relationships\r\n return true if given_user && ((given_user.id == self.author_id) || (given_user.id == self.foruser_id) || given_user.is_self_or_owner?(self.user))\r\n\r\n # Special case -- allow recipient and owners to see private messages\r\n if self.is_a?(Pvtmessage)\r\n return true if given_user.is_self_or_owner?(self.foruser) || given_user.is_self_or_owner?(self.user)\r\n return false\r\n end\r\n\r\n return true if given_user.admin?\r\n \r\n # Otherwise no can do if only my owner can see it (if you got to here, you aren't my owner)\r\n return false if self.restriction_level == Relationshiptype.nobody\r\n\r\n # Content of private or blocked projects cannot be seen\r\n return false if self.user && !self.user.is_view_permitted?\r\n\r\n # Fine, we'll actually run some DB queries...\r\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\r\n end", "def shared_access_allowed\n @settings.get_value(\"Shared Access\") == \"true\"\n end", "def verify_user_for_changes!\n\n unless @item.editable_by_user?(auth_user)\n status_error = @item.errors[:status].present? ? @item.errors[:status].join(' ') : nil\n flash[:error] = status_error || \"You do not have permission to the item.\"\n redirect_back(items_path) && return\n\n else\n if ItemPhoto.over_the_limit?(@item)\n flash[:notice] = \"The images over the limit will be discarded.\"\n end\n end\n\n end", "def forbidden?\n @forbidden\n end", "def checkage_restriction_on_comic\n @messsage = \"Your age criteria not satisfied to view that comic.\"\n render :file => \"shared/message\" if current_user && current_user.age_restriction_on_resource(@comic)\n end", "def collection_policy_permits?(included_collection_name)\n Pundit.policy(current_user, included_collection_name.to_s.classify.constantize).index?\n end", "def user_must_be_collection_member\n if media_object_id.present? && media_object_exists?\n errors.add(:media_object_id, 'not found') unless Ability.new(user).is_member_of?(media_object.collection)\n end\n end", "def xml_authorized?\n self.documento.digital == true\n end", "def inherit_restricted_status\n self.restricted = parent.restricted?\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def media_attachment_count\n self.case_media_attachments.try(:count) <= 10\n end", "def is_accessible?\n type != TYPES[:wall]\n end", "def may_edit_pages(user)\n true\n end", "def attachment_position_consumed?(attachment_position)\n return linkage_at_position(attachment_position) != nil\n end", "def restriction_level\r\n # Pvtmessages not so much\r\n return Relationshiptype.nobody if self.is_a?(Pvtmessage)\r\n \r\n # Items in inboxes MUST have security set to public\r\n return Relationshiptype.everyone if self.in_inbox?\r\n \r\n # Otherwise, return the level (default to open if something got messed up)\r\n self.relationshiptype_id.blank? ? Relationshiptype.everyone : self.relationshiptype_id\r\n end", "def guest_and_restricted_link?\n guest? && @record.fulltext_link[:url] == 'detail'\n end", "def submit_attachment # rubocop:disable Metrics/MethodLength\n raise 'requires a processed submission' if submission&.carma_case_id.blank?\n raise 'submission already has attachments' if submission.attachments.any?\n\n file_path = begin\n claim.to_pdf(sign: true)\n rescue\n return false\n end\n\n begin\n carma_attachments = CARMA::Models::Attachments.new(\n submission.carma_case_id,\n claim.veteran_data['fullName']['first'],\n claim.veteran_data['fullName']['last']\n )\n\n carma_attachments.add(CARMA::Models::Attachment::DOCUMENT_TYPES['10-10CG'], file_path)\n\n carma_attachments.submit!(carma_client)\n submission.attachments = carma_attachments.to_hash\n rescue\n # The end-user doesn't know an attachment is being sent with the submission at all. The PDF we're\n # sending to CARMA is just the submission, itself, as a PDF. This is to follow the current\n # conventions of CARMA: every case has the PDF of the submission attached.\n #\n # Regardless of the reason, we shouldn't raise an error when sending attachments fails.\n # It's non-critical and we don't want the error to bubble up to the response,\n # misleading the user to think thier claim was not submitted.\n #\n # If we made it this far, there is a submission that exists in CARMA.\n # So the user should get a sucessful response, whether attachments reach CARMA or not.\n File.delete(file_path)\n return false\n end\n\n File.delete(file_path)\n true\n end", "def restricted?\n return ( self.user_type == User::USER_TYPE_NORMAL )\n end", "def enforce_show_permissions(opts={})\n permissions = current_ability.permissions_doc(params[:id])\n if permissions.under_embargo? && !can?(:edit, permissions)\n raise Hydra::AccessDenied.new(\"This item is under embargo. You do not have sufficient access privileges to read this document.\", :edit, params[:id])\n end\n unless can? :read, permissions \n raise Hydra::AccessDenied.new(\"You do not have sufficient access privileges to read this document, which has been marked private.\", :read, params[:id])\n end\n end", "def check_update_permission\n return if owner? || @article.is_public_editable\n redirect_to articles_url\n end", "def check_access_settings\n redirect = request.referrer.nil? ? site_path : request.referrer\n downloads_enabled = AdminConfiguration.firecloud_access_enabled?\n if !downloads_enabled\n redirect_to merge_default_redirect_params(redirect, scpbr: params[:scpbr]), alert: \"Study access has been temporarily disabled by the site adminsitrator. Please contact #{view_context.mail_to('single_cell_portal@broadinstitute.org')} if you require assistance.\" and return\n end\n end", "def prevents_download\n return @prevents_download\n end", "def gr_is_visible?\n eval_policy(:read_access)\n end", "def show\n @gallery_photo_file = @gallery_photo.get_file_for_role(params[:id])\n if @gallery_photo.can_be_viewed_by?(current_user)\n render_gallery_photo\n else\n x_send_file(access_denied_file, :type => 'image/jpg', :status => 200, :disposition => 'inline')\n end\n end", "def is_signer\n if current_user == @doc.signer\n true\n else\n false\n redirect_to root_path, notice: \"Вы не имеете прав подписывать или отказывать в подписи этого документа\"\n end\n end" ]
[ "0.676367", "0.6594543", "0.6594543", "0.64621305", "0.6342594", "0.62423253", "0.62423253", "0.62423253", "0.62423253", "0.61780846", "0.6138564", "0.6138564", "0.6138564", "0.6138564", "0.61136526", "0.61136526", "0.60908794", "0.60637605", "0.6049823", "0.60339993", "0.5999523", "0.59691215", "0.59475917", "0.5939192", "0.59362954", "0.5902907", "0.5896222", "0.58961976", "0.5854512", "0.5820636", "0.5774055", "0.57582295", "0.5731629", "0.5714224", "0.568731", "0.5679953", "0.5670011", "0.5665284", "0.565188", "0.5649885", "0.56432885", "0.5630002", "0.5630002", "0.56274813", "0.56188315", "0.5611986", "0.5607509", "0.5592735", "0.55837077", "0.5577944", "0.5572638", "0.5572361", "0.5570609", "0.55692774", "0.55684215", "0.55620867", "0.5552222", "0.54840225", "0.54817575", "0.5469769", "0.5469727", "0.5460772", "0.54585415", "0.5437435", "0.5433891", "0.54313654", "0.5422651", "0.5403718", "0.54030776", "0.5396954", "0.53852063", "0.5370702", "0.53692997", "0.53678036", "0.5362811", "0.5350548", "0.53501296", "0.5349827", "0.5343898", "0.53403234", "0.53346366", "0.53346366", "0.53346366", "0.533177", "0.533168", "0.5329484", "0.53286666", "0.5327942", "0.5318929", "0.53122956", "0.5306279", "0.53050494", "0.5303298", "0.5300261", "0.52994573", "0.52991474", "0.52975976", "0.5293811" ]
0.63859767
6
Returns a css class name for kind of file
def icon_css_class case file_mime_type when *ARCHIVE_FILE_TYPES then "archive" when *AUDIO_FILE_TYPES then "audio" when *IMAGE_FILE_TYPES then "image" when *VIDEO_FILE_TYPES then "video" when "application/x-shockwave-flash" then "flash" when "image/x-psd" then "psd" when "text/plain" then "text" when "application/rtf" then "rtf" when "application/pdf" then "pdf" when "application/msword" then "word" when "application/vnd.ms-excel" then "excel" when *VCARD_FILE_TYPES then "vcard" else "file" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStyle(filename)\n DEFAULT_FILE_TYPES.invert[File.extname(filename)]\n end", "def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end", "def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z]/ \r\n script.close\r\n return $1.strip\r\n end\r\n end \r\n script.close \r\n \"\"\r\nend", "def categorize filename\n [filetype(filename), fileclass(filename)]\nend", "def class_file klass_name\n name = klass_name.split('::').last\n File.join class_path(klass_name), \"cdesc-#{name}.ri\"\n end", "def extract_class_name(filename)\n filename.split('/')[2..-1].collect { |i| i.camelize }.join('::').chomp(\".rb\")\n end", "def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end", "def class_name_for(file_name)\n file_name.split(/\\//).last.sub(/\\.rb$/, '').split(/_/).map do |s|\n s.capitalize\n end.join('')\n end", "def actionscript_file_to_short_class_name(file)\n return File.basename(file, '.*')\n end", "def type\n class_to_filename(self.class.to_s.sub(/.*:/, ''))\n end", "def as_css_background_with_class(klass=nil)\n klass=File.basename(@file_path).tr('.','_') unless klass\n \".#{klass} {\\n #{self.as_css_background}\\n}\"\n end", "def css_template_filename\n self.class.name.downcase.gsub(/.*::/,'') << '.css.erb'\n end", "def extract_class_name(filename)\n File.basename(filename).chomp(\".rb\").camelize\n end", "def base_filename; class_to_filename(name.gsub(/.*:/, '')); end", "def actionscript_file_to_class_name(file)\n name = super(file)\n\t\tname.gsub!(/^#{model.spec_dir}\\./, '')\n return name\n end", "def get_class_name(file_name)\n file_name += \".rb\" unless file_name =~ /\\.rb$/\n f = File.open(file_name, \"r\")\n f.readlines.each { |line| return $1.strip if line =~ /class\\ (.*)<\\ ?Test/ }\n f.close\n end", "def filename\r\n Chingu::Inflector.underscore(self.class.to_s)\r\n end", "def get_file_extension(file)\n if(file.extension == 'png' || file.extension == 'jpg' || file.extension == 'gif' || file.extension == 'jpeg')\n \"<div class='icon_image_file fl mr10'></div>\"\n elsif(file.extension == 'pdf')\n \"<div class='icon_pdf fl mr10'></div>\"\n elsif(file.extension == 'xls' || file.extension == 'xlsx')\n \"<div class='icon_xls fl mr10'></div>\"\n elsif(file.extension == 'ppt')\n \"<div class='icon_ppt fl mr10'></div>\"\n elsif(file.extension == 'docx' || file.extension == 'doc')\n \"<div class='icon_doc fl mr10'></div>\"\n else\n \"<div class='icon_file fl mr10'> &nbsp;</div>\"\n end\n end", "def css_class\n result = [self.project.try(:css_class), self.try(:format).try(:css_class)].join(' ')\n result = 'other' unless CSS_CLASSES.include?(result)\n result += ' invisible' unless self.is_visible\n result\n end", "def actionscript_file_to_class_name file\n name = file.dup\n name.gsub!(/^#{path}\\//, '')\n name.gsub!(/^#{test}\\//, '')\n name.gsub!(/^#{src}\\//, '')\n name.gsub!(/.as$/, '')\n name.gsub!(/#{File::SEPARATOR}/, '.')\n return name\n end", "def enum_class_name\n file_name.camelize\n end", "def css_classes(mod)\n if mod.respond_to?(:css_classes)\n return mod.css_classess\n else\n mod.class.name.underscore\n end\n end", "def fetch_style_class\n\t\tstyles = Dir.entries(\"./styles\").select do |entry|\n\t\t File.extname(entry).eql? \".rb\"\n\t\tend\n\n\t\tstyle_def = styles.detect do |style|\n\t\t File.basename(style, \".rb\") == @options[:style].to_s\n\t\tend\n\n\t\traise Errors::InvalidStyle unless style_def\n\n\t\trequire \"./styles/#{style_def}\"\n\n\t\tstyle_class_name = classify File.basename(style_def, \".rb\")\n\t\tstyle_class = Styles.const_get style_class_name\n\t\tstyle_class.new(@options)\n\n\t end", "def filename_to_class (f)\n f.split('/').map {|i| i.capitalize.gsub(/_([a-z])/) {|s| $1.upcase }}.\n join('::')\nend", "def getStyledFileName(fileName)\r\n return CodeNameStyling.getStyled(fileName, @langProfile.fileNameStyle)\r\n end", "def ruby_to_css_class(ruby_name)\n return \"\" unless ruby_name\n ruby_name.to_s.gsub('_','-')\n end", "def css_class\n end", "def getStyledClassName(className)\r\n return CodeNameStyling.getStyled(className, @langProfile.classNameStyle)\r\n end", "def class_to_filename (c)\n c.split(/::/).map {|i| i.gsub(/([A-Z])/, '_\\1').sub(/_/, '').downcase}.\n join('/')\nend", "def file2klass(str)\n\t\t\tstr.split(\"/\").map {|c|\n\t\t\t\tc.split(/_/).collect {|i| i.capitalize }.join(\"\")\n\t\t\t}.join(\"::\")\n\t\tend", "def class_name_for_class_file(subtree, class_file)\n the_classes_directory = classes_directory(subtree)\n subpath_string = FilePath.new(class_file).relative_path_from(the_classes_directory).to_s\n subpath_string = $1 if subpath_string =~ /^(.*)\\.class\\s*$/\n subpath_string.gsub!(\"/\", \".\")\n subpath_string.gsub!(\"\\\\\", \".\")\n subpath_string\n end", "def css_class\n @css_class ||= \"project #{status.gsub(' ','-').downcase}\"\n end", "def type_name\n File.basename(@path, '.rb').to_sym\n end", "def file_type(file_name)\n File.exname( file_name ).gsub( /^\\./, '').downcase\n end", "def display_class name\n return if name =~ /#|\\./\n\n found, klasses, includes, extends =\n classes_and_includes_and_extends_for name\n\n return if found.empty?\n\n out = class_document name, found, klasses, includes, extends\n\n display out\n end", "def class_name\n return @options[:class_name] if not @options[:class_name].nil?\n class_main_found = false\n @catalog['resources'].each_with_index do |r,i|\n if r['type'] == 'Class' and r['title'] == 'main'\n class_main_found = true\n next\n end\n if class_main_found and r['type'] == 'Class'\n return r['title'].downcase\n end\n end\n end", "def class_name\n element.attribute_value \"class\"\n end", "def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end", "def file_class\n @file_class ||\n if superclass.respond_to?(:file_class)\n superclass.file_class\n else\n ::Gollum::File\n end\n end", "def classname_from_file(file)\n the_process_class = File.basename(file)\n\n the_process_class['.rb'] = '' if the_process_class['.rb']\n\n if (/[A-Z]/ =~ the_process_class) != 0\n the_process_class = the_process_class.capitalize\n end\n\n match_found = the_process_class.scan(/_[a-z]/)\n if match_found\n # Ruby 1.8 : 'ab'[1] => 98 and 'ab'[1, 1] => 'b'\n # Ruby 1.9 + : 'ab'[1] => 'b' and 'ab'[1, 1] => 'b'\n match_found.each { |str| the_process_class[str] = str[1, 1].capitalize }\n end\n\n the_process_class\n end", "def css_class name\n attr \".#{name}\"\n end", "def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end", "def type_from_filename(filename)\n map = {\n %w(.c .h) => :c,\n %w(.cpp .hpp .cc .h cxx) => :cpp,\n %w(.rb .ru .irbrc .gemspec .pryrc) => :ruby,\n %w(.py) => :python,\n %w(.diff) => :diff,\n %w(.css) => :css,\n %w(.html) => :html,\n %w(.yaml .yml) => :yaml,\n %w(.xml) => :xml,\n %w(.php) => :php,\n %w(.js) => :javascript,\n %w(.java) => :java,\n %w(.rhtml) => :rhtml,\n %w(.json) => :json\n }\n\n _, type = map.find do |k, _|\n k.any? { |ext| ext == File.extname(filename) }\n end\n\n type\n end", "def file_type(file_name)\n return file_name[file_name.rindex(\".\") + 1, file_name.size]\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 get_model_class(file); end", "def extract_class_name(filename)\n nodes = ConstantExtractor.process(filename)\n nodes ? nodes.flat_map(&:children) : []\n end", "def css_class\n Meal.css_class_for_type(type)\n end", "def css_classes_for(classname)\n css_classes_for_map classname, mapping\n end", "def css_class\n @css_class ||= [\"project\", status.gsub(' ','-').downcase, (hideable? ? \"hideable\" : nil)].compact.join(\" \")\n end", "def class_file_name(prepend_path = false, append_extension = false)\n\t\tjfile_name = file_name\n\t\tjfile_name += \".class\" if append_extension\n\t\tjfile_name = CLASS_PATH + jfile_name if prepend_path\n\t\treturn jfile_name\n\tend", "def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend", "def getStyledPathName(pathName)\r\n return CodeNameStyling.getStyled(pathName, @langProfile.fileNameStyle)\r\n end", "def component_name_or_css_class(component_class:, component_name:, css_class:)\n if css_class\n # Don't return a '.' string\n return '' if component_css_class_string(component_class: component_class).blank?\n\n # returns a string like '.slat-actions'\n \".#{component_css_class_string(component_class: component_class)}\" \n else\n component_name\n end\n end", "def class_name(name)\n name, anchor = name.to_s.split(\"#\", 2)\n name = File.basename(name, \".json\")\n name = name + \"_\" + anchor if anchor.present?\n name.gsub(/[^\\w]/, \"_\").camelcase\n end", "def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end", "def output_class\n 'PictureTag::OutputFormats::' + titleize(PictureTag.preset['markup'])\n end", "def class_type_from(content_type) \n case Mime::Type.lookup(content_type).to_sym \n when :text: 'SimpleText' \n when :jpg, :jpeg, :gif, \n :png, :tiff, :bmp: 'ImageData' \n when :xml: 'XmlData' \n when :pdf: 'PdfData' \n else name.demodulize \n end \n end", "def class_name\r\n r = \"\"\r\n up = true\r\n each_byte do |c|\r\n if c == 95\r\n if up\r\n r << \"::\"\r\n else\r\n up = true\r\n end\r\n else\r\n m = up ? :upcase : :to_s\r\n r << (c.chr.send(m))\r\n up = false\r\n end\r\n end\r\n r\r\n end", "def css_path\n path.split(/\\//).map { |part|\n part.length == 0 ? nil : part.gsub(/\\[(\\d+)\\]/, ':nth-of-type(\\1)')\n }.compact.join(\" > \")\n end", "def type\n @type ||= File.extname(path)[1..-1]\n end", "def classify_name(filename)\n filename.to_s.split(\"_\").map{ |i| i[0...1].upcase + i[1..-1] }.join\n end", "def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end", "def determine_style(m)\n begin\n case m[:source].to_s\n when m.start_with?('Carnivore::Source::Http')\n :http\n else\n m[:source].class.to_s.split('::').last.downcase.to_sym\n end\n rescue\n :unknown\n end\n end", "def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end", "def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \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 klass_name\n \"#{params[:klass_name].classify}\"\n end", "def css_class(hay, needle); end", "def filetype_icon(filetype)\n return 'glyphicon-file' if filetype == 'application/pdf'\n end", "def get_class_name(formula_file)\n string = formula_file.match(/(#{@formulas_dir.split('/').last}.*#{@formula})\\.rb$/)[1]\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub(/(?:_|(\\/))([a-z\\d]*)/) { \"#{$1}#{$2.capitalize}\" }.gsub('/', '::') # rubocop:disable PerlBackrefs\n end", "def css_classes\n [\n \"version-#{status}\"\n ].join(' ')\n end", "def file_type(file_path)\n return 'file' if File.file? file_path\n return 'directory' if File.directory? file_path\n return 'unknown'\n end", "def readable_klass(klass_name)\n\t\tklass_name.blank? ? '' : klass_name.underscore.humanize.titleize\n\tend", "def stylesheet?\n Nanoc::Cachebuster::FILETYPES_CONSIDERED_CSS.include?(item[:extension].to_s)\n end", "def css_class *a; CssString.new a.flatten.unshift(self).join '.' end", "def check_class_name\n\t\tspecial = \"!?<>',?[]}{=-)(*&|^%$#`~{}/\\\\:;\"\n\t\tregex = /[#{special.gsub(/./){|char| \"\\\\#{char}\"}}]/\n\t\tif class_name =~ regex\n\t\t\treturn \"The file name cannot contain special characters\"\n\t\telsif class_name.include?(\"\\n\")\n\t\t\treturn \"The file name cannot contain line breaks\"\n\t\telsif class_name.include?(\" \") || class_name.include?(\"\\t\")\n\t\t\treturn \"The file name cannot contain white spaces\"\n\t\telsif class_name == \"\"\n\t\t\treturn \"The file name cannot be empty\"\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend", "def css_class(feature)\n \"#{css_class_prefix}_#{feature.to_s}\"\n end", "def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end", "def file_type\n FILE_TYPES[@file_type]\n end", "def klass2file(str)\n\t\t\tstr.split(/::/).map {|c|\n\t\t\t\tc.scan(/[A-Z][a-z0-9]*/).join(\"_\").downcase\n\t\t\t}.join(\"/\")\n\t\tend", "def cr_class_name(attr_name)\n instance_var = attr_name.gsub('/','_').downcase()\n instance_var.gsub!(' ','_')\n instance_var = instance_var.gsub('-','_')\n class_name = \"Cr\" + camelise(instance_var)\n return class_name\nend", "def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end", "def css_class_standard(hay, needle); end", "def css_class_builtin(hay, needle); end", "def get_category text\n #text = File.join(@path, t)\n if File.directory? text\n return :dir\n elsif File.executable? text\n return :executable\n elsif File.symlink? text\n return :link\n elsif File.exists? text\n if text =~ /\\.txt$/\n return :text\n elsif text =~ /\\.zip$/ or text =~ /gz$/ \n return :zip\n else\n return :file\n end\n else\n return :other\n end\n end", "def get_content_type(filename)\n ext = File.extname(filename) # get the extension\n type = 'application/octed-stream'\n type = 'text/html' if ext == '.html' || ext == '.htm'\n type = 'text/plain' if ext == '.txt' || ext == '.rb'\n type = 'text/css' if ext == '.css'\n type = 'image/jpeg' if ext == '.jpeg' || ext == '.jpg'\n type = 'image/gif' if ext == '.gif'\n type = 'image/png' if ext == '.png'\n type = 'image/bmp' if ext == '.bmp'\n type = 'text/xml' if ext == '.xml' || ext == '.xsl'\n type # same as: return type\n end", "def name_and_class\n [name, self['class']].compact.join('.')\n end", "def document_type\n FileUtility.get_file_type(@file_name)\n end", "def get_css_class_for_season_type\n if object.season_type && object.season_type.code =~ /CSI/i\n 'goggles-meeting-csi'\n elsif object.season_type && object.season_type.code =~ /FIN/i\n 'goggles-meeting-fin'\n else\n ''\n end\n end", "def parser_type_for_filename(filename); end", "def get_class()\n result = nil\n @cont.each { |line|\n if line =~ /\\s*\\w+\\s*=/\n result = /\\w+/.match(line)[0]\n break\n end\n }\n return result\n end", "def default_file_name\n \"#{klass_name.underscore}_#{id}\"\n end", "def file_path\n 'main.css'\n end", "def get_css_classes(output, post)\n # here we contruct the css classes to add to the media\n # we don't add zurb foundation flex-video tags for mp3 embeds\n css_classes = \"flex-video widescreen\" unless post.url[-4..-1] == \".mp3\"\n css_classes = css_classes + \" youtube\" if output.include? \"youtube.com\"\n css_classes = css_classes + \" vimeo\" if output.include? \"vimeo.com\"\n # Reset classes for images\n css_classes = \"image\" if post.url[-4..-1] == \".jpg\" or post.url[-4..-1] == \".gif\" or post.url[-4..-1] == \".png\" or post.url[-5..-1] == \".jpeg\"\n return css_classes\n end", "def class_to_basefile class_name\n\t\t\treturn \"#{base_dir}/#{class_name.gsub(\"::\", \"/\")}\"\n\t\tend", "def class(attachment = nil, style_name = nil)\n return super() if attachment.nil? && style_name.nil?\n\n plural_cache.underscore_and_pluralize_class(attachment.instance.class)\n end", "def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend", "def java_outer_classname\n if file_descriptor_proto.has_field?(:options) && present?(file_descriptor_proto.options.java_multiple_files)\n return nil\n elsif file_descriptor_proto.has_field?(:options) && present?(file_descriptor_proto.options.java_outer_classname)\n return file_descriptor_proto.options.java_outer_classname\n else\n basename = name.split('/').last\n basename = basename.gsub('.proto', '')\n return camelize(basename)\n end\n end", "def extension_for_type(entry_type)\n case entry_type\n when :javascript then 'js'\n when :stylesheet then 'css'\n when :typescript then 'ts'\n else entry_type\n end\n end" ]
[ "0.7138231", "0.70957786", "0.6911482", "0.6825835", "0.6763818", "0.67032063", "0.66817033", "0.66719776", "0.66584134", "0.6626825", "0.66194874", "0.65593463", "0.6532662", "0.6524408", "0.6500964", "0.64866716", "0.64494306", "0.643257", "0.64283687", "0.6416402", "0.63986486", "0.6371875", "0.63698405", "0.6354861", "0.6354166", "0.63392967", "0.6332493", "0.6331268", "0.6315226", "0.6282452", "0.621017", "0.6180645", "0.6168494", "0.61490417", "0.6129388", "0.61058295", "0.6104565", "0.6103977", "0.6098815", "0.6095701", "0.60910827", "0.60283387", "0.60241044", "0.6022048", "0.6020999", "0.60021585", "0.5983717", "0.5982787", "0.5969548", "0.5969016", "0.5962487", "0.5953656", "0.594787", "0.5926007", "0.5904141", "0.59030044", "0.59010714", "0.588561", "0.58851135", "0.58746654", "0.5838339", "0.583641", "0.58356255", "0.5833601", "0.5806105", "0.5804081", "0.5783136", "0.5782642", "0.5765456", "0.5753245", "0.57513356", "0.5744283", "0.57418305", "0.57288736", "0.57230234", "0.57171196", "0.571032", "0.5709105", "0.5707961", "0.5699065", "0.5689205", "0.5677818", "0.5668952", "0.5662533", "0.5651629", "0.564634", "0.5641669", "0.5637846", "0.5627823", "0.56222385", "0.5610516", "0.5609082", "0.5607324", "0.56061625", "0.56027496", "0.5583231", "0.5582004", "0.55807", "0.55797726", "0.55776304" ]
0.73979926
0
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:first_name, :last_name, :username, :birthday, :about, :email, :password, :current_password, :remember_me, :avatar, :cover_photo) 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
Move this to a twitter module
def twitter_connect access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret) user_info = JSON.parse(access_token.get("https://twitter.com/account/verify_credentials.json").body) self.login = user_info['screen_name'] self.twitter_name = user_info['name'] self.password = "5uttr33_#{self.login}" self.signup_source = 'twitter' self.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter\n handle_oauth\n end", "def twitter\n callback_from :twitter\n end", "def link_twitter\n\n end", "def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end", "def twitter\n handle_callback(:twitter)\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def tweet\n\treturn \"Tweet Tweet Twitter\"\nend", "def twitter?\n false\n end", "def tweet\r\n\treturn \"tweet tweet tweet\"\r\n\tend", "def tweet\n\t\treturn \"tweee\"\n\tend", "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def configure_twitter\n Twitter.configure do |config|\n config.consumer_key = \"VowhzjVm7OWLZmHGxosVyg\"\n config.consumer_secret = \"Pwkd1J2rxWVaejWdvg1MOW2qHmP6lAncP0EDTXWvZM\"\n config.oauth_token = \"109484472-I0kSWE9FnpxjlzUrDmL0eIFxkcDxnkLyIaZskQhf\"\n config.oauth_token_secret = \"1PmK1OlThcRsiYgHYwOdRHXVEboog5jukq35nIUNauA\"\n end\nend", "def twitter(name: T.unsafe(nil), nickname: T.unsafe(nil), uid: T.unsafe(nil)); end", "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def tweet\n\t\treturn \"AHHP! Pretty bird!\"\n\tend", "def tweet\n return \"Arrrr matey\"\n end", "def index\n if !current_user.has_twitter_oauth?\n @T_OAUTH = TwitterOAuth::Client.new( :consumer_key => TWITTER_KEY, :consumer_secret => TWIITER_SECRET )\n @T_REQUEST_TOKEN = @T_OAUTH.request_token auth_callback => TWITTER_CALLBACK_URL\n @T_TOKEN = @T_REQUEST_TOKEN.token\n @T_SECRET = @T_REQUEST_TOKEN.secret\n @link = @T_REQUEST_TOKEN.authorize_url\n session['token' ] = @T_TOKEN\n session['secret'] = @T_SECRET\n end\n end", "def twitt\n if PLANETOID_CONF[:twitter][:entries][:send_twitts] && self.published > self.feed.created_at\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:entries][:prefix]} #{self.title[0..150]} #{self.url}\"\n end\n end", "def twitter?\n self.provider == 'twitter'\n end", "def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end", "def base_url\n \"https://api.twitter.com\"\n end", "def twitter_list_name\n end", "def tweet\n return \"chirp chirp\"\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end", "def apply_twitter(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n end\n end", "def footer_twitter_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"social\").a.className(\"twitter\"), __method__)\n end", "def twitter\n @data['social']['twitter']\n end", "def share_to_twitter?\n self.tweet_id == TWSharing::Underway\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def tweet!\n TWITTER.update(\"#{title.truncate(75)} - #{tweet_users}\\n\\nhttp://beta.briefideas.org/ideas/#{sha}\")\n self.update_columns(:tweeted => true)\n end", "def tweet(t)\n @t = t\n @followers.each do |observer|\n observer.read(self)\n end \n end", "def tweet\n\t\treturn \"Polly want's a cracker.\"\n\tend", "def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def to_twitter\n client = Twitter::REST::Client.new do |config|\n config.access_token = user.twitter.oauth_token\n config.access_token_secret = user.twitter.secret\n config.consumer_key = ENV['TWITTER_KEY']\n config.consumer_secret = ENV['TWITTER_SECRET']\n end\n client.update(content)\n end", "def oauth\n ::OAuth::Consumer.new(Config.consumer_key, Config.consumer_secret, :site => \"https://api.twitter.com\")\n end", "def configure\n Twitter.configure do |configuration|\n configuration.consumer_key = @consumer_key\n configuration.consumer_secret = @consumer_secret\n configuration.oauth_token = @oauth_token\n configuration.oauth_token_secret = @oauth_token_secret\n end\n end", "def tweet_new_tweet(tweet)\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n $log.debug(tweet)\n client.update(tweet)\n $log.info(\"Successfully tweeted!\")\nend", "def index\n\n #client = Twitter::REST::Client.new do |config|\n # config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n # config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n # config.access_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n # config.access_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n #end\n\n require \"rubygems\"\n\n # Certain methods require authentication. To get your Twitter OAuth credentials,\n # register an app at http://dev.twitter.com/apps\n Twitter.configure do |config|\n config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n config.oauth_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n config.oauth_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n end\n\n # Initialize your Twitter client\n client = Twitter::Client.new\n\n # Post a status update\n client.update(\"I just posted a status update via the Twitter Ruby Gem !\")\n redirect_to request.referer, :notice => 'Tweet successfully posted'\n\n end", "def on_timeline(tweet)\n end", "def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def tweet\n \"<blockquote class='twitter-tweet' lang='en'><p lang='en' dir='ltr'>\" + tweet_text + \n \"</p>&mdash;\" + twitter_user + \"<a href='\" + twitter_url + \"'>\" + tweet_date + \n \"</a></blockquote><script async src='//platform.twitter.com/widgets.js' charset='utf-8'></script>\"\n end", "def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end", "def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmichiganstatewin.com\"\nend", "def authenticate()\n\n Twitter.configure do |config|\n config.consumer_key = @consumer_key\n config.oauth_token = @oauth_token\n config.oauth_token_secret = @oauth_token_secret\n config.consumer_secret = @consumer_secret\n\n end\n\n end", "def share_on_twitter_url(object)\n url = member_url([@tier, @topic, object])\n title = object.title\n \"http://twitter.com/home?status=#{url}\"\n end", "def conection\n\n #cliente para el oauth\n cliente=OAuth::Consumer.new(\n @token,\n @secret,\n {\n :site=>\"http://twitter.com\",\n :request_token_url=>\"https://api.twitter.com/oauth/request_token\",\n :access_token_url =>\"https://api.twitter.com/oauth/access_token\",\n :authorize_url =>\"https://api.twitter.com/oauth/authorize\"\n }\n )\n #se solicita al api el token y el secret del usuario\n request_token = cliente.get_request_token\n token2 = request_token.token\n secret2 = request_token.secret\n #se abre el navegador predeterminado del sistema con la pagina de autorizacion\n direccion = cliente.authorize_url + \"?oauth_token=\" + token2\n puts \"Abriendo en el navegador: \"+direccion\n system('start '+direccion)\n #solicita el pin brindado por twitter\n print \"Clic al link anterior e ingrese el pin que aparese en la pagina del Tweeter de su navegador:\"\n pin = gets.chomp\n\tputs\n #se autentica al usuario con los datos brindados\n begin\n OAuth::RequestToken.new(cliente, token2, secret2)\n access_token=request_token.get_access_token(:oauth_verifier => pin)\n Twitter.configure do |config|\n config.consumer_key = @token\n config.consumer_secret = @secret\n config.oauth_token = access_token.token\n config.oauth_token_secret = access_token.secret\n end\n $client = Twitter::Client.new\n $client.verify_credentials\n puts \"Autenticado Correctamente\"\n\n rescue Twitter::Unauthorized\n puts \"Error de Autorizacion\"\n end\n end", "def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end", "def oauth #:nodoc:\n @oauth ||= Bountybase.config.twitter[Bountybase.instance] ||\n begin\n E \"Cannot find twitter configuration for\", Bountybase.instance\n raise \"Cannot find twitter configuration\"\n end\n end", "def twitter\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_api_key\n config.consumer_secret = Rails.application.secrets.twitter_api_secret\n config.access_token = token\n config.access_token_secret = secret\n end\n end", "def twitter\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_api_key\n config.consumer_secret = Rails.application.secrets.twitter_api_secret\n config.access_token = token\n config.access_token_secret = secret\n end\n end", "def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end", "def twitter\n @user = User.find(session[:user_id])\n t = @user.twitter\n unless t.present?\n redirect_to @user, :notice => \"Please add your twitter account!\"\n return\n end\n @tweets = t.home_timeline\n @posts = []\n @tweets.each do |tweet|\n if Post.exists?(:tweet_id => tweet[:id])\n @posts.push(Post.find_by_tweet_id(tweet[:id]))\n else\n p = Post.new\n p.tweet_id = tweet[:id]\n p.tweeter_twitter_id = tweet[:user][:id]\n if User.exists?(:twitter_id => tweet[:user][:id])\n p.user_id = User.find_by_twitter_id(tweet[:user][:id]).id\n else\n p.user_id = -1\n end\n p.post_type = 3\n p.created_at = tweet[:created_at].to_datetime\n url = \"https://api.twitter.com/1/statuses/oembed.json?id=#{tweet[:id]}&omit_script=true\"\n begin\n tweet_page = open(URI.parse(url))\n p.body = JSON.parse(tweet_page.read)['html']\n if p.save!\n @posts.push(p)\n end\n rescue\n # Tried to access a protected tweet, just skip it\n end\n end\n end\n\n @body_class = 'twitter-background'\n respond_to do |format|\n format.html # twitter.html.erb\n format.json { render json: @posts }\n end\n end", "def post_tweet\n # @tweets << tweet: violates SST\n Tweet.new('tweet message', self)\n end", "def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end", "def initialize (tweet)\n\t\tputs \"Publicar un nuevo Tweet...\"\n\t\ttweet= gets() #Obtenemos lo que el usuario digite\n\t\tTwitter.configure do |config|\n\t\t\t\tconfig.consumer_key = 'x4pUZIkRRMRvCpVDJwdhw'\n \t\t\t\tconfig.consumer_secret = 'D8yU5s5qzRHfnfSN6pZXXZEobqfn2dqGZ27HlwwOiI'\n\t\t\t\tconfig.oauth_token = '948173238-0rDoOacK40XT7HmdmtGZXPvghX2pq7xhjjjer8pw'\n\t\t\t\tconfig.oauth_token_secret = 'fhsZZQAxoFmUqcFUbnUWJl5TmCU45tSJj6yrOv9rJYb1J'\n\t\tend\n\t\tTwitter.update(tweet)\n\t\tend", "def initialize (tweet)\n\t\tputs \"Publicar un nuevo Tweet...\"\n\t\ttweet= gets() #Obtenemos lo que el usuario digite\n\t\tTwitter.configure do |config|\n\t\t\t\tconfig.consumer_key = 'x4pUZIkRRMRvCpVDJwdhw'\n \t\t\t\tconfig.consumer_secret = 'D8yU5s5qzRHfnfSN6pZXXZEobqfn2dqGZ27HlwwOiI'\n\t\t\t\tconfig.oauth_token = '948173238-0rDoOacK40XT7HmdmtGZXPvghX2pq7xhjjjer8pw'\n\t\t\t\tconfig.oauth_token_secret = 'fhsZZQAxoFmUqcFUbnUWJl5TmCU45tSJj6yrOv9rJYb1J'\n\t\tend\n\t\tTwitter.update(tweet)\n\t\tend", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def list_tweets\n tweets\n end", "def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end", "def post_to_twitter\n tweet = event_post_to_twitter(current_user.events.find(params[:id]))\n if tweet\n tweet_url = \"https://twitter.com/#{current_user.twitter_username}/status/#{tweet.id}\"\n redirect_to request.referer,\n :flash => { :success => \"Your event has been twitted,\n <br><i class='fa fa-twitter'></i> \n <a href='#{tweet_url}' rel='nofollow' target='_blank'>#{tweet_url}</a>\" }\n else\n redirect_to request.referer, :flash => { :error => \"Ooops. something wrong\" }\n end\n end", "def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def hook_thyself\n me = self\n\n\n\n # Add something to tell someone\n register_command(:tweet_cmd, /^tweet$/, [/channel/, /private/]){|*args| \n me.tweet(bot, nick, args.join(\" \"))\n }\n\n\n \n # Hook for when we have successfully joined\n @config[:channels].each do |chan|\n register_hook(\"twitter_join_#{chan}\".to_sym, lambda{|m| m.channel == chan}, /join/){\n me.join_channel( chan, bot ) if nick == bot_nick # Ensure we only fire if the bot has joined, not other people\n }\n end\n\n end", "def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end", "def tweet(user, tweet_text)\n\t\tname = user.handle\n\t\ttweet = user.tweet(tweet_text)\n\t\t#Updates the global tweet list, the list of tweets by username, and the list of tweets by username and username's followers\n\t\tupdate_timeline_cache_tweets(tweet, name)\n\t\tupdate_cache_personal_tweet_list(tweet, name)\n\t\tupdate_global_cache_tweets(tweet, name)\n\tend", "def share_location_on_twitter options={}\n if from_twitter?\n\n c_id = id\n c_id = \"4f696467043bac0001000002\" if Rails.env != \"production\"\n\n oauth = providers.where(provider: \"twitter\").first\n \n status_msg = self.swap_stat\n status_msg.gsub! /you/, \"me\" \n status_msg = \"On @myradddar! #{status_msg} http://www.radddar.com/#{c_id}\"\n\n Twitter.configure do |config|\n config.consumer_key = ENV[\"RDR_TWITTER_KEY\"]\n config.consumer_secret = ENV[\"RDR_TWITTER_SECRET\"]\n config.oauth_token = oauth[:token]\n config.oauth_token_secret = oauth[:secret]\n end\n\n client = Twitter::Client.new\n client.update(status_msg,{\n lat: self.loc[0],\n long: self.loc[1],\n }) rescue nil\n\n end\n end", "def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end", "def tweet(tweet)\n\t\tclient = Twitter::REST::Client.new do |config|\n\t\tconfig.consumer_key = Rails.application.config.twitter_key\n\t\tconfig.consumer_secret = Rails.application.config.twitter_secret\n\t\tconfig.access_token = oauth_token\n\t\tconfig.access_token_secret = oauth_secret\n\tend\n\tclient.update(tweet)\n\tend", "def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end", "def tweet_creation_to_admin(tweet)\n @tweet = tweet\n\n set_attachments\n\n @screen_name = tweet.influencer.user.twitter_screen_name\n\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - @#{@screen_name} recibió una propuesto de Tweet\")\n when 'CO'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - @#{@screen_name} recibió una propuesto de Tweet\")\n when 'MX'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - @#{@screen_name} recibió una propuesto de Tweet\")\n end\n\n end", "def twitter_client\n #Dotenv.load\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[ 'twitter_api_public']\n config.consumer_secret = ENV[ 'twitter_api_secret' ]\n config.access_token = self.token\n config.access_token_secret = self.secret\n end\n end", "def on_twitter_engine_tweet(e, who, msg)\n pre = '<Twitter::Engine>'\n @log.info(\"#{pre} Tweet: #{who}: #{msg}.\")\n end", "def post_tweet(message)\n Tweet.new(message, self) # I am myself\n end", "def set_tweet\n # @tweet = Tweet.find(params[:id])\n @tweet = current_user.tweets.find(params[:id])\n end", "def initialize\n api_key = ENV[\"TWITTER_API_KEY_ID\"]\n api_secret = ENV[\"TWITTER_API_SECRET\"]\n ##will be current_user.access_token\n access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n access_token_secret = ENV[\"TWITTER_ACCESS_SECRET_TOKEN\"]\n\n @twitter_client = Twitter::REST::Client.new do |config|\n config.consumer_key = api_key\n config.consumer_secret = api_secret\n config.access_token = access_token\n config.access_token_secret = access_token_secret\n end\n\n end", "def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend", "def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end", "def create_from_tw\n client = Twitter::Client.new(\n :consumer_key => CONFIG[:tw_consumer_key],\n :consumer_secret => CONFIG[:tw_consumer_secret],\n :oauth_token => params[:tw_access_token],\n :oauth_token_secret => params[:tw_access_token_secret])\n\n @user = User.add_from_tw(\n client.user,\n params[:tw_access_token],\n params[:tw_access_token_secret],\n @source)\n end", "def timeline\n twitter.home_timeline\n end", "def twitter_client\n @twitter_client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = twitter_config(:consumer_key)\n config.consumer_secret = twitter_config(:consumer_secret)\n config.access_token = twitter_config(:access_token)\n config.access_token_secret = twitter_config(:access_token_secret)\n end\n end", "def login_twitter\n\tclient = Twitter::Streaming::Client.new do |config|\n\t config.consumer_key = \"YOUR_CONSUMER_KEY\"\n\t config.consumer_secret = \"YOUR_CONSUMER_SECRET\"\n\t config.access_token = \"YOUR_ACCESS_TOKEN\"\n\t config.access_token_secret = \"YOUR_ACCESS_SECRET\"\n\tend\nend", "def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end", "def tweet account\n if @in_reply_to_status_id then\n account.client.statuses.update! :status => @status, :in_reply_to_status_id=>@in_reply_to_status_id\n else\n account.client.statuses.update! :status => @status\n end\n end", "def run\n super\n\n twitter_account = _get_entity_attribute \"name\"\n max_accounts = _get_option \"max_accounts\"\n\n raise \"Twitter API keys required!\" unless $intrigue_config[\"twitter_consumer_key\"] && $intrigue_config[\"twitter_consumer_secret\"] && $intrigue_config[\"twitter_access_token\"] && $intrigue_config[\"twitter_access_token_secret\"]\n\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $intrigue_config[\"twitter_consumer_key\"]\n config.consumer_secret = $intrigue_config[\"twitter_consumer_secret\"]\n config.access_token = $intrigue_config[\"twitter_access_token\"]\n config.access_token_secret = $intrigue_config[\"twitter_access_token_secret\"]\n end\n\n response = client.friend_ids(twitter_account)\n\n binding.pry\n\n begin\n iterate = 0\n\n @task_log.log \"Found: #{response.count} friends\"\n @task_log.log \"Limiting to #{max_accounts}\" if response.count > max_accounts\n\n response.each do |friend_id|\n iterate += 1\n @task_log.log \"Friend: #{friend_id}\"\n _create_entity(\"WebAccount\", :name => \"#{friend_id}\",\n :uri => \"https://twitter.com/#{friend_id}\",\n :domain => \"Twitter\")\n return if iterate >= max_accounts\n end\n\n rescue Twitter::Error::TooManyRequests => e\n @task_log.error \"Requested too many friends #{e}\"\n end\n\n end", "def user_tweets screen_name\n\t\tTwitter.user_timeline(screen_name.to_s)\n\tend", "def configure\n # Consumer details come from registering an app at https://dev.twitter.com/\n # Once you have consumer details, use \"ebooks auth\" for new access tokens\n self.consumer_key = 't9g6TgrUYsZ4R5aeArsM2C36G' # Your app consumer key\n self.consumer_secret = 'olto6fNhfZz0CZwtx4uaFFpoyW88KG4LZnuaMFtWkvhgWq3897' # Your app consumer secret\n\n # Users to block instead of interacting with\n self.blacklist = ['']\n\n # Range in seconds to randomize delay when bot.delay is called\n self.delay_range = 1..6\n\t\n\t@userinfo = {}\n end", "def twitter_register_enabled?\n Figaro.env.respond_to?(:twitter_key) && Figaro.env.respond_to?(:twitter_secret)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def load_twitter_account\n # FIXME would this be better placed in the models?\n @twitter_account = @workspace ? @workspace.twitter_account || @workspace.create_twitter_account :\n @user.twitter_account || @user.create_twitter_account\n end", "def test04_L1DLT04_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Tweet\" button\n\tend", "def set_ommniauth_twitter(email = 'phanha9389twitter@gmail.com')\n OmniAuth.config.mock_auth[:twitter] = auth_hash_twitter(email)\n request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:twitter]\n end", "def url\n @author_url ||= begin\n \"http://twitter.com/#{self.screenname}\" if self.screenname\n end\n end" ]
[ "0.7305317", "0.7179668", "0.70971054", "0.69408566", "0.68489665", "0.67101634", "0.6556565", "0.65170765", "0.6501963", "0.6448231", "0.6423704", "0.64202505", "0.6397419", "0.63761497", "0.63516414", "0.6241625", "0.62313473", "0.6222005", "0.6210931", "0.61961675", "0.6190448", "0.61863077", "0.61814916", "0.6151716", "0.61441", "0.61289907", "0.6055369", "0.6045998", "0.60277253", "0.6020951", "0.60172004", "0.6014687", "0.60032135", "0.59848297", "0.59683776", "0.59476817", "0.59394443", "0.59362894", "0.5934306", "0.59322584", "0.5927739", "0.59252477", "0.5924988", "0.5924464", "0.5923516", "0.5916583", "0.5909126", "0.59041595", "0.5901192", "0.58924127", "0.5883966", "0.5879566", "0.5874988", "0.58586186", "0.58550596", "0.58536625", "0.58521265", "0.5847934", "0.58437407", "0.5834513", "0.5829921", "0.58165854", "0.57922035", "0.57922035", "0.5784151", "0.5783264", "0.5773549", "0.5762965", "0.57575756", "0.5743946", "0.5728341", "0.5718299", "0.57167214", "0.5715096", "0.57129264", "0.5711431", "0.57082427", "0.5704313", "0.56892604", "0.5678494", "0.5673187", "0.5671165", "0.56705713", "0.56691265", "0.5663699", "0.56614363", "0.56575936", "0.56525683", "0.5648747", "0.56473416", "0.5647158", "0.56408066", "0.56407195", "0.5639169", "0.5637812", "0.56376016", "0.56372356", "0.56316847", "0.5624203", "0.5621943" ]
0.6166997
23
Move this to a facebook module
def before_connect(facebook_session) self.login = facebook_session.user.name self.facebook_name = facebook_session.user.name self.password = "5uttr33_#{self.login}" self.signup_source = 'facebook' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook\n end", "def facebook\n\n end", "def fb_load_api\n\n\n end", "def facebook\n callback\n end", "def facebook\n handle_oauth\n end", "def facebook\n FbConnection\n end", "def facebook\n handle_auth \"facebook\"\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n end", "def like\n login_to_facebook\n bob.like\nend", "def facebook_oauth\n # Insert your own Facebook client ID and secret here\n # auth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n @facebook_oauth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n\n\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\nrescue Koala::Facebook::APIError => e\n logger.info e.to_s\n nil\nend", "def facebook?\n self.kind == 'facebook'\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n logger.info.e.to_s\n nil\n end", "def rc_facebook\n @rc_facebook ||= RestCore::Facebook.new(rc_facebook_options_new)\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n # error recovery (block-ish so can be shared across the rest of the Facebook methods)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n if Rails.env.production?\n logger.info e.to_s\n nil\n else\n raise e\n ### e.fb_error_xx parses the error, as in e.fb_error_type, e.fb_error_code, ...\n end\n end", "def facebook\n social_login(request.env['omniauth.auth'], current_user,\"Facebook\")\n end", "def authenticate(fb_user)\n \n \n end", "def facebook_activity(share_url=CONFIG[:host], connection_name='dropresume:update')\n if self.auth_provider == 'facebook'\n share_to_facebook(self, connection_name, \"http://#{share_url}\")\n end\n end", "def load_facebook_api\n return if !@facebook_api.nil?\n \n # Find the user token\n auth = authorizations.where(:provider => 'facebook').first\n if !auth.nil?\n @facebook_api = Koala::Facebook::API.new(auth.token)\n else\n raise 'User does not have a Facebook authorization.'\n end\n end", "def rest_api\n Koala::Facebook::RestAPI.new(access_token)\n end", "def before_connect(facebook_session)\n self.login = 'facebook_' + facebook_session.user.name\n self.facebook_name = facebook_session.user.name\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'facebook'\n end", "def welcome\n logger.info('Base.welcome params[:facebook]='+params[:facebook].to_s)\n end", "def client\n Mogli::Client.new(Network::Facebook.access_token)\n end", "def facebook_callback\n if params[:error_reason]\n redirect_to :controller => :home, :action => :index\n return\n end\n oauth_info = OauthToken.get_oauth_info('facebook')\n uri = URI.parse(\"https://graph.facebook.com/oauth/access_token\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n new_params = {:client_id => oauth_info['consumer_key'],\n :client_secret => oauth_info['consumer_secret'],\n :redirect_uri => oauth_info['callback'],\n :code => params[:code]}\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(new_params)\n response = http.request(request)\n \n fields = response.body.split('=')\n access_token = fields[1]\n\n oauth_token = OauthToken.find_by_token_and_site_token(access_token,'facebook')\n \n if current_user and oauth_token.present? and oauth_token.user and current_user != oauth_token.user\n redirect_to :controller => :oauth, :action => :duplicate_users, :id => oauth_token.id\n return\n end\n\n # Create the Oauth token\n if oauth_token\n oauth_token.update_attributes({:site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n else\n oauth_token = OauthToken.create({:user_id => (current_user ? current_user.id : nil),\n :site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n \n TrackedAction.add(:connected_to_third_party_site, oauth_token.user)\n TrackedAction.add(:connected_to_facebook, oauth_token.user)\n oauth_token.user.give_level_up_credits(10)\n end\n\n OauthToken.delay.autofollow_friends(oauth_token.id)\n\n flash[:authenticated_facebook] = 1\n if !session[:redirect_after_oauth].blank?\n redirect_to session[:redirect_after_oauth]\n session[:redirect_after_oauth] = nil\n else\n redirect_to :controller => :home, :action => :index\n end\n end", "def facebook?\n self.provider == 'facebook'\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def publish_on_fb\n\t \tbegin\n\t\t \tme = FbGraph::User.me(oauth_token)\n\t\t \tme.feed!(\n\t\t \t\t:message => \"\",\n\t\t \t\t:picture => \"indirizzo immagine\",\n\t\t \t\t:link => \"indirizzo applicazione\",\n\t\t \t\t:name => \"\",\n\t\t \t\t:description => \"\"\n\t\t \t)\n\t\trescue Exception\n\t\t\t# Condivisione non andata a buon fine.\n\t\tend\n \tend", "def facebook_id \n self.facebook_auth_cache.uid\n end", "def facebook?\n type == 'Facebook'\n end", "def create_fb_url_with_creds(indv_u_id, ac_token, decoded_state: nil)\n url = FACEBOOK_URL + \"?individual_user_id=#{indv_u_id}&secret=#{ac_token}\"\n if decoded_state\n url += \"pathway=#{decoded_state['pathway']}\" +\n \"&gift_template_id=#{decoded_state['gift_template_id']}\" \n end\n \n #Creates facebook oauth dialog url\n #--PE 10/30/14\n def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end\n\n #########\n protected\n ######### \n\n #Renew the access_token after API failure --PE July 17, 2012\n def rescue_api_error\n session.delete(:access_token)\n\t session.delete(:individual_user_id)\n\t oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, AUTH_CALLBACK)\n\t redirect_to(:action => \"exit_portal\", :url => oauth.url_for_oauth_code)\n end\n\n #Redirect to app index page after connection is reset --PE July 23, 2012\n def rescue_connection_reset\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (connection reset). \" +\n \"Please try again.\"\n end\n\n #Redirect to app index page after undefined method errors --PE July 23, 2012\n def rescue_undefined_method\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (undefined method). \" +\n \"Please try again.\"\n end\nend", "def new\n \n fb_auth = FbGraph::Auth.new('155275974530339', '309d340d359061c890906926e8139e4a')\n fb_auth.client # => Rack::OAuth2::Client\n \n client = fb_auth.client\n client.redirect_uri = \"http://localhost:3000/config_keys\"\n\n # redirect user to facebook\n redirect_to client.authorization_uri(\n :scope => [:email, :read_stream, :offline_access]\n )\n\n # in callback\n client.authorization_code = params[:code]\n access_token = client.access_token! # => Rack::OAuth2::AccessToken\n FbGraph::User.me(access_token).fetch # => FbGraph::User\n \n end", "def facebook_variables\n @facebooker_config = Facebooker::AdapterBase.facebooker_config\n @canvas_page_name = @facebooker_config['canvas_page_name']\n @application_base_url = 'http://apps.facebook.com/' + @canvas_page_name\n @api_key = @facebooker_config['api_key']\n @ajax_server = \"#{Facebooker::AdapterBase.facebooker_config['callback_url']}\"\n @facebook_session = facebook_session\n @scrollbar = session[:scrollbar]\n end", "def parent_api; end", "def parent_api; end", "def fb_auth\n @auth ||= self.authentications.facebook.first\n end", "def facebook\n # By default, client-side authentication gives you a short-lived\n # token:\n short_lived_token = params[:access_token]\n\n fb_hash = GenericApiRails.config.facebook_hash\n if fb_hash.nil?\n logger.error('Facebook login/signup not configured. For configuration instructions see controllers/generic_api_rails/authentication_controller.rb in the generic_api_rails project')\n render :json => { success: false , error: \"Facebook login/signup not configured\" }\n return\n end\n\n app_id = fb_hash[:app_id]\n app_secret = fb_hash[:app_secret]\n\n # to upgrade it, hit this URI, and use the token it hands back:\n token_upgrade_uri = \"https://graph.facebook.com/oauth/access_token?client_id=#{app_id}&client_secret=#{app_secret}&grant_type=fb_exchange_token&fb_exchange_token=#{short_lived_token}\"\n\n begin\n res = URI.parse(token_upgrade_uri).read\n\n res_hash = Rack::Utils.parse_query(res)\n\n long_lived_token = res_hash['access_token']\n rescue Exception => x\n logger.error(self.class.name + \" - facebook: #{x}\")\n long_lived_token = short_lived_token\n # render :json => { :error => \"token-upgrade error (#{x})\" }\n # return\n end\n\n # at this point, we have verified that the credential is authorized by\n # Facebook- facebook has even given us a long-lived token to\n # manipulate this credential via FB. Now, all we need is some details\n # about our credential, namely the credential ID, and email. We use Koala\n # here because it is a more flexible endpoint for Facebook, and we\n # don't want to be using OAuth here - we already have the token we\n # need.\n\n @graph = ::Koala::Facebook::API.new(long_lived_token, app_secret)\n fb_user = @graph.get_object(\"me\", fields: \"email,first_name,last_name,middle_name,birthday,about,location\")\n # logger.info(\"FB_USER: #{fb_user}\")\n uid = fb_user[\"id\"]\n profile_pic = @graph.get_picture(uid, { height: 500, width: 500 })\n\n # create a hash that matches what oauth spits out, but we've done\n # it with Koala:\n @provider = \"facebook\"\n @uid = uid\n @email = fb_user[\"email\"]\n\n person_hash = {\n fname: fb_user[\"first_name\"],\n lname: fb_user[\"last_name\"],\n minitial: fb_user[\"middle_name\"],\n profile_picture_uri: profile_pic,\n birthdate: fb_user[\"birthday\"]\n }\n\n @results = GenericApiRails.config.oauth_with.call(provider: \"facebook\", uid: uid, email: @email , person: person_hash)\n\n if @results[0].nil?\n # error = @results[1]\n @credential = nil\n else\n @credential = @results[0]\n end\n\n done\n end", "def invite_facebook_friends\n end", "def provider; end", "def facebook_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n username = hash[\"info\"][\"nickname\"]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, nil, email, gamer.id)\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = nil\n flash[:info] = t(:continue_reg_fb)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n if !auth\n Authentication.create_with_omniauth(provider,gid,\n token, nil, email, current_gamer.id)\n flash[:success] = t(:logged_in_to_fb)\n redirect_to \"/gamers/edit\"\n else\n Authentication.update_token(current_gamer.id, provider, token)\n redirect_to \"/games/post_facebook\"\n end\n end\n else\n flash[:error] = t(:oops_error_fb)\n redirect_to root_url\n end\n end", "def facebook_request\n redirect_to facebook_authenticate_url\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def facebook\n handle_redirect('devise.facebook_data', 'Facebook')\n end", "def facebook(name: T.unsafe(nil), email: T.unsafe(nil), username: T.unsafe(nil), uid: T.unsafe(nil)); end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def use_facebook(hash)\n @facebook_hash = hash\n @facebook_hash\n end", "def post(message)\n login_to_facebook\n bob.post(message)\nend", "def prepare_to_publish\n manager = OauthManager.new(@vehicle)\n @oauth = manager.oauth\n redirect_to manager.url\n\n rescue Exception => e\n flash[:error] = \"No se pudo autenticar con Facebook. #{e}\"\n redirect_to vehicles_path\n end", "def logged_in_to_facebook_and_app_authorized\n if ensure_application_is_installed_by_facebook_user \n # filter_parameter_logging :fb_sig_friends # commenting out for now because it fails sometimes\n end\n end", "def initialize options={}\n @oauth = Koala::Facebook::OAuth.new \\\n Facebook.config[:app_id], Facebook.config[:secret_key]\n @graph = Koala::Facebook::API.new access_token\n @page = @graph.get_object(Facebook.config[:page_id])\n end", "def signup_with_facebook\n @status, @msg, @data = UserValidator.signup_with_facebook(params)\n @status, @msg, @data = UserManager.signup_with_facebook(params) if @status\n end", "def facebook_url; \"https://facebook.com/#{facebook}\" end", "def fbc_link(fb_session)\n fb_uid = fb_session[\"user_id\"]\n access_token = fb_session[\"access_token\"]\n if self.new_record?\n self.facebook_connect_settings = FacebookConnectSettings.new(:fb_uid => fb_uid, :offline_session_key => access_token, :access_token => access_token)\n elsif facebook_connect_settings.nil?\n FacebookConnectSettings.create(:member_id => self.id, :fb_uid => fb_uid, :offline_session_key => access_token, :access_token => access_token)\n self.reload # so that the newly created facebook_connect_settings attribute is visible\n else\n facebook_connect_settings.update_attributes(:fb_uid => fb_uid, :offline_session_key => access_token, :access_token => access_token)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = metaclass.send(\"find_by_#{fb_user_name}\", fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.send(\"#{fb_user_name}_id=\", nil)\n existing_fb_user.save(false)\n end\n #link the new one\n self.send(\"#{fb_user_name}_id=\", fb_user_id)\n save(false)\n end\n end", "def facebook_client\n @facebook_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"facebook\").first\n Koala::Facebook::API.new(provider.access_token)\n end\n end\n end", "def private; end", "def initialize(access_token)\n @app_id = Rails.application.config.facebook_app_id\n @app_secret = Rails.application.config.facebook_app_secret\n @redirect_uri = Rails.application.config.facebook_redirect_uri\n @access_token = access_token\n end", "def Managerfb\n session[:check] = 1\n redirect_to '/auth/facebook'\n end", "def initialize(fb_data)\n @data = fb_data\n end", "def facebook_callback\n user_data = parse_facebook_user_data\n token = sign_user_token(user_data[\"email\"],\"facebook\")\n\n user = User.find_by_token(token)\n if user\n set_current_user(user)\n else\n user = User.new(:email => user_data[\"email\"],\n :nick => user_data[\"first_name\"],\n :token => token)\n user.save!\n\n set_current_user(user)\n end\n redirect_to :controller => \"sales_management\",\n :action => \"index\",\n :user_id => user.id\n end", "def facebook?\n provider_name == 'Facebook'\n end", "def koala\n return Koala::Facebook::API.new(facebook_access_token)\n end", "def link_fb_connect(fb_user)\n\t unless fb_user.id.nil?\n\t #check for existing account\n\t existing_fb_user = RmUser.find_by_fb_usid(fb_user.id)\n\t #unlink the existing account\n\t unless existing_fb_user.nil?\n\t #existing_fb_user.fb_usid = nil\n\t #existing_fb_user.save(false)\n\t end\n\t #link the new one\n\t self.fb_usid = fb_user.id\n\t self.first_name = fb_user.first_name\n\t self.last_name = fb_user.last_name\n\t #self.name = \n\t save(false)\n\t end\n\tend", "def return_from_general_auth\t\n # back from oauth wormhole..obtain facebook user and credentials\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GEN_AUTH_CALLBACK)\n session[:access_token] = oauth.get_access_token(params[:code])\n graph = Koala::Facebook::API.new(session[:access_token])\n facebook_user_id = graph.get_object(\"me\")[\"id\"]\n session[:individual_user_id] = \n IndividualUser.login_or_create(facebook_user_id,session[:access_token])\n\n # determine where to redirect\n state, link = false, false\n\t if params[:state]\n state = true\n decoded_state = ActiveSupport::JSON.decode(params[:state])\n \n # [Page Tab] return to the page tab\n if decoded_state['page_tab_id']\n\t\t\t graph = Koala::Facebook::API.new\n\t\t\t page_tab = graph.get_object(\"#{decoded_state['page_tab_id']}\")\n\t\t\t if page_tab[\"link\"]\n link = true\n\t\t\t\t encoded_page_state = URI.encode(ActiveSupport::JSON.encode(\n {:individual_user_id => session[:individual_user_id], \n :secret => session[:access_token]\n }))\n end\n end\n end\n \n # handle the redirect\n if state && link\n redirect_to(page_tab[\"link\"] + \n \"?sk=app_#{APP_ID}&app_data=#{encoded_page_state}\")\n else\n redirect_to(create_fb_url_with_creds(session[:individual_user_id],\n session[:access_token]))\n end\n return\n end", "def access_token\n Rails.configuration.fb.messenger.access_token\n end", "def omniauth(provider, *args); end", "def try\r\n\r\n\tif session[\"fb_access_token\"].present?\r\n\t@fql = Koala::Facebook::API.new(session[\"fb_access_token\"])\r\n\tfql = @fql.fql_query(\"SELECT eid FROM event_member WHERE uid = me()\")\r\n\tend\r\nend", "def block_friend\n end", "def facebook_actions\n self.publish_on_facebook\n self.notify_friends\n\n if Rails.env.production? and LevelUserLink.count % 1000 == 0\n FacebookFeedService.delay.publish_level_count(LevelUserLink.count)\n end\n end", "def fbauthorize\n redirect_to fb_auth_login_url.to_s\n end", "def modules; end", "def modules; end", "def modules; end", "def fb_object_id\n self.fb_action_id\n end", "def graph\n Koala::Facebook::GraphAPI.new(access_token)\n end", "def facebook_url\n facebook_id.blank? ? \"\" : \"http://facebook.com/\" + facebook_id\n end", "def refresh_fbml\r\n fbsession.profile_setFBML(:markup=>render_p_string('fb_profile/wide'))\r\n fb_redirect_to \"http://www.facebook.com/profile.php?id=#{logged_in_user.id}\"\r\n end", "def javascript_include_koala\n \"<div id=\\\"fb-root\\\"></div>\n <script src=\\\"http://connect.facebook.net/en_US/all.js\\\"></script>\n <script>\n FB.init({\n appId:'#{Devise::koala_app_id}', cookie:true,\n status:true, xfbml:true\n });\n </script>\"\n end", "def create_fb\n if current_facebook_user\n current_facebook_user.fetch\n if logged_in_member\n logged_in_member.update_attribute(:fb_user_id, current_facebook_user.id)\n redirect_to logged_in_member\n else\n @member = Member.find_or_initialize_with_facebook(current_facebook_user)\n conference_delegate = ConferenceDelegate.find_by_signature(params[:signature]) if !params[:signature].blank?\n if @member.new_record?\n @member.conference_delegate = conference_delegate\n @member.auth_service = 'Facebook'\n render :template => \"sessions/register_email\"\n else\n if conference_delegate && conference_delegate.member.nil? && @member.conference_delegate.nil?\n conference_delegate.update_attribute(:member, @member)\n end\n login_member!(@member)\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def publish_on_facebook\n if Rails.env.production? and self.user\n begin\n graph = Koala::Facebook::API.new(self.user.f_token)\n graph.put_connections(\"me\", \"sokoban_game:complete\",\n :level => pack_level_url(self.level.pack, self.level, :host => \"sokoban-game.com\"),\n :pushes => self.pushes,\n :moves => self.moves)\n rescue Koala::Facebook::APIError => e\n Rails.logger.info(\"PUBLISH ON FACEBOOK FAILED (but was published anyway ?)\")\n end\n end\n end", "def __bb_context; end", "def set_facebook_share\n @facebook_share = FacebookShare.find(params[:id])\n end", "def set_facebook_token\n @facebook_token = current_user.facebook_token\n end", "def index \n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/home/callback')\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"read_stream,publish_stream\") \t\n\t\tputs session.to_s + \"<<< session\"\n end", "def login_from_facebook\n fb_cookie = get_facebook_cookie\n return unless fb_cookie and fb_cookie[\"uid\"]\n\n #uid : 507527287\n #sig : ddf9dffcd85fcc41dbe4257b5eee922b\n #base_domain : gear.com\n #secret : fSoxbS_tGGF0oP2c9_SUbw__\n #access_token : 225955489319|2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287|d5zULU1zLZFguUUcsqVU0-C-tOM.\n #session_key : 2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287\n #expires : 1278799200\n\n user = User.find_by_fb_user_id(fb_cookie[\"uid\"])\n\n # cant find the user in the db but they have a fb session..\n return unless user\n \n # Add fb user to the user object and set the current user\n self.current_user = user \n end", "def linkedin\n handle_callback(:linkedin)\n end", "def use_oauth\n\t\t\t\n\t\tend", "def setup_bot\n Facebook::Messenger::Profile.set({\n greeting: {\n locale: 'default',\n text: 'Welcome to your friendly Ads Bot! :)' \n },\n get_started: {\n payload: 'GET_STARTED' # make sure to handle this postback\n }\n # @TODO: Add persistent menu\n }, access_token: access_token)\n end", "def set_facebook_page\n @facebook_page = FacebookPage.find(params[:id])\n end", "def footer_facebook_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"social\").a.className(\"facebook\"), __method__)\n end", "def facebook_user_data(data)\n raise \"SHOULD BE IMPLEMENT NEW USER DATA\"\n end", "def source_facebook?\n omniauth_access? && identities.collect{|i| i.provider}.include?('facebook')\n end", "def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end", "def fb_authenticate \n # If we have a new access token, validate it by attempting to get 'me',\n # the logged in facebook user\n if params[:access_token]\n begin\n rg = RestGraph.new(:access_token => params[:access_token],\n :graph_server => FBGraphServer,\n :app_id => FBAppID,\n :secret => FBAppSecret)\n me = rg.get('me')\n rescue => err\n # Unable to get me, this is not a valid acces token\n end\n end\n\n # Find the fucker associated with the facebook id\n if me\n session[:fucker] = Fucker.first(:conditions => {:facebook_id => me['id']})\n if !session[:fucker]\n session[:fucker] = Fucker.new({:name => me['name'], :facebook_id => me['id']})\n begin \n session[:fucker].save!\n rescue => e\n $log.warn(\"Unable to save new session fucker: #{e.message}\")\n session[:fucker] = nil\n end\n end\n elsif !params.has_key? :access_token && !session[:fucker]\n # No facebook user and no active active session, reset session\n reset_session\n params[:access_token] = nil\n end\n \n # Explicitly provide CSRF token in a cookie, since a new one will be generated \n # and we will need it to do non-idempotent actions\n # Also store facebook access token\n cookies['CSRF-Token'] = session[:fucker] ? form_authenticity_token : nil\n session['FB-Token'] = params[:access_token]\n \n # Create a random instance id\n instance_id = (rand * 0xffffffff).to_i;\n\n # Return the fucker\n respond_to do |format|\n format.json { render json: {:instance_id => instance_id, :fucker => session[:fucker], \n :csrf_token => cookies['CSRF-Token']}}\n end\n end", "def adapter_name\n 'Fb'\n end", "def facebook\n if request.env['omniauth.params']['role'] == \"user\"\n action = request.env['omniauth.params'] && request.env['omniauth.params']['action'] ? request.env['omniauth.params']['action'] : nil\n role = request.env['omniauth.params']['role']\n unless ['signin', 'signup', 'connect'].include? action\n raise 'wrong parameters for facebook auth'\n end\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"])\n @status = 'failed'\n @error = nil\n case action\n when 'signup'\n if @user\n @error = \"Compte déja associé avec un autre utilisateur\"\n elsif current_user\n @error = 'Vous êtes déja connecté'\n else\n @user = User.create_for_facebook_oauth(request.env[\"omniauth.auth\"], role)\n sign_in @user\n redirect_to root_path\n end\n when 'signin'\n if !@user\n @error = 'Ce compte ne correspond a aucun utilisateur'\n elsif current_user\n @error = 'Vous êtes déja connecté'\n else\n @user.update_for_facebook_oauth(request.env[\"omniauth.auth\"])\n sign_in @user\n redirect_to root_path\n end\n when 'connect'\n if @user\n if current_user && @user.id == current_user.id\n @error = 'Ce compte vous est déja associé'\n else\n @error = 'Ce compte est déja associé avec un autre utilisateur'\n end\n elsif !current_user || !current_user.id\n @error = 'Vous n\\'êtes pas connecté'\n else\n @user = current_user\n @user.connect_for_facebook_oauth(request.env[\"omniauth.auth\"])\n redirect_to user_profile\n end\n end\n if @error\n case action\n when 'signup'\n redirect_to user_signup_path(:error => @error)\n when 'signin'\n redirect_to user_signin_path(:error => @error)\n when 'connect'\n redirect_to edit_user_registration_path(:error => @error)\n end\n end\n end\n end", "def index\n @user = current_user\n @setting = @user.setting\n\n # @oauth = Koala::Facebook::OAuth.new(Rails.application.secrets.omniauth_provider_key.to_s, Rails.application.secrets.omniauth_provider_secret.to_s, \"/auth/facebook/callback\")\n #oauth = Koala::Facebook::OAuth.new(Rails.application.secrets.omniauth_provider_key.to_s, Rails.application.secrets.omniauth_provider_secret.to_s, \"/auth/:provider/callback_update\")\n #new_access_info = oauth.exchange_access_token_info#.auth.credentials.token\n #auth = request.env[\"omniauth.auth\"]\n # logger.info \"\\n AUTH!!!\\n\" + new_access_info.to_yaml + \"\\n \"\n # @oauth.get_user_info_from_cookies(cookies)\n # logger.info \"\\n AUTH : \" + @oauth.to_yaml\n # auth = request.env[\"omniauth.auth\"]\n #logger.info \"\\n auth!!!!!\\n\" +auth.to_yaml\n \n # @facebook_cookies ||= Koala::Facebook::OAuth.new(Rails.application.secrets.omniauth_provider_key.to_s, Rails.application.secrets.omniauth_provider_secret.to_s).get_user_info_from_cookie(cookies)\n#logger.info \"\\nFAEBOK COOK: \" + @facebook_cookies.to_yaml + \"\\n\"\n # Movie.sync_facebook(@user) \n # import_from_facebook\n #@graph = Koala::Facebook::API.new(session[:fb_access_token], Rails.application.secrets.omniauth_provider_secret.to_s)\n #friends = @graph.get_connections(\"me\", \"friends\")\n #logger.info \"\\n FRIENDS: \" + friends.to_yaml\n render action: :show\n end", "def det_facebook_login_method\n @status, @msg, @data = UserValidator.det_facebook_login_method(params)\n end", "def fb_init(options = {})\n perms = (options[:perms] || %w{email publish_stream}).join(\",\")\n locale = options[:locale] || \"es_ES\"\n\n js = <<-DATA\n <div id=\"fb-root\"></div>\n <script type=\"text/javascript\">\n window.fbAsyncInit = function() {\n FB.init({\n appId: '#{Facebook::APP_ID.to_s}',\n status: true,\n cookie: true,\n xfbml: true\n });\n\n FB.Canvas.setAutoResize(100);\n\n #{options[:append_to_init]}\n };\n\n (function() {\n var e = document.createElement('script'); e.async = true;\n e.src = document.location.protocol +\n '//connect.facebook.net/#{locale}/all.js';\n document.getElementById('fb-root').appendChild(e);\n }());\n\n var login = function(targetUrl, perms) {\n if (perms == null) {\n perms = \"#{perms}\"\n }\n FB.login(function(response) {\n if (response.session) {\n fixSession(JSON.stringify(response.session), targetUrl);\n } else {\n //pending to do when not logged in\n }\n }, {perms: perms});\n }\n\n var fixSession = function(fbSession, targetUrl) {\n $(\"body\").prepend('<form id=\"fixSession\"></form>');\n\n var f = $('form')[0];\n f.method = 'POST';\n f.action = \"/cookie_fix\";\n var m = document.createElement('input');\n m.setAttribute('type', 'hidden');\n m.setAttribute('name', '_session_id');\n m.setAttribute('value', fbSession);\n f.appendChild(m);\n\n m = document.createElement('input');\n m.setAttribute('type', 'hidden');\n m.setAttribute('name', 'redirect_to');\n m.setAttribute('value', targetUrl);\n f.appendChild(m);\n\n f.submit();\n }\n </script>\n DATA\n \n js.html_safe\n end", "def context; end" ]
[ "0.7241867", "0.7199786", "0.67367387", "0.6653006", "0.65570617", "0.64523655", "0.6426226", "0.61916757", "0.6089738", "0.6031665", "0.59686404", "0.5952022", "0.5947099", "0.59458524", "0.5929554", "0.5875273", "0.5867714", "0.58623266", "0.58169484", "0.5808161", "0.5795374", "0.5710242", "0.5700925", "0.5696798", "0.5674337", "0.56507933", "0.56480104", "0.56197363", "0.56100863", "0.56038284", "0.5580573", "0.5578109", "0.557542", "0.557542", "0.55750835", "0.55708313", "0.55583215", "0.55464554", "0.5541315", "0.55409235", "0.5536383", "0.5535477", "0.55343604", "0.55164963", "0.5498895", "0.549379", "0.5465688", "0.5461127", "0.54516447", "0.54453963", "0.5444794", "0.54430956", "0.5430076", "0.5429381", "0.54153574", "0.54121125", "0.54099447", "0.5401916", "0.5389985", "0.5384816", "0.5379713", "0.53777367", "0.5377212", "0.5375021", "0.536641", "0.5364647", "0.5355632", "0.5353022", "0.53367937", "0.5333073", "0.5333073", "0.5333073", "0.53321576", "0.5319841", "0.5317064", "0.5314114", "0.5299576", "0.5296707", "0.52951014", "0.52891594", "0.52867794", "0.5279494", "0.5273504", "0.5262394", "0.5261908", "0.52582455", "0.5249522", "0.5248578", "0.5244325", "0.52364844", "0.52310854", "0.522871", "0.5215659", "0.52065825", "0.5206076", "0.5201841", "0.5199218", "0.5197211", "0.5197113", "0.51966137" ]
0.5777472
21
GET /references GET /references.json
def index @references = @account.references.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def references\n references_hash.to_json\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "def index\n @references = Reference.all\n end", "def index\n @references = Reference.all\n end", "def references\n @references\n end", "def references\n @references ||= []\n end", "def get_references(dois)\n return [] unless dois.present? && ENV[\"LAGOTTO_URL\"].present?\n\n url = \"#{ENV['LAGOTTO_URL']}/api/references\"\n response = get_result(url, content_type: \"text/html\", data: dois_as_string(dois))\n\n references = response.fetch(\"references\", []).map do |reference|\n doi = reference.fetch(\"work_id\", \"\")[15..-1].upcase\n relation = reference.fetch(\"relation_type_id\", \"references\").camelize\n source = reference.fetch(\"source_id\", nil)\n source = SOURCES.fetch(source, source)\n\n if text = reference.fetch(\"DOI\", nil)\n text = text.upcase\n id = \"DOI\"\n else\n text = reference.fetch(\"URL\", nil)\n id = \"URL\"\n end\n\n { doi: doi,\n relation: relation,\n id: id,\n text: text,\n source: source }\n end.select { |item| item[:text].present? && item[:source] !~ /datacite_data/ }.group_by { |item| item[:doi] }\n end", "def references\n return @references\n end", "def index\n @refs = Ref.all\n end", "def updateReference\n return @references\n end", "def index\n @reforganism = Reforganism.find(params[:id])\n @referents = @reforganism.referents\n end", "def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end", "def show\n @reference = @account.references.find(params[:id])\n end", "def show\n @reference = Reference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference }\n end\n end", "def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end", "def references=(value)\n @references = value\n end", "def references; end", "def references; end", "def refs\n @refs ||= load_refs\n end", "def references\n GameContent.where reference_id: self.id\n end", "def show\n @book = Book.find(params[:id])\n @shown_references = Project.where(show_references: true).map{|p| p.references}.flatten\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @references_authors = References::Author.all\n end", "def refs(ref=nil)\n prefix = ref ? \"#{path_prefix}/refs/#{ref}\" : \"#{path_prefix}/refs\"\n Ghee::API::Repos::Git::Refs::Proxy.new(connection, prefix)\n end", "def parse_references\n globbed_references = body.scan(/(.*?\\))/)\n\n globbed_references.each do |reference|\n url = reference.first.scan(/(?<=\\().*(?=\\))/).first\n next unless url\n\n if url.include?('users')\n # Do nothing for now when it's a mention of a user\n # FIXME - this is junk\n elsif url.include?('ideas') && idea = Idea.find_by_sha(url.gsub('/ideas/', ''))\n # When this is an idea we know about, make a hard link\n self.idea_references.build(:referenced_id => idea.id)\n else\n # Just leave it in the body without doing anything.\n end\n end\n end", "def index\n @candidate_references = @candidate.references\n end", "def fetch_references(fragment)\n # Loop through each key in the current hash element\n fragment.each do |key, element|\n # Loop through arrays and keep looking,\n # unless they are enum or required arrays\n if element.is_a?(Array) && %w[enum required].index(key).nil?\n element.each do |value|\n fetch_references(anyKey: value)\n end\n end\n\n # Skip this element if it's not a hash, no $ref will exist\n next unless element.is_a?(Hash)\n\n # If we have a reference to follow\n if element.key?('$ref')\n file, path = element['$ref'].split('#')\n\n # Fetch the reference from the file that it's defined to be in\n referenced_property = if file.blank?\n # This is an internal reference (lives within the file we're parsing)\n parsed_json['definitions'][path.split('/').last]\n else\n # Fetch the reference from an external file\n referenced_file = UmmJsonSchema.new(schema_type, file)\n referenced_file.fetch_references(referenced_file.parsed_json)\n referenced_schema = referenced_file.parsed_json\n referenced_schema['definitions'][path.split('/').last]\n end\n\n # Merge the retrieved reference into the schema\n element.merge!(referenced_property)\n\n # Remove the $ref key so we don't attempt to parse it again\n element.delete('$ref')\n end\n\n # Keep diggin'\n fetch_references(element)\n end\n end", "def references(collection)\n target.try(:references, collection) || []\n end", "def reference\n @data['reference']\n end", "def references\n @references ||= message.references || []\n end", "def referrals(params = {})\n scope 'default'\n post('referrals/', params)\n end", "def orchio_get_by_ref(ref)\n response = client.send_request :get, inst_args(ref: ref)\n Result.new(\n status: orchio_status(response, 200),\n response: response,\n results: [ Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n ))]\n )\n end", "def index\n @references_citations = References::Citation.all\n end", "def references\n alias_of.references\n end", "def reference\n @refs ||= strip(:reference)\n end", "def refs\n @refs\n end", "def get_data_from_references(resource_name)\n puts \"fetching #{resource_name}...\"\n mauth_config = MAuth::ConfigEnv.load\n references_host = ENV.fetch('REFERENCES_HOST', 'https://references-innovate.imedidata.com')\n begin\n connection = Faraday::Connection.new(url: references_host) do |builder|\n builder.use MAuth::Faraday::RequestSigner, mauth_config\n builder.adapter Faraday.default_adapter\n end\n\n # get the data\n response = connection.get \"/v1/#{resource_name}\"\n puts \"HTTP #{response.status}\"\n\n # return the user info\n if response.status == 200\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\n else\n puts response.body\n nil\n end\n rescue JSON::ParserError => e\n puts \"Error parsing data from references: #{e.inspect}\"\n puts e.backtrace.join(\"\\n\")\n end\nend", "def references\n @references ||= Comment.find(:all, :conditions => [\"(comments.commentable_type = ? AND comments.commentable_id = ?) AND comments.position IN (?)\", self.commentable_type, self.commentable_id, self.reference_ids], :order => 'comments.position ASC')\n end", "def index\n @lesson_references = LessonReference.all\n end", "def reference\n value_for('reference')\n end", "def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end", "def get_refs(way)\n return [] if !way.tags.has_key?('ref')\n return way.tags['ref'].split(/(;|,)/).collect {|ref| ref.strip}\n end", "def index\n @source_refs = SourceRef.all\n end", "def references_hash\n {\n 'http://schema.org/url' => @metadata['landing_page'],\n 'http://resources.arcgis.com/en/help/arcgis-rest-api' => @metadata['url']\n }\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def references\n @references = operands.select {|op| op.is_a?(RDF::Resource)}\n end", "def references(url, data = nil)\n return [] if data.nil? || data.empty?\n # Enumerate the URIs and add them as keys of a hash to de-duplicate\n enum = Aspire::Enumerator::LinkedDataURIEnumerator.new.enumerator(url, data)\n uris = {}\n enum.each { |_k, hash, _i| uris[hash['value']] = true }\n # Return the list of URIs\n uris.keys\n end", "def index\n @tag_refs = TagRef.all\n end", "def referenced_objects\n return @referenced_objects\n end", "def get(params = {})\n client.get(\"/v1/reference-data/locations/#{@location_id}\", params)\n end", "def references\n details.map { |detail| detail[:recurring_detail_reference] }\n end", "def references(collection)\n target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || []\n end", "def show\n @through_reference = ThroughReference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @through_reference }\n end\n end", "def reference\n if success?\n nil\n else\n body ? self[\"reference\"] : \"No reference\"\n end\n end", "def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end", "def index\n @ref_data = RefDatum.all\n end", "def show\n @reference_database = ReferenceDatabase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference_database }\n end\n end", "def references_for_repository(repository_name)\n @reference_mapping[repository_name] || []\n end", "def ref\n @ref ||= maybe_ref || api.master_ref.ref\n end", "def destroy\n @reference = Reference.find(params[:id])\n @reference.destroy\n\n respond_to do |format|\n format.html { redirect_to references_url }\n format.json { head :no_content }\n end\n end", "def reference\n @reference\n end", "def referrers id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/referrers?date=#{date}&page=#{page}\"\n fetch uri\n end", "def objects_with_references\n end", "def parse_reference_ids full_document\n full_document.gsub(/%r(\\d+)/) do\n if Reference.exists? $1\n reference = Reference.find($1)\n reference.decorate.to_link\n else\n broken_markdown_link \"reference\", $1\n end\n end\n end", "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end", "def fetch_refs(repo_user,repo_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/refs\")\n body = response_body(uri)\n \n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n [] \n end\n end", "def urls\n \n # Go through the 3 urls in the record and retrieve the urls and associated \n # text for the caller\n references = []\n 1.upto(3) do |i|\n \n url = self.send(\"url#{i}\")\n break if url == ''\n \n url_text = self.send(\"url#{i}_name\")\n url_text = 'Reference' if url_text == ''\n references.push({ :text => url_text, :url => url })\n \n end\n \n references\n \n end", "def get_links_changes(params)\n get_json(links_changes_url(params))\n end", "def ref(id, options={})\n add Reference.new(resource, id, options)\n end", "def index\n @referees = Referee.all\n end", "def fetch_ref(repo_user,repo_name, ref_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/#{ref_name}\")\n body = response_body(uri)\n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n []\n end\n end", "def query\n @Title = \"References\"\n init_seeker Reference\n=begin\n @references = Reference.scoped\n @seeker = ReferenceSeeker.new @references, session[:seeker], params # Default; other controllers may set up different seekers\n session[:seeker] = @seeker.store\n=end\n render 'index', :layout=>false\n end", "def find_refs\n # should always be there\n @proj_xml_node.css(\"Project Reference\")\n end", "def destroy\n @references_author.destroy\n respond_to do |format|\n format.html { redirect_to references_authors_url }\n format.json { head :no_content }\n end\n end", "def cached_references\n @cached_references ||= []\n end", "def index\n @referenceboxes = Referencebox.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @referenceboxes }\n end\n end", "def index\n @ref_attributes = RefAttribute.all\n end", "def xref_urls\n xrefs.flat_map { |type, values|\n name = :\"xref_url_for_#{type.tr(\"-\", \"_\")}\"\n respond_to?(name, true) && xref_map(values, name) || values.to_a\n }\n end", "def [](ref_id)\n response = @key_value.perform(:get, ref_id)\n Ref.new(@key_value.collection, @key_value.key, response)\n end", "def parse_references( lines )\n data = {}\n return data if lines == nil\n index = 1\n h = {}\n references_left = 0\n\n lines.each do |line|\n next if line[0].chr == '#' # Comment\n next if line[0..1] == '//' # End of entry marker\n line.chomp!\n\n if (1..7).include?( index )\n h[index] = line\n references_left = h[index].to_i if index == 7\n index += 1\n next\n end\n\n if index == 8\n h[index] ||= []\n h[index] << line\n references_left -= 1\n end\n\n if references_left == 0\n data[ h[1] ] = {\n :name => h[1],\n :organism => h[2],\n :isoschizomers => h[3],\n :methylation => h[4],\n :source => h[5],\n :suppliers => h[6],\n :number_of_references => h[7],\n :references => h[8]\n }\n index = 1\n h = {}\n end\n end # lines.each\n data\n end", "def file_references\n return unless @command == :download_file_list\n\n @file_references ||= begin\n xml = xml_doc content\n descriptors = xml.css('FileDescriptor')\n descriptors.map { |descriptor| descriptor.at('FileReference').content }\n end\n end", "def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end", "def git_refs()\n # This glob pattern matches recursively so we will find a branch named\n # something like 'feature/subfeature/the-cool-feature'.\n # TODO: get remotes also\n git_dir = git_git_dir()\n\n locals = Dir.glob(File.join(git_dir, 'refs', 'heads', '**', '*')).select do |f|\n !File.directory? f\n end.map do |f|\n {\n 'name' => f.split('/refs/heads/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n remotes = Dir.glob(File.join(git_dir, 'refs', 'remotes', '**', '*')).select do |f|\n !File.directory?(f) and !f.end_with? \"/HEAD\"\n end.map do |f|\n {\n 'name' => f.split('/refs/remotes/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n locals + remotes\nend", "def reference_tokens\n refs = []\n each_term do |term|\n if is?(term, :reference)\n refs << term[:token]\n end\n end\n refs\n end", "def load_ref_commits(ref)\n commits = []\n page = 1\n begin\n loop do\n commits += Octokit.commits(@path, ref, :page => page)\n page += 1\n end\n rescue Octokit::NotFound, Faraday::Error::ResourceNotFound\n end\n commits\n end", "def show\n @ref = Ref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def refs(repo)\n repo.refs_hash[id]\n end", "def reference_list\n return @reference_list unless @reference_list.nil?\n io = _parent._parent._io\n _pos = io.pos\n io.seek(ofs_reference_list)\n @reference_list = ReferenceList.new(io, self, @_root, num_references)\n io.seek(_pos)\n @reference_list\n end", "def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end", "def resolve_references(data, rel_path)\n # Walk through all array entries to find more references\n return data.map { |x| resolve_references(x, rel_path) } if data.is_a?(Array)\n\n # Return any data that we cannot step into to find more `include` calls\n return data unless data.is_a?(Hash)\n\n # Any call to `include` gets its data read, parsed, and merged back\n # into the current data structure\n if data.key?('include')\n data.delete('include').flatten\n .map { |x| File.expand_path(x, rel_path) }\n .map { |x| find_files(x) }.flatten\n .map { |path| parse_nginx(path) }\n .each { |conf| merge_config!(data, conf) }\n end\n\n # Walk through the remaining hash fields to find more references\n Hash[data.map { |k, v| [k, resolve_references(v, rel_path)] }]\n end", "def readReferences\n @refA = readRawChannelLevel(REF_A)\n @refB = readRawChannelLevel(REF_B)\n end", "def getRefPath()\n return @refPath\n end", "def ref_params\n params.fetch(:ref, {})\n end", "def ref\n reference(@id, @revision)\n end", "def index\n @reference_lists = ReferenceList.all.page(params[:page]).per(15)\n end", "def get_collection_object_references\n # get ids of collection object links\n link_ids = CollectionobjectLink.where(\"resource_id = ?\", self.id).pluck(:id)\n resource_ids = MediaFile.where(\"sourceable_id IN (?)\", link_ids).pluck(:resource_id)\n\n #\n rel_resource_ids = RelatedResource.where(\"to_resource_id = ?\", self.id).pluck(:resource_id)\n\n all_resource_ids = rel_resource_ids + resource_ids\n\n begin\n Resource.find(all_resource_ids)\n rescue\n return []\n end\n end", "def references(collection)\n manager_refs_by_association.try(:[], collection).try(:[], :ems_ref)&.to_a || []\n end", "def show\n @reference = Reference.where(\"protocol_id = ?\", params[:id])\n end", "def gather_internal_refs\n #@files.each.with_object({}) do |(_, x), refs|\n @files.keys.each_with_object({}) do |i, refs|\n #x[:attachment] and next\n @files.get(i,:attachment) and next\n #file, = targetfile(x, read: true)\n file, = @files.targetfile_id(i, read: true)\n Nokogiri::XML(file)\n .xpath(ns(\"//bibitem[@type = 'internal']/\" \\\n \"docidentifier[@type = 'repository']\")).each do |d|\n a = d.text.split(%r{/}, 2)\n a.size > 1 or next\n refs[a[0]] ||= {}\n refs[a[0]][a[1]] = true\n end\n end\n end", "def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end" ]
[ "0.75559896", "0.7409477", "0.72816175", "0.7129962", "0.7129962", "0.6839481", "0.6710343", "0.66736835", "0.6607017", "0.65439403", "0.6514049", "0.64994705", "0.64339525", "0.64019185", "0.6378839", "0.6373114", "0.6265303", "0.625604", "0.625604", "0.6244192", "0.62306637", "0.6164155", "0.61541665", "0.6112094", "0.60977894", "0.60733646", "0.6030209", "0.59835607", "0.59831804", "0.5966264", "0.5934272", "0.5926646", "0.592233", "0.5921411", "0.59198344", "0.58871603", "0.5875418", "0.5835369", "0.582921", "0.5799988", "0.57820815", "0.57805336", "0.57746744", "0.57607776", "0.5758388", "0.5738078", "0.5737725", "0.5711527", "0.56732196", "0.566894", "0.56662905", "0.56584936", "0.5626198", "0.5617184", "0.56111", "0.5609292", "0.5605673", "0.556609", "0.5562361", "0.55590373", "0.55545354", "0.5546535", "0.5543578", "0.5539211", "0.5536673", "0.5534207", "0.55286217", "0.55169326", "0.55081666", "0.54977924", "0.54720604", "0.54695976", "0.546913", "0.5456907", "0.5444579", "0.5438601", "0.5433373", "0.5433113", "0.5428129", "0.5422655", "0.54214114", "0.5419542", "0.54128414", "0.5411666", "0.540005", "0.539524", "0.5383272", "0.5382004", "0.5367092", "0.536463", "0.5361587", "0.5359678", "0.5359046", "0.53584373", "0.53551465", "0.53382", "0.53173167", "0.5315276", "0.5312441", "0.5288461" ]
0.67257285
6
GET /references/1 GET /references/1.json
def show @reference = @account.references.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @references = Reference.all\n\n render json: @references\n end", "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "def references\n references_hash.to_json\n end", "def index\n @references = Reference.all\n end", "def index\n @references = Reference.all\n end", "def show\n @reference = Reference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference }\n end\n end", "def index\n @references = @account.references.all\n end", "def index\n @refs = Ref.all\n end", "def index\n @reforganism = Reforganism.find(params[:id])\n @referents = @reforganism.referents\n end", "def updateReference\n return @references\n end", "def references\n @references ||= []\n end", "def references\n @references\n end", "def get_references(dois)\n return [] unless dois.present? && ENV[\"LAGOTTO_URL\"].present?\n\n url = \"#{ENV['LAGOTTO_URL']}/api/references\"\n response = get_result(url, content_type: \"text/html\", data: dois_as_string(dois))\n\n references = response.fetch(\"references\", []).map do |reference|\n doi = reference.fetch(\"work_id\", \"\")[15..-1].upcase\n relation = reference.fetch(\"relation_type_id\", \"references\").camelize\n source = reference.fetch(\"source_id\", nil)\n source = SOURCES.fetch(source, source)\n\n if text = reference.fetch(\"DOI\", nil)\n text = text.upcase\n id = \"DOI\"\n else\n text = reference.fetch(\"URL\", nil)\n id = \"URL\"\n end\n\n { doi: doi,\n relation: relation,\n id: id,\n text: text,\n source: source }\n end.select { |item| item[:text].present? && item[:source] !~ /datacite_data/ }.group_by { |item| item[:doi] }\n end", "def references; end", "def references; end", "def orchio_get_by_ref(ref)\n response = client.send_request :get, inst_args(ref: ref)\n Result.new(\n status: orchio_status(response, 200),\n response: response,\n results: [ Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n ))]\n )\n end", "def references\n GameContent.where reference_id: self.id\n end", "def reference\n @data['reference']\n end", "def references=(value)\n @references = value\n end", "def show\n @book = Book.find(params[:id])\n @shown_references = Project.where(show_references: true).map{|p| p.references}.flatten\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# show.html.erb\n format.json { render json: @book }\n end\n end", "def ref\n @ref ||= maybe_ref || api.master_ref.ref\n end", "def references\n return @references\n end", "def parse_references\n globbed_references = body.scan(/(.*?\\))/)\n\n globbed_references.each do |reference|\n url = reference.first.scan(/(?<=\\().*(?=\\))/).first\n next unless url\n\n if url.include?('users')\n # Do nothing for now when it's a mention of a user\n # FIXME - this is junk\n elsif url.include?('ideas') && idea = Idea.find_by_sha(url.gsub('/ideas/', ''))\n # When this is an idea we know about, make a hard link\n self.idea_references.build(:referenced_id => idea.id)\n else\n # Just leave it in the body without doing anything.\n end\n end\n end", "def reference\n value_for('reference')\n end", "def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end", "def refs(ref=nil)\n prefix = ref ? \"#{path_prefix}/refs/#{ref}\" : \"#{path_prefix}/refs\"\n Ghee::API::Repos::Git::Refs::Proxy.new(connection, prefix)\n end", "def index\n @references_authors = References::Author.all\n end", "def reference\n @refs ||= strip(:reference)\n end", "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end", "def reference\n if success?\n nil\n else\n body ? self[\"reference\"] : \"No reference\"\n end\n end", "def show\n @through_reference = ThroughReference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @through_reference }\n end\n end", "def parse_reference_ids full_document\n full_document.gsub(/%r(\\d+)/) do\n if Reference.exists? $1\n reference = Reference.find($1)\n reference.decorate.to_link\n else\n broken_markdown_link \"reference\", $1\n end\n end\n end", "def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end", "def ref\n reference(@id, @revision)\n end", "def index\n @candidate_references = @candidate.references\n end", "def ref(id, options={})\n add Reference.new(resource, id, options)\n end", "def index\n @lesson_references = LessonReference.all\n end", "def show\n @reference_database = ReferenceDatabase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference_database }\n end\n end", "def fetch_references(fragment)\n # Loop through each key in the current hash element\n fragment.each do |key, element|\n # Loop through arrays and keep looking,\n # unless they are enum or required arrays\n if element.is_a?(Array) && %w[enum required].index(key).nil?\n element.each do |value|\n fetch_references(anyKey: value)\n end\n end\n\n # Skip this element if it's not a hash, no $ref will exist\n next unless element.is_a?(Hash)\n\n # If we have a reference to follow\n if element.key?('$ref')\n file, path = element['$ref'].split('#')\n\n # Fetch the reference from the file that it's defined to be in\n referenced_property = if file.blank?\n # This is an internal reference (lives within the file we're parsing)\n parsed_json['definitions'][path.split('/').last]\n else\n # Fetch the reference from an external file\n referenced_file = UmmJsonSchema.new(schema_type, file)\n referenced_file.fetch_references(referenced_file.parsed_json)\n referenced_schema = referenced_file.parsed_json\n referenced_schema['definitions'][path.split('/').last]\n end\n\n # Merge the retrieved reference into the schema\n element.merge!(referenced_property)\n\n # Remove the $ref key so we don't attempt to parse it again\n element.delete('$ref')\n end\n\n # Keep diggin'\n fetch_references(element)\n end\n end", "def referrals(params = {})\n scope 'default'\n post('referrals/', params)\n end", "def refs\n @refs ||= load_refs\n end", "def destroy\n @reference = Reference.find(params[:id])\n @reference.destroy\n\n respond_to do |format|\n format.html { redirect_to references_url }\n format.json { head :no_content }\n end\n end", "def reference\n @reference\n end", "def [](ref_id)\n response = @key_value.perform(:get, ref_id)\n Ref.new(@key_value.collection, @key_value.key, response)\n end", "def show\n @ref = Ref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def show\n @reference = Reference.where(\"protocol_id = ?\", params[:id])\n end", "def index\n @source_refs = SourceRef.all\n end", "def referrers id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/referrers?date=#{date}&page=#{page}\"\n fetch uri\n end", "def references(collection)\n target.try(:references, collection) || []\n end", "def index\n @references_citations = References::Citation.all\n end", "def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end", "def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def get_data_from_references(resource_name)\n puts \"fetching #{resource_name}...\"\n mauth_config = MAuth::ConfigEnv.load\n references_host = ENV.fetch('REFERENCES_HOST', 'https://references-innovate.imedidata.com')\n begin\n connection = Faraday::Connection.new(url: references_host) do |builder|\n builder.use MAuth::Faraday::RequestSigner, mauth_config\n builder.adapter Faraday.default_adapter\n end\n\n # get the data\n response = connection.get \"/v1/#{resource_name}\"\n puts \"HTTP #{response.status}\"\n\n # return the user info\n if response.status == 200\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\n else\n puts response.body\n nil\n end\n rescue JSON::ParserError => e\n puts \"Error parsing data from references: #{e.inspect}\"\n puts e.backtrace.join(\"\\n\")\n end\nend", "def reference\n GameContent.where(id: self.reference_id).first\n end", "def generate_ref(ref, index)\n ref_name = Google::StringUtils.underscore(ref.name)\n generate_object(ref, \"resource(#{ref_name},#{index})\", :resource,\n index, ensure: 'present')\n end", "def set_ref\n @ref = Ref.find(params[:id])\n end", "def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end", "def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end", "def objects_with_references\n end", "def fetch_ref(repo_user,repo_name, ref_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/#{ref_name}\")\n body = response_body(uri)\n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n []\n end\n end", "def references\n @references ||= message.references || []\n end", "def references\n @references ||= Comment.find(:all, :conditions => [\"(comments.commentable_type = ? AND comments.commentable_id = ?) AND comments.position IN (?)\", self.commentable_type, self.commentable_id, self.reference_ids], :order => 'comments.position ASC')\n end", "def show\n @referer = Referer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referer }\n end\n end", "def resolve_reference; end", "def index\n @ref_data = RefDatum.all\n end", "def refs\n @refs\n end", "def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end", "def references_hash\n {\n 'http://schema.org/url' => @metadata['landing_page'],\n 'http://resources.arcgis.com/en/help/arcgis-rest-api' => @metadata['url']\n }\n end", "def index\n @referees = Referee.all\n end", "def ref\n @references += 1\n end", "def get(params = {})\n client.get(\"/v1/reference-data/locations/#{@location_id}\", params)\n end", "def getRefPath()\n return @refPath\n end", "def create\n @ref = Ref.new(ref_params)\n\n respond_to do |format|\n if @ref.save\n format.html { redirect_to @ref, notice: 'Ref was successfully created.' }\n format.json { render :show, status: :created, location: @ref }\n else\n format.html { render :new }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n details.map { |detail| detail[:recurring_detail_reference] }\n end", "def destroy\n @references_author.destroy\n respond_to do |format|\n format.html { redirect_to references_authors_url }\n format.json { head :no_content }\n end\n end", "def references\n alias_of.references\n end", "def create\n @reference = Reference.new(params[:reference])\n\n respond_to do |format|\n if @reference.save\n format.html { redirect_to @reference, notice: 'Reference was successfully created.' }\n format.json { render json: @reference, status: :created, location: @reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def fetch_refs(repo_user,repo_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/refs\")\n body = response_body(uri)\n \n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n [] \n end\n end", "def resolved_ref\n \"resolved-#{ref}\"\n end", "def index\n @tag_refs = TagRef.all\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def new\n @reference_database = ReferenceDatabase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_database }\n end\n end", "def query\n @Title = \"References\"\n init_seeker Reference\n=begin\n @references = Reference.scoped\n @seeker = ReferenceSeeker.new @references, session[:seeker], params # Default; other controllers may set up different seekers\n session[:seeker] = @seeker.store\n=end\n render 'index', :layout=>false\n end", "def show\n @referral = Referral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referral }\n end\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def show\n @referencebox = Referencebox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referencebox }\n end\n end", "def urls\n \n # Go through the 3 urls in the record and retrieve the urls and associated \n # text for the caller\n references = []\n 1.upto(3) do |i|\n \n url = self.send(\"url#{i}\")\n break if url == ''\n \n url_text = self.send(\"url#{i}_name\")\n url_text = 'Reference' if url_text == ''\n references.push({ :text => url_text, :url => url })\n \n end\n \n references\n \n end", "def index\n @ref_attributes = RefAttribute.all\n end", "def resolve_json_reference(options, object, _field, reference_def)\n keys = nil\n reference_json = nil\n if reference_def[:metadata]\n key = reference_def[:metadata].key.to_sym\n if reference_def[:metadata].polymorphic?\n clazz = reference_def[:metadata].inverse_class_name.constantize\n else\n clazz = reference_def[:metadata].class_name.constantize\n end\n relation_class = if Mongoid::Compatibility::Version.mongoid7_or_newer?\n Mongoid::Association::Referenced::HasAndBelongsToMany::Proxy\n else\n Mongoid::Relations::Referenced::ManyToMany\n end\n\n if reference_def[:metadata].relation == relation_class\n object_ids = object.send(key)\n if object_ids\n reference_json = object_ids.map do |id|\n materialize_keys, json = materialize_json(options, clazz: clazz, id: id)\n keys = keys ? keys.merge_set(materialize_keys) : materialize_keys\n json\n end.compact\n else\n object_ids = []\n end\n end\n end\n # If we get to this point and reference_json is still nil, there's no chance we can\n # load the JSON from cache so we go ahead and call as_json on the object.\n unless reference_json\n reference_def_definition = reference_def[:definition]\n reference = reference_def_definition.is_a?(Symbol) ? object.send(reference_def_definition) : reference_def_definition.call(object)\n reference_json = nil\n if reference\n if reference.respond_to?(:as_json_partial)\n reference_keys, reference_json = reference.as_json_partial(options)\n keys = keys ? keys.merge_set(reference_keys) : reference_keys\n else\n reference_json = reference.as_json(options)\n end\n end\n end\n [keys, reference_json]\n end", "def references\n @references = operands.select {|op| op.is_a?(RDF::Resource)}\n end", "def macro\n :references_one\n end", "def update\n @reference = Reference.find(params[:id])\n\n respond_to do |format|\n if @reference.update_attributes(params[:reference])\n format.html { redirect_to @reference, notice: 'Reference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\t\t@param_refs = ParamRef.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @param_refs}\n\t\tend\n\tend", "def ref(logical_id)\n {\"Ref\" => xref(logical_id)}\n end", "def set_reference_list\n @reference_list = ReferenceList.find(params[:id])\n end", "def add_report_reference(id, reference)\n body = {\n data: {\n type: \"issue-tracker-reference-id\",\n attributes: {\n reference: reference\n }\n }\n }\n\n post(\"reports/#{id}/issue_tracker_reference_id\", body)\n end", "def macro\n :references_one\n end", "def index\n @referenceboxes = Referencebox.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @referenceboxes }\n end\n end" ]
[ "0.7289402", "0.7209014", "0.70708585", "0.7068969", "0.7068969", "0.6697828", "0.6539074", "0.6511298", "0.6510835", "0.6493784", "0.63351184", "0.63005394", "0.6247803", "0.6178562", "0.6178562", "0.6102249", "0.60849243", "0.60786736", "0.606717", "0.6055889", "0.604911", "0.60372764", "0.602685", "0.60219514", "0.6001998", "0.6000049", "0.599804", "0.5976595", "0.5968869", "0.5960118", "0.5948227", "0.5943727", "0.59394294", "0.5938478", "0.5880708", "0.58702177", "0.58610153", "0.58466715", "0.5844977", "0.5840023", "0.58360696", "0.5812755", "0.5762273", "0.57464164", "0.5744444", "0.57413644", "0.5739323", "0.5733508", "0.57332444", "0.57307005", "0.5680117", "0.5670145", "0.5661997", "0.565631", "0.5655375", "0.5629205", "0.56283617", "0.5615761", "0.5591144", "0.5582481", "0.5580264", "0.5565551", "0.55622864", "0.5560208", "0.55573493", "0.55553555", "0.5527862", "0.5505945", "0.5501214", "0.54945153", "0.5492231", "0.54879975", "0.54736996", "0.54696476", "0.5468515", "0.54656637", "0.54639924", "0.5454939", "0.54524946", "0.5450363", "0.54492545", "0.5446034", "0.5446034", "0.54438764", "0.542986", "0.5421723", "0.5420512", "0.54178184", "0.54174954", "0.5417136", "0.54148966", "0.5403701", "0.5391104", "0.53892875", "0.5372502", "0.5368659", "0.53643954", "0.53629637", "0.53613", "0.53607315" ]
0.66037506
6
GET /references/new GET /references/new.json
def new @reference = @account.references.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n @reference_database = ReferenceDatabase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_database }\n end\n end", "def new\n @through_reference = ThroughReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @through_reference }\n end\n end", "def new\n @referer = Referer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referer }\n end\n end", "def create\n @ref = Ref.new(ref_params)\n\n respond_to do |format|\n if @ref.save\n format.html { redirect_to @ref, notice: 'Ref was successfully created.' }\n format.json { render :show, status: :created, location: @ref }\n else\n format.html { render :new }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @referee = Referee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referee }\n end\n end", "def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type }\n end\n end", "def new\n # since our the reference new path contains the topic's id\n # we can use params[:topic_id] to get that id\n @topic = Topic.find params[:topic_id]\n\n # This is similar to Reference.new, BUT it creates the new reference\n # in the context of a Topic object and sets the foreign key\n @reference = @topic.references.new\n end", "def create\n @reference = Reference.new(params[:reference])\n\n respond_to do |format|\n if @reference.save\n format.html { redirect_to @reference, notice: 'Reference was successfully created.' }\n format.json { render json: @reference, status: :created, location: @reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end", "def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end", "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referral }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @ref_protein = RefProtein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_protein }\n end\n end", "def create\n @reference = @account.references.new(params[:reference])\n\n if @reference.save\n redirect_to [@account, @reference], notice: 'Reference was successfully created.'\n else\n render action: \"new\"\n end\n end", "def new\n @job = Job.new\n\n session[:time_now] = Time.now\n\n 2.times do\n @job.references.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @resources_and_link = ResourcesAndLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def new\n @dependent_relationship = DependentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dependent_relationship }\n end\n end", "def new\n @useful_link = UsefulLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @useful_link }\n end\n end", "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end", "def new\n @inv_x_ref = InvXRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inv_x_ref }\n end\n end", "def new\n @project = Project.new\n @refdb = Project.where(reference: true)\n end", "def new\n\t@topic = Topic.new\n\t@topic.locations.build\n\t@topic.references.build \n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.json { render json: @topic }\n\tend\n end", "def new\n @social_contract = SocialContract.new\n @social_contract.build_referendum\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @social_contract }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n\t\t@param_ref = ParamRef.new\n\n\t\trender json: @param_ref\n\tend", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @link }\n end\n end", "def new\n @relation = Relation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relation }\n end\n end", "def new\n @genome_reference = GenomeReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @genome_reference }\n end\n end", "def create\n respond_to do |format|\n if @resource.save\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reference = Reference.new reference_params\n if @reference.save\n respond_to do |format|\n format.html\n format.js\n end\n else\n render :new\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def new\n @special_document = ModifiedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_document }\n end\n end", "def new\n @note = Note.new\n @options.merge!({url: [@project, @item, :notes]})\n\n respond_to do |format|\n format.html { render action: 'new', layout: @options[:layout] }\n format.json { render json: @note }\n end\n end", "def create\n @candidate_reference = @candidate.references.build(candidate_reference_params)\n\n respond_to do |format|\n if @candidate_reference.save\n flash[:success] = 'Reference was successfully created.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { render :show, status: :created, location: @candidate_reference }\n else\n flash[:failure] = 'Reference creation unsuccessful.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id]) }\n format.json { render json: @candidate_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end", "def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end", "def create\n @references_citation = References::Citation.new(references_citation_params)\n\n respond_to do |format|\n if @references_citation.save\n format.html { redirect_to @references_citation, notice: 'Citation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_citation }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_citation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end", "def new\n @correction = Correction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correction }\n end\n end", "def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end", "def new\n @task_changes = TaskChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_changes }\n end\n end", "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end", "def new\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_diagnostic_test_type }\n end\n end", "def new\n @status_ref_pago_insc = StatusRefPagoInsc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ref_pago_insc }\n end\n end", "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @breadcrumb = 'create'\n @guide = Guide.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guide }\n end\n end", "def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end", "def create\n @source_ref = SourceRef.new(source_ref_params)\n\n respond_to do |format|\n if @source_ref.save\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully created.' }\n format.json { render :show, status: :created, location: @source_ref }\n else\n format.html { render :new }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @correlation = Correlation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correlation }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def new\n @git_datum = GitDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @git_datum }\n end\n end", "def new\n @links = Links.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @refarence = Refarence.new(refarence_params)\n\n respond_to do |format|\n if @refarence.save\n format.html { redirect_to @refarence, notice: 'Refarence was successfully created.' }\n format.json { render :show, status: :created, location: @refarence }\n else\n format.html { render :new }\n format.json { render json: @refarence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @reference_type.save\n flash[:notice] = 'Reference type was successfully created.'\n @changed << @reference_type.id\n \n format.html { redirect_to reference_types_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @reference_type, status: :created, location: @reference_type }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @commitment = Commitment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commitment }\n end\n end", "def new\n @colaboration = Colaboration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colaboration }\n end\n end", "def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end", "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "def new_reference(options={}, &block)\n save = options.delete(:save)\n\n if options[:number]\n options[:ref_id] = \"ref.#{options[:number]}\" unless options.has_key?(:ref_id)\n end\n\n if !options.has_key?(:cited_paper)\n uri = options.delete(:uri) || mk_random_uri\n bib = options.delete(:bibliographic)\n options[:cited_paper] = Paper.new(uri:uri, bibliographic:bib)\n end\n\n result = Reference.new(options)\n\n if block_given?\n if block.arity==0\n result.instance_eval &block\n else\n yield self\n end\n end\n\n result.save! if save\n result\n end", "def new_reference(options={}, &block)\n save = options.delete(:save)\n\n if options[:cited_paper] && !options.has_key?(:uri) && options[:cited_paper].uri\n options[:uri] = options[:cited_paper].uri\n end\n\n if options[:number]\n options[:uri] = \"http://example.org/#{options[:number]}\" unless options.has_key?(:uri)\n options[:ref_id] = \"ref.#{options[:number]}\" unless options.has_key?(:ref_id)\n end\n\n if !options.has_key?(:cited_paper)\n uri = options[:uri]\n bib = options.delete(:bibliographic)\n options[:cited_paper] = Paper.new(uri:uri, bibliographic:bib)\n end\n\n result = Reference.new(options)\n\n if block_given?\n if block.arity==0\n result.instance_eval &block\n else\n yield self\n end\n end\n\n result.save! if save\n result\n end", "def create\n @topic = Topic.find params[:topic_id]\n @reference = @topic.references.new(reference_params)\n\n if @reference.save\n redirect_to topic_path(@topic) , notice: 'Reference was successfully created.'\n else\n render :new\n end\n end", "def generate_ref(ref, index)\n ref_name = Google::StringUtils.underscore(ref.name)\n generate_object(ref, \"resource(#{ref_name},#{index})\", :resource,\n index, action: ':create')\n end", "def create\n @references_author = References::Author.new(references_author_params)\n\n respond_to do |format|\n if @references_author.save\n format.html { redirect_to @references_author, notice: 'Author was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_author }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_author.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @gnode = Gnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gnode }\n end\n end", "def create\n @ref_datum = RefDatum.new(ref_datum_params)\n\n respond_to do |format|\n if @ref_datum.save\n format.html { redirect_to @ref_datum, notice: 'Ref datum was successfully created.' }\n format.json { render :show, status: :created, location: @ref_datum }\n else\n format.html { render :new }\n format.json { render json: @ref_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @highlight = Highlight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @highlight }\n end\n end", "def new\n @guide = Guide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guide.as_json(:root => true) }\n end\n end", "def create\n @lesson_reference = LessonReference.new(lesson_reference_params)\n\n respond_to do |format|\n if @lesson_reference.save\n format.html { redirect_to @lesson_reference, notice: 'Lesson reference was successfully created.' }\n format.json { render :show, status: :created, location: @lesson_reference }\n else\n format.html { render :new }\n format.json { render json: @lesson_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def create\n @reference_database = ReferenceDatabase.new(params[:reference_database])\n\n respond_to do |format|\n if @reference_database.save\n format.html { redirect_to @reference_database, notice: 'Reference database was successfully created.' }\n format.json { render json: @reference_database, status: :created, location: @reference_database }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference_database.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @publink = Publink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publink }\n end\n end", "def new\n @storylink = Storylink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storylink }\n end\n end", "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n get_work; get_subject\n @work_has_subject = WorkHasSubject.new(:work => @work, :subject => @subject)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work_has_subject }\n end\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end" ]
[ "0.7560176", "0.69466454", "0.68360513", "0.67046285", "0.6702816", "0.66879934", "0.6649331", "0.6632744", "0.66226864", "0.65013385", "0.65010905", "0.64644486", "0.63942343", "0.6278453", "0.6274386", "0.6274033", "0.62692356", "0.6243434", "0.6240735", "0.6225951", "0.62127334", "0.62092465", "0.62002546", "0.6164002", "0.6163992", "0.61618483", "0.61517197", "0.61463404", "0.6133174", "0.6133174", "0.6133174", "0.6133174", "0.6133174", "0.6104324", "0.6089572", "0.6047344", "0.60416824", "0.6031571", "0.60092425", "0.5988406", "0.5984272", "0.597701", "0.597042", "0.5968218", "0.59679085", "0.5953514", "0.59527385", "0.59427464", "0.5918605", "0.59143335", "0.59141886", "0.5903231", "0.59000695", "0.5897088", "0.58854526", "0.5884365", "0.58820117", "0.58798146", "0.587486", "0.5871227", "0.5854221", "0.5850385", "0.5848303", "0.58477527", "0.5842672", "0.58423364", "0.58417386", "0.58366764", "0.58366764", "0.58366764", "0.58366764", "0.58354616", "0.5827639", "0.5825367", "0.58237857", "0.58237857", "0.5812965", "0.5810959", "0.58068985", "0.5801512", "0.5788499", "0.57876444", "0.5783803", "0.5783803", "0.5783803", "0.5782511", "0.5771029", "0.5766368", "0.5765239", "0.5764828", "0.5762581", "0.5762581", "0.57612866", "0.57596505", "0.5756357", "0.5754127", "0.5749215", "0.5745211", "0.574272", "0.57414716" ]
0.70272243
1
POST /references POST /references.json
def create @reference = @account.references.new(params[:reference]) if @reference.save redirect_to [@account, @reference], notice: 'Reference was successfully created.' else render action: "new" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end", "def create\n @reference = Reference.new(params[:reference])\n\n respond_to do |format|\n if @reference.save\n format.html { redirect_to @reference, notice: 'Reference was successfully created.' }\n format.json { render json: @reference, status: :created, location: @reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ref = Ref.new(ref_params)\n\n respond_to do |format|\n if @ref.save\n format.html { redirect_to @ref, notice: 'Ref was successfully created.' }\n format.json { render :show, status: :created, location: @ref }\n else\n format.html { render :new }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n references_hash.to_json\n end", "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "def create\n @candidate_reference = @candidate.references.build(candidate_reference_params)\n\n respond_to do |format|\n if @candidate_reference.save\n flash[:success] = 'Reference was successfully created.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { render :show, status: :created, location: @candidate_reference }\n else\n flash[:failure] = 'Reference creation unsuccessful.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id]) }\n format.json { render json: @candidate_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @topic = Topic.find params[:topic_id]\n @reference = @topic.references.new(reference_params)\n\n if @reference.save\n redirect_to topic_path(@topic) , notice: 'Reference was successfully created.'\n else\n render :new\n end\n end", "def updateReference\n return @references\n end", "def create\n @through_reference = ThroughReference.new(params[:through_reference])\n\n respond_to do |format|\n if @through_reference.save\n format.html { redirect_to @through_reference, notice: 'Through reference was successfully created.' }\n format.json { render json: @through_reference, status: :created, location: @through_reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @through_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def references=(value)\n @references = value\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def create\n @lesson_reference = LessonReference.new(lesson_reference_params)\n\n respond_to do |format|\n if @lesson_reference.save\n format.html { redirect_to @lesson_reference, notice: 'Lesson reference was successfully created.' }\n format.json { render :show, status: :created, location: @lesson_reference }\n else\n format.html { render :new }\n format.json { render json: @lesson_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def referrals(params = {})\n scope 'default'\n post('referrals/', params)\n end", "def create\n respond_to do |format|\n if @resource.save\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applicant_reference = current_applicant.applicant_references.build(applicant_reference_params)\n\n respond_to do |format|\n if @applicant_reference.save\n format.html { redirect_to applicant_references_url, notice: 'Applicant reference was successfully created.' }\n format.json { render :show, status: :created, location: @applicant_reference }\n else\n format.html { render :new }\n format.json { render json: @applicant_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aoo_ref = AooRef.new(aoo_ref_params)\n\n respond_to do |format|\n if @aoo_ref.save\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully created.' }\n format.json { render :show, status: :created, location: @aoo_ref }\n else\n format.html { render :new }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @source_ref = SourceRef.new(source_ref_params)\n\n respond_to do |format|\n if @source_ref.save\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully created.' }\n format.json { render :show, status: :created, location: @source_ref }\n else\n format.html { render :new }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_report_reference(id, reference)\n body = {\n data: {\n type: \"issue-tracker-reference-id\",\n attributes: {\n reference: reference\n }\n }\n }\n\n post(\"reports/#{id}/issue_tracker_reference_id\", body)\n end", "def create\n @reference = Reference.new reference_params\n if @reference.save\n respond_to do |format|\n format.html\n format.js\n end\n else\n render :new\n end\n end", "def create\n @ref_datum = RefDatum.new(ref_datum_params)\n\n respond_to do |format|\n if @ref_datum.save\n format.html { redirect_to @ref_datum, notice: 'Ref datum was successfully created.' }\n format.json { render :show, status: :created, location: @ref_datum }\n else\n format.html { render :new }\n format.json { render json: @ref_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_report_reference(reference)\n body = {\n type: \"issue-tracker-reference-id\",\n attributes: {\n reference: reference\n }\n }\n\n response_json = make_post_request(\"reports/#{id}/issue_tracker_reference_id\", request_body: body)\n @report = response_json[:relationships][:report][:data]\n self\n end", "def reference_params\n params.require(:reference).permit(:url)\n end", "def can_add_reference?\n true\n end", "def create\n @references_author = References::Author.new(references_author_params)\n\n respond_to do |format|\n if @references_author.save\n format.html { redirect_to @references_author, notice: 'Author was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_author }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_author.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_references\n globbed_references = body.scan(/(.*?\\))/)\n\n globbed_references.each do |reference|\n url = reference.first.scan(/(?<=\\().*(?=\\))/).first\n next unless url\n\n if url.include?('users')\n # Do nothing for now when it's a mention of a user\n # FIXME - this is junk\n elsif url.include?('ideas') && idea = Idea.find_by_sha(url.gsub('/ideas/', ''))\n # When this is an idea we know about, make a hard link\n self.idea_references.build(:referenced_id => idea.id)\n else\n # Just leave it in the body without doing anything.\n end\n end\n end", "def create\n @refarence = Refarence.new(refarence_params)\n\n respond_to do |format|\n if @refarence.save\n format.html { redirect_to @refarence, notice: 'Refarence was successfully created.' }\n format.json { render :show, status: :created, location: @refarence }\n else\n format.html { render :new }\n format.json { render json: @refarence.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @references = Reference.all\n end", "def index\n @references = Reference.all\n end", "def create\n @reference_list = ReferenceList.new(reference_list_params)\n\n respond_to do |format|\n if @reference_list.save\n format.html { redirect_to @reference_list, notice: 'Reference list was successfully created.' }\n format.json { render :show, status: :created, location: @reference_list }\n else\n format.html { render :new }\n format.json { render json: @reference_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end", "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end", "def create\n @adminref = Adminref.new(adminref_params)\n\n respond_to do |format|\n if @adminref.save\n format.html { redirect_to @adminref, notice: 'Adminref was successfully created.' }\n format.json { render :show, status: :created, location: @adminref }\n else\n format.html { render :new }\n format.json { render json: @adminref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ref = Ref.new(params[:ref])\n @ref.autors = params[:autors] ? Autor.find(params[:autors]) : []\n #video.categories = params[:categories] ? Category.find(params[:categories]) : []\n respond_to do |format|\n if @ref.save\n format.html { redirect_to(@ref, :notice => 'Ref was successfully created.') }\n format.xml { render :xml => @ref, :status => :created, :location => @ref }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ref.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reference_database = ReferenceDatabase.new(params[:reference_database])\n\n respond_to do |format|\n if @reference_database.save\n format.html { redirect_to @reference_database, notice: 'Reference database was successfully created.' }\n format.json { render json: @reference_database, status: :created, location: @reference_database }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference_database.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_reference\n respond_to do |type|\n type.js { create_reference_js }\n type.html { redirect_to :action => :index }\n end\n end", "def ref(id, options={})\n add Reference.new(resource, id, options)\n end", "def create\n @reference_analytic = ReferenceAnalytic.new(reference_analytic_params)\n\n respond_to do |format|\n if @reference_analytic.save\n format.html { redirect_to @reference_analytic, notice: 'Reference analytic was successfully created.' }\n format.json { render :show, status: :created, location: @reference_analytic }\n else\n format.html { render :new }\n format.json { render json: @reference_analytic.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n @references\n end", "def create\n @references_citation = References::Citation.new(references_citation_params)\n\n respond_to do |format|\n if @references_citation.save\n format.html { redirect_to @references_citation, notice: 'Citation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_citation }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_citation.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_reference(post, identification)\n auth, trans_id = identification.split(';')\n post[:authnum] = auth\n post[:transid] = trans_id\n end", "def claim_or_create_references(references)\n references.map do |ref_string|\n indirect_vm_ref = update_context.resolve_reference(ref_string, blame_reference).viewmodel_reference\n claim_or_create_member(indirect_vm_ref, ref_string)\n end\n end", "def destroy\n @reference = Reference.find(params[:id])\n @reference.destroy\n\n respond_to do |format|\n format.html { redirect_to references_url }\n format.json { head :no_content }\n end\n end", "def references\n @references ||= []\n end", "def create \n if InfoNode.duplicate_key?(params[:info_types])\n redirect_to :back, :alert => \"Key in the additional information shoud be unique\"\n return\n end\n\n unless params[:rid].nil?\n @rid = params[:rid].strip\n end\n\n @type = params[:type] \n\n @refs = []\n\n params[:refids].each_with_index do |ref_id, idx|\n @refs << {:ref_id => ref_id, :role => params[:labels][idx]}\n end unless params[:refids].nil?\n\n if @refs.empty?\n redirect_to :back, :alert => \"Please add references for a new relation\"\n return\n end\n\n @info_nodes = {}\n (0...params[:info_types].size).each do |i|\n key = params[:info_types][i]\n value = params[:info_values][i]\n if !key.nil? && !key.strip.blank? && !value.nil? && !value.strip.blank?\n @info_nodes[key] = value\n end\n end\n\n begin\n @collection = current_user.collections.find(params[:collection_id])\n raise \"Cannot find the collection No. #{params[:collection_id]}\" if @collection.nil?\n \n @document = @collection.documents.find_by_pmid(params[:document_id])\n raise \"Cannot find the document No. #{params[:document_id]}\" if @document.nil?\n \n @rid = @document.create_new_relation_id if @rid.blank?\n \n @relation = @document.create_relation(@rid, @type, @refs, @info_nodes)\n\n respond_to do |format|\n format.html { redirect_to \"/collections/#{@collection.id}/documents/#{@document.pmid}?tab=relation\", :notice => 'Relation was successfully created.' }\n format.json { render :json => @relation, :status => :created, :location => @relation }\n end\n rescue Exception => e\n logger.debug(e.backtrace)\n respond_to do |format|\n format.html { redirect_to :back, :alert => e.message}\n format.json { render json: @relation.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def references; end", "def references; end", "def create\n @facture = Facture.new(facture_params)\n\n respond_to do |format|\n if @facture.save\n format.html { redirect_to add_ref_path(@facture), notice: 'La facture a bien été créée.'} \n format.json { render :add_ref, status: :created, location: @facture }\n else\n format.html { render :new }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end", "def references_author_params\n params.require(:references_author).permit(:name, :slug)\n end", "def create\n @charity_remove_ref = CharityRemoveRef.new(charity_remove_ref_params)\n\n respond_to do |format|\n if @charity_remove_ref.save\n format.html { redirect_to @charity_remove_ref, notice: 'Charity remove ref was successfully created.' }\n format.json { render :show, status: :created, location: @charity_remove_ref }\n else\n format.html { render :new }\n format.json { render json: @charity_remove_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @references_snaks2 = ReferencesSnaks2.new(references_snaks2_params)\n\n respond_to do |format|\n if @references_snaks2.save\n format.html { redirect_to @references_snaks2, notice: 'References snaks2 was successfully created.' }\n format.json { render :show, status: :created, location: @references_snaks2 }\n else\n format.html { render :new }\n format.json { render json: @references_snaks2.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def create\n @georeference = Georeference::GoogleMap.new(georeference_params)\n respond_to do |format|\n if @georeference.save\n format.html do\n flash[:notice] = 'Georeference was successfully created.'\n if params[:commit_and_next]\n redirect_to new_georeferences_google_map_path(\n georeference: {\n collecting_event_id: @georeference.collecting_event.next_without_georeference\n })\n else\n redirect_to collecting_event_path(@georeference.collecting_event)\n end\n end\n format.json { render action: 'show', status: :created }\n else\n format.html { render :new }\n format.json { render json: @georeference.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @referee = Referee.new(referee_params)\n\n respond_to do |format|\n if @referee.save\n format.html { redirect_to @referee, notice: \"Referee was successfully created.\" }\n format.json { render :show, status: :created, location: @referee }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_ref(ref, index)\n ref_name = Google::StringUtils.underscore(ref.name)\n generate_object(ref, \"resource(#{ref_name},#{index})\", :resource,\n index, action: ':create')\n end", "def create\n @data_ref2 = DataRef2.new(data_ref2_params)\n\n respond_to do |format|\n if @data_ref2.save\n format.html { redirect_to @data_ref2, notice: 'Data ref2 was successfully created.' }\n format.json { render :show, status: :created, location: @data_ref2 }\n else\n format.html { render :new }\n format.json { render json: @data_ref2.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @referee = Referee.new(params[:referee])\n\n respond_to do |format|\n if @referee.save\n format.html { redirect_to @referee, notice: 'Referee was successfully created.' }\n format.json { render json: @referee, status: :created, location: @referee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @through_reference = ThroughReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @through_reference }\n end\n end", "def destroy\n @references_author.destroy\n respond_to do |format|\n format.html { redirect_to references_authors_url }\n format.json { head :no_content }\n end\n end", "def save_references(reference, params)\n reference.attributes = params\n if reference.valid?\n self.current_stage = :statement_stage\n self.reference = reference\n self.save\n return true\n end\n false\n end", "def new\n @reference = @account.references.new\n end", "def reference_params\n params.require(:reference).permit(:query)\n end", "def create\n @tag_ref = TagRef.new(tag_ref_params)\n @article = Article.find(params[:article])\n\n respond_to do |format|\n if @tag_ref.save\n format.html {redirect_to article_tags_article_path(@article), notice: 'Dodano Tag do artykułu.' }\n format.json { render :show, status: :created, location: @tag_ref }\n else\n format.html { render :new }\n format.json { render json: @tag_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @genome_reference = GenomeReference.new(genome_reference_params)\n\n respond_to do |format|\n if @genome_reference.save\n format.html { redirect_to(@genome_reference, :notice => 'GenomeReference was successfully created.') }\n format.xml { render :xml => @genome_reference, :status => :created, :location => @genome_reference }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @genome_reference.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n for article in @book.articles\n current_aspect.references << article\n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def ref_params\n params.fetch(:ref, {})\n end", "def reference_list_params\n params.require(:reference_list).permit(:name, :description, :value, :reference_id)\n end", "def reference_params\n params.require(:reference).permit(:query)\n end", "def ref\n @references += 1\n end", "def create\n @referer = Referer.new(params[:referer])\n\n respond_to do |format|\n if @referer.save\n format.html { redirect_to @referer, notice: 'Referer was successfully created.' }\n format.json { render json: @referer, status: :created, location: @referer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @referer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def faq_ref_params\n params.require(:faq).permit({reference: [:id, :youtube_url, :web_url, :image => []]})\n end", "def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end", "def create_subpath_to_references_map(references, reference_to_subpaths_map)\n out = { }\n references.each do |r|\n reference_to_subpaths_map[r].each do |subpath|\n out[subpath] ||= [ ]\n out[subpath] << r\n end\n end\n out\n end", "def add(reference)\n unless @references.include?(reference)\n @references << reference\n @subpaths_and_references = nil\n end\n end", "def destroy\n @ref.destroy\n respond_to do |format|\n format.html { redirect_to refs_url, notice: 'Ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @ref_attribute = RefAttribute.new(ref_attribute_params)\n\n respond_to do |format|\n if @ref_attribute.save\n format.html { redirect_to @ref_attribute, notice: 'Uusi viitetyyppi luotu onnistuneesti.' }\n format.json { render :show, status: :created, location: @ref_attribute }\n else\n format.html { render :new }\n format.json { render json: @ref_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @references_citation.destroy\n respond_to do |format|\n format.html { redirect_to references_citations_url }\n format.json { head :no_content }\n end\n end", "def references_citation_params\n params.require(:references_citation).permit(:source_id, :location)\n end", "def create\n @referral = Referral.new(params[:referral])\n\n respond_to do |format|\n if @referral.save\n format.html { redirect_to @referral, notice: 'Referral was successfully created.' }\n format.json { render json: @referral, status: :created, location: @referral }\n else\n format.html { render action: \"new\" }\n format.json { render json: @referral.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @referent.destroy\n respond_to do |format|\n format.html { redirect_to referents_url(:id => params[:refId]), notice: 'Referent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @references = @account.references.all\n end", "def create\n respond_to do |format|\n if @reference_type.save\n flash[:notice] = 'Reference type was successfully created.'\n @changed << @reference_type.id\n \n format.html { redirect_to reference_types_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @reference_type, status: :created, location: @reference_type }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_references(dois)\n return [] unless dois.present? && ENV[\"LAGOTTO_URL\"].present?\n\n url = \"#{ENV['LAGOTTO_URL']}/api/references\"\n response = get_result(url, content_type: \"text/html\", data: dois_as_string(dois))\n\n references = response.fetch(\"references\", []).map do |reference|\n doi = reference.fetch(\"work_id\", \"\")[15..-1].upcase\n relation = reference.fetch(\"relation_type_id\", \"references\").camelize\n source = reference.fetch(\"source_id\", nil)\n source = SOURCES.fetch(source, source)\n\n if text = reference.fetch(\"DOI\", nil)\n text = text.upcase\n id = \"DOI\"\n else\n text = reference.fetch(\"URL\", nil)\n id = \"URL\"\n end\n\n { doi: doi,\n relation: relation,\n id: id,\n text: text,\n source: source }\n end.select { |item| item[:text].present? && item[:source] !~ /datacite_data/ }.group_by { |item| item[:doi] }\n end", "def update!(**args)\n @references = args[:references] if args.key?(:references)\n end", "def change\n add_reference :pages, :pages\nend", "def set_ref\n @ref = Ref.find(params[:id])\n end", "def add_reference_obj(obj)\n @refs << obj\n end", "def push(*args, &block)\n reference =\n if args.first.is_a?(PDF::Core::Reference)\n args.first\n else\n PDF::Core::Reference.new(*args, &block)\n end\n\n @objects[reference.identifier] = reference\n @identifiers << reference.identifier\n reference\n end", "def references(collection)\n target.try(:references, collection) || []\n end", "def update\n @reference = Reference.find(params[:id])\n\n respond_to do |format|\n if @reference.update_attributes(params[:reference])\n format.html { redirect_to @reference, notice: 'Reference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inv_x_ref = InvXRef.new(params[:inv_x_ref])\n\n respond_to do |format|\n if @inv_x_ref.save\n format.html { redirect_to @inv_x_ref, notice: 'Inv x ref was successfully created.' }\n format.json { render json: @inv_x_ref, status: :created, location: @inv_x_ref }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inv_x_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_ref(ref, index)\n ref_name = Google::StringUtils.underscore(ref.name)\n generate_object(ref, \"resource(#{ref_name},#{index})\", :resource,\n index, ensure: 'present')\n end", "def create\n @referee = Referee.new(referee_params)\n\n respond_to do |format|\n if @referee.save\n format.html { redirect_to [:admin, @referee], notice: 'Referee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @referee }\n else\n format.html { render action: 'new' }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_references_label(vals)\n @references_collection << vals.last\n @references = vals.last if matches_mdes_version(vals)\n end", "def reference_params\n \t\tparams.require(:reference).permit(:description, :book_id, :book_id_secondary)\n \tend", "def index\n @refs = Ref.all\n end", "def referee_params\n params.require(:referee).permit(:idReferees, :Persons_idUser, :title, :forename, :surname, :email, :contactPhone, :relationship, :permissionToContact, :verified, :howVerified, :referenceDoc)\n end", "def create_reference\n self.reference or Reference.new\n end" ]
[ "0.71855813", "0.6840362", "0.6758709", "0.668814", "0.64029145", "0.62851226", "0.62712616", "0.62236667", "0.619319", "0.61857444", "0.6093365", "0.6088865", "0.60819405", "0.6073952", "0.6027425", "0.6009454", "0.5979176", "0.59740597", "0.5955723", "0.5949086", "0.59167475", "0.591053", "0.5907121", "0.59016275", "0.58916163", "0.585343", "0.5851199", "0.5851199", "0.5837234", "0.5807283", "0.5806811", "0.5782797", "0.57261187", "0.5718093", "0.5642375", "0.5636753", "0.5634662", "0.5622221", "0.56057894", "0.5605562", "0.5593438", "0.55781996", "0.55682844", "0.5541358", "0.5534186", "0.5518857", "0.5518857", "0.55093193", "0.55063623", "0.5492979", "0.5489853", "0.54887897", "0.5481545", "0.5476984", "0.5475468", "0.5474951", "0.54486144", "0.5438461", "0.54363316", "0.5435681", "0.54295784", "0.5406741", "0.5404485", "0.5404012", "0.5402589", "0.537626", "0.53760314", "0.53718084", "0.53525007", "0.5319928", "0.5316884", "0.5316884", "0.5305162", "0.5296602", "0.52772003", "0.52614075", "0.52604914", "0.5260353", "0.5258964", "0.52584475", "0.52530503", "0.5236064", "0.5232783", "0.52269626", "0.5226749", "0.52092445", "0.5208454", "0.51865435", "0.51805747", "0.5175362", "0.5157681", "0.5154751", "0.51507324", "0.5149255", "0.51484925", "0.5130631", "0.51234806", "0.51094687", "0.5098024", "0.50939155" ]
0.6675021
4
PUT /references/1 PUT /references/1.json
def update @reference = @account.references.find(params[:id]) if @reference.update_attributes(params[:reference]) redirect_to [@account, @reference], notice: 'Reference was successfully updated.' else render action: "edit" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @references = args[:references] if args.key?(:references)\n end", "def update\n @reference = Reference.find(params[:id])\n\n respond_to do |format|\n if @reference.update_attributes(params[:reference])\n format.html { redirect_to @reference, notice: 'Reference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateReference\n return @references\n end", "def update\n @through_reference = ThroughReference.find(params[:id])\n\n respond_to do |format|\n if @through_reference.update_attributes(params[:through_reference])\n format.html { redirect_to @through_reference, notice: 'Through reference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @through_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ref.update(ref_params)\n format.html { redirect_to @ref, notice: 'Ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @ref }\n else\n format.html { render :edit }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def update\n @ref = Ref.find(params[:id])\n\n respond_to do |format|\n if @ref.update_attributes(params[:ref])\n format.html { redirect_to(@ref, :notice => 'Ref was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ref.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_ref\n @ref = Ref.find(params[:id])\n end", "def update!(**args)\n @references = args[:references] if args.key?(:references)\n @title = args[:title] if args.key?(:title)\n end", "def ref(id, options={})\n add Reference.new(resource, id, options)\n end", "def update\n respond_to do |format|\n if @references_author.update(references_author_params)\n format.html { redirect_to @references_author, notice: 'Author was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @references_author }\n else\n format.html { render action: 'edit' }\n format.json { render json: @references_author.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def set_reference\n @reference = Reference.find(params[:id])\n end", "def update\n if @reference.update(reference_params)\n redirect_to topic_references_url(@reference.topic), notice: 'Reference was successfully updated.'\n else\n render :edit\n end\n end", "def references=(value)\n @references = value\n end", "def update!(**args)\n @reference = args[:reference] if args.key?(:reference)\n @resolutions = args[:resolutions] if args.key?(:resolutions)\n end", "def update\n respond_to do |format|\n if @source_ref.update(source_ref_params)\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_ref }\n else\n format.html { render :edit }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @candidate_reference.update(candidate_reference_params)\n flash[:success] = 'Reference was successfully updated.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { render :show, status: :ok, location: @candidate_reference }\n else\n flash[:failure] = 'Reference updation unsuccessful.' \n @candidate_references = [@candidate_reference]\n @new_candidate_reference = Candidate::Reference.new\n format.html { redirect_to edit_candidate_references_path(params[:candidate_id]) }\n format.json { render json: @candidate_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @referent.update(referent_params)\n format.html { redirect_to referent_path(@referent, :refId => params[:reforganismId]), notice: 'Referent was successfully updated.'}\n format.json { render :show, status: :ok, location: @referent }\n else\n format.html { render :edit }\n format.json { render json: @referent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_record(http, ref)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Updated text.\"\n}|\n resp = http.send_request('POST', \"/v1/Article/#{ref}\", json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'update reply.code should be 0 meaning no error')\n updated = reply[:updated]\n assert_equal(1, updated.length, 'update reply.updated should contain exactly one member')\n ref = updated[0]\n refute_equal(nil, ref, 'update reply record reference can not be nil')\n refute_equal(0, ref, 'update reply record reference can not be 0')\n ref\n end", "def destroy\n @reference = Reference.find(params[:id])\n @reference.destroy\n\n respond_to do |format|\n format.html { redirect_to references_url }\n format.json { head :no_content }\n end\n end", "def ref\n @references += 1\n end", "def update\n respond_to do |format|\n if @references_snaks2.update(references_snaks2_params)\n format.html { redirect_to @references_snaks2, notice: 'References snaks2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @references_snaks2 }\n else\n format.html { render :edit }\n format.json { render json: @references_snaks2.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_from_reference(reference, attributes = {})\n response = client.patch(\"2.0/tracks/reference/#{reference}\", attributes)\n\n Struct::Track.new(response)\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def bump_reference(resource)\n @references[resource] = ref_count(resource) + 1\n end", "def create\n @ref = Ref.new(ref_params)\n\n respond_to do |format|\n if @ref.save\n format.html { redirect_to @ref, notice: 'Ref was successfully created.' }\n format.json { render :show, status: :created, location: @ref }\n else\n format.html { render :new }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @reference_score = args[:reference_score] if args.key?(:reference_score)\n @references = args[:references] if args.key?(:references)\n @subreference_metadata = args[:subreference_metadata] if args.key?(:subreference_metadata)\n end", "def create\n @reference = Reference.new(params[:reference])\n\n respond_to do |format|\n if @reference.save\n format.html { redirect_to @reference, notice: 'Reference was successfully created.' }\n format.json { render json: @reference, status: :created, location: @reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def update\n @reference_database = ReferenceDatabase.find(params[:id])\n\n respond_to do |format|\n if @reference_database.update_attributes(params[:reference_database])\n format.html { redirect_to @reference_database, notice: 'Reference database was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reference_database.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_referent\n @referent = Referent.find(params[:id])\n end", "def reference_params\n params.require(:reference).permit(:url)\n end", "def set_referent\n @referent = Referent.find(params[:id])\n end", "def put_relation(args)\n\tapi_url = \"#{@base_url}/#{args[:coll_A]}/#{args[:key_A]}/relation/\" +\n\t \"#{args[:relation]}/#{args[:coll_B]}/#{key_B}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: '{}')\nend", "def create\n @reference = @account.references.new(params[:reference])\n\n if @reference.save\n redirect_to [@account, @reference], notice: 'Reference was successfully created.'\n else\n render action: \"new\"\n end\n end", "def update!(**args)\n @references = args[:references] if args.key?(:references)\n @reply = args[:reply] if args.key?(:reply)\n @summary = args[:summary] if args.key?(:summary)\n end", "def references_author_params\n params.require(:references_author).permit(:name, :slug)\n end", "def update\n @genome_reference = GenomeReference.find(params[:id])\n\n respond_to do |format|\n if @genome_reference.update_attributes(genome_reference_params)\n format.html { redirect_to(@genome_reference, :notice => 'GenomeReference was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @genome_reference.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @reference_analytic.update(reference_analytic_params)\n format.html { redirect_to @reference_analytic, notice: 'Reference analytic was successfully updated.' }\n format.json { render :show, status: :ok, location: @reference_analytic }\n else\n format.html { render :edit }\n format.json { render json: @reference_analytic.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n references_hash.to_json\n end", "def destroy\n @references_author.destroy\n respond_to do |format|\n format.html { redirect_to references_authors_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @reference_list.update(reference_list_params)\n format.html { redirect_to @reference_list, notice: 'Reference list was successfully updated.' }\n format.json { render :show, status: :ok, location: @reference_list }\n else\n format.html { render :edit }\n format.json { render json: @reference_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @conflicting_reference_id = args[:conflicting_reference_id] if args.key?(:conflicting_reference_id)\n @expiry_time = args[:expiry_time] if args.key?(:expiry_time)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @matches = args[:matches] if args.key?(:matches)\n @original_reference_id = args[:original_reference_id] if args.key?(:original_reference_id)\n @status = args[:status] if args.key?(:status)\n end", "def update_refs\n return true if self.user_id or changes.has_key? :user_id\n fields = self.attributes.select {|k,v| changes.has_key? k}\n self.references.update_all(fields) unless self.user_id\n end", "def update\n respond_to do |format|\n if @lesson_reference.update(lesson_reference_params)\n format.html { redirect_to @lesson_reference, notice: 'Lesson reference was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson_reference }\n else\n format.html { render :edit }\n format.json { render json: @lesson_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end", "def change_reference(new_reference)\n\n # In datamapper it's not possible to update the key value, so we use adapter\n # https://stackoverflow.com/questions/32302407/updating-a-property-set-as-the-key-in-datamapper\n BookingItem.change_item_reference(new_reference, reference)\n # Update the item references assigned\n BookingDataSystem::BookingLineResource.all(booking_item_reference: reference).update(booking_item_reference: new_reference)\n # Update stock locking references\n BookingDataSystem::BookingPrereservationLine.all(booking_item_reference: reference).update(booking_item_reference: new_reference)\n\n end", "def destroy\n @through_reference = ThroughReference.find(params[:id])\n @through_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to through_references_url }\n format.json { head :no_content }\n end\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @references_metrics = args[:references_metrics] if args.key?(:references_metrics)\n end", "def set_reference_list\n @reference_list = ReferenceList.find(params[:id])\n end", "def set_references_author\n @references_author = References::Author.find(params[:id])\n end", "def reference=(ref)\n @reference = ref\n end", "def update(updates = {})\n @ref.update(updates)\n end", "def update\n @inv_x_ref = InvXRef.find(params[:id])\n\n respond_to do |format|\n if @inv_x_ref.update_attributes(params[:inv_x_ref])\n format.html { redirect_to @inv_x_ref, notice: 'Inv x ref was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inv_x_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@param_ref = ParamRef.find(params[:id])\n\n\t\tif @param_ref.update_attributes(params[:param_ref])\n\t\t\thead :no_content\n\t\telse\n\t\t\trender json: @param_ref.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @image_reference.update_attributes image_reference_params\n format.html { redirect_to @image_reference, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def ref=(new_ref)\n @ref = new_ref\n end", "def index\n @references = Reference.all\n end", "def index\n @references = Reference.all\n end", "def create\n @topic = Topic.find params[:topic_id]\n @reference = @topic.references.new(reference_params)\n\n if @reference.save\n redirect_to topic_path(@topic) , notice: 'Reference was successfully created.'\n else\n render :new\n end\n end", "def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end", "def replace_references(refs)\n set = doc.xpath('.//references')\n\n if set\n inner_html = create_references_list_items(refs)\n replace_references_node(set, inner_html)\n end\n\n nil\n end", "def update\n respond_to do |format|\n if @adminref.update(adminref_params)\n format.html { redirect_to @adminref, notice: 'Adminref was successfully updated.' }\n format.json { render :show, status: :ok, location: @adminref }\n else\n format.html { render :edit }\n format.json { render json: @adminref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_ref_paths(data, paths = {})\n paths.each do |path, replace_path|\n replace_path = replace_path.sub(/\\/?$/, \"/\")\n data = data.gsub(/(\"\\$ref\"\\s*:\\s*\")#{Regexp.escape(path)}\\/?/, \"\\\\1#{replace_path}\")\n end\n data\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def add_report_reference(id, reference)\n body = {\n data: {\n type: \"issue-tracker-reference-id\",\n attributes: {\n reference: reference\n }\n }\n }\n\n post(\"reports/#{id}/issue_tracker_reference_id\", body)\n end", "def destroy\n @ref.destroy\n respond_to do |format|\n format.html { redirect_to refs_url, notice: 'Ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def orchio_put_if_match(document, ref)\n response = client.send_request :put, inst_args(json: document, ref: ref)\n set_ref_value response\n orchio_status response, 201\n end", "def put(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Put.new(new_path, headers) \n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "def update\n @referer = Referer.find(params[:id])\n\n respond_to do |format|\n if @referer.update_attributes(params[:referer])\n format.html { redirect_to @referer, notice: 'Referer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @referer.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_reference_obj(obj)\n @refs << obj\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 destroy\n @reference = @account.references.find(params[:id])\n @reference.destroy\n\n redirect_to account_references_url(@account)\n end", "def update\n begin\n @resource = Relation.find params[:id]\n @resource.update_attributes!(params[:relation])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def create\n @candidate_reference = @candidate.references.build(candidate_reference_params)\n\n respond_to do |format|\n if @candidate_reference.save\n flash[:success] = 'Reference was successfully created.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { render :show, status: :created, location: @candidate_reference }\n else\n flash[:failure] = 'Reference creation unsuccessful.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id]) }\n format.json { render json: @candidate_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ref_attribute.update(ref_attribute_params)\n format.html { redirect_to @ref_attribute, notice: 'Ref attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @ref_attribute }\n else\n format.html { render :edit }\n format.json { render json: @ref_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def references; end", "def references; end", "def create\n @through_reference = ThroughReference.new(params[:through_reference])\n\n respond_to do |format|\n if @through_reference.save\n format.html { redirect_to @through_reference, notice: 'Through reference was successfully created.' }\n format.json { render json: @through_reference, status: :created, location: @through_reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @through_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_ref2.update(data_ref2_params)\n format.html { redirect_to @data_ref2, notice: 'Data ref2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_ref2 }\n else\n format.html { render :edit }\n format.json { render json: @data_ref2.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def referrals(params = {})\n scope 'default'\n post('referrals/', params)\n end", "def update\n respond_to do |format|\n if @references_citation.update(references_citation_params)\n format.html { redirect_to @references_citation, notice: 'Citation was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @references_citation }\n else\n format.html { render action: 'edit' }\n format.json { render json: @references_citation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n if @referee.update_attributes(params[:referee])\n format.html { redirect_to @referee, notice: 'Referee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_reference(value)\n ref = @ref_by_value[value]\n\n unless ref.present?\n ref = new_ref!(value)\n @ref_by_value[value] = ref\n @value_by_ref[ref] = value\n end\n\n ref\n end", "def destroy\n @referent.destroy\n respond_to do |format|\n format.html { redirect_to referents_url(:id => params[:refId]), notice: 'Referent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_ref_attribute\n @ref_attribute = RefAttribute.find(params[:id])\n end", "def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end", "def update\n respond_to do |format|\n if @tag_ref.update(tag_ref_params)\n format.html { redirect_to @tag_ref, notice: 'Zmodyfikowano Tag.' }\n format.json { render :show, status: :ok, location: @tag_ref }\n else\n format.html { render :edit }\n format.json { render json: @tag_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @applicant_reference.update(applicant_reference_params)\n format.html { redirect_to applicant_references_url, notice: 'Applicant reference was successfully updated.' }\n format.json { render :show, status: :ok, location: @applicant_reference }\n else\n format.html { render :edit }\n format.json { render json: @applicant_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @personal_reference_types = args[:personal_reference_types] if args.key?(:personal_reference_types)\n @reference_score = args[:reference_score] if args.key?(:reference_score)\n @relationship_lexical_info = args[:relationship_lexical_info] if args.key?(:relationship_lexical_info)\n end", "def set_aoo_ref\n @aoo_ref = AooRef.find(params[:id])\n end", "def claim_or_create_references(references)\n references.map do |ref_string|\n indirect_vm_ref = update_context.resolve_reference(ref_string, blame_reference).viewmodel_reference\n claim_or_create_member(indirect_vm_ref, ref_string)\n end\n end" ]
[ "0.67712003", "0.659696", "0.6278232", "0.62116754", "0.6200272", "0.61416805", "0.61355275", "0.61160624", "0.6081065", "0.60681486", "0.60579693", "0.60466444", "0.60466444", "0.5948181", "0.594595", "0.5943138", "0.58960086", "0.5891728", "0.58345366", "0.58248174", "0.58208424", "0.58109224", "0.57680166", "0.5753385", "0.5744392", "0.57039464", "0.56855136", "0.56706154", "0.56627613", "0.5590867", "0.55882317", "0.557655", "0.5573923", "0.55315465", "0.55300105", "0.5521955", "0.55214757", "0.5481532", "0.5460025", "0.5430882", "0.54295695", "0.54282594", "0.5423902", "0.541788", "0.54046726", "0.539247", "0.5389027", "0.5386103", "0.5378712", "0.5373599", "0.5365625", "0.5364165", "0.5363878", "0.53614366", "0.5359331", "0.53551406", "0.53364336", "0.5329626", "0.5324143", "0.5319213", "0.53173757", "0.53137016", "0.5312957", "0.5304732", "0.5304732", "0.5299526", "0.5295366", "0.52940005", "0.5289938", "0.5285841", "0.5283516", "0.5283243", "0.52788734", "0.5277495", "0.5266024", "0.5249593", "0.52388555", "0.5228243", "0.5227282", "0.5215675", "0.5206576", "0.5198925", "0.51855356", "0.51855356", "0.5177541", "0.51598024", "0.515813", "0.5154227", "0.5123392", "0.51232386", "0.5118978", "0.5114844", "0.5112856", "0.5104081", "0.50964737", "0.50854915", "0.5083357", "0.5080809", "0.5075764", "0.5075723" ]
0.6373555
2
DELETE /references/1 DELETE /references/1.json
def destroy @reference = @account.references.find(params[:id]) @reference.destroy redirect_to account_references_url(@account) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @reference = Reference.find(params[:id])\n @reference.destroy\n\n respond_to do |format|\n format.html { redirect_to references_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref.destroy\n respond_to do |format|\n format.html { redirect_to refs_url, notice: 'Ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referent.destroy\n respond_to do |format|\n format.html { redirect_to referents_url(:id => params[:refId]), notice: 'Referent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @through_reference = ThroughReference.find(params[:id])\n @through_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to through_references_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @references_author.destroy\n respond_to do |format|\n format.html { redirect_to references_authors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_ref.destroy\n respond_to do |format|\n format.html { redirect_to source_refs_url, notice: 'Source ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referent.destroy\n respond_to do |format|\n format.html { redirect_to referents_url, notice: 'Referent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aoo_ref.destroy\n respond_to do |format|\n format.html { redirect_to aoo_refs_url, notice: 'Aoo ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_database = ReferenceDatabase.find(params[:id])\n @reference_database.destroy\n\n respond_to do |format|\n format.html { redirect_to reference_databases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @references_citation.destroy\n respond_to do |format|\n format.html { redirect_to references_citations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @references_snaks2.destroy\n respond_to do |format|\n format.html { redirect_to references_snaks2s_url, notice: 'References snaks2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_datum.destroy\n respond_to do |format|\n format.html { redirect_to ref_data_url, notice: 'Ref datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @genome_reference = GenomeReference.find(params[:id])\n @genome_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to(genome_references_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @refarence.destroy\n respond_to do |format|\n format.html { redirect_to refarences_url, notice: 'Refarence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referee = Referee.find(params[:id])\n @referee.destroy\n\n respond_to do |format|\n format.html { redirect_to referees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lesson_reference.destroy\n respond_to do |format|\n format.html { redirect_to lesson_references_url, notice: 'Lesson reference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to referential_resources_path(@referential), notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inv_x_ref = InvXRef.find(params[:id])\n @inv_x_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to inv_x_refs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to referrals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adminref.destroy\n respond_to do |format|\n format.html { redirect_to adminrefs_url, notice: 'Adminref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_list.destroy\n respond_to do |format|\n format.html { redirect_to reference_lists_url, notice: 'Reference list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_analytic.destroy\n respond_to do |format|\n format.html { redirect_to reference_analytics_url, notice: 'Reference analytic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referer = Referer.find(params[:id])\n @referer.destroy\n\n respond_to do |format|\n format.html { redirect_to referers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @charity_remove_ref.destroy\n respond_to do |format|\n format.html { redirect_to charity_remove_refs_url, notice: 'Charity remove ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_ref2.destroy\n respond_to do |format|\n format.html { redirect_to data_ref2s_url, notice: 'Data ref2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_signal.destroy\n respond_to do |format|\n format.html { redirect_to reference_signals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smp_referenz.destroy\n respond_to do |format|\n format.html { redirect_to smp_referenzs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @referee.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Referee was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_attribute.destroy\n respond_to do |format|\n format.html { redirect_to ref_attributes_url, notice: 'Ref attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_tag_reference.destroy\n respond_to do |format|\n format.html { redirect_to photo_tag_references_url, notice: 'Photo tag reference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @candidate_reference.destroy\n respond_to do |format|\n flash[:success] = 'Reference was successfully deleted' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @applicant_reference.destroy\n respond_to do |format|\n format.html { redirect_to applicant_references_url, notice: 'Applicant reference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referee.destroy\n respond_to do |format|\n format.html { redirect_to referees_url, notice: \"Referee was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @referral.destroy\n respond_to do |format|\n format.html { redirect_to referrals_url, notice: 'Referral was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(referrals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(referrals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @tag_ref.destroy\n respond_to do |format|\n format.html { redirect_to tag_refs_url, notice: 'Usunięto Tag z artykułu.' }\n format.json { head :no_content }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_referrals_path) }\n format.xml { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @referee.destroy\n respond_to do |format|\n format.html { redirect_to admin_referees_url, notice: 'Referee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def destroy\n @historic_refinancing.destroy\n respond_to do |format|\n format.html { redirect_to historic_refinancings_url, notice: 'Historic refinancing was successfully destroyed.' }\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 @dependent_relationship = DependentRelationship.find(params[:id])\n @dependent_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to dependent_relationships_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete(key)\n ref = @references.delete(key)\n if ref\n keys_to_id = @references_to_keys_map[ref.referenced_object_id]\n if keys_to_id\n keys_to_id.delete(key)\n @references_to_keys_map.delete(ref.referenced_object_id) if keys_to_id.empty?\n end\n ref.object\n else\n nil\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 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(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Delete.new(href, headers)\n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @referrer.destroy\n respond_to do |format|\n format.html { redirect_to referrers_url, notice: 'Referrer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(path)\n request(:delete, path)\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n\t\t\t\t@referral = Spree::Referral.find(params[:id])\n\t\t\t\t@referral.destroy\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t format.html { redirect_to admin_referrals_url }\n\t\t\t\t format.json { head :ok }\n\t\t\t\tend\n\t\t\tend", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def destroy\n @relation = Relation.find(params[:id])\n @relation.destroy\n\n respond_to do |format|\n format.html { redirect_to relations_url }\n format.json { head :no_content }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @resources_and_link = ResourcesAndLink.find(params[:id])\n @resources_and_link.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_and_links_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @pppams_indicator_base_ref = PppamsIndicatorBaseRef.find(params[:id])\n @pppams_indicator_base_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to pppams_indicator_base_refs_url }\n format.json { head :no_content }\n end\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def destroy\n @relative.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, :relatives], notice: 'Relative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_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(url, headers={})\n RestClient.delete url, headers\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @references_vehicle_driver.destroy\n respond_to do |format|\n format.html { redirect_to references_vehicle_drivers_url, notice: 'References vehicle driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_type.destroy\n\n flash[:notice] = 'Reference type was successfully deleted.'\n\n respond_to do |format|\n format.html { redirect_to reference_types_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n @ref_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @client.delete_document(@path)\n end", "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @xlink = Xlink.find(params[:id])\n @xlink.destroy\n\n respond_to do |format|\n format.html { redirect_to xlinks_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7663956", "0.7343859", "0.72768277", "0.7238109", "0.71854806", "0.7066309", "0.6985104", "0.69705397", "0.69513786", "0.6931926", "0.6849859", "0.68201685", "0.6801177", "0.6800338", "0.6785123", "0.67722946", "0.67667156", "0.6757891", "0.6709282", "0.6707669", "0.670645", "0.67035294", "0.6690745", "0.6658407", "0.66024846", "0.6588223", "0.6557324", "0.6509284", "0.6504092", "0.6503252", "0.65019757", "0.64945555", "0.64813036", "0.6460901", "0.6459646", "0.6442562", "0.6440569", "0.64397657", "0.6439116", "0.6437313", "0.6428913", "0.63993716", "0.63993716", "0.6381873", "0.6362212", "0.6339337", "0.6339337", "0.6333263", "0.630166", "0.63001925", "0.6297781", "0.6294461", "0.6276731", "0.62451077", "0.6228181", "0.6226507", "0.62110335", "0.6205672", "0.6199548", "0.61959183", "0.61668", "0.6164287", "0.61620253", "0.6160539", "0.6160503", "0.6157046", "0.6156128", "0.6154874", "0.61321235", "0.6128708", "0.6127746", "0.6120561", "0.6117647", "0.6109442", "0.61079997", "0.6105297", "0.61017764", "0.6099441", "0.6097119", "0.60932004", "0.6085849", "0.6083493", "0.6076159", "0.6076159", "0.6074208", "0.6074208", "0.6074208", "0.6074208", "0.607375", "0.60687774", "0.6064942", "0.6064408", "0.60626954", "0.60544336", "0.60544", "0.6044637", "0.6043611", "0.6040853", "0.60357904", "0.60302955" ]
0.6975505
7
update. >?????? Not sure if i need this. ????????<
def update_user @user = user.find(params[:id]) @user.update(params[:user]) if @user. valid? redirect "/users/#{@user.id}" else status 422 @errors = @user.errors.full_messages erb:'users/new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update ; end", "def update() end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update\n \t\n end", "def update\n \t\n end", "def update\r\n end", "def update\r\n\r\n end", "def update;end", "def update; end", "def update \n end", "def update\n \n end", "def update\n\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\n\t\t# Left empty intentionally.\n\tend", "def update\n\t\t\n\t\tend", "def update \n end", "def update\n\t\tend", "def update\n\t\tend", "def update\n \n end", "def update\n\n\tend", "def update\n\n\tend", "def update\n\tend", "def update\n\tend", "def update\n\tend", "def update\n\tend", "def update\n\tend", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n\n end", "def update(...)\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end" ]
[ "0.85042113", "0.8428573", "0.8386455", "0.8386455", "0.8386455", "0.8386455", "0.8386455", "0.8386455", "0.8386455", "0.8386455", "0.80175626", "0.80175626", "0.8002528", "0.80006397", "0.79926056", "0.7982395", "0.7970802", "0.796885", "0.7959984", "0.79393405", "0.79393405", "0.79393405", "0.79393405", "0.7928428", "0.79099023", "0.786613", "0.7860112", "0.7860112", "0.7857666", "0.7818593", "0.7818593", "0.7789023", "0.7789023", "0.7789023", "0.7789023", "0.7789023", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.77433044", "0.76811326", "0.766397", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954", "0.76567954" ]
0.0
-1
GET /internets GET /internets.json
def index @internets = Internet.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\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 index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end", "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def show\n @website = Website.find(params[:id])\n\n render json: @website\n end", "def index\n @urls = Url.get_top(25)\n # render json: @urls\n end", "def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end", "def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end", "def index\n @watch_sites = WatchSite.includes(:team, :venue).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_sites }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def create\n @internet = Internet.new(internet_params)\n\n respond_to do |format|\n if @internet.save\n format.html { redirect_to @internet, notice: 'Internet was successfully created.' }\n format.json { render :show, status: :created, location: @internet }\n else\n format.html { render :new }\n format.json { render json: @internet.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end", "def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end", "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def set_internet\n @internet = Internet.find(params[:id])\n end", "def index \n local = params[:local]\n \n if (local.to_s.empty?)\n render json: 'Not found', status: 404 \n else\n params = {:query => local, :access_key => \"f613d33c4f74fc5b648685dc3428d345\"}\n conn = Faraday.get(\"http://api.weatherstack.com/current\", params) do |req|\n req.headers['Content-Type'] = 'application/json'\n end\n render json: conn.body \n end\n end", "def index\n @online_stores = OnlineStore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_stores }\n end\n end", "def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end", "def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def index\n @networkings = Networking.all\n end", "def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "def index\n endpoint(get(services_url).body)\n end", "def index\n @networks = Network.all\n end", "def index\n @networks = Network.all\n end", "def index\n @networks = Network.all\n end", "def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend", "def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end", "def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend", "def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end", "def networks\n TestLab::Network.all\n end", "def index\n @satellites = Satellite.all\n @sat_json = Satellite.includes(:barrels).map { |sat| sat.as_json.merge({barrels: sat.barrels.as_json}) }\n end", "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def getAll(url)\n exchanges = []\n begin\n open(url) do |d|\n json = JSON.parse(d.read)\n json.each do |a|\n exchanges << a\n end\n end\n return true, exchanges\n end\n rescue SocketError => e\n return false, \"Could not connect to the API\"\nend", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def all\n render json: Url.all\n end", "def index\n @websites = Website.all\n end", "def index\n @websites = Website.all\n end", "def index\n @websites = Website.all\n end", "def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end", "def index\n @stations = Station.all\n\n render json: @stations\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end", "def index\n @servers = @site.servers\n end", "def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @network }\n end\n end", "def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend", "def get_weather_json(city)\n api_url = \"http://api.openweathermap.org/data/2.5/weather?q=#{city}\"\n RestClient.get(api_url).to_str\nend", "def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end", "def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "def index\n cmd = `cd ../dispatch-proxy/bin; node dispatch.js list`\n @networks = JSON.parse(cmd).select { |network| network['address'] =~ /\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/ } - [{\"name\"=>\"lo0\", \"address\"=>\"127.0.0.1\"}]\n # @networks.each { |n| puts \"#{n}\" }\n\n all_network_services = `networksetup -listallnetworkservices `.to_s.split(/\\r?\\n/)[1..-1] # Ignore the first line which describes about the command\n # puts \"All Services #{all_network_services}\"\n \n all_network_services_info = all_network_services.collect do |service| \n info_command = \"networksetup -getinfo '#{service}'\"\n info = `#{info_command}`.to_s.split(/\\r?\\n/)\n info.each_with_object({'name' => service}) { |str, hash| key_value = str.split(':', 2); hash[key_value.first] = key_value.last.strip }\n end\n # puts \"All Services Info #{all_network_services_info}\"\n\n @networks.each do |network|\n matching_network = all_network_services_info.find { |n| n['IP address'] == network['address'] }\n network['full_name'] = matching_network ? matching_network['name'] : network['name']\n end\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def show\n search_url = \"https://seeiendom.kartverket.no/api/soekEtterEiendom?searchstring=#{CGI.escape(@address_search.search_string)}\"\n @search_result_json = HTTParty.get(search_url)\n end", "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def index\n @trackers = Tracker.where(public: true)\n\n render json: @trackers\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def url_list\n urls = current_user.mini_urls\n if urls.count > 0\n render json: {urls: urls}, status: 200\n else\n raise Exceptions::EmptyObjectError.new('No URL found.')\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end", "def get(url); end", "def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end", "def index\n @clients = Client.all\n render json: @clients\n end", "def index\n @access_internets = AccessInternet.all.order(\"created_at DESC\")\n end", "def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end", "def getNetworks\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 networks\" }, :unauthorized)\n return\n end\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/network'\n\n # Create request for Service Manager\n stack = {\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, 200)\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 api_fetch(url)\n JSON.parse(URI.open(url).read)\nend", "def get_json(url)\n r = Mei::WebServiceBase.fetch(url)\n JSON.parse(r.body)\n end", "def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def index\n render json: Client.all\n end", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end", "def list\n get('/')\n end", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def index\n json_response(@device.browsers)\n end", "def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end", "def get_alerts\r\n\t\turl = URI.parse(\"http://api.wunderground.com/api/#{@token}/alerts/q/#{@state_code}/#{@city}.json\")\r\n\t\thttp_response = HTTParty.get(url).parsed_response\r\n\t\tputs JSON.pretty_generate(http_response)\r\n\tend", "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 sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end", "def realtime\n render :json=>WebUrl.all.map(&:url).to_json\n end", "def index\n serialized = []\n Site.all.each do |site|\n attribute = format_site(site)\n serialized.push(attribute)\n end\n render(json:serialized)\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end", "def index\n @databases = Database.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @databases }\n end\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 get url\n net_http_response = self.connection.get url\n [net_http_response.body, net_http_response.code.to_i, net_http_response.message]\n end" ]
[ "0.61471325", "0.61165494", "0.60363746", "0.60363746", "0.59300953", "0.5920869", "0.58244175", "0.58151627", "0.5804467", "0.57917476", "0.5772945", "0.5763802", "0.57162535", "0.5668736", "0.5654593", "0.5649707", "0.5640878", "0.5610581", "0.56096345", "0.5600866", "0.55978084", "0.55882853", "0.55769855", "0.55760074", "0.5570571", "0.5570529", "0.5567669", "0.55475897", "0.55442786", "0.5544144", "0.5542044", "0.5528855", "0.551496", "0.551496", "0.551496", "0.5510019", "0.55098593", "0.5509152", "0.55081797", "0.5502988", "0.5501881", "0.55017406", "0.5497822", "0.54952145", "0.54917395", "0.5487702", "0.5477876", "0.5477332", "0.5475364", "0.54714113", "0.54714113", "0.54714113", "0.5470656", "0.5456268", "0.5456268", "0.5451425", "0.5450663", "0.54478264", "0.54478234", "0.5436874", "0.5410524", "0.5409553", "0.539945", "0.5393944", "0.5386426", "0.5378467", "0.535061", "0.5350221", "0.5347235", "0.53464234", "0.5345953", "0.53431445", "0.53423405", "0.53392", "0.53383374", "0.53352237", "0.53343886", "0.53309804", "0.53192186", "0.53161234", "0.53068507", "0.530254", "0.5301498", "0.5297859", "0.5296586", "0.5292473", "0.52922904", "0.5286102", "0.52813524", "0.5279504", "0.5273044", "0.52713966", "0.5255413", "0.5253223", "0.52514863", "0.52480304", "0.52472574", "0.52444166", "0.5243492", "0.5240419" ]
0.71520454
0
GET /internets/1 GET /internets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @internets = Internet.all\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 set_internet\n @internet = Internet.find(params[:id])\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 create\n @internet = Internet.new(internet_params)\n\n respond_to do |format|\n if @internet.save\n format.html { redirect_to @internet, notice: 'Internet was successfully created.' }\n format.json { render :show, status: :created, location: @internet }\n else\n format.html { render :new }\n format.json { render json: @internet.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @website = Website.find(params[:id])\n\n render json: @website\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 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 show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @network }\n end\n end", "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "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 update\n respond_to do |format|\n if @internet.update(internet_params)\n format.html { redirect_to @internet, notice: 'Internet was successfully updated.' }\n format.json { render :show, status: :ok, location: @internet }\n else\n format.html { render :edit }\n format.json { render json: @internet.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def get_weather_json(city)\n api_url = \"http://api.openweathermap.org/data/2.5/weather?q=#{city}\"\n RestClient.get(api_url).to_str\nend", "def index\n @networks = Network.all\n end", "def index\n @networks = Network.all\n end", "def index\n @networks = Network.all\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def index\n @networkings = Networking.all\n end", "def index \n local = params[:local]\n \n if (local.to_s.empty?)\n render json: 'Not found', status: 404 \n else\n params = {:query => local, :access_key => \"f613d33c4f74fc5b648685dc3428d345\"}\n conn = Faraday.get(\"http://api.weatherstack.com/current\", params) do |req|\n req.headers['Content-Type'] = 'application/json'\n end\n render json: conn.body \n end\n end", "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def index\n cmd = `cd ../dispatch-proxy/bin; node dispatch.js list`\n @networks = JSON.parse(cmd).select { |network| network['address'] =~ /\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/ } - [{\"name\"=>\"lo0\", \"address\"=>\"127.0.0.1\"}]\n # @networks.each { |n| puts \"#{n}\" }\n\n all_network_services = `networksetup -listallnetworkservices `.to_s.split(/\\r?\\n/)[1..-1] # Ignore the first line which describes about the command\n # puts \"All Services #{all_network_services}\"\n \n all_network_services_info = all_network_services.collect do |service| \n info_command = \"networksetup -getinfo '#{service}'\"\n info = `#{info_command}`.to_s.split(/\\r?\\n/)\n info.each_with_object({'name' => service}) { |str, hash| key_value = str.split(':', 2); hash[key_value.first] = key_value.last.strip }\n end\n # puts \"All Services Info #{all_network_services_info}\"\n\n @networks.each do |network|\n matching_network = all_network_services_info.find { |n| n['IP address'] == network['address'] }\n network['full_name'] = matching_network ? matching_network['name'] : network['name']\n end\n end", "def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end", "def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end", "def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend", "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 index\n @urls = Url.get_top(25)\n # render json: @urls\n end", "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\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_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 destroy\n @internet.destroy\n respond_to do |format|\n format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend", "def networks\n TestLab::Network.all\n end", "def show\n @network_connection = NetworkConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @network_connection }\n end\n end", "def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end", "def show\n search_url = \"https://seeiendom.kartverket.no/api/soekEtterEiendom?searchstring=#{CGI.escape(@address_search.search_string)}\"\n @search_result_json = HTTParty.get(search_url)\n end", "def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end", "def index\n @access_internets = AccessInternet.all.order(\"created_at DESC\")\n end", "def networks\r\n NetworksController.instance\r\n end", "def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end", "def index\n @online_stores = OnlineStore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_stores }\n end\n end", "def show\n\t\trender json: @url, status: 200\n\tend", "def get_json(uri)\n start = Time.now\n attempt = 0\n begin\n res = @http.get(\n uri,\n 'Accept' => 'text/plain',\n 'User-Agent' => user_agent,\n 'Accept-Encoding' => ''\n )\n raise Error, \"Failed to retrieve #{uri} (#{res.code}): #{res.body}\" unless res.code == '200'\n info(\"GET #{uri}: #{res.code}/#{res.body.length}b in #{age(start)}\")\n JSON.parse(res.body)\n rescue StandardError => e\n attempt += 1\n raise e if attempt >= @attempts\n retry\n end\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def show\n @ip_list = IPAddress(@network.network)\n @network_ips = @network.addresses\n end", "def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end", "def get_info(lat, lon)\n Net::HTTP.get(URI(\"https://api.3geonames.org/#{lat},#{lon}.json\"))\nend", "def show\n @host = Host.find(params[:id])\n\n render json: @host\n end", "def get(url)\n begin\n # Start by creating a new `RestCLient::Resource` authenticated with\n # the `@project` name and `@password`.\n resource = RestClient::Resource.new(url) \n # `GET` the resource\n resource.get {|response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.body)\n else\n response.return!(request, result, &block)\n end\n }\n rescue => e\n # Rescue and reraise with the current `@url` for debugging purposes \n raise \"Problem fetching #{@url} because #{e.message}\"\n end\n end", "def index\n json_response(@device.browsers)\n end", "def info\n get '/'\n end", "def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend", "def show\n respond_to do |format|\n format.json { render json: @uri, status: 200 }\n end\n end", "def show\n @ip = Ip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end", "def 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 index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend", "def show\n @web = Web.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web }\n end\n end", "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 index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def index\n @databases = Database.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @databases }\n end\n end", "def get(url = \"/api/system/info\")\n url = File.join(@client.url, url)\n request = Typhoeus::Request.new(url,\n method: :get,\n headers: headers,\n ssl_verifypeer: @client.ssl_verify_peer?,\n cookiefile: cookie_file_path, # read from\n cookiejar: cookie_file_path, # write to\n userpwd: [@client.user, @client.password].join(\":\"))\n request.run\n request.response\n end", "def index\n \n @databases = Database.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> @databases }\n end\n end", "def show\n @title = \"Show Networks\"\n @network = Network.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network }\n end\n end", "def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end", "def index\n @wireless_routers = WirelessRouter.all\n end", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def show\n @viaje = Viaje.find(params[:id])\n @sitio = Site.find(@viaje.site_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @viaje }\n end\n end", "def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end", "def get(url); 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 make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend", "def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end", "def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_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 if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "def index\n @stations = Station.all\n\n render json: @stations\n end", "def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def info(url)\n rest = RestClient::Request.execute(\n method: :get,\n url: url,\n user: ENV['USER'],\n password: ENV['KEY'],\n headers: {\"Content-Type\" => \"application/json\"}\n )\n JSON.parse(rest, :symbolize_names => true)\n rescue RestClient::Exception\n \"Sorry something went wrong with the API\"\n end", "def index\n @websites = Website.all\n end", "def index\n @websites = Website.all\n end", "def index\n @websites = Website.all\n end" ]
[ "0.70718336", "0.6224669", "0.6216901", "0.6133639", "0.6105625", "0.6085787", "0.5920673", "0.5876168", "0.58517724", "0.5742555", "0.57318646", "0.570893", "0.56911224", "0.56615114", "0.56615114", "0.56482905", "0.56433547", "0.56433547", "0.56433547", "0.5640429", "0.56306297", "0.5629243", "0.5597062", "0.55931234", "0.5587236", "0.5584098", "0.5535689", "0.553306", "0.5526456", "0.55175835", "0.54955447", "0.54861796", "0.5472704", "0.546202", "0.5455234", "0.5450369", "0.5448613", "0.5447626", "0.5447626", "0.5442706", "0.543845", "0.54194546", "0.5416643", "0.5412727", "0.53916913", "0.5379986", "0.53768045", "0.5358532", "0.5356456", "0.5348554", "0.53456753", "0.53364146", "0.5334616", "0.53266907", "0.53233886", "0.53192014", "0.53192014", "0.5316756", "0.53159523", "0.5315766", "0.5312935", "0.5312898", "0.53128344", "0.53116095", "0.5308241", "0.53064054", "0.5304985", "0.5302048", "0.5301895", "0.5300652", "0.5294735", "0.52933276", "0.5292577", "0.52904534", "0.5282248", "0.52800316", "0.52791625", "0.527854", "0.527572", "0.52734494", "0.5272533", "0.5271821", "0.5270398", "0.5264605", "0.5264425", "0.52635026", "0.5263131", "0.5261624", "0.52527755", "0.52509636", "0.52475846", "0.52442205", "0.5243015", "0.52422357", "0.52414197", "0.5231184", "0.522596", "0.52251565", "0.52244574", "0.52244574", "0.52244574" ]
0.0
-1
POST /internets POST /internets.json
def create @internet = Internet.new(internet_params) respond_to do |format| if @internet.save format.html { redirect_to @internet, notice: 'Internet was successfully created.' } format.json { render :show, status: :created, location: @internet } else format.html { render :new } format.json { render json: @internet.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @internets = Internet.all\n end", "def internet_params\n params.require(:internet).permit(:banda, :contrato, :cnpj, :nome)\n end", "def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def set_internet\n @internet = Internet.find(params[:id])\n end", "def access_internet_params\n params.require(:access_internet).permit(:total_traffic, :hfc_cgn, :hfc_public, :hfc_ipv6, :hfc, :mobile_cgn, :mobile_corporate, :mobile_ipv6, :mobile, :mobile_olo, :corporate, :cache_in)\n end", "def update\n respond_to do |format|\n if @internet.update(internet_params)\n format.html { redirect_to @internet, notice: 'Internet was successfully updated.' }\n format.json { render :show, status: :ok, location: @internet }\n else\n format.html { render :edit }\n format.json { render json: @internet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @network = current_user.networks.new(network_params)\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: t(:nertwork_created_ok) }\n format.json { render action: 'show', status: :created, location: @network }\n else\n format.html { render action: 'new' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @internet.destroy\n respond_to do |format|\n format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def createNetwork\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 create networks\" }, :unauthorized)\n return\n end\n\n # Service name in the query\n networkName = params[\"network_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/network'\n\n # Create request for Service Manager\n stack = {\n 'name' => networkName,\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 post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end", "def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def create\n @website = Website.new(website_params)\n\n if @website.save\n render json: @website, status: :created, location: @website\n else\n render json: @website.errors, status: :unprocessable_entity\n end\n end", "def create\n @networking = Networking.new(networking_params)\n\n respond_to do |format|\n if @networking.save\n format.html { redirect_to @networking, notice: 'Networking was successfully created.' }\n format.json { render :show, status: :created, location: @networking }\n else\n format.html { render :new }\n format.json { render json: @networking.errors, status: :unprocessable_entity }\n end\n end\n end", "def entries_to_http entries, url, http = Atom::HTTP.new\n coll = Atom::Collection.new url, http\n\n entries.each { |entry| coll.post! entry }\n end", "def create\n @network = Network.new(network_params)\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: 'Network was successfully created.' }\n format.json { render :show, status: :created, location: @network }\n format.js {\n @networks = Network.all\n render :create\n }\n else\n format.html { render :new }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n format.js {\n @networks = Network.all\n render :create\n }\n end\n end\n end", "def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"application/json;charset=utf-8\")\n end", "def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end", "def create\n @network = Network.new(network_params)\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: 'Network was successfully created.' }\n format.json { render :show, status: :created, location: @network }\n else\n format.html { render :new }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def createPrivateNetworks(name='')\n opt = @options.merge!({ :body => { :name => name } })\n\n self.class.post(\"/privateNetworks\", opt)\n end", "def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"application/json;charset=utf-8\")\n end", "def create\n @access_internet = AccessInternet.new(access_internet_params)\n #@access_internet.hfc = @access_internet.hfc_cgn + @access_internet.hfc_public + @access_internet.hfc_ipv6\n #@access_internet.hfc = params[:hfc_cgn] + params[:hfc_public] + params[:hfc_ipv6]\n\n respond_to do |format|\n if @access_internet.save\n format.html { redirect_to @access_internet, notice: 'Access internet was successfully created.' }\n format.json { render :show, status: :created, location: @access_internet }\n else\n format.html { render :new }\n format.json { render json: @access_internet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @network = Network.new(network_params)\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: 'Network was successfully created.' }\n format.json { render action: 'show', status: :created, location: @network }\n else\n format.html { render action: 'new' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @network = Network.new(network_params)\n\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: 'Network was successfully created.' }\n format.json { render action: 'show', status: :created, location: @network }\n else\n format.html { render action: 'new' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit\n http = Net::HTTP.new(URL.host, URL.port)\n http.use_ssl = true\n http.start { |send| send.request(self) }.body\n end", "def save\n requires :display_text, :name, :network_offering_id, :zone_id\n\n options = {\n 'displaytext' => display_text,\n 'name' => name,\n 'zoneid' => zone_id,\n 'networkofferingid' => network_offering_id\n }\n\n response = service.create_network(options)\n merge_attributes(response['createnetworkresponse']['network'])\n end", "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend", "def 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 create\n @social_networking = Admin::SocialNetworking.new(social_networking_params)\n\n if @social_networking.save\n render json: @social_networking, status: :created\n else\n render json: @social_networking.errors, status: :unprocessable_entity\n end\n end", "def create\n ip = remote_ip\n geolocation_data = RestClient.get \"freegeoip.net/json/#{ip}\"\n @geolocation_data = JSON.parse(geolocation_data, :symbolize => true) \n if @short_url.present? \n short_visit = @short_url.short_visits.create(visitor_ip: geolocation_data[\"ip\"], visitor_city: geolocation_data[\"city\"],visitior_state: geolocation_data[\"country_name\"],visitor_country_iso: geolocation_data[\"country_code\"])\n render json: { short_visit: short_visit, status: \"Created\" } \n else\n render json: { errors: \"something went wrong\" , status: \"failed\" } \n end \n end", "def create\n ip = remote_ip\n geolocation_data = RestClient.get \"freegeoip.net/json/#{ip}\"\n @geolocation_data = JSON.parse(geolocation_data, :symbolize => true) \n if @short_url.present? \n short_visit = @short_url.short_visits.create(visitor_ip: geolocation_data[\"ip\"], visitor_city: geolocation_data[\"city\"],visitior_state: geolocation_data[\"country_name\"],visitor_country_iso: geolocation_data[\"country_code\"])\n render json: { short_visit: short_visit, status: \"Created\" } \n else\n render json: { errors: \"something went wrong\" , status: \"failed\" } \n end \n end", "def create\n HTTParty.post(create_url, :options => { :headers => HEADERS })\n end", "def create\n respond_to do |format|\n if @wireless.save\n format.html { redirect_to wirelesses_path, notice: 'Rede Wireless criada com sucesso.' }\n format.json { render :index, status: :created, location: @wireless }\n else\n format.html { render :new }\n format.json { render json: @wireless.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_data\n request = Collector::Request.\n new(self.api_location,\n :user => config[:htpasswd_user],\n :pass => config[:htpasswd_pass])\n\n # convert the array of object to a hash\n server = {\n websites: @websites.map{ |w| w.to_hash(@version).merge({server: config[:client_name].underscore }) }.map{ |w| w[:website] },\n name: config[:client_name].underscore\n }\n\n request.send(server)\n\n end", "def addhost(config)\n\n uri = URI.parse(\"#{config[\"addurl\"]}\")\n node = { \"EntityType\" => \"Orion.Nodes\", \"IPAddress\" => \"#{config[\"ipaddr\"]}\",\n \"Caption\"=> \"#{config[\"nodename\"]}\", \"DynamicIP\" => \"False\", \"EngineID\" => \"#{config[\"engineid\"]}\", \n \"Status\" => 1, \"UnManaged\" => \"False\", \"Allow64BitCounters\" => \"True\", \n \"SysObjectID\" => \"\", \"MachineType\" => \"\", \"VendorIcon\" => \"\", \n \"ObjectSubType\" => \"SNMP\", \"SNMPVersion\" => 2, \"Community\" => \"#{config[\"community\"]}\",\n }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})\n request.body = node.to_json\n request.basic_auth(\"#{config[\"username\"]}\", \"#{config[\"password\"]}\")\n\n response = http.request(request)\nend", "def create\n \t@title = \"Create Networks\"\n @network = Network.new(params[:network])\n respond_to do |format|\n if @network.save\n flash[:notice] = 'Network was successfully created.'\n format.html { redirect_to(@network) }\n format.xml { render :xml => @network, :status => :created, :location => @network }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @network.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n cmd = `cd ../dispatch-proxy/bin; node dispatch.js list`\n @networks = JSON.parse(cmd).select { |network| network['address'] =~ /\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/ } - [{\"name\"=>\"lo0\", \"address\"=>\"127.0.0.1\"}]\n # @networks.each { |n| puts \"#{n}\" }\n\n all_network_services = `networksetup -listallnetworkservices `.to_s.split(/\\r?\\n/)[1..-1] # Ignore the first line which describes about the command\n # puts \"All Services #{all_network_services}\"\n \n all_network_services_info = all_network_services.collect do |service| \n info_command = \"networksetup -getinfo '#{service}'\"\n info = `#{info_command}`.to_s.split(/\\r?\\n/)\n info.each_with_object({'name' => service}) { |str, hash| key_value = str.split(':', 2); hash[key_value.first] = key_value.last.strip }\n end\n # puts \"All Services Info #{all_network_services_info}\"\n\n @networks.each do |network|\n matching_network = all_network_services_info.find { |n| n['IP address'] == network['address'] }\n network['full_name'] = matching_network ? matching_network['name'] : network['name']\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def train_api(mapid)\n url_safe_mapid = URI.encode(mapid)\n apiKey = \"73b6a68e9e4f450792ba730b84d8c506\"\n apiLink = \"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=#{apiKey}&mapid=#{url_safe_mapid}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end", "def web(_request, response)\n response.headers[\"Content-Type\"] = \"application/json\"\n json = MultiJson.dump(\n adapter: robot.config.robot.adapter,\n lita_version: Lita::VERSION,\n redis_memory_usage: redis_memory_usage,\n redis_version: redis_version,\n robot_mention_name: robot.mention_name,\n robot_name: robot.name\n )\n response.write(json)\n end", "def forward_json(reading_json)\n #uri = URI.parse(\"http://cmu-sensor-network.herokuapp.com/sensors\")\n uri = URI.parse(\"http://209.129.244.9/sensors\")\n post_json_request = Net::HTTP::Post.new(uri.request_uri)\n post_json_request.add_field(\"Content-Type\", \"application/json\")\n post_json_request.body = reading_json\n http = Net::HTTP::new(uri.host, uri.port)\n response = http.request(post_json_request)\n return response\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 scrape\t\t\n url = 'http://api.nytimes.com'\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n #If the api being scraped uses https, then set use_ssl to true.\n #http.use_ssl = false\n request_url = '/svc/search/v2/articlesearch.json?q=bangkok+bombings&page=1&sort=newest&api-key=e89effddaf8553d3a95336aaf6882ebe:5:72702694'\n response = http.send_request('GET', request_url)\n article_parse = JSON.parse(response.body)\n article_data= article_parse['response']['docs']\n puts \"Title: The New York Times\"\n puts \"--------------------------------\"\n article_data.each do |v|\n\n tags= tag_article(v['headline']['main'].to_s)\n article = Article.new(title: v['headline']['main'].to_s, \n summary: v['snippet'].to_s, \n link: v['web_url'], \n source: \"New York Times\", \n date: v['pub_date'].to_s.gsub(/,/,'.'), \n tag_list: tags)\n article.save\n end\n\t end", "def getNetworks\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 networks\" }, :unauthorized)\n return\n end\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/network'\n\n # Create request for Service Manager\n stack = {\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, 200)\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 post(url, params = {})\n client.post(url, params).body\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def create\n @satellite = Satellite.new\n\n respond_to do |format|\n if @satellite.save\n format.html { redirect_to satellites_path, notice: 'Satellite was successfully created.' }\n format.json { render :show, status: :created, location: satellites_path }\n else\n format.html { render :new }\n format.json { render json: @satellite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @site = Site.new \n puts \"Got here\"\n #2.times { @site.connections.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def post_request(secureNetId, secureKey, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n body = {} # Request body hash\n yield body # Build body of request\n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def 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 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_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend", "def post_as_json(data)\n uri = URI.parse(LISTENER)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 0.5\n begin\n request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})\n request.body = data.to_json\n http.request(request){|res| puts \"Post status: #{res.body}\" }\n rescue StandardError => e\n puts \"Failed sending data: #{e.message}\"\n end\nend", "def create\n @wireless_router = WirelessRouter.new(wireless_router_params)\n\n respond_to do |format|\n if @wireless_router.save\n format.html { redirect_to @wireless_router, notice: 'Wireless router was successfully created.' }\n format.json { render :show, status: :created, location: @wireless_router }\n else\n format.html { render :new }\n format.json { render json: @wireless_router.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end", "def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end", "def save_as_JSON\n for i in 0..get_townhall_urls.length-1\n json_email = (get_townhall_email(get_townhall_urls[i])).to_json\n File.open(\"db/emails.json\", \"a\") { |file| file.puts json_email}\n end\n end", "def aws_internet_gateway_create(opts)\n opts[:vpc].internet_gateway = AWS::EC2.new.internet_gateways.create\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 @website = websites.new(website_params)\n\n respond_to do |format|\n if @website.save\n flash[:notice] = :success\n format.html { redirect_to @website, notice: 'Website was successfully created.' }\n format.json { render :show, status: :created, location: @website }\n else\n format.html { render :new }\n format.json { render json: @website.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(options = {})\n response = request(:post, \"/network_zones.json\", :query => {:pack => options})\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 JSON.pretty_generate(result)\n result\nend", "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 @response = HTTParty.get(\"https://travelbriefing.org/#{params[:name]}?format=json\",\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'})\n\n @response = JSON.parse(@response.parsed_response)\n\n destination = Destination.new\n destination.country = @response[\"names\"][\"name\"]\n destination.user = current_user\n destination.save\n redirect_to '/profiles'\n end", "def add_site(params = {})\n site_name.set params['site_name']\n client_division_site_number.set params['client_division_site_number']\n site_number.set params['site_number']\n address_1.set params['address_1']\n address_2.set params['address_2'] if params['address_2']\n zip_code.set params['zip_code']\n city.set params['city']\n country.select(params['country'], match: :first)\n sleep 2 # Wait for the state to be active #TODO: find a way to remove this sleep ~MD\n state.select(params['state']) unless state.disabled?\n study_env.select(params['study_env'])\n pi_email.set params['pi_email']\n pi_first_name.set(params['pi_first_name'])\n pi_last_name.set(params['pi_last_name'])\n pi_role.select(params['pi_role'])\n add_site_submit.click\n sleep 10 # Wait to create a site\n end", "def write(files, private_gist = false, description = nil)\n response = request(create_url) do |url|\n Net::HTTP::Post.new(url.path).tap {|req|\n req.body = JSON.generate(data(files, private_gist, description))\n }\n end\n\n case response\n when Net::HTTPUnauthorized\n $stderr.puts \"Invalid credentials connecting to #{api_url}\"\n false\n when Net::HTTPCreated, Net::HTTPOK\n JSON.parse(response.body)['html_url']\n else\n raise StandardError, \"#{response.code} #{response.message}\"\n end\n end", "def create_retry_test method_name, instructions\n retry_test_uri = HOST + \"retry_test\"\n uri = URI.parse retry_test_uri\n headers = {\"Content-Type\" => \"application/json\"}\n data = {\"instructions\" => {method_name => instructions.to_a}}.to_json\n http = Net::HTTP.new uri.host, uri.port\n request = Net::HTTP::Post.new uri.request_uri, headers\n request.body = data\n http.request request\n end", "def post url, options={}\n response = self.class.post(url, {:body => options}).parsed_response\n raise Skydrive::Error.new(response[\"error\"]) if response[\"error\"]\n response[\"data\"] ? response[\"data\"] : response\n end", "def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "def add(params)\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(intranet(:koha_rest_api) + \"holds\")\n res = http.post(uri, params.to_json, headers)\n expect(res.code).to eq(\"201\"), \"got unexpected #{res.code} when adding hold.\\nResponse body: #{res.body}\"\n res.body\n end", "def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end", "def create\n @social_network = SocialNetwork.new(params[:social_network])\n\n respond_to do |format|\n if @social_network.save\n format.html { redirect_to @social_network, notice: 'Social network was successfully created.' }\n format.json { render json: @social_network, status: :created, location: @social_network }\n else\n format.html { render action: \"new\" }\n format.json { render json: @social_network.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\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 post_json(path, body)\n uri = build_uri(path)\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 result = JSON.parse(response.body)\n puts result\n result\nend", "def create\n @route = Route.new(params[:route])\n\n route_html = Nokogiri::HTML(open(@route.url))\n\n @activity_id = @route.url.split('/').last()\n @api_url = \"https://www.strava.com/api/v3/activities/\" + @activity_id + \"?access_token=9a3dd1938530a0db29fc42f4eedc4ff975e78190\"\n\n parsed_uri = URI.parse(@api_url)\n http = Net::HTTP.new(parsed_uri.host, parsed_uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(parsed_uri.request_uri)\n response = http.request(request)\n parsed_response = JSON.parse(response.body)\n\n @route.distance = ((parsed_response[\"distance\"].to_f * 0.000621371).round(2)).to_s #Convert meters to miles\n @route.elevation = ((parsed_response[\"total_elevation_gain\"] *3.28084).round(2)).to_s #Convert meters to feet\n @route.map_polyline = parsed_response[\"map\"][\"summary_polyline\"]\n\n if @route.name.empty?\n @route.name = parsed_response[\"name\"]\n end\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to routes_url, notice: 'Your route was submitted successfully, and will be verified by an officer shortly.' }\n format.json { render json: @route, status: :created, location: @route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_JSON)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return JSON.parse(response.body)['id'] \\\n if check_response(response, 201)\n end", "def report_connectivity(controller, port, connectivity_map)\n me = `hostname`.chomp\n req = Net::HTTP::Post.new(\"/#{me}\", initheader = {'Content-Type'=>'application/json'})\n req.body = connectivity_map.to_json\n response = Net::HTTP.start(controller, port) do |http|\n http.request(req)\n end\n response.code == '200'\nend", "def http_post(uri, data)\n RestClient.post uri, data\n end", "def create\n seth_server_rest.post_rest(\"data\", self)\n self\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 destroy\n @access_internet.destroy\n respond_to do |format|\n format.html { redirect_to access_internets_url, notice: 'Access internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def post(url, payload = {}, headers = {})\n http :post, \"#{url}.json\", payload.to_json, headers\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def create\n @webservice = Webservice.find(params[:webservice_id])\n @rest_api = @webservice.rest_apis.create(rest_api_params)\n redirect_to webservice_path(@webservice)\n end", "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_request(options, path, post_data)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Post.new(path)\n\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n req.body = post_data\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end", "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend", "def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_api/\" + (@url.id).to_s(36)\n url_hash[:url] = @url.url\n\n render :json => url_hash.to_json\n end\n\n end", "def update\n respond_to do |format|\n if @access_internet.update(access_internet_params)\n format.html { redirect_to @access_internet, notice: 'Access internet was successfully updated.' }\n format.json { render :show, status: :ok, location: @access_internet }\n else\n format.html { render :edit }\n format.json { render json: @access_internet.errors, status: :unprocessable_entity }\n end\n end\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 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" ]
[ "0.6009264", "0.59840983", "0.5594287", "0.5545337", "0.5446135", "0.5374118", "0.5335536", "0.5175832", "0.5175655", "0.51737547", "0.51425505", "0.5102705", "0.5090323", "0.50758237", "0.50503325", "0.5047668", "0.5027481", "0.50174975", "0.5014189", "0.50128645", "0.49792323", "0.49688375", "0.496782", "0.49559528", "0.49493277", "0.4946834", "0.49325642", "0.48797736", "0.48792306", "0.48757988", "0.4858689", "0.4851622", "0.48291373", "0.4823411", "0.48204523", "0.4809186", "0.4803504", "0.48029774", "0.4782173", "0.4781271", "0.47693637", "0.47693637", "0.47672802", "0.4755594", "0.47485808", "0.47484863", "0.47463283", "0.4740386", "0.47352108", "0.47309318", "0.47250244", "0.47245958", "0.47221753", "0.4711134", "0.47007713", "0.46975172", "0.468893", "0.46888778", "0.4688734", "0.4680496", "0.46709374", "0.466915", "0.46677732", "0.46617508", "0.46544546", "0.46536914", "0.46498835", "0.46487138", "0.464782", "0.4646003", "0.46407664", "0.4640248", "0.46398064", "0.46391043", "0.46389621", "0.46378484", "0.46258008", "0.46250555", "0.46248052", "0.4612589", "0.46118465", "0.46098045", "0.46005583", "0.45980865", "0.4595473", "0.45907027", "0.45867103", "0.45792407", "0.45768318", "0.45766747", "0.45737582", "0.4573017", "0.45708892", "0.45708132", "0.45670244", "0.4564587", "0.45576477", "0.45562667", "0.4553791", "0.45530027" ]
0.69433653
0
PATCH/PUT /internets/1 PATCH/PUT /internets/1.json
def update respond_to do |format| if @internet.update(internet_params) format.html { redirect_to @internet, notice: 'Internet was successfully updated.' } format.json { render :show, status: :ok, location: @internet } else format.html { render :edit } format.json { render json: @internet.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def patch!\n request! :patch\n end", "def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end", "def update # PATCH\n raise NotImplementedError\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!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @access_internet.update(access_internet_params)\n format.html { redirect_to @access_internet, notice: 'Access internet was successfully updated.' }\n format.json { render :show, status: :ok, location: @access_internet }\n else\n format.html { render :edit }\n format.json { render json: @access_internet.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n respond_to do |format|\n if @network.update(network_params)\n format.html { redirect_to @network, notice: t(:nertwork_updated_ok) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\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 jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "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 @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 patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n respond_to do |format|\n if @network.update_attributes(params[:network])\n format.html { redirect_to @network, notice: \"#{t('network')} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\n end", "def update\n @intern = Intern.find(params[:id])\n\n respond_to do |format|\n if @intern.update_attributes(params[:intern])\n format.html { redirect_to @intern, notice: 'Intern was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intern.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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(*args)\n request :put, *args\n end", "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @networking.update(networking_params)\n format.html { redirect_to @networking, notice: 'Networking was successfully updated.' }\n format.json { render :show, status: :ok, location: @networking }\n else\n format.html { render :edit }\n format.json { render json: @networking.errors, status: :unprocessable_entity }\n end\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 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 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!(**args)\n @enable_internet_access = args[:enable_internet_access] if args.key?(:enable_internet_access)\n @network = args[:network] if args.key?(:network)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n if @network.update(network_params)\n format.html { redirect_to @network, notice: 'Network was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @network.update(network_params)\n format.html { redirect_to @network, notice: 'Network was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @serv = Serv.find(params[:id])\n olddomain=@serv.domain\n oldname=@serv.name\n oldip=@serv.conn.ip\n oldport=@serv.conn.port\n @serv2 = Serv.new(params[:serv])\n if @serv2.mother\n params[:serv][:domain]= @serv2.mother.name\n params[:serv][:mother]=@serv2.mother\n params[:serv][:conn][:ip]=@serv2.mother.conn.ip\n else\n params[:serv][:domain]=nil\n params[:serv][:mother]=nil\n params[:serv][:conn][:ip]=''\n end\n pass=@serv.update_attributes(params[:serv])\n\n if pass\n if @serv.mngbl\n #Si se modifico algo se reinicia el MR a través de los llamados a webservices registrar y remover del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => oldip, 'port' => oldport}\n request = Net::HTTP::Delete.new(\"/mbs/#{olddomain}/#{oldname}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port, 'domain' => @serv.domain, 'type' => @serv.name}\n request = Net::HTTP::Post.new(\"/mbs/register\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n end\n respond_to do |format|\n if pass\n newname=@serv.name\n modify_links(oldname,newname)\n format.html { redirect_to servs_url, notice: t('servs.update.notice') }\n format.json { head :no_content }\n else\n @net_eles = NetEle.all\n format.html { render action: \"edit\" }\n format.json { render json: @serv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n if @frozen_tunnel_io.update_attributes(params[:frozen_tunnel_io])\n format.html { redirect_to @frozen_tunnel_io, notice: 'El tunel de congelado fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frozen_tunnel_io.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @atr = Atr.find(params[:id])\n @mcr_atr=@atr.mcr_atr\n @man_rsc=@mcr_atr.man_rsc\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'value' => @atr.value}\n request = Net::HTTP::Put.new(\"/mbs/#{@man_rsc.domain}/#{@man_rsc.name}/#{@mcr_atr.name}/#{@atr.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n\n respond_to do |format|\n if @atr.update_attributes(params[:atr])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atr.errors, status: :unprocessable_entity }\n end\n end\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(url, vars={})\n send_request url, vars, 'PUT'\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_remote\n # TODO\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 # { 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!(**args)\n @http_body = args[:http_body] if args.key?(:http_body)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update number, routes\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 << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_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.raw_body\r\n end\r\n\r\n response.body\r\n end", "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.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @computer.versionless do |doc|\n if doc.update(computer_params)\n format.html { redirect_to computers_path, notice: t('computer.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @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 patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end", "def patch(uri, options = T.unsafe(nil)); 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 @http_request.update(http_request_params)\n format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @http_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @http_request.update(http_request_params)\n format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @http_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def update\n \n \n\n #puts '*****************cartodb22************************'\n #response = HTTParty.get('https://cantina23.cartodb.com/api/v2/sql?q=SELECT name FROM premas_projects&api_key=83a1b3e6c95613255bef720617d34adb0a7b87c1')\n #puts response\n #puts '*****************cartodb22************************'\n\n #puts '*****************cartodb22************************'\n #response = HTTParty.get(\"https://cantina23.cartodb.com/api/v2/sql?q=UPDATE premas_projects SET value=33333 WHERE cartodb_id=2&api_key=83a1b3e6c95613255bef720617d34adb0a7b87c1\")\n #puts response\n #puts '*****************cartodb22************************'\n\n \n \n \n \n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @online_resource = OnlineResource.find(params[:id])\n\n respond_to do |format|\n if @online_resource.update_attributes(params.require(:online_resource).permit(:recording_note, :resource_type_id,\n :taken_on, :capture_device_model_id, :quality_type_id, :private_note, web_address_attributes: [:parent_resource_id, :url]))\n format.html { redirect_to @online_resource, :notice => 'Online resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @online_resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n respond_to do |format|\n if @infrastructure.update(infrastructure_params)\n format.html { redirect_to @infrastructure, notice: 'Infrastructure was successfully updated.' }\n format.json { render :show, status: :ok, location: @infrastructure }\n else\n format.html { render :edit }\n format.json { render json: @infrastructure.errors, status: :unprocessable_entity }\n end\n end\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 patch(url, options = {}, &block)\n request HttpPatch, url, options, &block\n end", "def update\n url = single_url\n payload = attributes_to_payload\n payload[:reset_data] = true\n to_server url, payload\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\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 @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 @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end", "def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end", "def update\n @title = \"Update Networks\"\n @network = Network.find(params[:id])\n\n respond_to do |format|\n if @network.update_attributes(params[:network])\n flash[:notice] = 'Network was successfully updated.'\n format.html { redirect_to(@network) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @network.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_resources(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/resources\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"resources\": [{\"name\":\"dashboard.tabs.total\", \"value\":1}]\n }.to_json)\n puts response.body\n puts \"Client's resources were updated.\" if response.success?\n end", "def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end", "def update\n respond_to do |format|\n if @net_rack.update(net_rack_params)\n format.html { redirect_to @net_rack, notice: 'Net rack was successfully updated.' }\n format.json { render :show, status: :ok, location: @net_rack }\n else\n format.html { render :edit }\n format.json { render json: @net_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request(:put, *args)\n end", "def update\n respond_to do |format|\n if @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 @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\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 put(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:put, url, payload, headers)\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource.host, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource.host }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @uri.update(uri_params)\n format.json { render json: @uri, status: 200 }\n else\n format.json { render json: @uri.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def update\n respond_to do |format|\n if @iot.update(iot_params)\n format.html { redirect_to @iot, notice: 'Iot was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot }\n else\n format.html { render :edit }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n 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" ]
[ "0.66075563", "0.6107189", "0.60620934", "0.59931374", "0.5962214", "0.5935094", "0.59247345", "0.5882629", "0.58340967", "0.58259654", "0.58022547", "0.579239", "0.5791156", "0.5776272", "0.5764515", "0.57546973", "0.573455", "0.57310504", "0.57158035", "0.57158035", "0.5693011", "0.56879663", "0.56795955", "0.56532323", "0.5648873", "0.56447613", "0.563718", "0.5613149", "0.5608615", "0.56058323", "0.5603885", "0.5601429", "0.5587094", "0.5581535", "0.55728656", "0.55728656", "0.55728656", "0.55728656", "0.5559897", "0.5555366", "0.55519617", "0.55497026", "0.5546183", "0.5546183", "0.55457157", "0.551929", "0.5518446", "0.5502249", "0.5479196", "0.5476999", "0.54708695", "0.54695624", "0.5457087", "0.54532206", "0.54524297", "0.5449054", "0.5448482", "0.54441816", "0.5426818", "0.54252183", "0.5423702", "0.5416879", "0.5416605", "0.54135656", "0.5413506", "0.5413011", "0.5409411", "0.5406701", "0.5403658", "0.5403633", "0.5403082", "0.5401871", "0.54013294", "0.53934073", "0.5385143", "0.53815305", "0.53787106", "0.53767616", "0.5375784", "0.5375622", "0.53724796", "0.5368838", "0.53670585", "0.5365667", "0.5364449", "0.53596336", "0.5359014", "0.53583026", "0.5351089", "0.53477377", "0.53461695", "0.5340654", "0.5340322", "0.53395665", "0.5339499", "0.5338434", "0.533383", "0.5333406", "0.5330903", "0.53291756" ]
0.65989697
1
DELETE /internets/1 DELETE /internets/1.json
def destroy @internet.destroy respond_to do |format| format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @access_internet.destroy\n respond_to do |format|\n format.html { redirect_to access_internets_url, notice: 'Access internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n api_client.delete(url)\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(url)\n do_request(\"delete\", url)\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(url, headers={})\n RestClient.delete url, headers\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @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 delete!\n Recliner.delete(uri)\n end", "def delete endpoint\n do_request :delete, endpoint\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(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end", "def destroy\n @network.destroy\n\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network.destroy\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network.destroy\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network.destroy\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @network.destroy\n respond_to do |format|\n format.html {\n flash[:notice] = 'Network was successfully destroyed.'\n index\n }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end", "def delete\n request(:delete)\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\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 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 @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 @intern = Intern.find(params[:id])\n @intern.destroy\n\n respond_to do |format|\n format.html { redirect_to interns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network_detail = NetworkDetail.find(params[:id])\n @network_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(network_details_url) }\n format.xml { head :ok }\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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\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 official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def delete(*uris); end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @network.destroy\n respond_to do |format|\n format.html { redirect_to networks_url, notice: 'Network was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @network = Network.find(params[:id])\n @network.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_networks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end", "def destroy\n @ip = Ip.find(params[:id])\n @ip.destroy\n\n respond_to do |format|\n format.html { redirect_to ips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.delete( name )\n end", "def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @title = \"Destroy Networks\"\n @network = Network.find(params[:id])\n @network.destroy\n\n respond_to do |format|\n format.html { redirect_to(networks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n requires :id\n\n service.delete_internet_gateway(id)\n true\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 @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 delete(url)\n call(url: url, action: :delete)\n end", "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n head :no_content\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @host = Host.find_by(hostname: params[:id])\n @host.destroy\n\n head :no_content\n end", "def delete(url, headers = {})\n request(:delete, url, headers)\n end", "def delete(url, headers = {})\n request(:delete, url, headers)\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.xml { head :ok }\n end\n end", "def delete!\n server.delete(name)\n end", "def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end", "def destroy\n @database.destroy\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @ignite.destroy\n respond_to do |format|\n format.html { redirect_to ignites_url, notice: 'Ignite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @networking.destroy\n respond_to do |format|\n format.html { redirect_to networkings_url, notice: 'Networking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 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_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(id)\n request(:delete, \"/network_zones/#{id}.json\")\n end", "def destroy\n @network_action.destroy\n respond_to do |format|\n format.html { redirect_to network_actions_url, notice: 'Network action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end", "def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ip_name.destroy\n respond_to do |format|\n format.html { redirect_to ip_names_url }\n format.json { head :no_content }\n end\n end", "def delete(_url)\n # do nothing since we can't find the key by url\n end", "def destroy\n @online_resource = OnlineResource.find(params[:id])\n @online_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to online_resources_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n 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 destroy\n @client.delete(@name)\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to websites_url, notice: 'Website was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to websites_url, notice: 'Website was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to websites_url, notice: 'Website was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to websites_url, notice: 'Website was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def 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 @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to(websites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @networking = Networking.find(params[:id])\n @networking.destroy\n RemovedNetworkings.create(net_identifier: Integer(params[:id]))\n\n respond_to do |format|\n format.html { redirect_to networkings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @online_store = OnlineStore.find(params[:id])\n @online_store.destroy\n\n respond_to do |format|\n format.html { redirect_to online_stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7133318", "0.7132496", "0.70107406", "0.6983946", "0.68748295", "0.6865625", "0.68331397", "0.68314385", "0.6812762", "0.67787737", "0.67660373", "0.6747108", "0.6721552", "0.67062354", "0.6667756", "0.6652738", "0.6652738", "0.6652738", "0.6652738", "0.66250277", "0.6617316", "0.659776", "0.659776", "0.659776", "0.6590666", "0.6564665", "0.65550727", "0.6540021", "0.65315396", "0.6526396", "0.65186447", "0.65052676", "0.64988506", "0.6488113", "0.6485979", "0.64656633", "0.64636844", "0.64636844", "0.6462158", "0.64582443", "0.6433558", "0.6424043", "0.6419229", "0.64163566", "0.64134604", "0.64106333", "0.639681", "0.6387398", "0.63868463", "0.63828427", "0.6380354", "0.6370827", "0.63668185", "0.6353457", "0.63514006", "0.6343342", "0.6332045", "0.6328925", "0.6324992", "0.6324992", "0.63203114", "0.6315299", "0.6315299", "0.63145316", "0.63116986", "0.6310958", "0.63101095", "0.63071066", "0.63063455", "0.63051987", "0.6296057", "0.6295913", "0.62951946", "0.629388", "0.62926984", "0.62791055", "0.6276466", "0.6275065", "0.6273308", "0.62722516", "0.62689626", "0.6265423", "0.62598664", "0.62516844", "0.62515867", "0.62485355", "0.6246298", "0.6242111", "0.62414163", "0.62414163", "0.62414163", "0.62414163", "0.62407535", "0.62352526", "0.62319845", "0.62300885", "0.62219805", "0.62167597", "0.62167597", "0.62167597" ]
0.7319332
0
Use callbacks to share common setup or constraints between actions.
def set_internet @internet = Internet.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def internet_params params.require(:internet).permit(:banda, :contrato, :cnpj, :nome) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /admin/restaurants GET /admin/restaurants.json
def index @admin_restaurants = Admin::Restaurant.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end", "def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end", "def index\n json_response(Restaurant.all)\n end", "def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end", "def index \n restaurant = Restaurant.all\n render json: restaurant\n end", "def show\n json_response(@restaurant)\n end", "def index\n @restaurants = current_user.restaurants\n end", "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "def show\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n render json: @get_restaurant_list\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n \t@restaurants = Restaurant.all\n end", "def index\n #See all my restaurants\n #Retreive all the restaurants from the DB\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.order('RANDOM()').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n # return restaurants in nearby area\n # needs to be implemented later--for now just return all globally available restaurants\n # max_distance = params[:maxDistance]\n # location = { latitude: params[:latitude], longitude: params[:longitude] }\n\n # Restaurant.all.select do |restaurant|\n # restaurant.distance_to(location) <= max_distance\n # end\n\n @restaurants = Restaurant.all\n\n render json: @restaurants\n end", "def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end", "def index\n @restaurants = Restaurant.all\nend", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def list\n\t\toutput_action_header(\"***Listing restaurants***\")\n\t\trestaurants = Restaurant.saved_restaurants\n\t\toutput_restaurant_table(restaurants)\n\tend", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def index\n @restaurants = Restaurant.order('name ASC')\n respond_with(@restaurants)\n end", "def index\n # restaurant instances inside array\n @restaurants = Restaurant.all\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant.to_json(except: [ :created_at, :updated_at ], methods: [ :partial_dishes, :partial_comments, :busy, :partial_recommendations ]) }\n end\n end", "def index\n @restaurants = Restaurant.where(\"name like ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @restaurants.map(&:attributes) }\n end\n end", "def index\n if(current_user.customer_id?)\n @resturants = Resturant.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @resturants = Resturant.where(\"region_id = ?\", current_user.driver.region_id)\n end\n \n render json: @resturants, status: 200\n end", "def index\n @order_restaurants = OrderRestaurant.all\n end", "def index\n @restaurant_locations = RestaurantLocation.all\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 set_admin_restaurant\n @admin_restaurant = Admin::Restaurant.find(params[: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 restaurant = Restaurant.find(params[:id])\n\n expose restaurant\n end", "def index\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @include_restaurants = true\n respond_with(@menu_items)\n end", "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def show\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @favorite_restaurants = FavoriteRestaurant.all\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n end", "def weekIndex\n render json: Restaurant.restaurantsWeek\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @restaurantes = Restaurante.all\n end", "def index\n @restaurant_places = RestaurantPlace.all\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n else\n redirect_to root_url, alert: \"Please, sign in!\" \n end\n end", "def index\n @dishes = @restaurant.dishes\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n \n end", "def find\n @restaurant = Restaurant.find(params[:id])\n end", "def get_restaurants(location)\n latitude, longitude = convert_location(location)\n\n food_query = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/place/nearbysearch/json\",\n :query_values => {:location => \"#{latitude},#{longitude}\",\n :radius => \"#{get_distance}\",\n :types => \"food\",\n :key => \"#{KEY}\",\n :sensor => \"false\",\n :keyword => \"#{get_food_kind}\"}\n )\n food_query_json = RestClient.get(food_query.to_s)\n JSON.parse(food_query_json)[\"results\"]\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def show\n @restaurants = Restaurant.where(user_id: @user.id).paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n end", "def find\n @restaurant = Restaurant.find(params[:id])\n end", "def index\n nearby_places_finder = NearbyPlaces.new(nearby_places_params)\n\n expose nearby_places_finder.call,\n each_serializer: NearbyRestaurantSerializer\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @user_rating = @restaurant.user_rating(current_user)\n @average_rating = @restaurant.average_rating\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @restaurant.application_hash(current_user).to_json }\n end\n end", "def monthIndex\n render json: Restaurant.restaurantsMonth\n end", "def set_restaurants\n @restaurants = Restaurant.all\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end", "def index \n if user_signed_in?\n @role= current_user.Role\n end\n @restaurants = Restaurant.all \n end", "def index\n @restauracjas = Restauracja.all\n end", "def show\n position = Position.find_by_id(params[:id])\n \n if !position.nil?\n respond_with position, include: [:restaurants], status: :ok\n else\n respond_with message: \"Resource not found\", status: :not_found\n end\n end", "def index\n @administradors = Administrador.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @administradors }\n end\n end", "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def show\n render json: @admin\n end", "def show\r\n @restaurant = Restaurant.find(params[:id])\r\n @comments = Comment.where(:restaurant_id => params[:id]).order(\"created_at DESC\")\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @restaurant }\r\n end\r\n end", "def menu\n @menu_items = MenuItem.where(restaurant_id: params[:restaurant_id])\n @restaurants = Restaurant.find(params[:restaurant_id])\n\n end", "def restaurant\n location.restaurant\n end", "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "def index\n render json: reservations\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end", "def index\n @restauracjes = Restauracje.all\n end", "def restaurants\n menu_items.map {|item| item.restaurant}\n end", "def index\n @admin_agencies = Admin::Agency.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_agencies }\n end\n end", "def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end", "def index\n recipes = current_user.recipes\n render json: { recipes: recipes}.to_json, status: :ok\n end", "def my_restaurants\n render :personal_restaurants\n end", "def index\n # byebug\n if current_user\n recipes = Recipe.all \n render json: recipes\n else \n render json: { errors: [\"Not Authorized\"] }, status: :unauthorized\n end\n end", "def index\n @restaurants = Restaurant.all.order(name: :asc)\n end", "def index\n @admins = Admin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admins }\n end\n end", "def get_restaurant(res_id)\n\t\tzomato_restaurant_details_url = @base_uri +\n\t\t\t\"/restaurant?res_id=#{res_id}\"\n\t\tresponse = HTTParty.get(zomato_restaurant_details_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@restaurant_details = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\tend", "def restaurant\n @restaurant\n end", "def my_restaurant\n @orders = current_user.orders.where(restaurant_id: params[:restaurant_id])\n @menu_items = MenuItem.where(restaurant_id: params[:restaurant_id] )\n render :personal_restaurant\n # @appetizers = MenuItem.where(@menu_items.categories === [0])\n end", "def index\n @restaurant_posts = RestaurantPost.all\n end", "def index\n @favorite_routes = FavoriteRoute.all\n render json: @favorite_routes\n end", "def index\n @tenants = Tenant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tenants }\n end\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def index\n @tables = @restaurant.tables\n end", "def show\n \t@restaurant=Restaurant.find params[:id]\n end", "def show\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_table }\n end\n end" ]
[ "0.7925596", "0.7751788", "0.771165", "0.7629712", "0.745463", "0.7429853", "0.73732096", "0.7348267", "0.71471953", "0.7142301", "0.7142301", "0.7142301", "0.7142301", "0.7142301", "0.7142301", "0.7142301", "0.7108386", "0.7096301", "0.70579183", "0.7035994", "0.70215636", "0.7020665", "0.70125276", "0.6988866", "0.69573784", "0.69573784", "0.69573784", "0.68783015", "0.6850903", "0.678831", "0.6770961", "0.66939974", "0.66928333", "0.6687871", "0.6683922", "0.66643435", "0.6653656", "0.66447365", "0.6636815", "0.6623691", "0.65431327", "0.6541789", "0.648948", "0.6485086", "0.6482322", "0.64797574", "0.64734757", "0.64401615", "0.64401615", "0.64401615", "0.6423645", "0.64208466", "0.64132863", "0.6408933", "0.64061916", "0.6377173", "0.63741606", "0.6361086", "0.63561374", "0.63519806", "0.63445127", "0.6328553", "0.63251966", "0.63232476", "0.6311739", "0.6304982", "0.6296298", "0.6282815", "0.6279021", "0.6261167", "0.62575644", "0.6249707", "0.62489146", "0.6244563", "0.624156", "0.62400305", "0.6222711", "0.6217101", "0.62119657", "0.6211548", "0.62087935", "0.6207343", "0.6200374", "0.6185721", "0.6184862", "0.61839473", "0.6177412", "0.6176611", "0.6166669", "0.6166591", "0.6158357", "0.61568505", "0.61554605", "0.6155239", "0.6153497", "0.61401266", "0.61335087", "0.61279684", "0.6123895", "0.6123516" ]
0.7559378
4
GET /admin/restaurants/1 GET /admin/restaurants/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end", "def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end", "def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end", "def index\n json_response(Restaurant.all)\n end", "def show\n json_response(@restaurant)\n end", "def index \n restaurant = Restaurant.all\n render json: restaurant\n end", "def index\n @admin_restaurants = Admin::Restaurant.all\n end", "def show\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n render json: @get_restaurant_list\n end", "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def index\n @restaurants = current_user.restaurants\n end", "def index\n @restaurants = Restaurant.order('RANDOM()').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n \t@restaurants = Restaurant.all\n end", "def index\n #See all my restaurants\n #Retreive all the restaurants from the DB\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\nend", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def set_admin_restaurant\n @admin_restaurant = Admin::Restaurant.find(params[:id])\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant.to_json(except: [ :created_at, :updated_at ], methods: [ :partial_dishes, :partial_comments, :busy, :partial_recommendations ]) }\n end\n end", "def show\n restaurant = Restaurant.find(params[:id])\n\n expose restaurant\n end", "def index\n # return restaurants in nearby area\n # needs to be implemented later--for now just return all globally available restaurants\n # max_distance = params[:maxDistance]\n # location = { latitude: params[:latitude], longitude: params[:longitude] }\n\n # Restaurant.all.select do |restaurant|\n # restaurant.distance_to(location) <= max_distance\n # end\n\n @restaurants = Restaurant.all\n\n render json: @restaurants\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n end", "def show\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n \n end", "def find\n @restaurant = Restaurant.find(params[:id])\n end", "def find\n @restaurant = Restaurant.find(params[:id])\n end", "def index\n @restaurants = Restaurant.order('name ASC')\n respond_with(@restaurants)\n end", "def index\n if(current_user.customer_id?)\n @resturants = Resturant.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @resturants = Resturant.where(\"region_id = ?\", current_user.driver.region_id)\n end\n \n render json: @resturants, status: 200\n end", "def index\n # restaurant instances inside array\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.where(\"name like ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @restaurants.map(&:attributes) }\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 index\n @order_restaurants = OrderRestaurant.all\n end", "def index\n @dishes = @restaurant.dishes\n end", "def weekIndex\n render json: Restaurant.restaurantsWeek\n end", "def index\n @restaurant_locations = RestaurantLocation.all\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @user_rating = @restaurant.user_rating(current_user)\n @average_rating = @restaurant.average_rating\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @restaurant.application_hash(current_user).to_json }\n end\n end", "def show\r\n @restaurant = Restaurant.find(params[:id])\r\n @comments = Comment.where(:restaurant_id => params[:id]).order(\"created_at DESC\")\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @restaurant }\r\n end\r\n end", "def show\n \t@restaurant=Restaurant.find params[:id]\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\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 get_restaurant(res_id)\n\t\tzomato_restaurant_details_url = @base_uri +\n\t\t\t\"/restaurant?res_id=#{res_id}\"\n\t\tresponse = HTTParty.get(zomato_restaurant_details_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@restaurant_details = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\tend", "def list\n\t\toutput_action_header(\"***Listing restaurants***\")\n\t\trestaurants = Restaurant.saved_restaurants\n\t\toutput_restaurant_table(restaurants)\n\tend", "def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @restaurant }\n end\n end", "def index\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @include_restaurants = true\n respond_with(@menu_items)\n end", "def monthIndex\n render json: Restaurant.restaurantsMonth\n end", "def new\r\n @restaurant = Restaurant.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @restaurant }\r\n end\r\n end", "def show\n position = Position.find_by_id(params[:id])\n \n if !position.nil?\n respond_with position, include: [:restaurants], status: :ok\n else\n respond_with message: \"Resource not found\", status: :not_found\n end\n end", "def show\n render json: @admin\n end", "def show\n @restaurants = Restaurant.where(user_id: @user.id).paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n end", "def show\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_table }\n end\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @favorite_restaurants = FavoriteRestaurant.all\n end", "def restaurant\n location.restaurant\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def new\n \t@restaurant = Restaurant.new\n\n \trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\nend", "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def restaurant\n @restaurant\n end", "def index\n render json: reservations\n end", "def index\n @restaurant_places = RestaurantPlace.all\n end", "def index\n @restaurantes = Restaurante.all\n end", "def index\n @restaurants = Restaurant.all\n @restaurant = Restaurant.new\n end", "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def show\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_dish }\n end\n end", "def index\n @restaurant = Restaurant.find(restaurant_id)\n @dishes = Dish.where(restaurant_id: restaurant_id).all\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end", "def menu\n @menu_items = MenuItem.where(restaurant_id: params[:restaurant_id])\n @restaurants = Restaurant.find(params[:restaurant_id])\n\n end", "def my_restaurant\n @orders = current_user.orders.where(restaurant_id: params[:restaurant_id])\n @menu_items = MenuItem.where(restaurant_id: params[:restaurant_id] )\n render :personal_restaurant\n # @appetizers = MenuItem.where(@menu_items.categories === [0])\n end", "def index\n @restaurants = Restaurant.all.order(name: :asc)\n end", "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "def my_restaurants\n render :personal_restaurants\n end", "def index\n recipes = current_user.recipes\n render json: { recipes: recipes}.to_json, status: :ok\n end", "def index\n @restauracjas = Restauracja.all\n end", "def index \n if user_signed_in?\n @role= current_user.Role\n end\n @restaurants = Restaurant.all \n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def index\n @pratos = @restaurante.pratos\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end" ]
[ "0.7614239", "0.76137954", "0.7550007", "0.75472903", "0.74081206", "0.7404448", "0.7341166", "0.72243017", "0.7194612", "0.7166104", "0.7166104", "0.7166104", "0.71347123", "0.70109844", "0.70107186", "0.70107186", "0.70107186", "0.70107186", "0.70107186", "0.70107186", "0.70107186", "0.6988672", "0.6964607", "0.6909281", "0.6900055", "0.6879552", "0.687163", "0.6863932", "0.6814205", "0.67942756", "0.67884827", "0.677535", "0.6749189", "0.67168033", "0.67168033", "0.67168033", "0.67133427", "0.66989845", "0.66714627", "0.6641239", "0.66276413", "0.66219586", "0.6594036", "0.6550429", "0.6546068", "0.6523118", "0.65167177", "0.6420008", "0.6416887", "0.6413286", "0.64117485", "0.64081115", "0.6383165", "0.63808835", "0.63798785", "0.6379534", "0.6367962", "0.63675904", "0.63675904", "0.63675904", "0.63675904", "0.63675904", "0.6351493", "0.63337076", "0.6326535", "0.6320409", "0.6302843", "0.6300417", "0.6297379", "0.6293682", "0.6291107", "0.6288363", "0.6277486", "0.6250498", "0.62502027", "0.6244758", "0.622358", "0.6220156", "0.62194294", "0.6215866", "0.6209693", "0.61957806", "0.6191644", "0.61855996", "0.6182602", "0.61793023", "0.6153978", "0.61408085", "0.61216676", "0.6116333", "0.61141187", "0.6111607", "0.61104393", "0.61038584", "0.6102662", "0.61016536", "0.6092982", "0.6092982", "0.6092982", "0.6092982", "0.6092982" ]
0.0
-1
POST /admin/restaurants POST /admin/restaurants.json
def create @admin_restaurant = Admin::Restaurant.new(admin_restaurant_params) respond_to do |format| if @admin_restaurant.save format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully created.' } format.json { render :show, status: :created, location: @admin_restaurant } else format.html { render :new } format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n json_response(Restaurant.create!(restaurant_params), :created)\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n render :show, status: :created, location: @restaurant\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\", error: @restaurant.errors.full_messages }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@restaurant = Restaurant.new(params[:restaurant])\n\n \trespond_to do |format|\n \t\tif @restaurant.save\n \t\t\tformat.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n \t\t\tformat.json { render json: @restaurant, status: :created, location: @restaurant }\n \t\telse\n \t\t\tformat.html { render action: \"new\" }\n \t\t\tformat.json { render json: @restaurant.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: \"Restaurant was successfully created.\" }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @restaurant }\n else\n format.html { render action: 'new' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n @restaurants = Restaurant.find(params[:id])\n else\n render 'create_error'\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @restaurant = Restaurant.new(params[:restaurant])\r\n\r\n respond_to do |format|\r\n if @restaurant.save\r\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\r\n format.json { render json: @restaurant, status: :created, location: @restaurant }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n @restaurant.save\n redirect_to restaurants_path\n end", "def create\n @get_restaurant_list = GetRestaurantList.new(params[:get_restaurant_list])\n\n if @get_restaurant_list.save\n render json: @get_restaurant_list, status: :created, location: @get_restaurant_list\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n respond_to do |format|\n if @restaurant.save\n format.html {redirect_to @restaurant, notice: 'Restaurant was successfully created.'}\n format.json {render :show, status: :created, location: @restaurant}\n else\n format.html {render :new}\n format.json {render json: @restaurant.errors, status: :unprocessable_entity}\n end\n end\n end", "def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end", "def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end", "def create\n # create_restaurant\n find_user\n @restaurant = Restaurant.new(restaurant_params)\n @restaurant.user_id = @user.id\n if @restaurant.save\n redirect_to \"/restaurants\"\n # render plain: \"Success\", status: 201\n else\n render plain: \"failure\", status: 422\n end\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n @restaurant.user_id = current_user.id\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to my_restaurant_path(current_user, @restaurant.id), notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order_restaurant = OrderRestaurant.new(order_restaurant_params)\n\n respond_to do |format|\n if @order_restaurant.save\n format.html { redirect_to @order_restaurant, notice: 'Order restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @order_restaurant }\n else\n format.html { render :new }\n format.json { render json: @order_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:rest_name, :rest_phone, :rest_url, :rest_fax, :rest_firstaddr, :rest_secondaddr, :rest_city, :rest_state, :rest_zip, :rest_cuisine, :rest_delivers, :rest_fee, :rest_menufile, :rest_desc)\n end", "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "def create\n restaurant = Restaurant.new(restaurant_params)\n\n if restaurant.save\n expose restaurant\n else\n error! :invalid_resource, restaurant.errors\n end\n end", "def restaurant_params\n params.permit(:restaurant, :name, :location, :term)\n end", "def create\n @restaurant_post = RestaurantPost.new(restaurant_post_params)\n\n respond_to do |format|\n if @restaurant_post.save\n format.html { redirect_to @restaurant_post, notice: 'Restaurant post was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_post }\n else\n format.html { render :new }\n format.json { render json: @restaurant_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@restaurant = current_user.restaurants.build(restaurant_params)\n if @restaurant.save\n flash[:success] = \"Restaurant created!\"\n redirect_to root_url\n else\n\t\t render \"new\"\n end\n\tend", "def set_restaurant_for_create\n @restaurant = Restaurant.find(params[:restaurant][:id])\n end", "def create\n\t\t@restaurant = Restaurant.new restaurant_params \n\n\t\tif @restaurant.save\n\t\t redirect_to '/restaurants'\n\t\telse\n\t\t render 'new'\n\t\tend\n\tend", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n notice = 'Restaurant was successfully created.'\n\n if (@restaurant.linkedRestaurator != '')\n @restaurant.restaurator_id = @restaurant.linkedRestaurator\n else\n notice = 'Vous avez ajoute un restaurant sans lui assigner un restaurateur.'\n end\n\n if (current_user.clientType == Client::CLIENT_TYPES[:entrepreneur])\n @restaurant.entrepreneur_id = current_user.id\n end\n\n respond_to do |format|\n if @restaurant.save\n\n format.html { redirect_to @restaurant, notice: notice }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #IOnstanciate a new restaurant\n @restaurant = Restaurant.new(restaurant_params)\n #Pass to the restaurant the parameters\n #save the restaurant\n @restaurant.save\n redirect_to restaurants_path\n end", "def create\n @food = Food.new(food_params)\n @food.user_id = current_user.id \n @food.restaurant_id = @restaurant.id\n\n respond_to do |format|\n if @food.save\n format.html { redirect_to @restaurant }\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\n @restaurant = Restaurant.create(order_params)\n\n respond_to do |format|\n if @restaurant\n format.html { redirect_to '/', notice: 'Todo list was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_restaurant = FavoriteRestaurant.new(favorite_restaurant_params)\n\n respond_to do |format|\n if @favorite_restaurant.save\n format.html { redirect_to @favorite_restaurant, notice: 'Favorite restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_restaurant }\n else\n format.html { render :new }\n format.json { render json: @favorite_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def add\n @restaurant = Restaurant.new\n @restaurants = User.find(session[:user_id]).restaurants\n end", "def create\n restaurants = yelp.businesses\n restaurants.each do |item|\n create = Restaurant.new(\n :name => item.name,\n :location => item.location.neighborhoods,\n :phone_numbers => item.display_phone,\n :featured_image => item.image_url,\n :thumb_url => item.url,\n :cuisines => item.categories,\n :aggregate_rating => item.rating,\n :yelp => item.id\n )\n create.save\n end\n end", "def index \n restaurant = Restaurant.all\n render json: restaurant\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :city, :state, :zip)\n end", "def addRestaurant(restaurant)\n @restaurants << restaurant\n end", "def create\n @restaurant = Restaurant.create!(restaurant_params)\n\n respond_to do |format|\n if !(@restaurant.rest_menufile.nil?)\n\t\tupload\n\t end\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @restaurant }\n else\n format.html { render action: 'new' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:owner_id, :name, :content, :address)\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n redirect_to restaurants_path\n else\n render :new\n end\nend", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was successfully created.') }\n format.xml { render :xml => @restaurant, :status => :created, :location => @restaurant }\n else\n format.html { render :action => 'new' }\n format.xml { render :xml => @restaurant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :zip)\n end", "def set_admin_restaurant\n @admin_restaurant = Admin::Restaurant.find(params[:id])\n end", "def restaurant_params\n params.require(:restaurant).permit(:yelp_id, :id, :name, :state, :postal_code, :address, :display_phone, :location => {}, :photos => [], :categories => [])\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :cuisine, :address, :city, :state, :zip, :country)\n end", "def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end", "def create\n @state_object = States.new\n @states = @state_object.abbreviations\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n redirect_to \"/restaurants/#{@restaurant.id}\"\n else\n flash[:notice] = \"Your restaurant couldn't be saved. Sorry!\"\n render :new\n end\n end", "def new_restaurant_params\n params.require(:restaurant).permit(:name, :address, :city, :state, :zip, :description)\n end", "def index\n @admin_restaurants = Admin::Restaurant.all\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :telephone, :address, :term)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :desc, :addr_1, :addr_2, :addr_city, :addr_code, :addr_state, :addr_country, :phone_1)\n end", "def create\n @restaurant_location = RestaurantLocation.new(restaurant_location_params)\n\n respond_to do |format|\n if @restaurant_location.save\n format.html { redirect_to @restaurant_location, notice: 'Restaurant location was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_location }\n else\n format.html { render :new }\n format.json { render json: @restaurant_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Restaurant.create(\n # name: params[:name],\n # category: params[:category],\n # address: params[:address],\n # phone_number: params[:phone_number]\n # )\n\n # @restaurant = Restaurant.new(restaurant_params)\n # @restaurant.save\n\n # Restaurant.create(restaurant_params)\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n redirect_to restaurant_path(@restaurant)\n else\n render :new\n end\n end", "def create\n @restaurante = Restaurante.new(restaurante_params)\n #@restaurante = Restaurante.new params.require(:restaurante).permit(:nome, :endereco,:especialidade)\n #@restaurante = Restaurante.new(params[:restaurante])\n respond_to do |format|\n if @restaurante.save\n format.html { redirect_to @restaurante, notice: 'Restaurante criado com sucesso!.' }\n format.json { render :show, status: :created, location: @restaurante }\n else\n format.html { render :new }\n format.json { render json: @restaurante.errors, status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n # this comes from the post\n params.require(:restaurant).permit(:name, :address, :category)\nend", "def restaurant_params\n params.require(:restaurant).permit(:name, :description, :city, :state, :zip_code, :address)\n end", "def update\n json_response(@restaurant.update!(restaurant_params))\n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n\n ################################################\n ## Preferences\n ################################################\n #get items from input and add to an array\n @prefs = Array.new\n unless params[:prefs].nil?\n params[:prefs].each do |p|\n @prefs << Preference.find(p)\n end\n end\n\n #if event item is NOT in array, remove it from event\n @restaurant.preferences.each do |p|\n unless @prefs.include? (p)\n PreferencesRestaurants.where(restaurant_id: @restaurant, preference_id: p).first.destroy\n end\n end\n\n #if item is NOT in event array, add it to event\n @prefs.each do |p|\n unless @restaurant.preferences.exists? (p)\n @restaurant.preferences << Preference.find(p)\n end\n end\n ################################################\n\n\n ################################################\n ## Restrictions\n ################################################\n #get items from input and add to an array\n @restrics = Array.new\n unless params[:restrics].nil?\n params[:restrics].each do |r|\n @restrics << Restriction.find(r)\n end\n end\n\n #if event item is NOT in array, remove it from event\n @restaurant.restrictions.each do |r|\n unless @restrics.include? (r)\n RestaurantsRestrictions.where(restaurant_id: @restaurant, restriction_id: r).first.destroy\n end\n end\n\n #if item is NOT in event array, add it to event\n unless @restrics.nil?\n @restrics.each do |p|\n unless @restaurant.restrictions.exists? (p)\n @restaurant.restrictions << Restriction.find(p)\n end\n end\n end\n ################################################\n\n\n \n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:restaurant_name)\n end", "def create\n if @restaurant.present?\n review = Review.new(review_params)\n if review.save\n render_json content: review\n else\n render_json content: review.errors\n end\n else\n render json: {error: \"restaurant id #{review_params[:restaurant_id]} does not exist\"}, status: :forbidden\n end\n end", "def set_restaurants\n @restaurants = Restaurant.all\n end", "def create\n @restaurante = Restaurante.new(restaurante_params)\n @restaurante.client_id = current_client.id\n\n respond_to do |format|\n if @restaurante.save\n format.html { redirect_to @restaurante,\n notice: 'Restaurante creado exitosamente.' }\n format.json { render :show, status: :created, location: @restaurante }\n else\n format.html { render :new }\n format.json { render json: @restaurante.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :location, :price, :link, :user_id, :category_id)\n end", "def index\n json_response(Restaurant.all)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :city,\n :description, :cuisine_id, :image_url)\n end", "def create\n @restauracja = Restauracja.new(restauracja_params)\n\n respond_to do |format|\n if @restauracja.save\n format.html { redirect_to @restauracja, notice: 'Restauracja was successfully created.' }\n format.json { render :show, status: :created, location: @restauracja }\n else\n format.html { render :new }\n format.json { render json: @restauracja.errors, status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :phone, :email)\n end", "def index\n @restaurants = Restaurant.order('RANDOM()').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def index\n @restaurants = Restaurant.all\n end", "def restaurant_params\n params.require(:restaurant).permit(:rid, :user_id, :name, :place, :city, :description, :image)\n end", "def index\n @restaurants = Restaurant.all\n @restaurant = Restaurant.new\n end", "def create\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :category, :phone_number)\n end", "def admin_restaurant_params\n params.require(:admin_restaurant).permit(:name, :description, :address, :phone, :logo)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name)\n end", "def create\n @restauracje = Restauracje.new(restauracje_params)\n\n respond_to do |format|\n if @restauracje.save\n format.html { redirect_to @restauracje, notice: 'Restauracje was successfully created.' }\n format.json { render :show, status: :created, location: @restauracje }\n else\n format.html { render :new }\n format.json { render json: @restauracje.errors, status: :unprocessable_entity }\n end\n end\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :price, :distance, :rating)\n end", "def index\n @restaurants = Restaurant.all\n end", "def set_restaurant\n @restaurant = Restaurant.new(params[:id])\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :city, :zip, :img_url)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :description, :stars)\n end", "def new\r\n @restaurant = Restaurant.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @restaurant }\r\n end\r\n end", "def index\n @restaurants = Restaurant.all\nend", "def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @restaurant }\n end\n end" ]
[ "0.7369996", "0.7160911", "0.71376413", "0.6938119", "0.69327366", "0.6910166", "0.6910166", "0.6910166", "0.6895149", "0.6895149", "0.6895149", "0.68870723", "0.6833067", "0.68267864", "0.67923766", "0.67799735", "0.6750343", "0.67458135", "0.6731178", "0.6726244", "0.6664632", "0.6650028", "0.66322595", "0.6541546", "0.653757", "0.65221584", "0.6477473", "0.646396", "0.64293456", "0.6428756", "0.6424727", "0.640375", "0.63967425", "0.63901895", "0.63686407", "0.63601387", "0.6358858", "0.63549423", "0.63512945", "0.63361657", "0.6334441", "0.63274497", "0.6322888", "0.63161474", "0.63145727", "0.6306393", "0.62999606", "0.6281446", "0.62750554", "0.62732065", "0.62551355", "0.6249359", "0.6248659", "0.6231762", "0.6227562", "0.62270224", "0.62245333", "0.62205756", "0.6217118", "0.621429", "0.62133515", "0.61970985", "0.6195302", "0.61909014", "0.6182159", "0.6179861", "0.61773014", "0.6177198", "0.6174627", "0.6160509", "0.61591285", "0.61366713", "0.61318725", "0.6118549", "0.61179346", "0.61179346", "0.61179346", "0.61179346", "0.61179346", "0.61179346", "0.61179346", "0.61175895", "0.6115883", "0.6110792", "0.60999966", "0.6093123", "0.6089868", "0.6089868", "0.6080924", "0.6075322", "0.6070709", "0.6062863", "0.6056341", "0.60525155", "0.6032256", "0.6031015", "0.60304725", "0.60304725", "0.60304725", "0.60304725" ]
0.7427476
0
PATCH/PUT /admin/restaurants/1 PATCH/PUT /admin/restaurants/1.json
def update respond_to do |format| if @admin_restaurant.update(admin_restaurant_params) format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully updated.' } format.json { render :show, status: :ok, location: @admin_restaurant } else format.html { render :edit } format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_response(@restaurant.update!(restaurant_params))\n end", "def update \n @restaurant = Restaurant.find(params[:id])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n # format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.html { redirect_to account_owner_dashboards_path, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_restaurant\n end", "def update\n if @restaurant.update(restaurant_params)\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @restaurant = Restaurant.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @restaurant.update_attributes(params[:restaurant])\r\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :status => :ok }.to_json }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @restaurant.errors, :status => :unprocessable_entity }\n format.json { fail }\n end\n end\n end", "def update\n if @restaurant.update(restaurant_params.except(:local_id))\n render :show, status: :ok, location: @restaurant\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to user_restaurant_url(current_user), notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t@restaurant = Restaurant.find(params[:id])\n\n \trespond_to do |format|\n \t\tif @restaurant.update_attributes(params[:restaurant])\n \t\t\tformat.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n \t\t\tformat.json { head :ok }\n \t\telse\n \t\t\tformat.html { render action: \"edit\" }\n \t\t\tformat.json { render json: @restaurant.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end", "def update\n set_params\n @restaurant = Restaurant.find(params[:id])\n authorize! :update, @restaurant\n if (params[:restaurant][:status] == \"Exclusive\" &&\n @restaurant.owned_by != current_user.id)\n params[:restaurant][:status] = \"Pending Approval\"\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n MenuItem.destroy_all(:restaurant_id => params[:id])\n set_menu_items_and_file\n super\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n temp_restaurant = Restaurant.new(params[:restaurant])\n notice = 'Restaurant was successfully updated.'\n\n if (temp_restaurant.linkedRestaurator != '')\n @restaurant.restaurator_id = temp_restaurant.linkedRestaurator\n else\n notice = 'Vous avez modifie un restaurant sans lui assigner un restaurateur.'\n end\n\n if (current_user.clientType == Client::CLIENT_TYPES[:entrepreneur])\n @restaurant.entrepreneur_id = current_user.id\n end\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: notice }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @restaurant.update(restaurant_params)\n @restaurants = Restaurant.all\n else\n render 'update_error'\n end\n end", "def update\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n if @get_restaurant_list.update(params[:get_restaurant_list])\n head :no_content\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html {redirect_to @restaurant, notice: 'Restaurant was successfully updated.'}\n format.json {render :show, status: :ok, location: @restaurant}\n else\n format.html {render :edit}\n format.json {render json: @restaurant.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: \"Restaurant was successfully updated.\" }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order_restaurant.update(order_restaurant_params)\n format.html { redirect_to @order_restaurant, notice: 'Order restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @order_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n \n if !(@restaurant.rest_menufile.nil?)\n upload\n end\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @restaurant = Restaurant.find(params[:restaurant_id])\n @food = Food.find(params[:id])\n end", "def update\n data = tenant_update_params\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"customer_id\": @tenant.customer_id,\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/edit\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n respond_to do |format|\n if response[\"status\"] == 200\n if @tenant.update(tenant_update_params)\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n if @tenant.active == true\n end\n end\n @tenant.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { redirect_to tenants_url, notice: 'Tenant was not updated.' }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\nend", "def edit\n id = params[:id]\n @restaurant = Restaurant.find_by_id(id)\n if @restaurant.nil?\n raise ActionController::RoutingError.new('No such restaurant')\n end\n @foods = Food.where(\"restaurant_id = ?\", id)\n\n end", "def update_restaurant(restaurant)\n restaurant.name = params[:name] || restaurant.name\n restaurant.description = params[:description] || restaurant.description\n restaurant.address.address_1 = params[:address_1] || restaurant.address.address_1\n restaurant.address.address_2 = params[:address_2] || restaurant.address.address_2\n restaurant.address.city = params[:city] || restaurant.address.city\n restaurant.address.county = params[:county] || restaurant.address.county\n restaurant.address.state = params[:state] || restaurant.address.state\n restaurant.avatar = params[:avatar] || restaurant.avatar\n restaurant.category = params[:category] || restaurant.category\n restaurant.address.country = params[:country] || restaurant.address.country\n restaurant.location.latitude = params[:latitude] || restaurant.location.latitude if restaurant.location\n restaurant.location.longitude = params[:longitude] || restaurant.location.longitude if restaurant.location\n restaurant.address.save!\n restaurant.location.save! if restaurant.location\n restaurant.save!\n restaurant\n end", "def update\n # Cambio de estado desde panel de usuario con rol de operations\n if params[:status]\n respond_to do |format|\n @restaurant.status = params[:status]\n @restaurant.save\n return redirect_to operations_restaurants_path\n end\n end\n\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { head :no_content }\n restaurantsign_in @restaurant\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @restaurante = Restaurante.find params[:id]\n respond_to do |format|\n if @restaurante.update(restaurante_params)\n format.html { redirect_to @restaurante, notice: 'Restaurante editado com sucesso!.' }\n format.json { render :show, status: :ok, location: @restaurante }\n else\n format.html { render :edit }\n format.json { render json: @restaurante.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 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 respond_to do |format|\n if @favorite_restaurant.update(favorite_restaurant_params)\n format.html { redirect_to @favorite_restaurant, notice: 'Favorite restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @favorite_restaurant.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 #Update my restaurant\n @restaurant = Restaurant.find(params[:id])\n @restaurant.update(restaurant_params)\n redirect_to restaurants_path\n end", "def update\n @restaurant = current_restaurant\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n flash[:notice] = t('restaurants.update.success')\n format.js { } # default update.js.rjs\n else\n# format.html { render :action => \"show\" }\n# format.xml { render :xml => @restaurant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_admin_restaurant\n @admin_restaurant = Admin::Restaurant.find(params[:id])\n end", "def update\n # byebug\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Blog was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n\n\n if @restaurant.update!(restaurant_params)\n redirect_to @restaurant\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { redirect_to restaurants_url, notice: 'There was an error processing your vote' }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restaurant_table = RestaurantTable.find(params[:id])\n\n respond_to do |format|\n if @restaurant_table.update_attributes(params[:restaurant_table])\n format.html { redirect_to @restaurant_table, notice: 'Restaurant table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @restaurant.update(restaurant_params)\n redirect_to restaurants_path\n else\n render :edit\n end\nend", "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def update\n respond_to do |format|\n if @restaurant_place.update(restaurant_place_params)\n format.html { redirect_to @restaurant_place, notice: 'Restaurant place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restaurant_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def edit\n @restaurant = Restaurant.find(params[:id])\n end", "def edit\n @restaurant = Restaurant.find(params[:id])\n end", "def edit\n @restaurant = Restaurant.find(params[:id])\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n if Rental.current_user.admin?\n respond_to do |format|\n if @rental.update(rental_params)\n format.html { redirect_to rentals_path}\n format.json { render :show, status: :ok, location: @rental }\n else\n format.html { render :edit }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n else \n redirect_to rentals_path\n end\n end", "def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end", "def approve\n order = current_user.restaurant.orders.find(params[:id])\n order.update(status: 1)\n render json: {is_success: true}, status: :ok\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 update\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n\n respond_to do |format|\n if @tipo_restaurante.update_attributes(params[:tipo_restaurante])\n format.html { redirect_to(@tipo_restaurante, :notice => 'Tipo restaurante was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_restaurante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @restaurant.present?\n if @review.present?\n if @review.update(review_params)\n render_json content: @review\n else\n render_json content: @review.errors\n end\n end\n end\n\n end", "def update\n authorize @ingredient.recipe\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient}\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n respond_to do |format|\n if @restaurant_post.update(restaurant_post_params)\n format.html { redirect_to @restaurant_post, notice: 'Restaurant post was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_post }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @merge_restaurant.update(merge_restaurant_params)\n format.html { redirect_to @merge_restaurant, notice: 'Merge restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @merge_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @merge_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipes_food.update(recipes_food_params)\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipes_food }\n else\n format.html { render :edit }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_agency = Admin::Agency.find(params[:id])\n\n respond_to do |format|\n if @admin_agency.update_attributes(params[:admin_agency])\n format.html { redirect_to @admin_agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def edit\n \t@restaurant=Restaurant.find params[:id]\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 update\n respond_to do |format|\n if @restauracja.update(restauracja_params)\n format.html { redirect_to @restauracja, notice: 'Restauracja was successfully updated.' }\n format.json { render :show, status: :ok, location: @restauracja }\n else\n format.html { render :edit }\n format.json { render json: @restauracja.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restauracje.update(restauracje_params)\n format.html { redirect_to @restauracje, notice: 'Restauracje was successfully updated.' }\n format.json { render :show, status: :ok, location: @restauracje }\n else\n format.html { render :edit }\n format.json { render json: @restauracje.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend", "def update\n respond_to do |format|\n if @admin_administrator.update(admin_administrator_params)\n format.html { redirect_to @admin_administrator, notice: t('crud.updated_successfully!', name: Admin::Administrator.model_name.human) }\n format.json { render action: 'show', status: :ok, location: @admin_administrator }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_administrator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @type_food.update(type_food_params)\n format.html { redirect_to @type_food, notice: 'Type food was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_food }\n else\n format.html { render :edit }\n format.json { render json: @type_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resturant.update(resturant_params)\n format.html { redirect_to @resturant, notice: 'Resturant was successfully updated.' }\n format.json { render :show, status: :ok, location: @resturant }\n else\n format.html { render :edit }\n format.json { render json: @resturant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fast_food.update(fast_food_params)\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully updated.' }\n format.json { render :show, status: :ok, location: @fast_food }\n else\n format.html { render :edit }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe = Recipe.find(params[:id])\n\n if recipe.user == current_user\n recipe.update(recipe_params)\n render json: { recipe: params[:id], deleted: true }\n else\n render json: { recipe: params[:id], deleted: false }\n end\n end", "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin = Admin.find(params[:id])\n\n if @admin.update(admin_params)\n head :no_content\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @meal_food.update(meal_food_params)\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_food }\n else\n format.html { render :edit }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update_restaurants\n unless restaurant_ids.nil?\n #delete lunch_restaurants that are no longer in the list of restaurant_ids\n self.lunch_restaurants.each do |lr|\n lr.destroy unless restaurant_ids.include?(lr.restaurant.id.to_s)\n restaurant_ids.delete(lr.restaurant_id.to_s)\n end\n\n #add lunch_restaurants that are in the list of restaurant_ids\n restaurant_ids.each do |r|\n self.lunch_restaurant.create(:restaurant_id => r) unless r.blank?\n end\n \n reload\n self.restaurant_ids = nil\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "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 edit\n @role= current_user.Role\n @restaurant = Restaurant.find(params[:id])\n end", "def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @recipe\n \n @recipe.modifier = current_user\n \n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: t('.success') }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_food.update(user_food_params)\n format.html { redirect_to @user_food, notice: 'User food was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_food }\n else\n format.html { render :edit }\n format.json { render json: @user_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = @recruiter.user\n respond_to do |format|\n if @recruiter.update_attributes(params[:recruiter]) && @user.update_attributes(params[:user])\n @user.update_attribute(:is_admin, params[:user][:is_admin]) if current_user.is_admin # is_admin is non accessible\n format.html { redirect_to @recruiter, notice: 'Recruiter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recruiter.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7251908", "0.6729797", "0.6715429", "0.6670564", "0.66246164", "0.66246164", "0.66246164", "0.66246164", "0.65513116", "0.65513116", "0.654816", "0.6507395", "0.650353", "0.6469208", "0.6415895", "0.6415895", "0.6415895", "0.63961005", "0.63853073", "0.63785475", "0.6362571", "0.6358826", "0.6345719", "0.630591", "0.6279558", "0.62521374", "0.6227614", "0.6223694", "0.6218668", "0.6189421", "0.6179768", "0.61771584", "0.61748546", "0.6171913", "0.6170693", "0.616908", "0.6145741", "0.61373925", "0.6116345", "0.60929", "0.6086337", "0.6082888", "0.60828483", "0.6040852", "0.603896", "0.6031581", "0.60293627", "0.5999116", "0.59787947", "0.597818", "0.597818", "0.59690845", "0.59690845", "0.59690845", "0.5967315", "0.5959157", "0.595114", "0.5939512", "0.5938701", "0.59295774", "0.5915864", "0.58996886", "0.58692545", "0.5866081", "0.5861521", "0.5858638", "0.5853499", "0.5852346", "0.584378", "0.584378", "0.5835142", "0.5834267", "0.58341897", "0.58341086", "0.58238965", "0.5813247", "0.580327", "0.57999", "0.5790217", "0.57857126", "0.57799447", "0.5775582", "0.5772176", "0.57650244", "0.576464", "0.5763586", "0.57589465", "0.57357407", "0.5732554", "0.57322353", "0.5726526", "0.57229555", "0.57228726", "0.5718809", "0.5716635", "0.57161164", "0.57133347", "0.5712372", "0.57120466", "0.5703666" ]
0.6990584
1
DELETE /admin/restaurants/1 DELETE /admin/restaurants/1.json
def destroy @admin_restaurant.destroy respond_to do |format| format.html { redirect_to admin_restaurants_url, notice: 'Restaurant was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n render json: {success: true}\n end", "def destroy\r\n @restaurant = Restaurant.find(params[:id])\r\n @restaurant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to restaurants_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # DELETE\n # TODO: removes a specific restaurant\n DB.execute(\"DELETE FROM restaurants WHERE id = #{@id}\")\n nil\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n \t@restaurant = Restaurant.find(params[:id])\n \t@restaurant.destroy\n\n \trespond_to do |format|\n \t\tformat.html { redirect_to restaurants_url }\n \t\tformat.json { head :ok }\n \tend\n end", "def destroy\n\n @restaurant.delete\n\n redirect_to root_path\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @restaurant = Restaurant.find_by(id: params[:id])\n current_user\n if @restaurant.user_id == @current_user.id\n @restaurant.destroy!\n redirect_to '/restaurants'\n else\n status 422\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html {redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n @get_restaurant_list.destroy\n\n head :no_content\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: \"Restaurant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = @restaurant.find(params[:id])\n @restaurant.destroy\n redirect_to restaurants_path\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to menus_url }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end", "def destroy\n @restaurant.destroy!\n head :no_content\n end", "def destroy\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n @restaurant_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_dishes_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @food.destroy\n respond_to do |format|\n format.html { redirect_to @restaurant, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant was successfully destroyed.' }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:restaurant_id])\n @food = @restaurant.foods.find(params[:id])\n @food.destroy\n # Food.find(params[:id]).destroy\n redirect_to restaurant_path(@restaurant)\n end", "def destroy\n @restaurante.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_url,\n notice: 'Restaurante eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_place.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to order_restaurants_url, notice: 'Order restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @restaurant.destroy\n redirect_to restaurants_path\nend", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @restaurant.destroy\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n @favorite_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to favorite_restaurants_url, notice: 'Favorite restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_location.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_locations_url, notice: 'Restaurant location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @restaurant_table = RestaurantTable.find(params[:id])\n @restaurant_table.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_tables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_cuisine.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_cuisines_url, notice: 'Restaurant cuisine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n authorize! :destroy, @restaurant\n @restaurant.destroy\n super\n end", "def destroy\n # @restaurante = Restaurante.find(params[:id])\n @restaurante.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_url, notice: 'Restaurante deletado com sucesso!.' }\n format.json { head :no_content }\n \n # redirect_to action: 'index'\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end", "def delete\n render json: Location.delete(params[\"id\"])\n end", "def delete(*rest) end", "def destroy\n @restauracje.destroy\n respond_to do |format|\n format.html { redirect_to restauracjes_url, notice: 'Restauracje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_post.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_posts_url, notice: 'Restaurant post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @merge_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to merge_restaurants_url, notice: 'Merge restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete\n\n end", "def destroy\n @restauracja.destroy\n respond_to do |format|\n format.html { redirect_to restauracjas_url, notice: 'Restauracja was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n @tipo_restaurante.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_restaurantes_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fooditem = Fooditem.find(params[:id])\n @fooditem.destroy\n\n respond_to do |format|\n format.html { redirect_to fooditems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurantes_proximo.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_proximos_url, notice: 'Restaurantes proximo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @resturant.destroy\n respond_to do |format|\n format.html { redirect_to resturants_url, notice: 'Resturant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tRestaurant.find(params[:id]).destroy\n flash[:success] = \"Restaurant and related meals removed.\"\n redirect_to moderator_path\n\tend", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @restaurant.branches.each do |branch|\n branch.destroy\n end\n\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @immigrant = Immigrant.find(params[:id])\n @immigrant.destroy\n\n respond_to do |format|\n format.html { redirect_to immigrants_url }\n format.json { head :no_content }\n end\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n supprimer = AdministrateurService.instance.supprimerAdmin(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def destroy\n authorize! :manage_account, current_account\n @food = current_account.foods.find(params[:id])\n @food.destroy\n respond_with @food, :location => foods_url\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "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\n client.delete(url)\n @deleted = true\nend", "def destroy\n @restaurant_floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_floor_plans_url, notice: 'Restaurant floor plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end" ]
[ "0.73669946", "0.73669946", "0.73669946", "0.73669946", "0.73669946", "0.73669946", "0.73669946", "0.73669946", "0.7314704", "0.7306246", "0.72777504", "0.72777504", "0.72777504", "0.7174789", "0.71701103", "0.71401596", "0.71370363", "0.7126396", "0.7086429", "0.7086429", "0.7086429", "0.7086429", "0.70690584", "0.701776", "0.701776", "0.70175886", "0.70145035", "0.70084244", "0.6994676", "0.68940526", "0.6877117", "0.6864132", "0.68348104", "0.68285364", "0.68069154", "0.6802309", "0.6796342", "0.6795604", "0.6782115", "0.6779566", "0.67581594", "0.67399937", "0.67368007", "0.67316765", "0.6727415", "0.67269945", "0.67181474", "0.67162466", "0.670723", "0.67040074", "0.66878134", "0.6686038", "0.6668981", "0.6667097", "0.6667097", "0.66619605", "0.66619176", "0.6652866", "0.66519123", "0.66452545", "0.6608449", "0.6606581", "0.6602275", "0.6600783", "0.6587289", "0.6584546", "0.65796924", "0.657161", "0.65715814", "0.65575725", "0.6554285", "0.6553138", "0.6540682", "0.65364087", "0.6530522", "0.6529085", "0.6526524", "0.6519779", "0.6514118", "0.65137416", "0.65136534", "0.6511965", "0.6509096", "0.6503171", "0.6498438", "0.6494204", "0.6494204", "0.6494204", "0.6494204", "0.6494204", "0.6494204", "0.6494204", "0.6491823", "0.6487582", "0.6487117", "0.64857477", "0.6480606", "0.6474531", "0.64673036", "0.646524" ]
0.75120753
0
Use callbacks to share common setup or constraints between actions.
def set_admin_restaurant @admin_restaurant = Admin::Restaurant.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def admin_restaurant_params params.require(:admin_restaurant).permit(:name, :description, :address, :phone, :logo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /reservations GET /reservations.json
def index @reservations = Reservation.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: reservations\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def reservations\n @reservations ||= flight.reservations\n end", "def index\n @reservations = @apartment.reservations.all\n end", "def index\n @reservations = @bus.reservations\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def index\n @reservations = Reservation.includes(:guest).all\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end", "def index\n @reservations = @user.reservations\n @reservations_json = []\n @reservations.each do |r|\n ro = r\n r = r.as_json\n %w{arrived email no_show owner_id}.each {|k| r.delete(k)}\n r[:start_time] = ro.start_time_format\n r[:end_time] = ro.end_time_format\n @reservations_json << r\n end\n\n render json: @reservations_json, status: 200 \n end", "def index\n respond_to do |format|\n if current_user.try(:admin?)\n @reservations = Reservation.all\n else\n @reservations = Reservation.where(user_id: current_user)\n end\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def index\n reservations = Reservation.all\n render('reservations/index',:locals => {:reservations => reservations})\n end", "def show\n @reservation = current_user.reservations.find(params[:id])\n respond_with(@reservation)\n end", "def fetch_reservations(property_id)\n fetcher = Commands::ReservationsFetcher.new(credentials)\n fetcher.call(property_id)\n end", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @reservations = Reservation.paginate :page => params[:page] || 1, :per_page => limit, :conditions => [\"user_id = ? AND historical = ?\", session[:user_id], 0], :order => \"id\"\n\n respond_to do |format|\n format.xml { render :xml => @reservations }\n format.any { render :json => @reservations }\n end\n end", "def index\n scope = apply_scopes(Reservation)\n @reservations = scope.respond_to?(:to_a) ? scope.to_a : scope.all\n @reservations = @reservations.paginate(page: params['page'])\n end", "def index\n @reservations = Reservation.all.paginate(:page => params[:page]).per_page(10)\n authorize! :index, :Reservations\n end", "def index\n @reservations = Reservation.all\n @reservation_statuses = @@reservation_statuses\n end", "def get_by_property\n @api_v1_reservation = current_api_v1_user.properties.find(params[:id]).reservations\n render template: '/api/v1/reservations/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end", "def index\n @reservations = current_user.reservations.joins(:menu_item).order('menu_items.date DESC, time_slot DESC')\n respond_with(@reservations)\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def your_reservations\n @rooms = current_user.rooms\n @reservations = Reservation.all\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n else\n redirect_to root_url, alert: \"Please, sign in!\" \n end\n end", "def index\n @reservation_details = ReservationDetail.all\n end", "def index\n @customer_reservations = CustomerReservation.all\n end", "def index\n @reservacions = Reservacion.all\n end", "def index\n @space_reservations = SpaceReservation.all\n end", "def index\n @employee_reservations = Employee::Reservation.all\n end", "def booking_parking_reservations_get(opts = {})\n data, _status_code, _headers = booking_parking_reservations_get_with_http_info(opts)\n data\n end", "def show\n @search = @room.reservations.search(params[:q])\n @reservations = @search.result.where(\"initial_date > ?\", Date.today).paginate(:page => params[:page], :per_page => 4)\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n redirect_to reservations_path\n end", "def reservations(base = self.date_from)\n\t\t\t\t\t@reservations = {} if @reservations.nil?\n\t\t\t\t\tif @reservations[base.to_s].nil?\n\t\t\t\t\t\t@reservations[base.to_s] = RicReservation.reservation_model.event(self, base)\n\t\t\t\t\tend\n\t\t\t\t\treturn @reservations[base.to_s]\n\t\t\t\tend", "def index\n\n headers['Access-Control-Allow-Origin'] = '*'\n @reservations = Reservation.search(params[:search])\n respond_to do |format|\n # perform the standard login check for the html version of the request.\n # ( this will also render the default index template )\n format.html { check_if_admin_logged_in }\n format.json do\n # TODO: do knock authentication check here\n render json: @reservations, include: ['users','property']\n end\n end #respond_to\n end", "def index\n @tool_reservations = ToolReservation.all\n end", "def show\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserf }\n end\n end", "def index\n @reserves = Reserve.all\n end", "def index\n @reservationcs = Reservationc.all\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @reservation }\n end\n end", "def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end", "def show\n\t\t@reservations = Reservation.where(listing_id: @listing.id)\n\t\t# @listing = Listing.search(params[:search], params[:city])\n\n\tend", "def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def index\n if current_user.role == \"user\"\n @reservations = current_user.reservations.includes(:alleys, :user).order(:date)\n elsif current_user.role == \"cashier\"\n @reservations = Reservation.includes(:alleys, :user).by_date Date.today\n else\n @reservations = Reservation.includes(:alleys, :user).order(:date).all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservation_rooms = ReservationRoom.all\n end", "def index\n #@reservations = Reservation.all\n @reservations = current_user.reservations #.order(\"created_at DESC\")\n #@eateries = Eatery.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n end", "def reservations_by_date(date)\n date = Date.parse(date)\n res_by_date = @reservations.select do |res|\n res.date_range.included_in_date_range(date)\n end\n return res_by_date\n end", "def reservations_by_date(date)\n specific_reservations = @reservations.find_all do |reservation|\n (reservation.start_date..reservation.end_date).cover?(Date.parse(date))\n end\n\n return specific_reservations\n end", "def preload\n today = Date.today\n reservations = @location.reservations\n .where(\n 'start_date >= ? ', today\n )\n .select('id, status, start_date')\n\n render json: reservations\n end", "def index\n @reservations = Reservation.is_public.confirmed.order(updated_at: :desc).limit(500)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve }\n end\n end", "def index\n @reservations = @user.reservations.active_total\n end", "def show\n @reservation = Reservation.new\n end", "def show\n @reservation = Reservation.find(params[:id])\n render :show \n end", "def calendar\n @reservations= Reservation.all\n @reservations_by_date = @reservations.group_by { |e| e.date.strftime('%Y-%m-%d') }\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def count_reservations\n reservations.count\n end", "def show\n @reservation = Reservation.new\n end", "def show\n @reservation = Reservation.new\n end", "def index\n @reservation_owners = ReservationOwner.all\n end", "def list_reservations(date)\n res_on_date = @reservations.select do |reservation|\n date >= reservation.start_date && date < reservation.end_date\n end\n \n return res_on_date\n end", "def index\n @user_reservations = query_reservations(user: current_user).paginate(page: params[:user_reservations_page], :per_page => 5)\n if current_user.is_admin?\n @awaiting_approval = query_reservations(status: 'requested')\n @all_reservations = query_reservations.paginate(page: params[:all_reservations_page], :per_page => 5)\n render :admin_index\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def index\n @study_reservations = StudyReservation.all\n end", "def index\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_admin = User.find(group.user_id)\n member = Member.find_by(group_id: group.id, user_id: @current_user.id)\n if @current_user.id == group_admin.id\n @reservations = Reservation.where(space_id: params[:space_id])\n elsif member\n @reservations = Reservation.where(\n space_id: params[:space_id], \n member_id: member.id\n )\n end\n render json: @reservations\n end", "def index\n @phone_reservations = PhoneReservation.all\n end", "def list_reservations\n return @occupied.values.select { |value| value.class == Hotel::Reservation }\n end", "def index\n if params[:brewery_id]\n @reservations = @brewery.reservations.all\n else\n @reservations = @user.reservations.all\n end\n end", "def show_pending_reservations\n @tab_title = I18n.t('team_management.pending_reservations')\n\n prf = PendingReservationFinder.new(current_user)\n @pending_reservations = prf.get_pending_reservations()\n end", "def search\n if request.get?\n @office_hour = OfficeHour.by_date Date.today\n @office_hour_list = create_office_hour_list\n @holidays = create_holiday_list\n @time = next_valid_time\n else\n @alleys = Alley.all\n @reservations = find_possible_reservations params[:search]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n format.js\n end\n end" ]
[ "0.80168474", "0.7786847", "0.7786847", "0.7642628", "0.7595051", "0.75216544", "0.73537683", "0.7279801", "0.7249016", "0.72301537", "0.7209059", "0.7209059", "0.7209059", "0.7209059", "0.7209059", "0.7209059", "0.71926415", "0.7182939", "0.71568966", "0.7123418", "0.708233", "0.70750934", "0.70664346", "0.70664346", "0.7038554", "0.70108056", "0.7006343", "0.69695216", "0.6856952", "0.68349993", "0.6833158", "0.67863816", "0.6748151", "0.67328143", "0.67328143", "0.67328143", "0.6705802", "0.6683863", "0.6677304", "0.66756016", "0.6669771", "0.6650196", "0.6628924", "0.66199774", "0.6611142", "0.65968126", "0.65968126", "0.65968126", "0.6579018", "0.6543557", "0.651339", "0.6512081", "0.6510424", "0.6494661", "0.64928746", "0.64893436", "0.6478932", "0.6476289", "0.6470251", "0.6464775", "0.64567673", "0.64511967", "0.6449839", "0.6443743", "0.64394206", "0.6435283", "0.6426692", "0.6406762", "0.6403145", "0.64023113", "0.63805586", "0.6365333", "0.63597816", "0.6355479", "0.6355479", "0.6338719", "0.63348347", "0.6328715", "0.6317418", "0.63122374", "0.62968934", "0.62919736", "0.6291557", "0.62563014", "0.6236449", "0.6219542" ]
0.77413225
17
GET /reservations/1 GET /reservations/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: reservations\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reservation }\n end\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def index\n @reservations = @apartment.reservations.all\n end", "def get_by_property\n @api_v1_reservation = current_api_v1_user.properties.find(params[:id]).reservations\n render template: '/api/v1/reservations/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def show\n @reservation = Reservation.find(params[:id])\n end", "def index\n @reservations = @bus.reservations\n end", "def show\n @reservation = current_user.reservations.find(params[:id])\n respond_with(@reservation)\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def reservations\n @reservations ||= flight.reservations\n end", "def index\n @reservations = Reservation.includes(:guest).all\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def fetch_reservations(property_id)\n fetcher = Commands::ReservationsFetcher.new(credentials)\n fetcher.call(property_id)\n end", "def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def show\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserf }\n end\n end", "def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def index\n reservations = Reservation.all\n render('reservations/index',:locals => {:reservations => reservations})\n end", "def show\n @reservation = Reservation.find(params[:id])\n render :show \n end", "def index\n @reservations = @user.reservations\n @reservations_json = []\n @reservations.each do |r|\n ro = r\n r = r.as_json\n %w{arrived email no_show owner_id}.each {|k| r.delete(k)}\n r[:start_time] = ro.start_time_format\n r[:end_time] = ro.end_time_format\n @reservations_json << r\n end\n\n render json: @reservations_json, status: 200 \n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end", "def index\n respond_to do |format|\n if current_user.try(:admin?)\n @reservations = Reservation.all\n else\n @reservations = Reservation.where(user_id: current_user)\n end\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservation_details = ReservationDetail.all\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @reservation }\n end\n end", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @reservations = Reservation.paginate :page => params[:page] || 1, :per_page => limit, :conditions => [\"user_id = ? AND historical = ?\", session[:user_id], 0], :order => \"id\"\n\n respond_to do |format|\n format.xml { render :xml => @reservations }\n format.any { render :json => @reservations }\n end\n end", "def show\n @reservation = Reservation.new\n end", "def show\n @reservation = Reservation.new\n end", "def show\n @reservation = Reservation.new\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def index\n @reservations = Reservation.all\n @reservation_statuses = @@reservation_statuses\n end", "def load_reservation\n @reservation = Reservation.find(params[:id])\n end", "def show\n redirect_to reservations_path\n end", "def show\n reservation = Reservation.find(params[:id])\n render('show',:locals => {:reservation => reservation})\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve }\n end\n end", "def index\n @reservacions = Reservacion.all\n end", "def index\n @reservations = Reservation.all.paginate(:page => params[:page]).per_page(10)\n authorize! :index, :Reservations\n end", "def index\n scope = apply_scopes(Reservation)\n @reservations = scope.respond_to?(:to_a) ? scope.to_a : scope.all\n @reservations = @reservations.paginate(page: params['page'])\n end", "def new\n @reservation = Reservation.new\n @reservation.restaurant_id = params[:restaurant_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def preload\n today = Date.today\n reservations = @location.reservations\n .where(\n 'start_date >= ? ', today\n )\n .select('id, status, start_date')\n\n render json: reservations\n end", "def index\n @reserves = Reserve.all\n end", "def index\n @reservationdetails = @reservation.reservationdetails\n end", "def index\n @tool_reservations = ToolReservation.all\n end", "def index\n @customer_reservations = CustomerReservation.all\n end", "def index\n @reservations = current_user.reservations.joins(:menu_item).order('menu_items.date DESC, time_slot DESC')\n respond_with(@reservations)\n end", "def index\n @employee_reservations = Employee::Reservation.all\n end", "def new\n @reservation = Reservation.new\n @outlet = params[:outlet]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reserf = Reserve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserf }\n end\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def show\n @search = @room.reservations.search(params[:q])\n @reservations = @search.result.where(\"initial_date > ?\", Date.today).paginate(:page => params[:page], :per_page => 4)\n end", "def show\n @reservation = Reservation.new\n begin\n @current_reservation = Reservation.where(\n vacation_property_id: @vacation_property.id, \n guest_phone: @user.phone_number,\n status: 1)\n .first \n rescue Exception => e\n puts \"e.message\"\n end\n end", "def index\n @space_reservations = SpaceReservation.all\n end", "def show\n\t\t@reservations = Reservation.where(listing_id: @listing.id)\n\t\t# @listing = Listing.search(params[:search], params[:city])\n\n\tend", "def reservations(base = self.date_from)\n\t\t\t\t\t@reservations = {} if @reservations.nil?\n\t\t\t\t\tif @reservations[base.to_s].nil?\n\t\t\t\t\t\t@reservations[base.to_s] = RicReservation.reservation_model.event(self, base)\n\t\t\t\t\tend\n\t\t\t\t\treturn @reservations[base.to_s]\n\t\t\t\tend", "def index\n @reservationcs = Reservationc.all\n end", "def show\n @reserved_date = ReservedDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserved_date }\n end\n end", "def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n else\n redirect_to root_url, alert: \"Please, sign in!\" \n end\n end", "def index\n @phone_reservations = PhoneReservation.all\n end", "def show\n model = Reservation.find(params[:id])\n @reservation = ReservationDecorator.decorate(model)\n @conflicts = ReservationDecorator.decorate_collection(Reservation.conflicting(model))\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def your_reservations\n @rooms = current_user.rooms\n @reservations = Reservation.all\n end", "def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end" ]
[ "0.77576584", "0.74549264", "0.74549264", "0.7452395", "0.74343014", "0.74343014", "0.74343014", "0.74343014", "0.74343014", "0.74343014", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.74071085", "0.7223718", "0.71747077", "0.7110296", "0.70854115", "0.70854115", "0.70854115", "0.70750034", "0.7050435", "0.6969097", "0.6969097", "0.6944535", "0.6903432", "0.6845827", "0.6832575", "0.6816242", "0.6815372", "0.6812711", "0.6806492", "0.6789867", "0.6789867", "0.6789867", "0.67818004", "0.6755078", "0.67459184", "0.67323184", "0.67209595", "0.6702694", "0.6670917", "0.66431177", "0.6626938", "0.66057444", "0.65912426", "0.6563972", "0.6563972", "0.65620613", "0.65397", "0.653533", "0.6525023", "0.64919007", "0.6465728", "0.6417069", "0.6397393", "0.63962084", "0.63914555", "0.63783574", "0.63728637", "0.635557", "0.6349852", "0.6310007", "0.6308476", "0.63045716", "0.6294337", "0.629175", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6278079", "0.6276986", "0.62716854", "0.6267331", "0.6262701", "0.6262531", "0.6221877", "0.6208236", "0.6189897", "0.61834925", "0.61599016", "0.61571836", "0.6151909", "0.6148922" ]
0.0
-1
POST /reservations POST /reservations.json
def create if current_user.check_reservations return redirect_back(fallback_location: root_url,alert: "You already have #{Variable.find_by_name("MAX_RESERVATIONS").value} reservations in progress. Please deliver one of these first to make more reservations.") else @reservation = Reservation.new(reservation_params) ending_time = (@reservation.job.duration / Variable.find_by_name("RESERVATION_FACTOR").value.to_f)*24*60*60 @reservation.ending_time = Time.now + ending_time @reservation.status = "LIVE" job = @reservation.job @reservation.amount = @reservation.job.amount respond_to do |format| if @reservation.save @reservation.job.update(status: "RESERVED") TimerJob.set(wait_until: @reservation.ending_time).perform_later(@reservation,"LIVE") format.html { redirect_to @reservation, notice: "Job reserved successfully." } format.json { render :show, status: :created, location: @reservation } else format.html { render :new } format.json { render json: @reservation.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create_reservations\n Time.use_zone(@timezone) do\n @reservations = build_reservations\n return nil unless @reservations.any?\n @reservations = commit_reservations(@reservations)\n return nil unless valid? && @reservations.all?(&:persisted?)\n charge(@reservations) && @reservations.each(&:reload) if @pay\n track(@reservations)\n\n @reservations\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n render json: reservations\n end", "def create\r\n @reservation = Reservation.new(reservation_params)\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation_room = ReservationRoom.new(reservation_room_params)\n @reservations = Reservation.all\n \n respond_to do |format|\n if @reservation_room.save\n format.html { redirect_to @reservation_room, notice: 'La habitacion se ha asignado a la reserva correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation_room }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render 'api/reservations/show'\n else\n render json: @reservation.errors.full_messages, status: 422\n\n end \n\n\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @reservation.user = current_user\n @reservation.flight = flight\n\n if @reservation.save\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @reservation.apartment_id = @apartment.id\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Apartamento Reservado.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def create\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @reservation.requester = current_user\n if params[:reservation][:nook_id]\n @nook = Nook.find(params[:reservation][:nook_id])\n @reservation.nook = @nook\n end\n\n respond_to do |format|\n if @reservation.save\n format.html {\n flash[:notice] = t('reservations.submitted')\n if request.xhr?\n render text: nooks_url\n else\n redirect_to nooks_path\n end\n }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = @brewery.reservations.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { notification }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n reservation = Reservation.new(reserve_params)\n respond_to do |format|\n if reservation.update(reserve_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @reservation = Reservation.new(reservation_params)\n @reservation = current_user.reservations.create!(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n # current_user.book! @reservation\n end", "def create\n @reservation = V2::Reservation.new(reservation_params)\n if @reservation.save\n flash[:notice] = \"An interview has been booked for #{@reservation.time_slot.start_datetime_human}\"\n send_notifications(@reservation)\n else\n flash[:error] = \"No time slot was selected, couldn't create the reservation\"\n end\n @available_time_slots = []\n @person = @reservation.person\n respond_to do |format|\n format.js {}\n format.html { render :new }\n end\n end", "def create\r\n @reservation = Reservation.new(reservation_params)\r\n @reservation.user = current_user\r\n\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def create\n @employee_reservation = Employee::Reservation.new(employee_reservation_params)\n\n respond_to do |format|\n if @employee_reservation.save\n format.html { redirect_to @employee_reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @employee_reservation }\n else\n format.html { render :new }\n format.json { render json: @employee_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end", "def create\n res = Reservation.create(\n row: params[:row],\n col: params[:col],\n user_id: params[:user_id], # DON'T DO THIS! Use current_user\n flight_id: params[:flight_id]\n )\n\n if res.persisted?\n # Send back the reservation object that was successfully created\n render json: res\n else\n # Send back an error hash, including the ActiveRecord validation error messages\n render json: { error: true, messages: res.errors.full_messages }\n end\n end", "def create\n @reserve = Reserf.new(reserf_params)\n\n respond_to do |format|\n if @reserve.save\n format.html { redirect_to @reserve, notice: 'Reserf was successfully created.' }\n format.json { render :show, status: :created, location: @reserve }\n else\n format.html { render :new }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def create\n reservation_id = SecureRandom.uuid\n\n Reservation::Worker::Process.perform_async(reservation_id, Time.zone.now.to_i, reservation_params)\n\n render json: { reservation_id: reservation_id }, status: 200\n end", "def create \n p_name = params[:reservation][:name]\n p_amount_people = params[:reservation][:amount_people]\n p_year1 = params[:reservation][\"arrive_date(1i)\"].to_i\n p_month1 = params[:reservation][\"arrive_date(2i)\"].to_i\n p_day1 = params[:reservation][\"arrive_date(3i)\"].to_i\n p_year2 = params[:reservation][\"departure_date(1i)\"].to_i\n p_month2 = params[:reservation][\"departure_date(2i)\"].to_i\n p_day2 = params[:reservation][\"departure_date(3i)\"].to_i\n p_needs = params[:reservation][:needs].split(' ')\n p_activities = params[:reservation][:activities].split(' ')\n\n @reservation = Reservation.new(\n username: @username_actual,\n name: p_name,\n amount_people: p_amount_people,\n arrive_date: Date.new(\n p_year1,\n p_month1,\n p_day1\n ),\n departure_date: Date.new(\n p_year2,\n p_month2,\n p_day2\n ),\n needs: p_needs,\n activities: p_activities\n )\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agenda_reserv_resource = Agenda::ReservResource.new(agenda_reserv_resource_params)\n if @agenda_reserv_resource.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n EventNotification.notify_admin(@reservation).deliver\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def reservations\n @reservations ||= flight.reservations\n end", "def create\n @reservation = Reservation.new(reservation_params) \n respond_to do |format|\n if @reservation.save\n\n Reservation.last.reservation_rooms.each do |reservation|\n #Cambio el estado de la habitacion\n reservation.update({start: reservation.check_in, end: (reservation.check_out.to_date)+1,title: \"Reserva: \"+Room.find(reservation.room_id).identificador ,textColor: \"#ffffff\"})\n #Le pongo check_in y check_out para el calendario\n Room.find(reservation.room_id).update({state_id: 3})\n end\n\n format.html { redirect_to reservations_path(), notice: 'Reservacion creada exitosamente.' }\n #format.json { render :show, status: :created, location: @reservation }\n else\n #@my_reservation_requests = ReservationRequest.find(reservation_params[:reservation_request_id])\n #@reservation.reservation_requests.build()\n @reservation.reservation_rooms.build() \n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n # to help with creation errors:\n @reservation.customer = current_customer \n @reservation.restaurant = @restaurant \n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = @space.reservations.build(reservation_params.merge(user: authed_user))\n\n respond_to do |format|\n if @reservation.save\n ReservationMailer.created_email(@reservation, root_url.gsub(/\\/$/, '')).deliver_later\n format.html { redirect_to [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation], notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation] }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reserf = Reserve.new(params[:reserf])\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to @reserf, notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n write_log(\"in create -\\n\")\n @reservation = Reservation.new(reservation_params)\n @user = User.find(session[:current_user_id])\n respond_to do |format|\n if @reservation.save\n UserMailer.reservation_confirmation(@user, @reservation).deliver\n UserMailer.car_repair_appointment(@user, @reservation).deliver\n\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @reservation = Reservation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def create\n @user = User.user_by_token(request.cookies[\"token\"])\n return unless valid_form?\n\n @reservation = Reservation.new(reservation_params)\n @reservation.user = @user\n\n render json: { error: \"The time selected is not available.\" }, status: :unauthorized and return unless valid_time?\n render json: { error: \"Reservation time too long.\" }, status: :unauthorized and return false unless valid_length?\n unless valid_vaccine?\n render json: { error: \"You must be vaccinated to use this amenity.\" }, status: :unauthorized and return false\n end\n\n save_reservation\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n\n # UserMailer.booking_create(current_user, @reservation).deliver\n # OwnerMailer.booking_create(@reservation).deliver\n\n Reward.create( user_id: @reservation.user_id, \n reservation_id: @reservation.id, \n points_total: 5*@reservation.party_size, \n points_pending: 5*@reservation.party_size, \n description: \"\")\n \n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reserf = Reserve.new(reserf_params)\n @reserf.busy = true\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to root_path, notice: 'Reserve was successfully created.' }\n format.json { render :show, status: :created, location: @reserf }\n else\n format.html { render :new }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n if user_signed_in?\n @reservation.user_id = current_user.id\n elsif owner_signed_in?\n @reservation.owner_id = current_owner.id\n @reservation.restaurant = current_owner.restaurant\n end\n\n respond_to do |format|\n if @reservation.save\n\n if user_signed_in?\n Reward.create( user_id: @reservation.user_id, \n reservation_id: @reservation.id, \n points_total: 5*@reservation.party_size, \n points_pending: 5*@reservation.party_size, \n description: \"\")\n end\n \n if user_signed_in?\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { redirect_to root_url, notice: 'Reservation was successfully created.' }\n end\n\n # UserMailer.booking_create(current_user, @reservation).deliver\n # OwnerMailer.booking_create(@reservation).deliver\n else\n format.html { render action: \"new\" }\n # format.html { redirect_to new_reservation_path(reservation: params[:reservation]) }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.status = \"Pending\"\n @reservation.user = current_user\n\n place = Place.find_by_id(params[:reservation][:place_id])\n\n @reservation.object_resources << place.object_resources if place\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservacion = Reservacion.new(reservacion_params)\n\n respond_to do |format|\n if @reservacion.save\n format.html { redirect_to @reservacion, notice: 'Su solicitud fue realizada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @reservacion }\n else\n format.html { render :new }\n format.json { render json: @reservacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agenda_reservation = Agenda::Reservation.new(agenda_reservation_params)\n if @agenda_reservation.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n end", "def create\n sr = SeatReservation.reserve_seat(@customer, params[:seat_id])\n\n # NJS - what to return back? just a success msg?\n respond_to do |format|\n format.json { render json: {reservation_id: sr.id}} \n end\n end", "def index\n @reservations = @apartment.reservations.all\n end", "def reservation_params\n params.require('reservation').permit('user_id', 'event_id')\n end", "def create\n @reservation = Reservation.new(reservation_params)\n @user = current_user\n @date = (@reservation.reserved_on).to_formatted_s(:long_ordinal)\n @date_of_return = (@reservation.reserved_on + 1.month).to_formatted_s(:long_ordinal)\n respond_to do |format|\n if @reservation.save\n ReservationMailer.create_reservation_notifier(@user, @date, @date_of_return).deliver\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def reservation_params\n params.require(:reservation).permit(:user_id, :listing_id, :start_date, :end_date, :guest_number, :verified)\n end", "def create\n\n @reservation = Reservation.new(reservation_params)\n\n @passenger = Passenger.new\n @passengers = Passenger.all\n @enterprise = Enterprise.new\n @enterprises = Enterprise.all\n @rooms = Room.all\n @groups = Group.all\n @room_types = RoomType.all\n\n respond_to do |format|\n if @reservation.guardar( new_reservation_rooms )\n format.html { redirect_to @reservation, notice: 'La reserva se ha registrado correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reservations = @user.reservations\n @reservations_json = []\n @reservations.each do |r|\n ro = r\n r = r.as_json\n %w{arrived email no_show owner_id}.each {|k| r.delete(k)}\n r[:start_time] = ro.start_time_format\n r[:end_time] = ro.end_time_format\n @reservations_json << r\n end\n\n render json: @reservations_json, status: 200 \n end", "def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.js\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else \n format.js\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Reservation.transaction do\n @reservation = Reservation.new(reservation_params)\n @reservation.room.lock!\n\n respond_to do |format|\n if @reservation.save\n @invoke_slack_webhook = true\n format.html { redirect_to @reservation, notice: '予約を登録しました' }\n format.json { render :show, status: :created, location: @reservation }\n if @reservation.room_id == 0 && !ENV[\"SCHEDULE_EMAIL_ADDRESS\"].blank?\n ScheduleMailer.schedule_mail(@reservation).deliver_now\n end\n else\n @invoke_slack_webhook = false\n format.html do\n set_rooms\n render :new\n end\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def reservation_params\n params.require(:reservation).permit(:name, :amount_people, :arrive_date, :departure_date, :needs, :activities)\n end", "def create\n format_time_input\n check_input\n @reservation = Reservation.new(reservation_params)\n @reservation.status = :requested\n respond_to do |format|\n # TODO: Duplication\n if @conflicts.any?\n respond_to_conflicts :new, format\n elsif @reservation.save\n notify_approval_needed\n respond_to_update format\n else\n respond_to_errors :new, format\n end\n end\n end", "def create\n @reservation_detail = ReservationDetail.new(reservation_detail_params)\n\n respond_to do |format|\n if @reservation_detail.save\n format.html { redirect_to @reservation_detail, notice: \"Reservation detail was successfully created.\" }\n format.json { render :show, status: :created, location: @reservation_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_member_ids = Member.where(group_id: group.id).pluck(:user_id)\n unless group_member_ids.include?(@current_user.id)\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render json: @reservation, status: :created\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create\n @reservation_owner = ReservationOwner.new(reservation_owner_params)\n\n respond_to do |format|\n if @reservation_owner.save\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully created.' }\n format.json { render :show, status: :created, location: @reservation_owner }\n else\n format.html { render :new }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n total_due = @reservation.get_total_due\n @reservation[:total_due] = total_due\n @reservation.save\n\n respond_to do |format|\n\n if @reservation.persisted?\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, include:['property'] }\n else\n format.html { render :new }\n format.json { render json: { status: 401, errors: @reservation.errors } }\n\n # for the API create\n # headers['Access-Control-Allow-Origin'] = '*'\n # reservation = Reservation.create reservation_params\n #\n # render json: reservation, include: ['flight', 'user']\n end\n end\n end", "def index\n @reservations = @bus.reservations\n end", "def reservation_params\n params.require(:reservation).permit(:user_id, :restaurant_id, :seats, :date, :time)\n end", "def create\n @reservationdetail = Reservationdetail.new(reservationdetail_params)\n\n respond_to do |format|\n if @reservationdetail.save\n format.html { redirect_to reservation_reservationdetail_url(@reservation, @reservationdetail), notice: 'Reservationdetail was successfully created.' }\n format.json { render :show, status: :created, location: @reservationdetail }\n else\n format.html { render :new }\n format.json { render json: @reservationdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def reserve(*args)\n @reservations << Reservation.new(self, *args)\n end", "def reservation_params\n params.require(:reservation).permit(:from_date, :to_date, :property_id, :guests_count, :booking_code)\n end", "def create\n=begin temp = params[:reserf]\n temp[\"roomname\"] = params[:room][\"roomname\"]\n @reserf = Reserve.new(temp)\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to result_path(@reserf), notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def create\n \treserve_params = params[:reservation]\n @reserve = current_user.reservations.new(:category_id => reserve_params[:category_id], :date_in => reserve_params[:date_in], :date_out => reserve_params[:date_out], :room_id => reserve_params[:room_id])\n reserved = Reservation.is_reserved(reserve_params[:room_id],reserve_params[:date_in],reserve_params[:date_out])\n unless reserved\n respond_to do |format|\n if @reserve.save\n format.html { redirect_to myrooms_path, notice: 'Room has been booked' }\n format.json { render :show, status: :created, location: @reserve }\n else\n format.html { render :new }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to myrooms_path, notice: 'The Room is already Booked' }\n end\n end\n end", "def create\n @space_reservation = SpaceReservation.new(space_reservation_params)\n\n respond_to do |format|\n if @space_reservation.save\n format.html { redirect_to @space_reservation, notice: 'Space reservation was successfully created.' }\n format.json { render :show, status: :created, location: @space_reservation }\n else\n format.html { render :new }\n format.json { render json: @space_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_back_or_default home_url }\n #format.html { redirect_to(@reservation, :notice => 'Reservation was successfully created.') }\n format.xml { render :xml => @reservation, :status => :created, :location => @reservation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def reservation_params\n params.require(:reservation).permit(:user_id, :restaurant_id, :time, :date, :head_count,\n :special_request, :cancel)\n end", "def reservation_params\n params.require(:reservation).permit(:start_at, :end_at, :usage)\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def reservation_params\n params.require(:reservation).permit(:reserved_on, :book_id, :user_id)\n end", "def reservation_params\n params.require(:reservation).permit(:passenger_id, :enterprise_id, :amount, :observation)\n end", "def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def reservation_params\n params.require(:reservation).permit(:name, :start, :end, :description,\n :url, :stream_url, :notes)\n end", "def reservation_params\n params.require(:reservation).permit(:beginning_date, :ending_date, :rate, :host_id, :booking_id)\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n\n @reservation.assign_attributes(:user_id => current_user.try(:id))\n \n respond_to do |format|\n if @reservation.save\n ReservationMailer.notification(@reservation, @reservation.user).deliver\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @reservation = Reservation.new\n @outlet = params[:outlet]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def create\n @reserved = Reserved.new(reserved_params)\n\n respond_to do |format|\n if @reserved.save\n format.html { redirect_to @reserved, notice: 'Reserved was successfully created.' }\n format.json { render :show, status: :created, location: @reserved }\n else\n format.html { render :new }\n format.json { render json: @reserved.errors, status: :unprocessable_entity }\n end\n end\n end", "def reservation_params\n params.require(:reservation).permit(:user_id, :resource_id, :start_time, :end_time, :resource_id)\n end", "def make_reservation\n \n node_obj = Nodes.new\n hash_details_of_resources = node_obj.get_details_of_resources\n \n # finds which resources are for reservation\n ids = []\n reservations = []\n reservations = params[:reservations]\n # puts \"Autes einai oi krathseis pou thelw na kanw\"\n # puts reservations\n\n # control for empty request for reservation\n reservation_table = []\n if reservations == nil \n redirect_to :back\n flash[:danger] = \"You must select a timeslot to make a reservation. Please try again\" \n else\n\n #control for up to 8 timeslots reservation \n\n hash_num_limition = Hash.new\n reservations.each do |element|\n hash_num_limition[element.split('/')[0]] = 0 \n end\n\n reservations.each do |element|\n hash_num_limition[element.split('/')[0]] = hash_num_limition[element.split('/')[0]]+1\n end\n\n flag_limit = false\n hash_num_limition.each_value do |value|\n if value>8\n flag_limit = true\n break\n end\n end\n\n if flag_limit == true\n redirect_to :back\n flash[:danger] = \"Please choose at most 8 timeslots for every resource.\" \n else\n #control for forgotten timeslots \n old_timeslot = false\n reservations.each do |reservation|\n if reservation.split('/')[1] <= Time.zone.now.to_s[0...-9]\n old_timeslot = true\n break\n end\n end\n \n if old_timeslot == true\n redirect_to :back\n flash[:danger] = \"Please select a time from now on\" \n else\n\n \n # Checks if there is two different dates of reservations (case of 24hours schedule) and keeps the shorter\n reservation_date_num = 0\n reservation_date = \"\"\n reservations.each do |reservation|\n date = reservation.split('/')[1][0...-6]\n if date != reservation_date\n if date < reservation_date && reservation_date != \"\"\n reservation_date = date\n reservation_date_num +=1\n elsif reservation_date == \"\"\n reservation_date = date\n reservation_date_num +=1\n end\n \n end\n end\n\n reservations.each do |reservation|\n if !ids.include?(reservation.split('/')[0])\n ids << reservation.split('/')[0]\n end\n end\n\n puts \"reservation_date_num\"\n puts reservation_date_num\n\n # constructs a table with the reservations. 1 for selected timeslot and 0 for non-selected\n if reservation_date_num >= 2 || reservation_date == Time.zone.today.to_s\n\n today = Time.zone.today.to_s\n tomorrow = (Time.zone.today + 1.day).to_s\n time_now = Time.zone.now.to_s.split(\" \")[1][0...-3]\n\n #Upologismos gia sthles\n columns = Array.new(48)\n columns[0]= \"Name\"\n (0..47).each do |n|\n if (n % 2 == 0) \n columns[n+1] = \"#{n<20 ? \"0#{n / 2}\" : n / 2}:00\"\n else\n columns[n+1] = \"#{n<20 ? \"0#{n / 2}\" : n / 2}:30\"\n end\n end\n\n today_and_tommorow_columns = []\n today_and_tommorow_columns << \"Name\"\n\n columns.each do |element|\n if element > time_now && element != \"Name\"\n today_and_tommorow_columns << today + \" \" + element \n end\n end\n\n columns.each do |element|\n if element <= time_now && element != \"Name\" \n today_and_tommorow_columns << tomorrow + \" \" + element\n end\n end\n\n #Upologismos gia rows\n rows = Array.new(ids.length){Array.new(49,0)}\n rows.each_index do |i|\n rows[i][0] = ids[i]\n end\n\n reservation_table = rows.map{|r| Hash[ *today_and_tommorow_columns.zip(r).flatten ] }\n else\n ids.each_index do |i|\n h = Hash.new\n r_name = ids[i]\n h[\"Name\"] = r_name\n (0..47).each do |n|\n if (n % 2 == 0) \n h[\"#{reservation_date}#{n<20 ? \" 0#{n / 2}\" : \" #{n / 2}\"}:00\"] = 0\n else\n h[\"#{reservation_date}#{n<20 ? \" 0#{n / 2}\" : \" #{n / 2}\"}:30\"] = 0\n end\n end\n #if the last half hour of a day selected, we reserve a node until \"23:59\" \n h[reservation_date + \" 23:59\"] = 0\n reservation_table << h\n end\n end\n #Sumplhrwnw o kathe hash me tis krathseis \n reservation_table.each do |element|\n reservations.each do |reservation|\n if reservation.split('/')[0] == element[\"Name\"]\n element[reservation.split('/')[1]] =1\n end\n end\n end\n puts ids\n\n \n # array_with_reservations: table filled with hashes of the reservations to be done \n array_with_reservations = []\n num = 0\n #Compute valid_from and valid_until for each reservation request \n valid_from = \"\"\n valid_until = \"\"\n puts \"Auto einai to reservation table afou to gemisw\"\n puts reservation_table.inspect\n reservation_table.each do |element|\n element.each do |key,value|\n #puts key\n #puts value\n if num ==0\n if value ==1\n #puts \"mpika \"\n valid_from = key\n #puts valid_from\n num += 1\n end\n else \n if value ==0\n valid_until = key\n #stelnw krathsh \n #element[\"Name\"]\n\n valid_from = valid_from + \":00 \" #+ Time.zone.now.to_s.split(' ')[2]\n valid_from = Time.zone.parse(valid_from)\n valid_until = valid_until + \":00 \" #+ Time.zone.now.to_s.split(' ')[2]\n valid_until = Time.zone.parse(valid_until)\n #reserveNode(node_list_uuids[element[\"Name\"]],params[:user_slice],valid_from,valid_until)\n \n h = Hash.new\n h = {\"valid_from\" => valid_from, \"valid_until\"=> valid_until, \"resources\"=> [hash_details_of_resources[element[\"Name\"]][\"uuid\"]] }\n if array_with_reservations.length == 0\n array_with_reservations << h\n else\n flag = 0\n array_with_reservations.each do |reservation|\n if reservation[\"valid_from\"] == valid_from && reservation[\"valid_until\"] == valid_until && !reservation[\"resources\"].include?(hash_details_of_resources[element[\"Name\"]][\"uuid\"])\n reservation[\"resources\"] << hash_details_of_resources[element[\"Name\"]][\"uuid\"]\n flag =1\n break \n end\n end\n if flag == 0\n array_with_reservations << h\n end\n end\n puts \"Tha kanw krathsh me valid_from\"\n puts valid_from\n puts \"kai valid_until\"\n puts valid_until\n # puts \"Gia ton \"+element[\"Name\"] + \"me uuid=\" + @node_list_uuids[element[\"Name\"]]\n num = 0\n end\n end\n end\n end\n puts \"\"\n puts \"Auto einai to array me ta reservation pou prepei na ginoun\"\n puts array_with_reservations\n\n # Making reservations\n results_of_reservations = []\n array_with_reservations.each do |reservation|\n results_of_reservations << reserveNode(reservation[\"resources\"],params[:user_slice],reservation[\"valid_from\"],reservation[\"valid_until\"])\n end\n \n flash_msg = []\n results_of_reservations.each do |result|\n if !result.to_s.include?(\"OK\") \n flash_msg << result.to_s \n end\n end \n if flash_msg.length !=0\n flash[:danger] = flash_msg\n else\n flash[:success] = \"Successful reservation!\"\n end\n redirect_to :back \n end\n\n end\n\n \n end \n end" ]
[ "0.719537", "0.71615386", "0.71431714", "0.71431714", "0.7130943", "0.7123144", "0.7095066", "0.7020095", "0.6983413", "0.69494253", "0.6922912", "0.6906279", "0.6906279", "0.68949294", "0.68930775", "0.68813384", "0.68267894", "0.680376", "0.6786492", "0.6770697", "0.6745307", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.6724186", "0.67003334", "0.66393363", "0.66373044", "0.663462", "0.65956914", "0.65956914", "0.65785986", "0.6577954", "0.6576728", "0.6552932", "0.6528571", "0.65274626", "0.6508525", "0.649807", "0.6480933", "0.6477005", "0.64664584", "0.6465682", "0.6465682", "0.6465682", "0.6463593", "0.64626384", "0.645702", "0.645386", "0.6446432", "0.6440164", "0.643775", "0.642031", "0.6419134", "0.6412188", "0.64030594", "0.6399691", "0.63983345", "0.6396404", "0.63910913", "0.63882583", "0.63875705", "0.6386689", "0.6385739", "0.6375018", "0.63693273", "0.6358387", "0.6347417", "0.63253057", "0.6323406", "0.6311516", "0.6304701", "0.63016695", "0.62960124", "0.6294429", "0.6291838", "0.62898266", "0.62516797", "0.62515575", "0.6249649", "0.6239163", "0.62386435", "0.6235167", "0.62264866", "0.62239546", "0.6215581", "0.6210186", "0.619897", "0.6196185", "0.6194997" ]
0.0
-1
PATCH/PUT /reservations/1 PATCH/PUT /reservations/1.json
def update respond_to do |format| if @reservation.update(reservation_params) if params[:reservation][:status] == "LIVE" # TimerJob.set(wait_until: @reservation.ending_time).perform_later(@reservation,"LIVE") elsif params[:reservation][:status] == "DELIVERED" Notif.create(event: "<a href='#{reservation_url(@reservation.slug)}'>Worker has delivered the work of a reservation.</a>",user_id: @reservation.job.user.id) elsif params[:reservation][:status] == "INREVISION" Notif.create(event: "<a href='#{reservation_url(@reservation.slug)}'>Employer asked for a Revision.</a>",user_id: @reservation.user.id) elsif params[:reservation][:status] == "COMPLETED" PayoutJob.perform_later(@reservation,"COMPLETED") elsif params[:reservation][:status] == "REJECTED" PayoutJob.perform_later(@reservation,"REJECTED") end format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' } format.json { render :show, status: :ok, location: @reservation } else format.html { render :edit } format.json { render json: @reservation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @reservation.update(reservation_params)\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def update\n @reservation = current_user.reservations.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @reservation.update(reservation_add_params)\n render :json => @reservation, status: :ok\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to request.referer, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts @reservation.inspect\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: \"Reservation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @reservation.update(reservation_params)\n render :show, status: :ok, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n respond_to do |format| \n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else \n format.js {render 'new'}\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { notification(false) }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @reservation.update(reservation_params)\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @reservation }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\r\n respond_to do |format|\r\n if @reservation.update(reservation_params)\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @reservation }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, :flash => {:success => 'Reservation was successfully updated.'} } \n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n respond_to do |format|\n if request.format == :json\n @reservation.update_attributes(:start_time => params[:event][:start_time], :end_time => params[:event][:end_time])\n elsif @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation, :formats => [:html] }\n else\n format.html { render :edit }\n #format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Reserva Actualizada.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(reservation_params)\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to university_library_reservations_path, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n format_time_input\n check_input\n respond_to do |format|\n # TODO: Duplication\n if @conflicts.any?\n respond_to_conflicts :edit, format\n elsif @reservation.update(reservation_params)\n notify_approval_needed\n respond_to_update format\n else\n respond_to_errors :edit, format\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to venue_reservation_url, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation.session, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation_request.update(reservation_request_params)\n format.html { redirect_to @reservation_request, notice: 'Reservation fue Actualizada.' }\n format.json { render :show, status: :ok, location: @reservation_request }\n else\n format.html { render :edit }\n format.json { render json: @reservation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n \n UserMailer.booking_update(current_user, @reservation).deliver\n OwnerMailer.booking_update(@reservation).deliver\n\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to(@reservation, :notice => 'Reservation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation]) and @reservation.sync\n format.html { redirect_to(@reservation, :notice => 'Reservation was successfully updated.') }\n format.json { render :json => @reservation, :include => :image }\n format.xml { render :xml => @reservation, :include => :image }\n else\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n format.any { render :json => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee_reservation.update(employee_reservation_params)\n format.html { redirect_to @employee_reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_reservation }\n else\n format.html { render :edit }\n format.json { render json: @employee_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation_detail.update(reservation_detail_params)\n format.html { redirect_to @reservation_detail, notice: \"Reservation detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reservation_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reservation_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_reservation.update(vehicle_reservation_params)\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vehicle_reservation }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[\"id\"])\n @reservation.update(reservation_params)\n redirect_to reservations_path\n end", "def update\n @reserf = Reserve.find(params[:id])\n @reserf.status = \"confirm\"\n respond_to do |format|\n if @reserf.update_attributes(params[:reserf])\n format.html { redirect_to reserves_path, notice: 'Reserve was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n\n #redirect_to reserves_path\n end", "def update\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n if @reserf.update_attributes(params[:reserf])\n format.html { redirect_to @reserf, notice: 'Reserve was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n if user_signed_in?\n @reservation.user_id = current_user.id\n elsif owner_signed_in?\n @reservation.owner_id = current_owner.id\n @reservation.restaurant = current_owner.restaurant\n end\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n \n # UserMailer.booking_update(current_user, @reservation).deliver\n # OwnerMailer.booking_update(@reservation).deliver\n\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render json: @reservation }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def update\n reservation = Reservation.find(params[:id])\n respond_to do |format|\n if reservation.update(car_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reserf.update(reserve_params)\n format.html { redirect_to @reserf, notice: 'Reserve was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserf }\n else\n format.html { render :edit }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @reservation = Reservation.find(params[\"id\"])\n render :edit\n end", "def update\n respond_to do |format|\n if @reservation_owner.update(reservation_owner_params)\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation_owner }\n else\n format.html { render :edit }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservationdetail.update(reservationdetail_params)\n format.html { redirect_to reservation_reservationdetail_url(@reservation, @reservationdetail), notice: 'Reservationdetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservationdetail }\n else\n format.html { render :edit }\n format.json { render json: @reservationdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n if user_signed_in?\n @reservation.user_id = current_user.id\n elsif owner_signed_in?\n reservation_status = params[:reservation].delete(:status)\n set_reservation_status(reservation_status)\n @reservation.owner_id = current_owner.id\n @reservation.restaurant = current_owner.restaurant\n end\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n \n # UserMailer.booking_update(current_user.id, @reservation.id).deliver\n # OwnerMailer.booking_update(@reservation.id).deliver\n\n format.html { redirect_to :back ,\n notice: 'Reservation was successfully updated.'\n } #redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render json: @reservation }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tool_reservation.update(tool_reservation_params)\n format.html { redirect_to @tool_reservation, notice: 'Tool reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @tool_reservation }\n else\n format.html { render :edit }\n format.json { render json: @tool_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @reservation\n respond_to do |format|\n #Shouldn't accept new kit, after being returned\n if(@reservation.picked_up == true)\n @reservation.errors.add(:kit_id, \"Cannot change kit after kit has been picked up\")\n format.html { render :edit }\n end\n\n\n #If the kit has been changed, then we need to un-reserve the old one\n #Reserve the new one\n save_kit_id = nil\n\n if(params[:kit_id] != @reservation.kit_id)\n save_kit_id = @reservation.kit_id\n Kit.find(params[:kit_id]).set_reserved\n @reservation.kit.unset_reserved\n end\n\n\n\n if @reservation.update(reservation_params)\n if(save_kit_id != nil)\n #Kit was changed, and was saved\n Kit.find(save_kit_id).unset_reserved\n end\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n #Change not accepted, unreserve kit\n Kit.find(params[:kit_id]).unset_reserved\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Reservation.transaction do\n respond_to do |format|\n @reservation.attributes = reservation_params\n @reservation.room.lock!\n room_or_time_changed =\n @reservation.room_id_changed? || @reservation.start_at_changed?\n\n if @reservation.weekly? && (request.xhr? || params[:only_day])\n reservation_cancel =\n ReservationCancel.create!(reservation: @reservation,\n start_on: params[:date])\n @reservation = @reservation.dup\n @reservation.repeating_mode = \"no_repeat\"\n end\n\n if @reservation.save\n @invoke_slack_webhook = room_or_time_changed\n format.html {\n # Use reservation_url to avoid a brakeman warning.\n redirect_to reservation_url(@reservation),\n notice: '予約を更新しました'\n }\n format.json { render :show, status: :ok, location: @reservation }\n else\n reservation_cancel.destroy if reservation_cancel\n @invoke_slack_webhook = false\n format.html do\n set_rooms\n render :edit\n end\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @observations.update(obersvation_params)\n format.html { redirect_to @obersvation, notice: 'Obersvation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obersvation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n puts \"HACE ALGOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\"\n if !params[:reserva][:tipo_reserva].blank?\n @tipo_reserva = TipoReserva.find(params[:reserva][:tipo_reserva])\n @reserva.tipo_reserva = @tipo_reserva\n end\n\n if !params[:reserva][:habitacion].blank?\n @habitacion = Habitacion.find(params[:reserva][:habitacion])\n @reserva.habitacion = @habitacion\n end\n\n if !params[:reserva][:cliente].blank?\n @cliente = Cliente.find(params[:reserva][:cliente])\n @reserva.cliente = @cliente\n end\n if !params[:reserva][:confirmada].blank?\n @reserva.confirmada = params[:reserva][:confirmada]\n end\n if @reserva.update(reserva_params)\n format.html { redirect_to reservas_url, notice: 'Reserva modificada con exito.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n if @reservation_room.update(reservation_room_params)\n format.html { redirect_to @reservation_room, notice: 'Los datos de la reserva de la habitacion se han modificado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n #flash[:notice] = 'Réservation valide.'\n format.html { redirect_to(@reservation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phone_reservation.update(phone_reservation_params)\n format.html { redirect_to @phone_reservation, notice: 'Phone reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phone_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reserve_record.cancel_reserve\n format.html { redirect_to '/', notice: 'Reserve record was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserve_record }\n else\n format.html { redirect_to '/', notice: 'Something went wrong.' }\n format.json { render json: @reserve_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reserva atualizada com sucesso.' }\n\n @reservation.place.class_monitors.each do |monitor|\n NotifyUserMailer.reservation_made_to_class_monitor(@reservation, monitor).deliver\n end\n\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end", "def create\n reservation = Reservation.new(reserve_params)\n respond_to do |format|\n if reservation.update(reserve_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @reservation.update(reservation_params)\n redirect_to @reservation, notice: 'Reservation was successfully updated.'\n else\n render :edit\n end\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def update\n respond_to do |format|\n if @customer_reservation.update(customer_reservation_params)\n format.html { redirect_to [:admin, @customer_reservation], notice: 'Customer reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_reservation }\n else\n format.html { render :edit }\n format.json { render json: @customer_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @rooms = Room.all\n @groups = Group.all\n @passenger = Passenger.new\n @passengers = Passenger.all\n @enterprise = Enterprise.new\n @enterprises = Enterprise.all\n @room_types = RoomType.all\n\n @reservation.update_attributes( reservation_params )\n\n respond_to do |format|\n if @reservation.guardar( new_reservation_rooms )\n format.html { redirect_to @reservation, notice: 'Los datos de la reserva ha sido modificados correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def cancel\n @reservation.update(status: false)\n @reservation.seats.update(reserved: false)\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Reservation was successfully cancelled.' }\n format.json { head :no_content }\n end\n end", "def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end", "def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end", "def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end", "def update\n respond_to do |format|\n if @reserve.update(reserf_params)\n\t\t\t\treserve_update_hhv_llv(@reserve)\n format.html { redirect_to @reserve, notice: 'Reserf was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserve }\n else\n format.html { render :edit }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end", "def set_reservation\n @reservation = Reservation.find(params[:id])\n end" ]
[ "0.7111349", "0.68773746", "0.6858809", "0.6824269", "0.67877764", "0.67745304", "0.67740273", "0.6718256", "0.67057306", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.67049897", "0.6699124", "0.66741943", "0.66650313", "0.6624526", "0.66213566", "0.66213566", "0.6620026", "0.6616712", "0.6608498", "0.6595777", "0.6575397", "0.6523494", "0.650363", "0.64877695", "0.6467522", "0.6458182", "0.6458016", "0.64464873", "0.6444349", "0.64250106", "0.64058983", "0.63990885", "0.6387095", "0.6385627", "0.6377262", "0.6360442", "0.6360442", "0.6342406", "0.632101", "0.6267689", "0.6260044", "0.6205965", "0.6205835", "0.6170974", "0.6167696", "0.6166277", "0.61547375", "0.6143158", "0.61409295", "0.6111575", "0.610056", "0.60584486", "0.60577214", "0.6045226", "0.60448194", "0.60307574", "0.6028051", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.60253716", "0.6015276", "0.6006482", "0.5997684", "0.5985596", "0.5966197", "0.5966197", "0.5966197", "0.5954036", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845", "0.59418845" ]
0.0
-1
DELETE /reservations/1 DELETE /reservations/1.json
def destroy @reservation.destroy respond_to do |format| format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n reservation = Reservation.find(params[:id])\n if reservation\n reservation.destroy\n render json: reservation\n else \n render json: [\"Reservation doesnt exist\"], status: 404 \n end \n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = current_user.reservations.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Reservation.find(params[:id]).destroy\n #@reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservation_url(1), notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'La reserva fue eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to apartment_reservations_url(@apartment), notice: 'Reserva Eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n authorize! :manage, @reservation\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n\n respond_to do |format|\n format.html { redirect_to reserves_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @reservation.destroy\r\n respond_to do |format|\r\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to venue_reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_reservation.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_reservations_url, notice: 'Reserva excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to rooms_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to university_library_reservations_path, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if allowed?(action: \"reservation_destroy\", user: current_user)\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @reserve.destroy\n respond_to do |format|\n format.html { redirect_to reserf_url, notice: 'Reserf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserf.destroy\n respond_to do |format|\n format.html { redirect_to reserves_url, notice: 'Reserve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve.destroy\n respond_to do |format|\n format.html { redirect_to reserves_url, notice: 'Reserve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully cancelled.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation_detail.destroy\n respond_to do |format|\n format.html { redirect_to reservation_details_url, notice: \"Reservation detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone_reservation.destroy\n respond_to do |format|\n format.html { redirect_to phone_reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n reservation = Reservation.find(params[:id])\n reservation.destroy\n redirect_to request.referrer\n end\n end", "def destroy\n Reservation.delete(params[:id])\n redirect_to user_path(params[:user_id])\n end", "def destroy\n @reservation_request = ReservationRequest.find(params[:id])\n @reservation_request.destroy\n \n respond_to do |format|\n format.html { redirect_to reservation_requests_url }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to \"/calendar/index\", notice: '予約を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n @reservation.destroy\n\n \n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @reservation.requester == current_user\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to [@user, @brewery, @reservation], notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservationdetail.destroy\n respond_to do |format|\n format.html { redirect_to reservation_reservationdetails_url(@reservation), notice: 'Reservationdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation_room.destroy\n respond_to do |format|\n format.html { redirect_to reservation_rooms_url }\n format.json { head :no_content }\n end\n end", "def remove_reservation\n @reservation = Reservation.find(params[:id])\n @reservation.destroy!\n end", "def destroy\n @reservation.destroy\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n redirect_to reservations_url, notice: 'Reservation was successfully destroyed.'\n end", "def destroy\n @reservacion.destroy\n respond_to do |format|\n format.html { redirect_to reservacions_url, notice: 'Su Reservación fue eliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @tool_reservation.destroy\n respond_to do |format|\n format.html { redirect_to tool_reservations_url, notice: 'Tool reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @employee_reservation.destroy\n respond_to do |format|\n format.html { redirect_to employee_reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservationc.destroy\n respond_to do |format|\n format.html { redirect_to reservationcs_url, notice: \"Reservationc was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation_owner.destroy\n respond_to do |format|\n format.html { redirect_to reservation_owners_url, notice: 'Reservation owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n # @reservation.destroy\n \n respond_to do |format|\n format.html { redirect_to(:back) } #redirect_to reservations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @study_reservation.destroy\n respond_to do |format|\n format.html { redirect_to study_reservations_url, notice: 'Study reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rameur.reservations.each { |resa| resa.destroy if resa.rameurs.size == 1 }\n Reservation.where(responsable_id: @rameur.id).each { |resa| resa.destroy(responsable_id: nil) }\n @rameur.destroy\n respond_to do |format|\n format.html { redirect_to rameurs_url, notice: \"Rameur supprimé\" }\n format.json { head :no_content, status: :success }\n end\n end", "def destroy\n @reserva = Reserva.find(params[:id])\n @reserva.destroy\n respond_with @reserva, :location => admin_reservas_path\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @vehicle.reservations.present?\n redirect_to @vehicle, alert: 'Vehículo posee historial de reservas, no se puede eliminar'\n return\n end\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'El vehículo ha sido eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_reservation.destroy\n respond_to do |format|\n format.html { redirect_to space_reservations_url, notice: 'Space reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_reservation.destroy\n respond_to do |format|\n format.html { redirect_to admin_customer_reservations_url, notice: 'Customer reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agenda_reserv_resource.destroy\n index\n end", "def destroy\n @reserved.destroy\n respond_to do |format|\n format.html { redirect_to reserveds_url, notice: 'Reserved was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrival_range = ArrivalRange.find(params[:id])\n @arrival_range.destroy\n\n respond_to do |format|\n format.html { redirect_to arrival_ranges_url }\n format.json { head :no_content }\n end\n end", "def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end", "def destroy\n @odsreserf.destroy\n respond_to do |format|\n format.html { redirect_to odsreserves_url, notice: 'Odsreserf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @car = Car.find(params[:id])\n reservations = Reservation.where(car_id: @car.id)\n reservations.destroy_all\n @car.destroy\n flash[:success] = 'Car deleted.'\n redirect_to cars_url\n end", "def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n @form = Form.find(params[:id])\n @form.destroy\n respond_to do |format|\n format.html { redirect_to reserves_path, notice: 'Reserve was successfully deleted.' }\n format.json { head :no_content }\n \n end\n end", "def destroy\n @reservation2_room.destroy\n respond_to do |format|\n format.html { redirect_to reservation2_rooms_url, notice: 'Reservation2 room was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'La Reserva ha sido destruido totalmente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resident.destroy\n respond_to do |format|\n format.html { redirect_to residents_url, notice: 'Resident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reservation.destroy\n respond_to do |format|\n format.html {\n flash[:notice] = 'Reserva excluída com sucesso.'\n return redirect_to reservations_url unless @reservation.reservation_group\n redirect_to @reservation.reservation_group\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve.destroy\n #flash[:notice] = t('reserve.reservation_was_canceled')\n\n if @reserve.manifestation.is_reserved?\n if @reserve.item\n retain = @reserve.item.retain(User.find(1)) # TODO: システムからの送信ユーザの設定\n if retain.nil?\n flash[:message] = t('reserve.this_item_is_not_reserved')\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to reserves_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.reserve')) }\n format.json { head :no_content }\n end\n end", "def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end" ]
[ "0.7747309", "0.7607613", "0.7607613", "0.7607613", "0.7607613", "0.7567083", "0.7545028", "0.7545028", "0.7545028", "0.74918175", "0.7434657", "0.73913974", "0.73021823", "0.7298407", "0.7298407", "0.7295748", "0.72883016", "0.7283948", "0.7282211", "0.72298676", "0.7221215", "0.7201601", "0.71019673", "0.71007776", "0.709921", "0.7096219", "0.70960474", "0.7067007", "0.704871", "0.70227194", "0.70124245", "0.6977979", "0.6959987", "0.6946717", "0.6945551", "0.6932115", "0.69293636", "0.6924311", "0.6913565", "0.6886374", "0.6884819", "0.68661237", "0.68599796", "0.68449396", "0.68322176", "0.68193656", "0.6805708", "0.6803864", "0.6791259", "0.6787044", "0.6780127", "0.6770633", "0.6751239", "0.6737292", "0.672702", "0.67232144", "0.67232144", "0.67232144", "0.67171746", "0.67136043", "0.6705056", "0.6681699", "0.6676209", "0.6665953", "0.6665953", "0.6644559", "0.6633544", "0.6633334", "0.66213346", "0.65948796", "0.6587557", "0.6583894", "0.65777254", "0.6567014", "0.6567014", "0.6567014", "0.6567014", "0.6567014", "0.6567014", "0.6567014", "0.6567014", "0.6540379", "0.65388626", "0.6536693", "0.6533406" ]
0.73028004
23
Use callbacks to share common setup or constraints between actions.
def set_reservation @reservation = Reservation.friendly.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def reservation_params params.require(:reservation).permit(:user_id, :job_id, :status,:review,:rating,:amount,:ending_time,:slug,:revision_description,:rejection_description,:pause_reason,:paused_at,:reviewed_at) 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
clear out memoized Framework and LocalEnv instances
def reset @instance = nil @local_env = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_env\n DataCache.env_hash = {}\n end", "def clear_cached_values\n @chocoversion = nil\n @compiled_choco = nil\n end", "def clean\n # exists? will automatically call deconfigure if necessary\n @instance_cache.map!{ |dev| dev if dev.exists? }\n end", "def reset_cache\n envspecific_regexs(true)\n end", "def clear!\n defined_settings.each {|setting| instance_variable_set(\"@#{setting}\", nil)}\n @storage_adapters = []\n @cached_paths = {}\n end", "def clear!\n @handlers = {}\n @environments = {}\n @requests = []\n end", "def reset!\n @loaded_softwares = nil\n end", "def reset!\n #$LOAD_STACK = []\n\n if manager = lock_load\n $LOAD_MANAGER = manager\n else\n #$LOAD_MANAGER.prime(*lookup_paths, :expound=>true)\n manager = Manager.new\n manager.prime(*lookup_paths, :expound=>true)\n $LOAD_MANAGER = manager\n end\n\n $LOAD_MANAGER << RubyLibrary.instance\n\n #if development?\n # find project root\n # if root\n # $LOAD_MANAGER.isolate_project(root)\n # end\n #end\n end", "def clear!\n Padrino.clear_middleware!\n Padrino.mounted_apps.clear\n @_load_paths = nil\n @_dependency_paths = nil\n @_global_configuration = nil\n Padrino.before_load.clear\n Padrino.after_load.clear\n Padrino::Reloader.clear!\n Thread.current[:padrino_loaded] = nil\n end", "def engines_reset!\n @engine_instances = nil\n end", "def reset\n @exemptions = ExemptionList.from_module(CoreExemptions)\n @global = false\n @trusted_filters = []\n end", "def reset\n LegacyFacter.reset\n Options[:custom_dir] = []\n Options[:external_dir] = []\n SessionCache.invalidate_all_caches\n nil\n end", "def reset!\n @engine_names = nil\n @engine_name_and_engine = nil\n @engine_name_and_class = nil\n @engine_path_and_name = nil\n @engine_association_paths = nil\n end", "def reset!\n default_tags.clear\n adapters.clear\n groups.each_key { |group| singleton_class.send(:remove_method, group) if group && respond_to?(group) }\n @groups = nil\n metrics.each_key { |metric| singleton_class.send(:remove_method, metric) if respond_to?(metric) }\n @metrics = nil\n collectors.clear\n configurators.clear\n instance_variable_set(:@configured_by, nil)\n instance_variable_set(:@debug_was_enabled_by, nil)\n end", "def reset\n clear_cache\n @class_hierarchy = nil\n @ontology = nil\n @known_classes = nil\n end", "def reset_used_factories\n @used_factories = []\n end", "def clear_all!\n @cache = Cache.new\n end", "def resetValues\n @@multinode = nil\n @@serverList = nil\n @@proxy = nil\n @@serviceList = {}\n end", "def clear_cache\n @all = nil\n end", "def reset_all\n clear_commands\n reset_colors\n @app_info = nil\n @app_exe = nil\n @verbose_parameters = true\n @@default_method = nil\n @@class_cache = {}\n end", "def with_clean_env(&block); end", "def clear_memo!\n self.class.clear_memo!\n end", "def flush_memos\n CACHE.clear\n end", "def __reset\n @registry.clear\n end", "def reset!\n self.instance_variables.each { |variable| instance_variable_set(variable, nil) }\n self\n end", "def reset\r\n interpreter_reset\r\n compiler_reset\r\n end", "def reset!\n @loaded_projects = nil\n end", "def reset!\n remove_instance_variable \"@service_definitions\" if defined? @service_definitions\n remove_instance_variable \"@services_config_list\" if defined? @services_config_list\n end", "def reset_env(opts = T.unsafe(nil)); end", "def reset!\n registered_keys.each { |key| ClassConstants.new(key).deconstantize }\n @registered_keys = []\n container._container.clear\n end", "def teardown\n @mem.mem_clear\n end", "def clear\n ve 'rm(list=ls())'\n end", "def clear\n @autoloaded_classes.to_a.reverse_each do |klass|\n RubyCodeAutoreloader::ClassLoader.remove_constant(klass)\n @autoloaded_classes.delete(klass)\n end\n\n @existing_modules_before_load.clear\n @autoloaded_files = []\n ActiveSupport::DescendantsTracker.clear\n ActiveSupport::Dependencies.clear\n end", "def reset\n @enabled = proc { |_env| Rails.env.development? || Rails.env.test? }\n @flamegraph_enabled = true\n @flamegraph_sample_rate = 0.5\n @logger = RailsMiniProfiler::Logger.new(Rails.logger)\n @skip_paths = []\n @storage = Storage.new\n @ui = UserInterface.new\n @user_provider = proc { |env| Rack::Request.new(env).ip }\n end", "def clear_cache() @cache = {}; end", "def clear_all\n clear_modules\n end", "def clear_local\n execute(:rm, '-rf', File.join(local_cache_path, '*')) if test!(\"[ -d #{local_cache_path} ]\")\n File.unlink(cached_gemfile_md5_path)\n end", "def clear_backend_stubs\n unstub_backend_get_keys\n unstub_backend_utilization\n unstub_backend_referrer_filters\n\n ::BackendClient::Application.any_instance.unstub(:create_referrer_filter, :create_key)\n end", "def clear!\n context_manager.clear!\n end", "def reset!\n @base_dir = @path = nil\n end", "def reset\n self.instance_variables.each do |var|\n instance_variable_set(var, nil)\n end\n initialize\n end", "def reset!\n @cache = nil\n end", "def clear_weblab_cache\n @@weblab_base = Rengine::WeblabBase.new(\n Rengine::Weblab.find_by_is_active(true),\n Rengine::Weblab.find_by_is_test(true))\n $current_weblab=nil\n \n end", "def reset!\n logs.remove\n features.remove\n users.remove\n end", "def clean_up\n @breakpoints = []\n @breakpoint_count = -1\n @file = nil\n\n Thread.list.each do |th|\n th[:__pry_debug_stepped_file] = nil\n th[:__pry_debug_stepping] = false\n\n th[:__pry_debug_exception_binding] = nil\n th[:__pry_debug_last_exception] = nil\n end\n\n @break_on_raise = false\n @debugging = false\n @will_load = true\n\n @mutex = Mutex.new\n end", "def invalidate(env)\n env.delete ENV_FLAG\n @last_been_run = Time.at 0\n end", "def clear!\n @cache = {}\n end", "def reset_env\n clear_env\n set_env self.env_defaults\n end", "def reset!\n instance_variables.each { |var| remove_instance_variable var }\n end", "def clean_thread_locals; end", "def clear_persistent_LOADED_FEATURES\n RubyContext.clear_persistent_LOADED_FEATURES\n end", "def clear\n @registry = {}\n end", "def reset\n (@settings||{}).each do |name,instance| \n remove_setter(name)\n remove_getter(name)\n remove_boolean_getter(name)\n instance.destroy\n end\n @settings = Hash.new\n end", "def reset\n @global = Global.new\n end", "def reset\n [:@sitemap_url, :@models, :@delay, :@environments, :@ping_urls, :@background, :@notified_urls].each do |var|\n remove_instance_variable var if instance_variable_defined?(var)\n end\n end", "def clear_cached_vars\n @_rendered , @_versions = false , false\n end", "def reset\n # self.instance_variable_names.each do |var_name|\n # self.instance_variable_set var_name, nil\n # end\n instance_variables.each { |name, value|\n instance_variable_set(name, nil)\n }\n end", "def memoize_cache_clear\n __memoize_cache__.clear\n self\n end", "def reset!\n @orm = @namespace = @source = @setting_class = nil\n self.config = nil\n self.raise_missing = nil\n self.report_missing = nil\n self.typecast_on_write = nil\n self.password_secret = nil\n end", "def reset!\n @cached_descriptions = nil\n @nodes = nil\n @cloud_nodes = nil\n end", "def clear_all\n FileUtils.rm_rf(CACHE_DIR)\n end", "def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end", "def flush_cache!\n @cached_dependencies = {}\n end", "def reset\n @session_cache = SpStore::PChip::SoftSessionCache.new @session_cache_size\n @node_cache = SpStore::PChip::SoftNodeCache.new @node_cache_size,\n @node_count, @session_cache\n @hash_engine = SpStore::PChip::SoftHashEngine.new\n end", "def clean\n Thread.current[:__cms_original_content] = nil\n Thread.current[:__cms_active_page] = nil\n Thread.current[:__cms_stack] = nil\n Thread.current[:__content_node_stack] = nil\n Thread.current[:__content_iterator_stack] = nil\n Thread.current[:__content_iterator_stack_key] = nil\n end", "def clear\n instance_variables.each do |instance_variable|\n instance_variable_set(instance_variable, nil)\n end\n end", "def interpreter_reset\r\n @data_stack = Array.new\r\n @ctrl_stack = Array.new\r\n @start_time = Time.now\r\n end", "def redis_shared_state_cleanup!\n Gitlab::Redis::SharedState.with(&:flushall)\n end", "def clear\n @already_searched = {}\n Facter.clear_messages\n LegacyFacter.clear\n Options[:custom_dir] = []\n LegacyFacter.collection.invalidate_custom_facts\n LegacyFacter.collection.reload_custom_facts\n SessionCache.invalidate_all_caches\n nil\n end", "def clear_cache; end", "def teardown\r\n\t\t@vendors = nil\r\n\t\t@vendor = nil\r\n\t\t@model = nil\r\n\t\t@deviceView = nil\r\n\t\t@devicewWhatHas = nil\r\n\t\t@fetchTrees = nil\r\n\t\t@fetchSpecs = nil\r\n\tend", "def reset\n cleanup(true)\n end", "def cib_reset\n # Puppet.debug 'Reset CIB memoization'\n @raw_cib = nil\n @cib = nil\n @primitives = nil\n @primitives_structure = nil\n @nodes_structure = nil\n end", "def clear\n @names = {}\n @processes = []\n end", "def cleanup_script_execution\n FileUtils.rm_rf(InstanceConfiguration::CACHE_PATH)\n end", "def teardown\n reset_test_env\n end", "def teardown\n reset_test_env\n end", "def clear\n LOCK.synchronize do\n @hooks = nil\n @applied = nil\n @logger = nil\n end\n end", "def reset\n @parsers = nil\n @transformer = nil\n @cache = nil\n end", "def reset_variables\n @variables.clear\n end", "def clear_compiler *keys\n compiler_pool && compiler_pool.clear\n end", "def _post_eval\n @environments << @env if @env_used\n @env = nil\n @options = nil\n end", "def clear_dependencies\n if self == ActiveRecord::Base.acl_manager.initial_destroy\n ActiveRecord::Base.acl_manager.destroy_pool = []\n ActiveRecord::Base.acl_manager.initial_destroy = nil\n end\n end", "def clear!\n contexts.clear\n end", "def clear!\n contexts.clear\n end", "def clear\n FileUtils.rm_f(cache_file)\n initialize!\n end", "def reset\n initialize\n @log = nil\n @default_model = nil\n end", "def clear\n cache.clear\n end", "def reset\n initialize\n setup\n end", "def flush\n LegacyFacter.flush\n SessionCache.invalidate_all_caches\n nil\n end", "def clear\n @entity_list = {}\n @context_list = {}\n @last_unique_id = 0\n @entity_names = {} # Internal cache of context names for quick key retrieval\n end", "def gc\n sandbox {|git,w,i| git.gc }\n reset(true)\n end", "def teardown\n FileUtils.remove_dir(TEMP_SITE_PATH, true) if Dir.exists? TEMP_SITE_PATH\n Ruhoh::Manager.reset\nend", "def cache_clear\n @moneta.clear\n end", "def finalize!\n all_files.each { |f| Kernel.require f } if eager_load\n all_files.clear\n self\n end", "def sparkResetEnvironment()\n\tif ($cleanupCalls.size > 0)\n\t\tlogNormal(\"resetEnvironment(): Calling \" + $cleanupCalls.size.to_s + \" cleanup functions.\\n\")\n\t\tsparkInvokeCleanupCalls()\n\t\t$cleanupCalls.clear\n\telse\n\t\tlogNormal(\"resetEnvironment(): No cleanup functions to call.\\n\")\n\tend\n\tsparkResetScene()\nend", "def reset!\n Unleashed::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Unleashed::Default.options[key])\n end\n\n self\n end", "def tear_down; end", "def restore_globals\n # Restore the original $LOAD_PATH to negate any changes made.\n $LOAD_PATH.replace @@load_path_org\n # Could restore the original $LOADED_FEATURES ($\"), but this worker process\n # acculumates many gems and modules over time and it's not practical to\n # reload them every time.\n # So, just deleting those in @sitelibbase or @sourcebase directory.\n $LOADED_FEATURES.reject! {|x| x.start_with?(@sitelibbase, @sourcebase)}\n end" ]
[ "0.75804156", "0.67919594", "0.67855126", "0.664412", "0.66419417", "0.6629648", "0.6599121", "0.65307087", "0.6491632", "0.64609265", "0.6442336", "0.6434068", "0.640228", "0.63668215", "0.6365093", "0.63631463", "0.63004464", "0.6282625", "0.62706286", "0.62630033", "0.62523687", "0.62392104", "0.6235808", "0.6222701", "0.61678374", "0.61639297", "0.6161417", "0.6161349", "0.6150459", "0.6139899", "0.6136662", "0.6130726", "0.6127285", "0.6120742", "0.6119825", "0.6119223", "0.6114061", "0.6107941", "0.61073244", "0.6093962", "0.60843784", "0.6080118", "0.60747355", "0.60700214", "0.60665154", "0.60600877", "0.6057584", "0.60574013", "0.60472566", "0.60442024", "0.6023782", "0.60224295", "0.60222", "0.6019769", "0.6016982", "0.600519", "0.6000786", "0.5999113", "0.5999065", "0.5997669", "0.5994581", "0.59929776", "0.5991918", "0.59793514", "0.5977418", "0.5972338", "0.59700185", "0.5961763", "0.5960911", "0.59465677", "0.5943507", "0.5932502", "0.59302807", "0.593012", "0.5928999", "0.5928197", "0.5928197", "0.5925023", "0.59092677", "0.59070724", "0.5901066", "0.58983487", "0.5880492", "0.58785677", "0.58785677", "0.58777946", "0.5876942", "0.587489", "0.58709323", "0.586866", "0.58567375", "0.5851565", "0.5844509", "0.5839387", "0.5838875", "0.583567", "0.58316386", "0.58298045", "0.58295935" ]
0.74100643
2
GET /isps GET /isps.json
def index @isps = Isp.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end", "def index\n @socio_irpjs = SocioIrpj.all\n end", "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def index\n @socio_spcs = SocioSpc.all\n end", "def index\n @spis = Spi.all\n end", "def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @soils = Soil.where(:field_id => session[:field_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @soils }\n end\n end", "def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end", "def index\n @sips = Sip.all\n end", "def show\n @sipoc = Sipoc.find(params[:id])\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 index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def index\n @sirens = Siren.all\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\n respond_with(@sicoss_situation)\n end", "def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end", "def index\n @sities = Sity.all\n end", "def set_isp\n @isp = Isp.find(params[:id])\n end", "def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end", "def create\n @isp = Isp.new(isp_params)\n\n respond_to do |format|\n if @isp.save\n format.html { redirect_to @isp, notice: 'Isp was successfully created.' }\n format.json { render :show, status: :created, location: @isp }\n else\n format.html { render :new }\n format.json { render json: @isp.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def index\n @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 index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def show\n render json: @shelter\n end", "def show\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp_company_info }\n end\n end", "def index\n @snifs = Snif.all\n end", "def index\n @sponsercfs = Sponsercf.all\n end", "def show\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @srsa }\n end\n end", "def show\n @secry = Secry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secry }\n end\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def index\n @presents = Present.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @presents }\n end\n end", "def show\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sproject }\n end\n end", "def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end", "def index\r\n @sivic_models = SivicModel.all\r\n end", "def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def show\n render json: @sighting\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\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 @curriculum = Curriculum.find(params[:id])\n @curriculum_disciplines = @curriculum.curriculum_disciplines.by_module.paginate :page => params[:page]\n\n respond_with @curriculum\n end", "def index\n @psi_disciplines = PsiDiscipline.all\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 @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 @search = SicossSituation.search(params[:search])\n @sicoss_situations = @search.page(params[:page]).per(10)\n flash.now[:notice] = t('flash.actions.index.notice') if @sicoss_situations.empty?\n respond_with(@sicoss_situations)\n end", "def show\n respond_with(@sicoss_location)\n end", "def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end", "def show\n @ski = Ski.find(params[:id])\n\n @image = Image.where(:ski_id => params[:id])\n\n @inventory = Inventory.where(:ski_id => params[:id])\n\n @store = Store.where(:ski_id => params[:id])\n\n @spec = Spec.where(:ski_id => params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ski }\n end\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end", "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @island }\n end\n end", "def index\n @spots = Spot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end", "def show\n @swc = Swc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swc }\n end\n end", "def show\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surgery }\n end\n end", "def index\n @inspirations = Inspiration.all\n end", "def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end", "def index\n @secrate_codes = SecrateCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @secrate_codes }\n end\n end", "def index\n @socio_cpfs = SocioCpf.all\n end", "def index\n @surveys = Survey.filter_by_user(current_user.id)\n\n render json: @surveys\n end", "def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end", "def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end", "def get_symptoms\n begin\n @desease = Desease.find(params[:id])\n\n @symptoms = @desease.symptoms\n render json: @symptoms\n rescue ActiveRecord::RecordNotFound => e\n render json: e, status: :unprocessable_entity\n end\n \n \n end", "def index\n @situations = Situation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end", "def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end", "def list_sol_isos(search_string)\n handle_output(options,\"\") \n list_js_isos()\n list_ai_isos()\n return\nend", "def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def index\n @cys_envs = CysEnv.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cys_envs }\n end\n end", "def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end", "def index\n @srsas = Srsa.all\n @srsas = Srsa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsas }\n end\n end", "def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }\n end\n end", "def index\n @gpsds = Gpsd.all\n #respond_to do |format|\n # format.json { render }\n #end\n end", "def index\n @socio_rgs = SocioRg.all\n end", "def index\n @disciplines = Discipline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disciplines }\n end\n end", "def index\n @pic_spaces = PicSpace.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_spaces }\n end\n end", "def index\n @seihinns = Seihinn.all\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 @intergroup_session = IntergroupSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intergroup_session }\n end\n end", "def show\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasp }\n end\n end", "def index\n @spikings = Spiking.all\n end", "def index\n @nasp_rails = NaspRail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @nasp_rails }\n end\n end", "def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end", "def index\n @cst_ipis = CstIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_ipis }\n end\n end", "def update\n respond_to do |format|\n if @isp.update(isp_params)\n format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }\n format.json { render :show, status: :ok, location: @isp }\n else\n format.html { render :edit }\n format.json { render json: @isp.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end" ]
[ "0.65481347", "0.6263038", "0.62025106", "0.6166296", "0.61100435", "0.61009514", "0.6085157", "0.6040352", "0.60241735", "0.5971656", "0.5910074", "0.5909469", "0.5893497", "0.58617395", "0.5853113", "0.5841907", "0.58054084", "0.58040136", "0.58012736", "0.57784843", "0.5777204", "0.57728106", "0.57504123", "0.57370293", "0.57254", "0.5716585", "0.5713568", "0.57098246", "0.57048494", "0.5701359", "0.56798285", "0.5677902", "0.56748617", "0.56727564", "0.5668567", "0.564227", "0.56402504", "0.56393814", "0.56322014", "0.55897915", "0.5589775", "0.557507", "0.5555514", "0.55547225", "0.55450284", "0.55401146", "0.55277246", "0.5527136", "0.55203235", "0.5514368", "0.5513843", "0.5509233", "0.5505065", "0.5504319", "0.5502793", "0.54899347", "0.5487412", "0.5486853", "0.5480623", "0.54736847", "0.54713863", "0.5468282", "0.54665965", "0.5449651", "0.5445502", "0.54427826", "0.5435639", "0.54299206", "0.54290414", "0.542635", "0.54258287", "0.5424679", "0.54224205", "0.5417562", "0.54147655", "0.54116684", "0.54089963", "0.5408658", "0.5405778", "0.5405443", "0.54049104", "0.5400936", "0.539653", "0.5396362", "0.5394057", "0.5389112", "0.5387785", "0.5386429", "0.53810996", "0.5379435", "0.5373966", "0.537349", "0.53711414", "0.5366634", "0.53645766", "0.53627074", "0.53585565", "0.53522503", "0.53476506", "0.53461677" ]
0.69026697
0
GET /isps/1 GET /isps/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @isps = Isp.all\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\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 @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end", "def show\n @sipoc = Sipoc.find(params[:id])\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @socio_irpjs = SocioIrpj.all\n end", "def set_isp\n @isp = Isp.find(params[:id])\n end", "def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end", "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end", "def show\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp_company_info }\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 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 @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end", "def create\n @isp = Isp.new(isp_params)\n\n respond_to do |format|\n if @isp.save\n format.html { redirect_to @isp, notice: 'Isp was successfully created.' }\n format.json { render :show, status: :created, location: @isp }\n else\n format.html { render :new }\n format.json { render json: @isp.errors, status: :unprocessable_entity }\n end\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 @secry = Secry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secry }\n end\n end", "def show\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sproject }\n end\n end", "def show\n @iph = Iph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iph }\n end\n end", "def show\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @srsa }\n end\n end", "def index\n @spis = Spi.all\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def 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 @swc = Swc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swc }\n end\n end", "def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end", "def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end", "def index\n @socio_spcs = SocioSpc.all\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def show\n @mispronunciation = Mispronunciation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mispronunciation }\n end\n end", "def index\n @soils = Soil.where(:field_id => session[:field_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @soils }\n end\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "def show\n @supplysite = Supplysite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplysite }\n end\n end", "def show\n @curriculum = Curriculum.find(params[:id])\n @curriculum_disciplines = @curriculum.curriculum_disciplines.by_module.paginate :page => params[:page]\n\n respond_with @curriculum\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def show\n @intergroup_session = IntergroupSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intergroup_session }\n end\n end", "def show\n @piping_system = PipingSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @piping_system }\n end\n end", "def show\n respond_with(@sicoss_situation)\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @sims_instrument_configuration = SimsInstrumentConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sims_instrument_configuration }\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 @internship = Internship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def show\n @competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition_interaction_observation }\n end\n end", "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @island }\n end\n end", "def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end", "def show\n @internship = Internship.find(params[:id])\n\n respond_to do |format|\n format.html \n format.json { render :json => @internship }\n end\n end", "def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def show\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasp }\n end\n end", "def show\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cys_env }\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 @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\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 @instrulife_list = InstrulifeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instrulife_list }\n end\n end", "def show\n @experience_sharing = ExperienceSharing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_sharing }\n end\n end", "def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end", "def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end", "def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end", "def show\n @matrix_discipline = MatrixDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def index\n @sips = Sip.all\n end", "def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end", "def show\n @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\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end", "def show\n @spdatum = Spdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spdatum }\n end\n end", "def show\n @ski = Ski.find(params[:id])\n\n @image = Image.where(:ski_id => params[:id])\n\n @inventory = Inventory.where(:ski_id => params[:id])\n\n @store = Store.where(:ski_id => params[:id])\n\n @spec = Spec.where(:ski_id => params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ski }\n end\n end", "def show\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surgery }\n end\n end", "def show\n @curriculum_assessment = current_user.curriculumAssessments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculum_assessment }\n end\n end", "def show\n @ip = Ip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end", "def show\n @impuesto = Impuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @impuesto }\n end\n end", "def show\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ins_company }\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 index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def show\n @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spiel }\n end\n end", "def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def show\n @security_similar = SecuritySimilar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @security_similar }\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 @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 @responsibility = Responsibility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @responsibility }\n end\n end", "def update\n respond_to do |format|\n if @isp.update(isp_params)\n format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }\n format.json { render :show, status: :ok, location: @isp }\n else\n format.html { render :edit }\n format.json { render json: @isp.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\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 render json: @shelter\n end", "def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end", "def show\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oase }\n end\n end", "def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def show\n @ip_type = IpType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ip_type }\n end\n end", "def show\n @squishee_cup = SquisheeCup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squishee_cup }\n end\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end" ]
[ "0.6801033", "0.6415608", "0.63551927", "0.635458", "0.6257551", "0.6213184", "0.6192963", "0.6173294", "0.6162576", "0.6150383", "0.6078247", "0.6034171", "0.6031955", "0.6024358", "0.60232824", "0.6016151", "0.6001468", "0.5979261", "0.5968506", "0.5942707", "0.59199435", "0.5918791", "0.59077805", "0.5889291", "0.5887601", "0.5869856", "0.5847189", "0.58293307", "0.5821888", "0.5816026", "0.5815395", "0.5813972", "0.58137244", "0.5796696", "0.57959557", "0.5794407", "0.5793266", "0.5793023", "0.5792201", "0.5786053", "0.57832533", "0.577984", "0.5777007", "0.57758445", "0.5769922", "0.57683355", "0.57683355", "0.5764205", "0.5764059", "0.57592493", "0.5757026", "0.5749019", "0.57436454", "0.57426065", "0.5742045", "0.5740217", "0.57217145", "0.571909", "0.57090735", "0.5705415", "0.5701706", "0.5699358", "0.56975985", "0.56966853", "0.5693852", "0.5692317", "0.5691212", "0.5689677", "0.56831425", "0.56817025", "0.56790143", "0.5672338", "0.5672152", "0.5671147", "0.5666809", "0.56657386", "0.56646556", "0.5652877", "0.56511885", "0.5642939", "0.5639752", "0.56364983", "0.5635265", "0.5635188", "0.56329226", "0.56228805", "0.56227547", "0.5619717", "0.5619443", "0.5614531", "0.561166", "0.5605095", "0.559578", "0.5594462", "0.55936337", "0.55898863", "0.55884254", "0.55844873", "0.55836827", "0.55768496", "0.55727655" ]
0.0
-1
POST /isps POST /isps.json
def create @isp = Isp.new(isp_params) respond_to do |format| if @isp.save format.html { redirect_to @isp, notice: 'Isp was successfully created.' } format.json { render :show, status: :created, location: @isp } else format.html { render :new } format.json { render json: @isp.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isp_params\n params.require(:isp).permit(:name, :attackID)\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def index\n @isps = Isp.all\n end", "def create\n @socio_spc = SocioSpc.new(socio_spc_params)\n\n respond_to do |format|\n if @socio_spc.save\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_spc }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sity = Sity.new(sity_params)\n\n respond_to do |format|\n if @sity.save\n format.html { redirect_to @sity, notice: 'Sity was successfully created.' }\n format.json { render :show, status: :created, location: @sity }\n else\n format.html { render :new }\n format.json { render json: @sity.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def create\n @snp = Snp.new(params[:snp])\n\n respond_to do |format|\n if @snp.save\n format.html { redirect_to @snp, notice: 'Snp was successfully created.' }\n format.json { render json: @snp, status: :created, location: @snp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @isp.update(isp_params)\n format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }\n format.json { render :show, status: :ok, location: @isp }\n else\n format.html { render :edit }\n format.json { render json: @isp.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end", "def set_isp\n @isp = Isp.find(params[:id])\n end", "def create\n @socio_irpj = SocioIrpj.new(socio_irpj_params)\n\n respond_to do |format|\n if @socio_irpj.save\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_irpj }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spi = Spi.new(spi_params)\n\n respond_to do |format|\n if @spi.save\n format.html { redirect_to @spi, notice: 'Spi was successfully created.' }\n format.json { render :show, status: :created, location: @spi }\n else\n format.html { render :new }\n format.json { render json: @spi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @squire = Squire.new(squire_params)\n\n respond_to do |format|\n if @squire.save\n format.html { redirect_to @squire, notice: 'Squire was successfully created.' }\n format.json { render :show, status: :created, location: @squire }\n else\n format.html { render :new }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @snip = Snip.new(params[:snip])\n\n respond_to do |format|\n if @snip.save\n format.html { redirect_to @snip, notice: 'Snip was successfully created.' }\n format.json { render json: @snip, status: :created, location: @snip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @siren = Siren.new(siren_params)\n\n respond_to do |format|\n if @siren.save\n format.html { redirect_to @siren, notice: 'Siren was successfully created.' }\n format.json { render :show, status: :created, location: @siren }\n else\n format.html { render :new }\n format.json { render json: @siren.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @snp = Snp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snp }\n end\n end", "def create\n @psi_discipline = PsiDiscipline.new(psi_discipline_params)\n\n respond_to do |format|\n if @psi_discipline.save\n format.html { redirect_to @psi_discipline, notice: 'Psi discipline was successfully created.' }\n format.json { render :show, status: :created, location: @psi_discipline }\n else\n format.html { render :new }\n format.json { render json: @psi_discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sprint.save\n\n respond_with(@sprint)\n end", "def destroy\n @isp.destroy\n respond_to do |format|\n format.html { redirect_to isps_url, notice: 'Isp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @sponsercf = Sponsercf.new(sponsercf_params)\n\n respond_to do |format|\n if @sponsercf.save\n \n format.html { redirect_to @sponsercf, notice: 'Sponsercf was successfully created.' }\n format.json { render :show, status: :created, location: @sponsercf }\n else\n format.html { render :new }\n format.json { render json: @sponsercf.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 create\n @sip = Sip.new(sip_params)\n\n respond_to do |format|\n if @sip.save\n format.html { redirect_to @sip, notice: 'Sip was successfully created.' }\n format.json { render :show, status: :created, location: @sip }\n else\n format.html { render :new }\n format.json { render json: @sip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @siseasclass = Siseasclass.new(siseasclass_params)\n\n respond_to do |format|\n if @siseasclass.save\n format.html { redirect_to @siseasclass, notice: 'Siseasclass was successfully created.' }\n format.json { render :show, status: :created, location: @siseasclass }\n else\n format.html { render :new }\n format.json { render json: @siseasclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @csosn = Csosn.new(params[:csosn])\n\n respond_to do |format|\n if @csosn.save\n format.html { redirect_to @csosn, notice: 'Csosn was successfully created.' }\n format.json { render json: @csosn, status: :created, location: @csosn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card_ips = CardIp.factory(card_ip_params)\n\n if @card_ips.save\n render :show, status: :created\n else\n render json: @card_ip.errors, status: :unprocessable_entity\n end\n end", "def create\n @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @csp = Csp.new(csp_params)\n\n respond_to do |format|\n if @csp.save\n format.html { redirect_to @csp, notice: 'Csp was successfully created.' }\n format.json { render :show, status: :created, location: @csp }\n else\n format.html { render :new }\n format.json { render json: @csp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surgery = Surgery.new(params[:surgery])\n\n respond_to do |format|\n if @surgery.save\n format.html { redirect_to @surgery, notice: 'Surgery was successfully created.' }\n format.json { render json: @surgery, status: :created, location: @surgery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @sivic_model = SivicModel.new(sivic_model_params)\r\n\r\n respond_to do |format|\r\n if @sivic_model.save\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_model }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @snippit = Snippit.new(snippit_params)\n\n respond_to do |format|\n if @snippit.save\n format.html { redirect_to edit_snippit_path(@snippit), notice: 'Snippit was successfully created.' }\n format.json { render :show, status: :created, location: @snippit }\n else\n format.html { render :new }\n format.json { render json: @snippit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spliff = Spliff.new(spliff_params)\n\n respond_to do |format|\n if @spliff.save\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully created.' }\n format.json { redirect_to '/spliffs', status: :created, location: '/spliffs' }\n else\n format.html { render :new }\n format.json { render json: @spliff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @st_pi = StPi.new(params[:st_pi])\n\n respond_to do |format|\n if @st_pi.save\n flash[:notice] = 'PIS criado.'\n format.html { redirect_to(@st_pi) }\n format.xml { render :xml => @st_pi, :status => :created, :location => @st_pi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @st_pi.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #@curriculum_assessment = CurriculumAssessment.create(params[:curriculum_assessments])\n \n @dop = Dop.find(params[:curriculum_assessment][:dop_id])\n @item = Item.find(params[:curriculum_assessment][:item_id])\n @curriculum_assessment = CurriculumAssessment.create(item: @item, dop: @dop)\n\n\n respond_to do |format|\n if @curriculum_assessment.save\n format.html { redirect_to @curriculum_assessment, notice: 'Curriculum assessment was successfully created.' }\n format.json { render json: @curriculum_assessment, status: :created, location: @curriculum_assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculum_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @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 @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n @socio.save\n format.html { redirect_to socios_url}\n end\n end", "def create\n @irisplant = Irisplant.new(irisplant_params)\n\n respond_to do |format|\n if @irisplant.save\n format.html { redirect_to @irisplant, notice: 'Irisplant was successfully created.' }\n format.json { render :show, status: :created, location: @irisplant }\n else\n format.html { render :new }\n format.json { render json: @irisplant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spiking = Spiking.new(spiking_params)\n\n respond_to do |format|\n if @spiking.save\n format.html { redirect_to @spiking, notice: 'Spiking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spiking }\n else\n format.html { render action: 'new' }\n format.json { render json: @spiking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sicoss_situation = SicossSituation.new(params[:sicoss_situation])\n flash[:notice] = t('scaffold.notice.created', :item => SicossSituation.model_name.human) if @sicoss_situation.save\n respond_with(@sicoss_situation, :location => sicoss_situations_path)\n end", "def spiking_params\n params.require(:spiking).permit(:spik_short_name, :spik_long_name, :spik_process_description, :spik_device_needed, :pros, :cons, :reference_id, :user_id)\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @poststudysurvey = Poststudysurvey.new(poststudysurvey_params)\n\n respond_to do |format|\n if @poststudysurvey.save\n format.html { redirect_to @poststudysurvey, notice: 'Poststudysurvey was successfully created.' }\n format.json { render action: 'show', status: :created, location: @poststudysurvey }\n else\n format.html { render action: 'new' }\n format.json { render json: @poststudysurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def snif_params\n params.require(:snif).permit(:name, :phone_number, :address, :city, :state, :zipcode, :mcr_rating, :beds_capacity, :medicare, :medicaid, :percentage_occupied, :beds_unavailable, :in_hospital, :population, :corporation)\n end", "def create\n @swyp_in = SwypIn.new(params[:swyp_in])\n @swyp_in.address = request.remote_ip\n @swyp_peer = @swyp_in.pair\n @swyp_in.developer = Developer.find_by_api_key(params[:api_key])\n \n if @swyp_in.save\n @swyp = @swyp_in\n render 'shared/status.json'\n else\n format.json { render json: @swyp_in.errors, status: :unprocessable_entity }\n end\n \n end", "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def create\n @snif = Snif.new(snif_params)\n\n respond_to do |format|\n if @snif.save\n format.html { redirect_to @snif, notice: 'Snif was successfully created.' }\n format.json { render :show, status: :created, location: @snif }\n else\n format.html { render :new }\n format.json { render json: @snif.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def souvenir_params\n params.require(:souvenir).permit(:impression, :works_1, :works_2, :works_3, :iris_11, :iris_12, :iris_13, :iris_14, :iris_21, :iris_22, :iris_23, :iris_24, :iris_31, :iris_32, :iris_33, :iris_34)\n end", "def spice_params\n params.require(:spice).permit(:name, :imgPath, :description)\n end", "def create\n @climb = Climb.new(params[:climb])\n respond_to do |format|\n if @climb.save\n Sesh.find(params[:sesh_id]).climbs << @climb\n format.html { redirect_to @climb.sesh, notice: 'Climb was successfully created.' }\n format.json { render json: @climb.sesh.data.to_json, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @climb.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 @sire = Sire.new(sire_params)\n\n respond_to do |format|\n if @sire.save\n format.html { redirect_to @sire, notice: 'Sire was successfully created.' }\n format.json { render :show, status: :created, location: @sire }\n else\n format.html { render :new }\n format.json { render json: @sire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scoop = Scoop.new(scoop_params)\n @scoop.kid = current_kid\n respond_to do |format|\n if @scoop.save\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully created!' }\n format.json { render :show, status: :created, location: @scoop }\n else\n format.html { render :new }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @st_ipi = StIpi.new(params[:st_ipi])\n\n respond_to do |format|\n if @st_ipi.save\n flash[:notice] = 'IPI criado.'\n format.html { redirect_to(@st_ipi) }\n format.xml { render :xml => @st_ipi, :status => :created, :location => @st_ipi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @st_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @socio_irpjs = SocioIrpj.all\n end", "def spi_params\n params.require(:spi).permit(:value, :exam_attempt_id, :target_exam_id)\n end", "def new\n @sicoss_situation = SicossSituation.new\n respond_with(@sicoss_situation)\n end", "def create\n @socio = Socio.new(socio_params)\n respond_to do |format|\n if @socio.save\n format.html { redirect_to new_socio_path, notice: 'El socio fue creado correctamente.' }\n format.json { render action: 'show', status: :created, location: @socio }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @epicrisis = Epicrisis.new(epicrisis_params)\n\n respond_to do |format|\n if @epicrisis.save\n format.html { redirect_to @epicrisis, notice: 'Epicrisis was successfully created.' }\n format.json { render :show, status: :created, location: @epicrisis }\n else\n format.html { render :new }\n format.json { render json: @epicrisis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ipc_seat = IpcSeat.new(ipc_seat_params)\n\n respond_to do |format|\n if @ipc_seat.save\n format.html { redirect_to @ipc_seat, notice: 'Ipc seat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ipc_seat }\n else\n format.html { render action: 'new' }\n format.json { render json: @ipc_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spit = Spit.new(params[:spit])\n\n respond_to do |format|\n if @spit.save\n format.html { redirect_to(@spit, :notice => 'Spit was successfully created.') }\n format.xml { render :xml => @spit, :status => :created, :location => @spit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sponser_params\n params.require(:sponser).permit(:name, :Address, :Catagory, :Gander, :Funding, :Typemanagment, :phone, :exprience, :sponcerBio)\n end", "def create\n @srsa = Srsa.new(params[:srsa])\n\n respond_to do |format|\n if @srsa.save\n format.html { redirect_to :action => 'index' }\n format.json { render json: @srsa, status: :created, location: @srsa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @srsa.errors, status: :unprocessable_entity }\n end\n end\n end", "def csp_params\n params.require(:csp).permit(:number, :term_begin, :term_end, :dm_number, :grade, :password,\n nursery_attributes:[:id, :name, :address, :phone, :fax, :email, :responder, :billing_address, :status, :csp_id])\n end", "def create\n @scomp = Scomp.new(scomp_params)\n\n respond_to do |format|\n if @scomp.save\n format.html { redirect_to @scomp, notice: 'Scomp was successfully created.' }\n format.json { render action: 'show', status: :created, location: @scomp }\n else\n format.html { render action: 'new' }\n format.json { render json: @scomp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @siritori = Siritori.new(siritori_params)\n\n respond_to do |format|\n if @siritori.save\n format.html { redirect_to @siritori, notice: 'Siritori was successfully created.' }\n format.json { render :show, status: :created, location: @siritori }\n else\n format.html { render :new }\n format.json { render json: @siritori.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spdatum = Spdatum.new(params[:spdatum])\n\n respond_to do |format|\n if @spdatum.save\n format.html { redirect_to @spdatum, notice: 'Spdatum was successfully created.' }\n format.json { render json: @spdatum, status: :created, location: @spdatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spdatum.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 @sinnoh = Sinnoh.new(sinnoh_params)\n\n respond_to do |format|\n if @sinnoh.save\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully created.' }\n format.json { render :show, status: :created, location: @sinnoh }\n else\n format.html { render :new }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end", "def psi_discipline_params\n params.require(:psi_discipline).permit(:name, :description, :cost, :system_strain, :attack, :defense, :level)\n end", "def create\n @surgery = Surgery.new(surgery_params)\n\n respond_to do |format|\n if @surgery.save\n format.html { redirect_to @surgery, notice: 'Surgery was successfully created.' }\n format.json { render :show, status: :created, location: @surgery }\n else\n format.html { render :new }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sponsercfs = Sponsercf.all\n end", "def create\n @inspiration = Inspiration.new(params[:inspiration])\n \n respond_to do |format|\n if @inspiration.save\n format.html { redirect_to @inspiration, notice: 'Inspiration was successfully created.' }\n format.json { render json: @inspiration, status: :created, location: @inspiration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expensesbasis = @post.expensesbases.new(expensesbasis_params)\n\n respond_to do |format|\n if @expensesbasis.save\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully created.' }\n format.json { render :show, status: :created, location: @expensesbasis }\n else\n format.html { render :new }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio_cpf = SocioCpf.new(socio_cpf_params)\n\n respond_to do |format|\n if @socio_cpf.save\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_cpf }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @insp_comm_scale = InspCommScale.new(insp_comm_scale_params)\n\n respond_to do |format|\n if @insp_comm_scale.save\n format.html { redirect_to @insp_comm_scale, notice: 'Insp comm scale was successfully created.' }\n format.json { render :show, status: :created, location: @insp_comm_scale }\n else\n format.html { render :new }\n format.json { render json: @insp_comm_scale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(socio_params)\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, notice: 'Socio criado com sucesso.' }\n format.json { render :show, status: :created, location: @socio }\n else\n format.html { render :new }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inspiration = Inspiration.new(inspiration_params)\n\n respond_to do |format|\n if @inspiration.save\n format.html { redirect_to @inspiration, notice: 'Inspiration was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inspiration }\n else\n format.html { render action: 'new' }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\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 create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end", "def survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end", "def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socio }\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @ref_pysician = RefPysician.new(ref_pysician_params)\n\n respond_to do |format|\n if @ref_pysician.save\n format.html { redirect_to @ref_pysician, notice: 'Ref pysician was successfully created.' }\n format.json { render :show, status: :created, location: @ref_pysician }\n else\n format.html { render :new }\n format.json { render json: @ref_pysician.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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 ejemplares\n\t\tsnib = Geoportal::Snib.new\n\t\tsnib.params = params\n\t\tsnib.ejemplares\n\t\t\n\t\trender json: snib.resp\n\tend", "def foodsp_params\n params.require(:foodsp).permit(:productsp, :pricesp, :expirysp, :caloriessp, :proteinssp, :sugarsp, :fatsp, :customersp_id)\n end", "def create\n @spiel = Spiel.new(params[:spiel])\n\n respond_to do |format|\n if @spiel.save\n format.html { redirect_to @spiel, notice: 'Spiel was successfully created.' }\n format.json { render json: @spiel, status: :created, location: @spiel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spiel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end", "def create\n @possess = Possess.new(params[:possess])\n\n respond_to do |format|\n if @possess.save\n format.html { redirect_to @possess, notice: 'Possess was successfully created.' }\n format.json { render json: @possess, status: :created, location: @possess }\n else\n format.html { render action: \"new\" }\n format.json { render json: @possess.errors, status: :unprocessable_entity }\n end\n end\n end", "def poststudysurvey_params\n params.require(:poststudysurvey).permit(:studyrating, :similar, :different, :open_answer, :passport_number)\n end", "def index\n @socio_spcs = SocioSpc.all\n end", "def create\n @ice_observation = IceObservation.new(ice_observation_params)\n\n respond_to do |format|\n if @ice_observation.save\n format.html { redirect_to @ice_observation, notice: 'Ice observation was successfully created.' }\n format.json { render :show, status: :created, location: @ice_observation }\n else\n format.html { render :new }\n format.json { render json: @ice_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def sponsercf_params\n params.require(:sponsercf).permit(:sponser_id, :user_id, :name, :custom_factor_string, :email)\n end", "def index\n @spis = Spi.all\n end", "def swit_params\n params.require(:swit).permit(:post)\n end", "def onsen_params\n params.require(:onsen).permit(:name, :prefecture_id, :url, :review, :list_id, :user_id)\n end" ]
[ "0.58544284", "0.5805111", "0.567645", "0.5673798", "0.5655088", "0.5631333", "0.5578892", "0.55357426", "0.5533478", "0.55230206", "0.5515764", "0.5376391", "0.5360025", "0.5348559", "0.5308799", "0.5296655", "0.5250025", "0.52440387", "0.5237828", "0.5228899", "0.5209398", "0.52017045", "0.5178772", "0.5176769", "0.5163651", "0.51568615", "0.5129183", "0.51067173", "0.51065296", "0.5104615", "0.5083763", "0.508108", "0.5075905", "0.5069899", "0.5061512", "0.5058859", "0.5057683", "0.5039417", "0.5038237", "0.5035384", "0.5018586", "0.5014807", "0.4996845", "0.49963146", "0.49927536", "0.4982263", "0.49819404", "0.49784127", "0.49737048", "0.4968896", "0.49618235", "0.49590212", "0.49527195", "0.49472636", "0.4947059", "0.49467447", "0.4942776", "0.4940855", "0.4939158", "0.49353734", "0.49330735", "0.49313402", "0.49229783", "0.49207485", "0.49065113", "0.49038935", "0.48929882", "0.48793206", "0.48739764", "0.48732823", "0.48731896", "0.48704097", "0.48683223", "0.48665172", "0.48629472", "0.48616093", "0.48600537", "0.48480207", "0.48415822", "0.48406145", "0.48386684", "0.48371547", "0.48350367", "0.4824205", "0.48238683", "0.48224965", "0.48196945", "0.48159876", "0.48039106", "0.48017344", "0.48004374", "0.4798585", "0.47949588", "0.47946218", "0.47944403", "0.4789752", "0.4789051", "0.47879487", "0.4787946", "0.4783286" ]
0.71348965
0
PATCH/PUT /isps/1 PATCH/PUT /isps/1.json
def update respond_to do |format| if @isp.update(isp_params) format.html { redirect_to @isp, notice: 'Isp was successfully updated.' } format.json { render :show, status: :ok, location: @isp } else format.html { render :edit } format.json { render json: @isp.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_spc.update(socio_spc_params)\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_model.update(sivic_model_params)\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @socio_irpj.update(socio_irpj_params)\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spi.update(spi_params)\n format.html { redirect_to @spi, notice: 'Spi was successfully updated.' }\n format.json { render :show, status: :ok, location: @spi }\n else\n format.html { render :edit }\n format.json { render json: @spi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @snp = Snp.find(params[:id])\n\n respond_to do |format|\n if @snp.update_attributes(params[:snp])\n format.html { redirect_to @snp, notice: 'Snp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snp.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 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 # { 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 # PATCH\n raise NotImplementedError\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @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 respond_to do |format|\n if @spliff.update(spliff_params)\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully updated.' }\n format.json { redirect_to '/spliffs', status: :ok, location: '/spliffs' }\n else\n format.html { render :edit }\n format.json { render json: @spliff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @snip = Snip.find(params[:id])\n\n respond_to do |format|\n if @snip.update_attributes(params[:snip])\n #format.html { redirect_to @snip, notice: 'Snip was successfully updated.' }\n format.html { render action: \"edit\", notice: 'Snip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scomp.update(scomp_params)\n format.html { redirect_to @scomp, notice: 'Scomp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scomp.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def put!\n request! :put\n end", "def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end", "def update\n respond_to do |format|\n if @ipc_seat.update(ipc_seat_params)\n format.html { redirect_to @ipc_seat, notice: 'Ipc seat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_cpf.update(socio_cpf_params)\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scoop.update(scoop_params)\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully updated!' }\n format.json { render :show, status: :ok, location: @scoop }\n else\n format.html { render :edit }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update!(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 @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 @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 @sity.update(sity_params)\n format.html { redirect_to @sity, notice: 'Sity was successfully updated.' }\n format.json { render :show, status: :ok, location: @sity }\n else\n format.html { render :edit }\n format.json { render json: @sity.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n respond_to do |format|\n if @sick.update(sick_params)\n format.html { redirect_to @sick, notice: 'Sick was successfully updated.' }\n format.json { render :show, status: :ok, location: @sick }\n else\n format.html { render :edit }\n format.json { render json: @sick.errors, status: :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @psi_discipline.update(psi_discipline_params)\n format.html { redirect_to @psi_discipline, notice: 'Psi discipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @psi_discipline }\n else\n format.html { render :edit }\n format.json { render json: @psi_discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sire.update(sire_params)\n format.html { redirect_to @sire, notice: 'Sire was successfully updated.' }\n format.json { render :show, status: :ok, location: @sire }\n else\n format.html { render :edit }\n format.json { render json: @sire.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 @sys_op = SysOp.find(params[:id])\n\n respond_to do |format|\n if @sys_op.update_attributes(params[:sys_op])\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spiking.update(spiking_params)\n format.html { redirect_to @spiking, notice: 'Spiking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spiking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ref_pysician.update(ref_pysician_params)\n format.html { redirect_to @ref_pysician, notice: 'Ref pysician was successfully updated.' }\n format.json { render :show, status: :ok, location: @ref_pysician }\n else\n format.html { render :edit }\n format.json { render json: @ref_pysician.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shouldersbiceps1.update(shouldersbiceps1_params)\n format.html { redirect_to \"/shouldersbiceps1s\"}\n format.json { render :show, status: :ok, location: @shouldersbiceps1 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n put :update\n end", "def update\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n if @sp_company_info.update_attributes(sp_company_info_params)\n format.html { redirect_to \"/sp_company_infos\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp_company_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @secry = Secry.find(params[:id])\n\n respond_to do |format|\n if @secry.update_attributes(params[:secry])\n format.html { redirect_to @secry, notice: 'Secry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @secry.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 respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @siren.update(siren_params)\n format.html { redirect_to @siren, notice: 'Siren was successfully updated.' }\n format.json { render :show, status: :ok, location: @siren }\n else\n format.html { render :edit }\n format.json { render json: @siren.errors, status: :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @rep.update(rep_params)\n format.html { redirect_to @rep, notice: 'Rep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n binding.pry\n respond_to do |format|\n if @sets_and_rep.update(sets_and_rep_params)\n format.html { redirect_to @sets_and_rep, notice: 'Sets and rep was successfully updated.' }\n format.json { render :show, status: :ok, location: @sets_and_rep }\n else\n format.html { render :edit }\n format.json { render json: @sets_and_rep.errors, status: :unprocessable_entity }\n end\n end\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 update\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n if @sproject.update_attributes(params[:sproject])\n format.html { redirect_to @sproject, notice: 'Sproject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sprint.update_attributes(params[:sprint])\n\n respond_with(@sprint)\n end", "def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n if @clasp.update_attributes(params[:clasp])\n format.html { redirect_to @clasp, notice: 'Clasp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spit = Spit.find(params[:id])\n\n respond_to do |format|\n if @spit.update_attributes(params[:spit])\n format.html { redirect_to(@spit, :notice => 'Spit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ski = Ski.find(params[:id])\n\n respond_to do |format|\n if @ski.update_attributes(params[:ski])\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ski = Ski.find(params[:id])\n\n respond_to do |format|\n if @ski.update_attributes(params[:ski])\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n if @srsa.update_attributes(params[:srsa])\n format.html { redirect_to @srsa, notice: 'Srsa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @srsa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @legal_spouse.update(legal_spouse_params)\n format.html { redirect_to @legal_spouse, notice: 'Legal spouse was successfully updated.' }\n format.json { render :show, status: :ok, location: @legal_spouse }\n else\n format.html { render :edit }\n format.json { render json: @legal_spouse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expensesbasis.update(expensesbasis_params)\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully updated.' }\n format.json { render :show, status: :ok, location: @expensesbasis }\n else\n format.html { render :edit }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @swyp_in = SwypIn.find(params[:id])\n\n respond_to do |format|\n if @swyp_in.update_attributes(params[:swyp_in])\n format.html { redirect_to @swyp_in, notice: 'Swyp in was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @swyp_in.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 respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @st_pi = StPi.find(params[:id])\n\n respond_to do |format|\n if @st_pi.update_attributes(params[:st_pi])\n flash[:notice] = 'PIS atualizado.'\n format.html { redirect_to(@st_pi) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @st_pi.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n @idiom = Idiom.find(params[:id])\n\n respond_to do |format|\n if @idiom.update_attributes(params[:idiom])\n format.html { redirect_to @idiom, notice: 'Idiom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @irisplant.update(irisplant_params)\n format.html { redirect_to @irisplant, notice: 'Irisplant was successfully updated.' }\n format.json { render :show, status: :ok, location: @irisplant }\n else\n format.html { render :edit }\n format.json { render json: @irisplant.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\r\n respond_to do |format|\r\n if @sivic_profissao.update(sivic_profissao_params)\r\n format.html { redirect_to @sivic_profissao, notice: 'Sivic profissao was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_profissao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n if @surgery.update_attributes(params[:surgery])\n format.html { redirect_to @surgery, notice: 'Surgery was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @sculpture.update(sculpture_params)\n format.html { redirect_to @sculpture, notice: 'Sculpture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sculpture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def update\n respond_to do |format|\n if @csp.update(csp_params)\n format.html { redirect_to @csp, notice: t(\"notice.updated\") }\n format.json { render :show, status: :ok, location: @csp }\n else\n format.html { render :edit }\n format.json { render json: @csp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_contcelula.update(sivic_contcelula_params)\r\n format.html { redirect_to @sivic_contcelula, notice: 'Sivic contcelula was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contcelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @snippit = Snippit.find(params[:id])\n\n respond_to do |format|\n if @snippit.update_attributes(params[:snippit])\n format.html { redirect_to(@snippit, :notice => 'Snippit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snippit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sproject.update(sproject_params)\n format.html { redirect_to @sproject, notice: 'Sproject was successfully updated.' }\n format.json { render :show, status: :ok, location: @sproject }\n else\n format.html { render :edit }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stoff.update(stoff_params)\n format.html { redirect_to @stoff }\n format.json { render :show, status: :ok, location: @stoff }\n else\n format.html { render :edit }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to entities_path, notice: 'IPS editada exitosamente.' }\n format.json { render :show, status: :ok, location: @entity }\n else\n format.html { render :edit }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio modificado com sucesso.' }\n format.json { render :show, status: :ok, location: @socio }\n else\n format.html { render :edit }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ipack = Ipack.find(params[:id])\n\n respond_to do |format|\n if @ipack.update_attributes(params[:ipack])\n format.html { redirect_to ipacks_url, notice: 'Collection successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ipack.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 @sprint = Sprint.find(params[:id])\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to @sprint, notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(@sicoss_situation)\n end" ]
[ "0.6500215", "0.65000606", "0.6294271", "0.6283362", "0.6253095", "0.6186845", "0.61377424", "0.612602", "0.6110562", "0.6096497", "0.6082327", "0.60786444", "0.60739785", "0.607001", "0.6069687", "0.60664874", "0.60622823", "0.60445046", "0.60377777", "0.6026912", "0.6023557", "0.60189474", "0.59941566", "0.5993561", "0.59879184", "0.5982964", "0.59829247", "0.59742653", "0.5956808", "0.5931409", "0.59302694", "0.5921571", "0.5917911", "0.59154546", "0.59025306", "0.59009856", "0.5899413", "0.5882478", "0.58797425", "0.58669907", "0.58603424", "0.58582956", "0.58329654", "0.5829186", "0.58260965", "0.5822776", "0.5822004", "0.5821299", "0.5820963", "0.58061236", "0.5802837", "0.5800841", "0.5798124", "0.57906", "0.5785786", "0.5778579", "0.5773867", "0.5755301", "0.57541615", "0.5753995", "0.5750694", "0.5740243", "0.57334715", "0.5727009", "0.57269007", "0.57269007", "0.5723511", "0.57223076", "0.5719232", "0.5718937", "0.57177955", "0.57168067", "0.5713037", "0.5704859", "0.5704859", "0.5701354", "0.5695122", "0.5694232", "0.569398", "0.569398", "0.5692319", "0.5691366", "0.56886953", "0.56850785", "0.5683101", "0.5682617", "0.5680773", "0.5680328", "0.56800276", "0.5679988", "0.5678079", "0.5677667", "0.5677227", "0.5676385", "0.5667896", "0.56678635", "0.5663157", "0.5662586", "0.5662449", "0.56610286" ]
0.6948542
0
DELETE /isps/1 DELETE /isps/1.json
def destroy @isp.destroy respond_to do |format| format.html { redirect_to isps_url, notice: 'Isp was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @socio_spc.destroy\n respond_to do |format|\n format.html { redirect_to socio_spcs_url }\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 @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 delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @socio_irpj.destroy\n respond_to do |format|\n format.html { redirect_to socio_irpjs_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 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 @spi.destroy\n respond_to do |format|\n format.html { redirect_to spis_url, notice: 'Spi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snp = Snp.find(params[:id])\n @snp.destroy\n\n respond_to do |format|\n format.html { redirect_to snps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spice.destroy\n\n head :no_content\n end", "def destroy\n @squire.destroy\n respond_to do |format|\n format.html { redirect_to squires_url, notice: 'Squire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spaethi = Spaethi.find(params[:id])\n @spaethi.destroy\n\n respond_to do |format|\n format.html { redirect_to spaethis_url }\n format.json { head :ok }\n end\n end", "def destroy\n @iph = Iph.find(params[:id])\n @iph.destroy\n\n respond_to do |format|\n format.html { redirect_to iphs_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 return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\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 @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snip = Snip.find(params[:id])\n @snip.destroy\n\n respond_to do |format|\n format.html { redirect_to snips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @psi_discipline.destroy\n respond_to do |format|\n format.html { redirect_to psi_disciplines_url, notice: 'Psi discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ss.destroy\n respond_to do |format|\n format.html { redirect_to sses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_model.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_models_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @spdatum = Spdatum.find(params[:id])\n @spdatum.destroy\n\n respond_to do |format|\n format.html { redirect_to spdata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sys_op = SysOp.find(params[:id])\n @sys_op.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_ops_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @sire.destroy\n respond_to do |format|\n format.html { redirect_to sires_url, notice: 'Sire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @ref_pysician.destroy\n respond_to do |format|\n format.html { redirect_to ref_pysicians_url, notice: 'Ref pysician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cppic = Cppic.find(params[:id])\n @cppic.destroy\n\n respond_to do |format|\n format.html { redirect_to cppics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ipc_seat.destroy\n respond_to do |format|\n format.html { redirect_to ipc_seats_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @sity.destroy\n respond_to do |format|\n format.html { redirect_to sities_url, notice: 'Sity was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @socio.destroy\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @st_ipi = StIpi.find(params[:id])\n @st_ipi.destroy\n\n respond_to do |format|\n format.html { redirect_to(st_ipis_url) }\n format.xml { head :ok }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def delete_slip(id:)\n empty_param_error('id') if id.to_s.eql? ''\n resource :delete, \"api/v1/users/me/slips/#{id}\"\n end", "def destroy\n @secry = Secry.find(params[:id])\n @secry.destroy\n\n respond_to do |format|\n format.html { redirect_to secries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spiel = Spiel.find(params[:id])\n @spiel.destroy\n\n respond_to do |format|\n format.html { redirect_to spiels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @idiom = Idiom.find(params[:id])\n @idiom.destroy\n\n respond_to do |format|\n format.html { redirect_to idioms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rep.destroy\n respond_to do |format|\n format.html { redirect_to reps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @st_pi = StPi.find(params[:id])\n @st_pi.destroy\n\n respond_to do |format|\n format.html { redirect_to(st_pis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @sivic_rede.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_redes_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n @chiropractic_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to chiropractic_assessments_url }\n format.json { head :ok }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @socio_cpf.destroy\n respond_to do |format|\n format.html { redirect_to socio_cpfs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gpsquest.destroy\n respond_to do |format|\n format.html { redirect_to gpsquests_url, notice: 'Gpsquest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spliff.destroy\n respond_to do |format|\n format.html { redirect_to spliffs_url, notice: 'Spliff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @csosn = Csosn.find(params[:id])\n @csosn.destroy\n\n respond_to do |format|\n format.html { redirect_to csosns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ski = Ski.find(params[:id])\n @ski.destroy\n\n respond_to do |format|\n format.html { redirect_to skis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ski = Ski.find(params[:id])\n @ski.destroy\n\n respond_to do |format|\n format.html { redirect_to skis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @siren.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Siren was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\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.xml { head :ok }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shichoson = Shichoson.find(params[:id])\n @shichoson.destroy\n\n respond_to do |format|\n format.html { redirect_to shichosons_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 delete\n request(:delete)\n end", "def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @irpf.destroy\n respond_to do |format|\n format.html { redirect_to irpfs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clasp = Clasp.find(params[:id])\n @clasp.destroy\n\n respond_to do |format|\n format.html { redirect_to clasps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ci = Ci.find(params[:id])\n @ci.destroy\n\n respond_to do |format|\n format.html { redirect_to cis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shouldersbiceps3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps3s_url, notice: 'Shouldersbiceps3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @csp.destroy\n respond_to do |format|\n format.html { redirect_to csps_url, notice: 'Csp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sproject = current_user.sprojects.find(params[:id])\n @sproject.destroy\n\n respond_to do |format|\n format.html { redirect_to sprojects_url }\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 @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 destroy\n @slap.destroy\n respond_to do |format|\n format.html { redirect_to slaps_url, notice: 'Slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mispronunciation = Mispronunciation.find(params[:id])\n @mispronunciation.destroy\n\n respond_to do |format|\n format.html { redirect_to mispronunciations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @operations_check = OperationsCheck.find(params[:id])\n @operations_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_checks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sti = Sti.find(params[:id])\n @sti.destroy\n\n respond_to do |format|\n format.html { redirect_to(stis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @scomp.destroy\n respond_to do |format|\n format.html { redirect_to scomps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scoop.destroy\n respond_to do |format|\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sims_instrument_configuration = SimsInstrumentConfiguration.find(params[:id])\n @sims_instrument_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to sims_instrument_configurations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @oase = Oasis.find(params[:id])\n @oase.destroy\n\n respond_to do |format|\n format.html { redirect_to oases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @signupsurvey.destroy\n respond_to do |format|\n format.html { redirect_to signupsurveys_url }\n format.json { head :no_content }\n end\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @statement = Statement.find(params[:id])\n @statement.destroy\n\n respond_to do |format|\n format.html { redirect_to statements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ipc_all_ac.destroy\n respond_to do |format|\n format.html { redirect_to ipc_all_acs_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6861883", "0.6731049", "0.67298347", "0.6683525", "0.6659344", "0.66463345", "0.66406304", "0.6636197", "0.66064376", "0.66064376", "0.65785253", "0.65729284", "0.6566983", "0.6547658", "0.6539412", "0.65387005", "0.64981526", "0.6493661", "0.6487279", "0.6483142", "0.647726", "0.64766604", "0.64653444", "0.6463684", "0.64567816", "0.6449912", "0.644854", "0.6443363", "0.64202887", "0.64152133", "0.64115185", "0.64062685", "0.64060414", "0.6397602", "0.63926506", "0.6392641", "0.6392641", "0.6392641", "0.6392641", "0.6392231", "0.6389614", "0.63889647", "0.6382236", "0.63749474", "0.63717943", "0.6368942", "0.63658834", "0.6364616", "0.6362808", "0.6359122", "0.63543963", "0.63543034", "0.6350924", "0.6348026", "0.63449866", "0.6333381", "0.63333267", "0.63207513", "0.63183755", "0.6317632", "0.63167167", "0.6311697", "0.6311697", "0.63113236", "0.6311087", "0.6308924", "0.6305971", "0.630596", "0.6295758", "0.6295228", "0.62940854", "0.62918186", "0.62898105", "0.6286366", "0.6278211", "0.62710136", "0.62704766", "0.62673265", "0.62664163", "0.6263325", "0.6260725", "0.6260169", "0.62601566", "0.6259154", "0.6258118", "0.6256398", "0.6254944", "0.62503016", "0.62465", "0.6242543", "0.62407565", "0.62400925", "0.6239385", "0.6236213", "0.62353635", "0.6235124", "0.6234086", "0.6231841", "0.6230613", "0.6228275" ]
0.7208446
0
Use callbacks to share common setup or constraints between actions.
def set_isp @isp = Isp.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def isp_params params.require(:isp).permit(:name, :attackID) 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
Accept dispute If a dispute is legitimate, you can choose to accept it. This will close it for you and remove it from your list of open disputes. There are no further financial implications.
def accept_dispute(dispute_id, opts = {}) accept_dispute_with_http_info(dispute_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_challenge\n @challenge = Challenge.find(params[:challenge_id])\n if !@challenge.nil? then\n accepted = params[:accepted].to_b\n @challenge.update_attributes accepted: accepted, closed: true\n \n if accepted then\n @challenge.rival.update_attribute :score, @challenge.rival.score+30 #author gain 30 points\n else\n @challenge.rival.update_attribute :score, @challenge.rival.score-30 #rival losses 30 points\n end\n \n end\n redirect_to action:'dashboard'\n end", "def decline!\n return unless accepted.nil?\n\n update(accepted: false)\n end", "def reject\n if request.post?\n if @ad.mark_as_disapproved!(params[:reason])\n flash[:notice] = 'AD successfully rejected!'\n else\n flash_errors_model @ad\n end\n redirect_to url_for(action: :index)\n end\n end", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def accept \n order = Order.find(params[:orderid])\n order.status = \"Accepted\"\n order.save!\n if order.artwork.sold == false\n order.artwork.toggle!(:sold)\n end\n Order.find_all_by_artwork_id(order.artwork.id).each do |f|\n if f.status != \"Accepted\"\n f.status = \"Declined\"\n f.save!\n end\n end\n redirect_to [:admin, User.find(params[:id])]\n end", "def after_accepted\n # repute points\n self.repute_accept\n \n # cash rewards\n if self.kase && self.kase.offers_reward?\n self.kase.rewards.active.each do |reward|\n reward.cash!\n end\n end\n end", "def reject!\n return false if self.approved == true\n self.destroy\n end", "def refuse\n @presentation.refuse!\n redirect_to admin_submissions_path((@presentation.poster ? :poster : :contributed) => 1), notice: 'The presentation has been unaccepted.'\n end", "def establish!\n attempted!\n\n review.establish!\n\n potential_end_products_to_remove = []\n removed_or_withdrawn_issues.select(&:end_product_establishment).each do |request_issue|\n request_issue.end_product_establishment.remove_contention!(request_issue)\n potential_end_products_to_remove << request_issue.end_product_establishment\n end\n\n potential_end_products_to_remove.uniq.each(&:cancel_unused_end_product!)\n clear_error!\n processed!\n end", "def awaiting_disbursement?\n financial_aid_approved? && !disbursed?\n end", "def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "def disapprove\n self.approved = false\n end", "def restrict_disclosure(presentation)\n if !presentation.show_abstract_to_everybody && cannot?(:view_abstract, Presentation)\n def presentation.abstract\n I18n.translate('presentations.not_logged_in')\n end\n def presentation.disclose_abstract\n false\n end\n elsif presentation.disclose_at > Time.now\n def presentation.abstract\n I18n.translate('presentations.pending_disclosure', :date => I18n.localize(disclose_at, :format => :month_day))\n end\n def presentation.disclose_abstract\n false\n end\n else\n def presentation.disclose_abstract\n true\n end\n end\n end", "def legal_terms_acceptance_on!\n @legal_terms_acceptance = true\n end", "def closed!\n update_attributes(\n :state_name => \"closed\",\n :abstains => possible_votes - votes.count,\n :closed_at => Time.now\n )\n end", "def raise_dispute(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/raise_dispute\", options).body)\n @attributes = response['items']\n true\n end", "def dispute_closed\n UserMailer.dispute_closed\n end", "def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end", "def entrance_decision_enter_cave_money\n\n puts \"************************************************************\"\n puts \"Bandit: Ha! You sad poor bum! well if you really want to do get into this cave then I need you to do me a favor. interested?\"\n puts \"type yes, no, or what kind of favor?\"\n while user_input = gets.chomp.downcase.rstrip.lstrip # loop while getting user input\n case user_input\n when \"what kind of favor?\"\n puts \"Bandit: Don't worry about it! now are you in or are you out?\"\n puts \"type yes or no\"\n when \"yes\"\n bandit_favor\n break\n when \"no\"\n puts \"Bandit: Get the hell out of here before I get pissed.\"\n run_away_story\n break\n else\n puts \"Please type yes, no, or what kind of favor? only!\"\n # print the prompt, so the user knows to re-enter input\n end\n end\n end", "def decline_suggestion suggestion \n\t\tsuggestion.status = 4\t\n\t\tsuggestion.save\n\t\t#user_reward(suggestion, -5)\n end", "def human_close_reason\n if self.closed?\n if self.client_cancel?\n \"Frage hat sich erledigt\"\n elsif self.mandated? && self.mandated =~ /listed/i\n \"Anwalt wurde gefunden\"\n elsif self.mandated? && self.mandated =~ /unlisted/i\n \"Anwalt wurde gefunden\"\n else\n \"Laufzeit der Frage beendet\"\n end\n end\n end", "def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end", "def disclose\n @data['disclose']\n end", "def disclose\n @data['disclose']\n end", "def reject\n self[:status] = \"Reject\"\n save\n end", "def accept_or_decline_invitation(params = [])\n study_invites = array_of_study_invite(params)\n while study_invites.size > 0 do\n study_invites.each do |option|\n if invitations.first.study_name.text.include?(option.first) && option.last.downcase.include?('accept')\n invitations.first.inv_accept.click\n sleep 5\n study_invites.shift unless study_invites.empty?\n break\n elsif invitations.first.study_name.text.include?(option.first) && option.last.downcase.include?('decline')\n invitations.first.inv_decline.click\n sleep 5\n study_invites.shift unless study_invites.empty?\n break\n end\n end\n end\n end", "def deny\n @issue = Issue.find(params[:id])\n @issue.resolved = 0\n old_submitter = @issue.submitter_id\n @issue.submitter_id = nil\n project = Project.find(@issue.project_id)\n if @issue.save\n flash[:warning] = \"The Solution was Rejected\"\n UserMailer.resolution_denied(@issue, old_submitter).deliver\n redirect_to project_issue_path(project.slug,@issue.id)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n redirect_to project_issue_path(project.slug,@issue.id)\n end\n end", "def entrance_decision_enter_cave_intimidate\n puts \"************************************************************\"\n puts \"Bandit: oh? so you think you're tough? Tell you what, you defeat me and I'll give you my sword and free passage.\"\n puts \"You get in a brawl with the bandit leader and win.\"\n puts \"Bandit: Argh. no more please. you can go in the cave just please no more.\"\n puts \"Bandit sword equipped\"\n puts \"Bandit Sword power: 20\"\n @enter_cave = true\n @bandit_beat = true\n @bandit_blade = true\n end", "def user_accept(user_id)\n\n cancels = {}\n user = User.find(user_id)\n\n # For each trade line\n trade_lines.each do |x|\n if x.inventory_own.user_id == user_id\n # We accept only the user's portion of the trade\n x.user_from_accepted = true\n x.save\n \n # If this inventory item is involved in other trades\n # then those trades are invalidated\n user_own(user_id).inventory_own.trades.each do |y|\n if y.id != x.trade_id\n cancels[y.id] = y\n end\n end\n\n # If this inventory item is involved in other trades\n # then those trades are invalidated\n user_need(user_id).inventory_need.trades.each do |y|\n if y.id != x.trade_id\n cancels[y.id] = y\n end\n end\n \n cancels.keys.each do |z|\n trade = cancels[z]\n\n unless trade.declined?\n trade.trade_lines.each { |w| w.user_from_accepted = false }\n trade.trade_lines.each { |w| w.save }\n note = trade.trade_notes.build\n note.comment = \"Sorry, I accepted another trade\"\n note.user_id = user_id\n trade.save\n end\n end\n end\n end\n end", "def select_as_deleted choices\n if !choices.nil?\n operations.select { |op| choices[\"d#{op.output(OUTPUT).item.id}\".to_sym] == \"Yes\" }.each do |op|\n frag = op.output(OUTPUT).item\n op.error :low_concentration, \"The concentration of #{frag} was too low to continue\"\n frag.mark_as_deleted\n end\n end\n \n operations.each do |op|\n op.input(INPUT).item.mark_as_deleted if op.input(INPUT).item\n end\n end", "def handle_completly_uncontested!\n\n # sole party get three seats\n sole_party = @parties.first\n sole_party.award(3)\n\n # TODO: fix this demeter violation\n other_major = sole_party.null_opposing_major\n other_major.award(1)\n @parties << other_major\n\n # one seat to third party\n # TODO: fix this demeter violation\n third_party = sole_party.null_coalition_minor\n third_party.award(1)\n @parties << third_party\n end", "def actions_after_decline(comment: \"\", user: )\n appointees.where(status: [:prop_waiting, :prop_accepted, :app_waiting, :app_accepted, :direct_app, :direct_app_accepted]).each do |appointee|\n appointee.actions.create(kind: :canceled, comment: comment, user: user)\n end\n end", "def test02_closed_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n \tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_closed)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\tsleep 10 #let content populate\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_closed)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.when_present.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend", "def display_disclaimer()\n # Display Disclaimer\n puts 'The contents of this class must not be considered an offer,'\n puts 'proposal, understanding or agreement unless it is confirmed'\n puts 'in a document signed by at least five blood-sucking lawyers.'\n end", "def user_decline(user_id, comment = nil)\n trade_lines.each { |x| x.user_from_accepted = false }\n trade_lines.each { |x| x.save }\n if comment\n note = trade_notes.build\n note.comment = comment\n note.user_id = user_id\n note.note_type = \"cancel\"\n note.save\n end\n end", "def accept\n if @product.goaled?\n count = params.require(:count)\n @product.bids.not_accepted.oldest(count).each do |bid|\n bid.update! accepted_at: Time.current\n end\n redirect_to [current_role, @product]\n else\n redirect_to [current_role, @product],\n alert: 'Product is not goaled yet.'\n end\n end", "def delete_disputes\n clients.each do |client|\n client.counterparts.each do |counterpart|\n if counterpart.lawsuits.include?(self)\n Dispute.find_by_counterpart_id_and_client_id(counterpart.id,\n client.id).delete\n end\n end\n end\n end", "def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end", "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "def accept!(user_id)\n if self.approved_at.nil?\n # Approvability::Notifier.confirm_approval(self).deliver # Send an email to the contributor\n self.update_attributes(rejected_at: nil, approved_at: Time.now, user: user_id)\n end\n self\n end", "def reject( id, reedo = false, do_amt_reject = false )\n connection.put( \"#{resource_uri}/#{id}/reject\", :headers => { \"Content-Length\" => \"0\" }, :body => { :redo => reedo ? \"true\" : \"false\", :do_amt_reject => do_amt_reject ? \"true\" : \"false\" } )\n end", "def reject_suggestion\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"You have declined the invitation suggestion.\"\n end", "def facilitate_abandonment\n new_client = get_answer_to(\"Is the abandoner a new client? (Y/N)\").downcase\n if new_client == 'y'\n add_client\n abandoning_client = clients.last\n else\n puts \"Choose the adopting client by their number.\"\n display_all_clients\n abandoning_client_index = gets.chomp.to_i - 1\n abandoning_client = clients[abandoning_client_index]\n end\n add_animal\n puts \"Great. #{abandoning_client.name} has given #{animals.last.name} up for adoption.\"\n end", "def disbursement_remaining_factor\n approved_amount == 0 ? 0 : 1 - (disbursed_amount / approved_amount.to_f)\n end", "def revoke\r\n @fund -= 15\r\n puts \"Project #{@name} pissed someone off, and they revoked their donation.\"\r\nend", "def do_close\n self.void_pending_purchase_orders\n self.closed_at = Time.now.utc\n self.kase.sweep_max_reward_price_cache if self.kase\n self.send_canceled\n end", "def reject!(admin, reason)\n unless admin.is_a?(Admin)\n raise \"The author must be a Admin.\"\n end\n self.update_attributes(\n last_reject_reason: reason,\n last_rejected_by: admin.id,\n last_rejected_at: Time.now\n )\n update_status(STATUS_REJECTED)\n TipJournal.write_event_rejected(self, admin)\n # TODO: send email to tipster\n end", "def verify_request_issue_contending_decision_issue_not_readded(\n page_url,\n decision_review,\n contested_decision_issues\n )\n # verify that not modifying a request issue contesting a decision issue\n # does not result in readding\n\n visit page_url\n expect(page).to have_content(contested_decision_issues.first.description)\n expect(page).to have_content(contested_decision_issues.second.description)\n expect(page).to have_content(\"PTSD denied\")\n\n click_remove_intake_issue_dropdown(\"PTSD denied\")\n\n click_intake_add_issue\n add_intake_rating_issue(\"Issue with legacy issue not withdrawn\")\n\n click_edit_submit\n expect(page).to have_content(\"has been submitted\")\n\n first_not_modified_request_issue = RequestIssue.find_by(\n decision_review: decision_review,\n contested_decision_issue_id: contested_decision_issues.first.id\n )\n\n second_not_modified_request_issue = RequestIssue.find_by(\n decision_review: decision_review,\n contested_decision_issue_id: contested_decision_issues.second.id\n )\n\n expect(first_not_modified_request_issue).to_not be_nil\n expect(second_not_modified_request_issue).to_not be_nil\n\n non_modified_ids = [first_not_modified_request_issue.id, second_not_modified_request_issue.id]\n request_issue_update = RequestIssuesUpdate.find_by(review: decision_review)\n\n # existing issues should not be added or removed\n expect(request_issue_update.added_issues.map(&:id)).to_not include(non_modified_ids)\n expect(request_issue_update.removed_issues.map(&:id)).to_not include(non_modified_ids)\n end", "def has_closed_cases\n unless current_user.lawfirm.cases.where(open: false).exists?\n redirect_to new_closed_case_path,\n :flash => {:danger => \"You must fill out or upload information of a closed case to view.\"}\n end\n end", "def test02_post_closed_news_cancel_article_draft\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tcancel_delete\n\tend", "def reset_close_action\n if self.close_action && self.close_action =~ /^no/i\n self.mandated = nil\n self.close_reason = nil\n self.mandated_advocate = nil\n elsif self.close_action && self.close_action =~ /^close/i\n # we might be fine, attributes were already set\n end\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def confirm_acceptance\n return render(:template => 'shared/access_denied', :status => :unauthorized) unless current_user?(@user)\n @short_listed_winner = current_user.short_listed_winnings.find(params[:id])\n if @short_listed_winner.pending?\n if request.get?\n @dispatch = Dispatch.new(current_user.attributes().delete_if{|k,v| ![:address_line_1, :address_line_2, :city, :state, :country, :pin_code, :mobile_number, :phone_number].include?(k.to_sym)})\n @dispatch.prize = @short_listed_winner.prize\n else\n begin\n Dispatch.transaction do |transaction|\n @dispatch = Dispatch.new(params[:dispatch])\n @dispatch.user_id = current_user.id\n @dispatch.country = current_user.country\n @dispatch.prize_id = @short_listed_winner.prize.id\n @dispatch.short_listed_winner_id = params[:id]\n if !@dispatch.prize.needs_dd?\n @dispatch.status = Dispatch::STATUSES[:pending_shipment]\n @dispatch.payment_type = 'N/A'\n end \n @dispatch.save!\n\n @short_listed_winner.accepted = true\n @short_listed_winner.confirmed_on = Time.now\n @short_listed_winner.save!\n \n if @dispatch.prize.needs_dd?\n flash[:notice] = 'Your prize will be dispatched within 30 working days after we receive your DD.'\n else\n flash[:notice] = 'Your prize will be dispatched within 30 working days.'\n end \n PrizeMailer.deliver_prize_confirmed_notification(@dispatch, self)\n return redirect_to(:action => :pending_prizes)\n end\n\t rescue Exception => err\n #logger.error(err.to_s)\n end #begin\n end #get?\n else\n case @short_listed_winner.status\n when 'Accepted' then flash.now[:notice] = 'You have already accepted this prize.'\n when 'Rejected' then flash.now[:notice] = 'You have rejected this prize.'\n when 'Expired' then flash.now[:notice] = 'Oops! Looks like you’re a little late. The confirmation period for your prize claim has expired. But you can still play more contests to WIN more amazing prizes.'\n end\n end # pending?\n render :layout => 'users'\n end", "def deny\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.update_attribute(:approved, false)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def can_reject?\n !accepted? && !rejected? && !withdrawn?\n end", "def close_sale\n self.active = false\n if winner?\n self.owner = winner?\n self.save\n end\n end", "def dislike\n @opportunity = Opportunity.find(params[:id])\n role = if current_user.developer?\n current_user.role_developer\n elsif current_user.organisation?\n current_user.role_organisation\n else\n raise \"Cannot dislike opportunity - invalid role\"\n end\n raise \"Not allowed to dislike\" unless role.can_like?\n\n role.dislike!(@opportunity)\n flash[:notice] = t(\".success\", {title: @opportunity.title})\n redirect_to :root\n end", "def extracosmic_expansive_onstand(lymphatolysis_fissure, french, whauve_diapophysial)\n unsuckled_catsup(apterygota, unfightable_phoneticist)\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def deny(reason)\n user = self.adult_sponsor\n if self.destroy && reason.is_a?(Hash)\n user.group = nil\n user.save\n GroupMailer.send_denied_notice(user, self, reason['email_text']).deliver\n true\n else\n false\n end\n end", "def accept\n @issue = Issue.find(params[:id])\n @issue.resolved = 2\n project = Project.find(@issue.project_id)\n if @issue.save\n flash[:notice] = \"The Solution was Accepted\"\n UserMailer.resolution_approved(@issue, @issue.submitter_id).deliver\n redirect_to project_issue_path(project.slug,@issue.id)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n redirect_to project_issue_path(project.slug,@issue.id)\n end\n end", "def reject!(person, reason)\n if (in_dispute_period? || contested?) && person_can_respond?(person) && response_for(person) != false\n self.class.transaction do\n BountyClaimEvent::BackerDisputed.create!(\n bounty_claim: self,\n person: person,\n description: reason\n )\n BountyClaimResponse.find_or_create_by_claim_and_person(self, person, false, reason) and reload\n end\n end\n end", "def can_be_rejected?\n self.applied?\n end", "def cancel_bid\n @booking = Booking.find(params[:id])\n @booking.presenters.delete(current_user.presenter)\n flash[:success] = \"Success! You've withdrawn your bid.\"\n if @booking.presenters.count < 2\n @booking.help_required = false\n @booking.save\n end\n Notification.send_message(@booking.creator.user, \"#{current_user.presenter.get_private_full_name(current_user)} has withdrawn their bid.\", booking_path(@booking), :cancel_bid)\n redirect_to root_url\n end", "def call\n return broadcast(:has_supports) if @opinion.votes.any?\n\n transaction do\n change_opinion_state_to_withdrawn\n reject_emendations_if_any\n end\n\n broadcast(:ok, @opinion)\n end", "def collectible?\n !collected? && (unanimously_accepted? || !in_dispute_period?) && !contested?\n end", "def reject\n @assignment.active_offer.rejected!\n render_success @assignment.active_offer\n end", "def cancel_request\n\t\tuser = current_user\n\n\t\tassignment = Assignment.find_by(request_id: params[:request_id])\n\t\tuser.accepteds.delete(assignment)\n\t\tpending_status = RequestStatus.find_by(description: \"pending accept\")\n\t\tpending_status.assignments << assignment\n\n\t\tredirect_back fallback_location: '/home'\n\tend", "def editreject\n\t\t@article = Article.find(params[:id])\n\t\t# only submitted articles can be rejected\n\t\tif @article.state != 1\n\t\t\tflash[:notice] = 'Only submitted articles can be rejected.'\n\t\t\tredirect_to :action => 'articles', :state => 1\n\t\tend\n\tend", "def disposable?( include_early_disposal_request_approved_via_transfer = false)\n return false if disposed?\n # otherwise check the policy year and see if it is less than or equal to\n # the current planning year\n return false if policy_replacement_year.blank?\n\n if policy_replacement_year <= current_planning_year_year\n # After ESL disposal\n true\n else\n # Prior ESL disposal request\n last_request = early_disposition_requests.last\n if include_early_disposal_request_approved_via_transfer\n last_request.try(:is_approved?)\n else\n last_request.try(:is_unconditional_approved?)\n end\n end\n end", "def submit_leave_study\n if params[:withdraw].to_s.casecmp(\"withdraw\").zero?\n current_user.revoke_consent!\n redirect_to dashboard_path, notice: \"You left the SleepINNOVATE study.\"\n else\n @withdraw_error = true\n render :leave_study\n end\n end", "def void!(reason)\n return if reason.blank?\n date = self.encounter_datetime.to_date\n\n # void this encounter's observations\n self.observations.each{|observation|\n observation.void!(reason)\n }\n\n # void this encounter's orders\n self.orders.each{|order|\n order.drug_orders.each{|d|\n Pharmacy.new_delivery(d.drug_inventory_id,d.quantity,date)\n }\n order.void!(reason)\n }\n end", "def test02_open_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n\t\tlogin $user_3_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\t\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend", "def consume_food\n if @status == :alive\n # eat the food if it is within my scope\n @food = @food + @food_within_scope.first.eat(@consumption_rate) if !@food_within_scope.empty?\n\n # if I have a storage of food, I'll digest it\n if @food > 0\n @food = @food - (1 * @digestion_rate)\n @food = 0 if @food < 0\n else\n # if i run out of food, i'll starve i.e. die faster\n @starvation_rate = @starvation_rate + 1\n end \n \n end \n end", "def confirm_invitation\n @teammate = Teammate.find(params[:teammate_id])\n return redirect_to forbidden_path unless @teammate.user_id == @current_user.id\n\n if params[:confirm] == 'accept'\n verified = @teammate.verify\n verified ? msg = 'Bem-vindo ao Time de Tripulantes!' : msg = 'Oops! Ocorreu um erro, tente novamente. Caso o erro persista peça para ser adicionado novamente ao time.'\n return redirect_to pitch_teammate_path(@pitch, @teammate), flash: { notice: msg }\n elsif params[:confirm] == 'decline'\n @teammate.destroy\n msg = \"Convite do time #{@teammate.pitch.name} Rejeitado com Sucesso.\"\n return redirect_to root_path, flash: { notice: msg }\n end\n end", "def waiver_submitted\n requested_decision\n end", "def cancel\n investment = Investment.new(session[:investment_attributes])\n investment.skip_validation = true\n investment.status = 1\n if investment.save\n redirect_to investments_path, notice: \"Your Investments successfuly saved!\"\n else\n redirect_to start_wizard_investment_path, alert: \"Something went wrong, your investments hasn't been saved\"\n end\n end", "def disbursed?\n @disbursement_details.valid?\n end", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def reject\n if params[:confirm] == \"true\"\n if @refill_request.valid?\n @refill_request.update_attributes(params[:refill_request])\n refill_response_xml = \"<Denied>\n <DenialReasonCode>#{@refill_request.denial_reason.code}</DenialReasonCode>\n <DenialReason>#{@refill_request.denial_reason.description}</DenialReason>\n </Denied>\"\n\n status_code = generate_refreq_xml(@refill_request, refill_response_xml, nil, false, true)\n if Prescription::SUCCESS_STATUSES.include?(status_code)\n medication = @refill_request.medications.first\n medication.update_attributes(:status => status_code)\n @refill_request.update_status MedicationRefill::REFILL_STATUSES[:denied]\n render :update do |page|\n page << \"RedBox.close()\"\n page.replace_html \"medication_status_#{medication.id}\", \"<div class='status_#{medication.display_status.downcase}'>#{medication.display_status}</div>\"\n page.replace_html \"refill_status_#{@refill_request.id}\", \"Rejected\"\n page.replace_html \"actions_#{@refill_request.id}\", \"<td align='center' colspan='10' id='status_#{@refill_request.id}'>Refill Response sent Successfully.</td>\"\n page.visual_effect :highlight, \"status_#{@refill_request.id}\", :duration => 2.0\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", \"Request failed, please try again or contact support\"\n end\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", @refill_request.errors.full_messages\n end\n end\n else\n @header = \"Refill Request - Denial\"\n @denial_reasons = DenialReason.find(:all)\n end\n end", "def test02_post_closed_board_cancel_article_draft\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tcancel_delete\n\tend", "def reject\n self.update_attributes(:status => REJECTED)\n end", "def reject_automount!\n @reject_automount = true\n end", "def reject\n\t\t@article = Article.find(params[:id])\n\n\t\tif @article.state == 1\n\t if params[:article][:message]\n\t @article.state = 2\n\t @article.message = params[:article][:message] \n\t @article.freezebody = @article.title + \"\\n\\n\" + @article.teaser + \"\\n\\n\" + @article.body + \"\\n\\n\" + @article.version + \"\\n\\n\" + @article.changelog\n\t \n\t if @article.save\n\t flash[:notice] = \"The artile was rejected.\"\n\t redirect_to :action => 'articles', :state => 1\n\t else\n\t render :action => \"editreject\"\n\t end \n\t else\n\t flash[:notice] = \"No reject without reject message.\"\n\t redirect_to :action => 'articles', :state => 1\n\t end\n\t else\n\t flash[:notice] = \"Only submitted articles can be rejected.\"\n\t redirect_to :action => 'articles', :state => 1\n\t end \n\tend", "def approve_adoption\n self[:adoptable] = false\n save\n end", "def donor_can_cancel?\n !received?\n end", "def closed_project\n project = Project.find(params[:id])\n bid = Bid.find(params[:bid_id])\n bid.accepted = true\n project.closed = true\n bid.save\n project.save\n redirect_to project.user.profile\n end", "def confirm_attack\n @active_battler.current_action.set_attack\n process_action\n @windows[Win_Status].clear_dmg_preview\n if (@active_battler != nil)\n @active_battler.perf_action = true\n end\n @windows[Menu_Actor].setup(@active_battler)\n actor_menu_open\n clear_tr_sprites\n end", "def sell_confirmed\n end", "def deny\n self.status = 'denied'\n save\n end", "def reject_offer\n @auction = @current_user.auctions.find(params[:auction_id])\n @offer = @auction.offers.find(params[:offer_id])\n Alert.transaction do\n Alert.offer_to_reject_response!(@offer, @decision)\n if @decision\n @offer.reject!\n end\n end\n end", "def consume\n eated_food = 0;\n player = @game.player\n puts \"you have #{player.food} Units of food\"\n\n loop do\n puts \"What do you Want to eat?\"\n eated_food = gets.to_i\n\n break if eated_food <= player.food && eated_food >= 0\n end\n\n player.food -= eated_food\n player.strength = (player.strength + 5 * eated_food).to_i\n end", "def applyBadConsequence(m)\n if(m.getBadConsequence.isDeath)\n discardAllTreasures\n else\n decrementLevels(m.getBadConsequence.getLevels)\n pbc=m.getBadConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pbc)\n end\n\n end", "def close\n self.closed = true\n self.date_closed = Date.today\n self.save!\n end", "def disbursement_factor\n approved_amount == 0 ? 0 : disbursed_amount / approved_amount.to_f\n end", "def captives_close\n Directions.each do |dir|\n return true if warrior.look(dir)[0].unit.to_s.to_sym == :Captive\n end\n return false\n end", "def accept_bid\n @accepted_bid = Bid.find(params[:bid_id])\n @accepted_bid.status = 1\n @accepted_bid.save\n\n # Changing the project status to 'In Progress' and setting the project deadline\n @project = Project.find(params[:project_id])\n @project.status = 1\n @project.deadline = Date.today + Product.find(@project.product_id).duration\n @project.save\n\n # Rejecting all other project bids\n @rejected_bids = Bid.where(:project_id => @project.id, :status => 0)\n @rejected_bids.each do |bid|\n bid.status = 2\n bid.save\n end\n\n # what happens on dev's dashboard when client accepts a bid ?\n\n flash[:notice] = \"Bid accepted!\"\n redirect_to projects_dashboard_path\n end", "def reject(reason)\n @close_error = reason\n close\n end", "def accept\n @ride = current_user.fares.find_by_id(params[:ride])\n @rider = User.find_by_id(params[:passenger])\n\n @ride.accept(@rider)\n UserMailer.passenger_accept(current_user, @rider).deliver\n redirect_to user_path(current_user)\n end", "def accept\n\t\t@post = Post.find(params[:id])\n\t\t@user_wallet = current_user.wallet\n\t\t@request = Request.where(\"post_id=? AND status=?\",@post.id,\"completed\").first\n\t\t@user_payment =Payment.where(\"post_id=? AND user_id=?\",@post.id,current_user.id).first\n\t\t# comparing two string words\n\t\ts1 = @post.text.split(' ')\n\t\ts2 = @post.updated_text.split(' ')\n\t\tdiff = s2 - s1\n\t\t# getting count of different words\n\t\t@post.words =diff.count\n\t\tp @post.words.inspect\n\t\t\tloop do \n\t\t\t\t@payment_reference = ( \"success\" + [*(0..9)].sample(10).join.to_s )\n\t\t\t\tbreak @payment_reference unless Payment.exists?(reference_id: @payment_reference)\n\t\t\tend\n\n\t\t\t# user return payment\n\t\t\t@payment = Payment.new()\n\t\t\t@payment.amount = @post.words * PaymentCharge.first.per_word_amount.to_f\n\t\t\t@payment.reference_id = @payment_reference\n\t\t\t@payment.status = \"refund\"\n\t\t\t@payment.user_id = current_user.id\n\t\t\t@payment.post_id = @post.id\n\t\t\t# checking if coupon is present \n\t\t\t\tif @user_payment.discount_id.present?\n\t\t\t\t\t@coupon = Coupon.find(@user_payment.discount_id) \n\t\t\t\t\t@coupon_redemption = CouponRedemption.where(\"coupon_id =? AND user_id=?\", @coupon.id,current_user.id).first\n\t\t\t\t\t@payment.discount_id = @coupon.id\n\t\t\t\t\t@payment.payment_type = \"debited\"\n\t\t\t\t\t# if coupon type is percentage\n\t\t\t\t\tif @coupon.coupon_type == \"percentage\"\n\t\t\t\t\t\t\tpercentage_amount = @payment.amount.to_f/100.0 * @coupon.percentage.to_f\n\t\t\t\t\t\t\t# if coupon percentage amount is greater than coupon limit amount\n\t\t\t\t\t\t\tif percentage_amount.to_f > @coupon.amount.to_f\n\t\t\t\t\t\t\t\t@payment.discount_amount = @coupon.amount.to_f\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@payment.discount_amount = percentage_amount.to_f\n\t\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t# if coupon type is amount \n\t\t\t\t\t\tif @payment.amount.to_f > @coupon.amount.to_f\n\t\t\t\t\t\t\t@payment.discount_amount = @coupon.amount.to_f\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@payment.discount_amount = @payment.amount.to_f\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t@user_return_amount = @user_payment.paid_amount.to_f - @payment.amount.to_f + @payment.discount_amount.to_f\n\t\t\t\telse \n\t\t\t\t\t@user_return_amount = @user_payment.paid_amount.to_f - @payment.amount.to_f \n\t\t\t\tend\n\t\t\t@payment.amount = @user_payment.paid_amount.to_f - @user_return_amount.to_f\n\t\t\t@payment.paid_amount = @user_return_amount.to_f\n\t\t\t@balance_amount = @user_payment.paid_amount.to_f - @user_return_amount.to_f\n\t\t\t@user_wallet = User.find(@post.user_id).wallet\n\t\t\t@user_wallet.transaction do\n\t\t\t\t@user_wallet.with_lock do \n\t\t\t\t\t@user_wallet.hold_amount = @user_wallet.hold_amount.to_f - @user_return_amount.to_f\n\t\t\t\t\t@user_wallet.save\n\n\t\t\t\t\t@user_wallet.balance = @user_wallet.balance.to_f + @user_return_amount.to_f\n\t\t\t\t\t@user_wallet.save\n\t\t\t\tend\n\t\t\tend\n\t\t\t@payment.save\n\n\t\t\t# payment for super admin commission to successful proof reading \n\t\t\t@super_admin_payment = Payment.new()\n\t\t\t@super_admin_payment.admin_id = Admin.find_by(:role=>\"Super Admin\").id\n\t\t\t@super_admin_payment.amount = PaymentCharge.first.commission_percentage.to_f/100 * @payment.amount.to_f.round(2)\n\t\t\t@super_admin_payment.reference_id = @payment_reference\n\t\t\t@super_admin_payment.status = \"completed\"\n\t\t\t@super_admin_payment.post_id = @post.id\n\t\t\t@super_admin_payment.paid_amount = @super_admin_payment.amount.to_f\n\t\t\t@super_admin_wallet = Admin.find_by(:role=>\"Super Admin\").wallet\n\t\t\t@super_admin_wallet.transaction do\n\t\t\t\t\t@super_admin_wallet.with_lock do \n\t\t\t\t\t\t@user_wallet.hold_amount = @user_wallet.hold_amount.to_f - @super_admin_payment.paid_amount.to_f\n\t\t\t\t\t\t@user_wallet.save\n\n\t\t\t\t\t\t@super_admin_wallet.balance = @super_admin_wallet.balance.to_f + @super_admin_payment.paid_amount.to_f\n\t\t\t\t\t\t@super_admin_wallet.save\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t@super_admin_payment.save\n\t\t\t\n\t\t\t# payment for proofreader amount \n\t\t\t@payment2 = Payment.new()\n\t\t\t@payment2.admin_id = @request.admin_id\n\t\t\t@payment2.amount = @payment.amount.to_f - @super_admin_payment.paid_amount.to_f\n\t\t\t@payment2.reference_id = @payment_reference\n\t\t\t@payment2.status = \"completed\"\n\t\t\t@payment2.post_id = @post.id\n\t\t\t@payment2.paid_amount = @payment2.amount\n\t\t\t@admin_wallet = Admin.find(@request.admin_id).wallet\n\t\t\t@admin_wallet.transaction do\n\t\t\t\t@admin_wallet.with_lock do \n\t\t\t\t\t@user_wallet.hold_amount = @user_wallet.hold_amount.to_f - @payment2.paid_amount.to_f\n\t\t\t\t\t@user_wallet.save\n\n\t\t\t\t\t@admin_wallet.balance = @admin_wallet.balance.to_f + @payment2.paid_amount.to_f\n\t\t\t\t\t@admin_wallet.save\n\t\t\t\tend\n\t\t\tend\n\t\t\t@payment2.save\n\t\t\t@post.status =\"completed\"\n\t\t\t@post.save\n\t\t\t@request.status=\"completed\"\n\t\t\t@request.save\n\t\t\tredirect_to posts_index_path,notice: \"Thank you ,Please visit again\"\n\tend" ]
[ "0.61208856", "0.6075507", "0.5793209", "0.5760594", "0.57113373", "0.56835866", "0.5675617", "0.56418127", "0.56329083", "0.5626112", "0.56073636", "0.55921817", "0.5514798", "0.54894674", "0.54762053", "0.5470018", "0.54161257", "0.53955007", "0.5378741", "0.5365518", "0.5343007", "0.53421247", "0.53297937", "0.53297937", "0.53231615", "0.5290003", "0.5282928", "0.52644557", "0.52572244", "0.5246472", "0.52374315", "0.52323574", "0.51911134", "0.51903427", "0.51842475", "0.51762456", "0.51734036", "0.51648957", "0.51642543", "0.51605576", "0.5146051", "0.51300377", "0.512674", "0.51266384", "0.51177084", "0.51167667", "0.5105221", "0.5089642", "0.50892633", "0.5087339", "0.50838137", "0.50806403", "0.5070493", "0.5063691", "0.50570655", "0.5037602", "0.50360656", "0.5034883", "0.5030545", "0.5028361", "0.5026177", "0.5020401", "0.5014221", "0.50061107", "0.5005473", "0.500393", "0.4987992", "0.49839917", "0.4982356", "0.4974016", "0.49703908", "0.49668103", "0.49640718", "0.49620062", "0.4956332", "0.49539977", "0.49516964", "0.49505976", "0.4944528", "0.4944343", "0.49431345", "0.493704", "0.49313313", "0.49286956", "0.49257693", "0.49187806", "0.4909896", "0.4908988", "0.4908383", "0.4908174", "0.49069145", "0.4903888", "0.49028128", "0.48959044", "0.48916996", "0.489086", "0.48855942", "0.4880918", "0.4880349", "0.48797566" ]
0.58076364
2
Accept dispute If a dispute is legitimate, you can choose to accept it. This will close it for you and remove it from your list of open disputes. There are no further financial implications.
def accept_dispute_with_http_info(dispute_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.accept_dispute ...' end # verify the required parameter 'dispute_id' is set if @api_client.config.client_side_validation && dispute_id.nil? fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.accept_dispute" end pattern = Regexp.new(/^(dsp)_(\w{26})$/) if @api_client.config.client_side_validation && dispute_id !~ pattern fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.accept_dispute, must conform to the pattern #{pattern}." end # resource path local_var_path = '/disputes/{dispute_id}/accept'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.accept_dispute", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#accept_dispute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_challenge\n @challenge = Challenge.find(params[:challenge_id])\n if !@challenge.nil? then\n accepted = params[:accepted].to_b\n @challenge.update_attributes accepted: accepted, closed: true\n \n if accepted then\n @challenge.rival.update_attribute :score, @challenge.rival.score+30 #author gain 30 points\n else\n @challenge.rival.update_attribute :score, @challenge.rival.score-30 #rival losses 30 points\n end\n \n end\n redirect_to action:'dashboard'\n end", "def decline!\n return unless accepted.nil?\n\n update(accepted: false)\n end", "def accept_dispute(dispute_id, opts = {})\n accept_dispute_with_http_info(dispute_id, opts)\n nil\n end", "def reject\n if request.post?\n if @ad.mark_as_disapproved!(params[:reason])\n flash[:notice] = 'AD successfully rejected!'\n else\n flash_errors_model @ad\n end\n redirect_to url_for(action: :index)\n end\n end", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def accept \n order = Order.find(params[:orderid])\n order.status = \"Accepted\"\n order.save!\n if order.artwork.sold == false\n order.artwork.toggle!(:sold)\n end\n Order.find_all_by_artwork_id(order.artwork.id).each do |f|\n if f.status != \"Accepted\"\n f.status = \"Declined\"\n f.save!\n end\n end\n redirect_to [:admin, User.find(params[:id])]\n end", "def after_accepted\n # repute points\n self.repute_accept\n \n # cash rewards\n if self.kase && self.kase.offers_reward?\n self.kase.rewards.active.each do |reward|\n reward.cash!\n end\n end\n end", "def reject!\n return false if self.approved == true\n self.destroy\n end", "def refuse\n @presentation.refuse!\n redirect_to admin_submissions_path((@presentation.poster ? :poster : :contributed) => 1), notice: 'The presentation has been unaccepted.'\n end", "def establish!\n attempted!\n\n review.establish!\n\n potential_end_products_to_remove = []\n removed_or_withdrawn_issues.select(&:end_product_establishment).each do |request_issue|\n request_issue.end_product_establishment.remove_contention!(request_issue)\n potential_end_products_to_remove << request_issue.end_product_establishment\n end\n\n potential_end_products_to_remove.uniq.each(&:cancel_unused_end_product!)\n clear_error!\n processed!\n end", "def awaiting_disbursement?\n financial_aid_approved? && !disbursed?\n end", "def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "def disapprove\n self.approved = false\n end", "def restrict_disclosure(presentation)\n if !presentation.show_abstract_to_everybody && cannot?(:view_abstract, Presentation)\n def presentation.abstract\n I18n.translate('presentations.not_logged_in')\n end\n def presentation.disclose_abstract\n false\n end\n elsif presentation.disclose_at > Time.now\n def presentation.abstract\n I18n.translate('presentations.pending_disclosure', :date => I18n.localize(disclose_at, :format => :month_day))\n end\n def presentation.disclose_abstract\n false\n end\n else\n def presentation.disclose_abstract\n true\n end\n end\n end", "def legal_terms_acceptance_on!\n @legal_terms_acceptance = true\n end", "def closed!\n update_attributes(\n :state_name => \"closed\",\n :abstains => possible_votes - votes.count,\n :closed_at => Time.now\n )\n end", "def raise_dispute(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/raise_dispute\", options).body)\n @attributes = response['items']\n true\n end", "def dispute_closed\n UserMailer.dispute_closed\n end", "def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end", "def entrance_decision_enter_cave_money\n\n puts \"************************************************************\"\n puts \"Bandit: Ha! You sad poor bum! well if you really want to do get into this cave then I need you to do me a favor. interested?\"\n puts \"type yes, no, or what kind of favor?\"\n while user_input = gets.chomp.downcase.rstrip.lstrip # loop while getting user input\n case user_input\n when \"what kind of favor?\"\n puts \"Bandit: Don't worry about it! now are you in or are you out?\"\n puts \"type yes or no\"\n when \"yes\"\n bandit_favor\n break\n when \"no\"\n puts \"Bandit: Get the hell out of here before I get pissed.\"\n run_away_story\n break\n else\n puts \"Please type yes, no, or what kind of favor? only!\"\n # print the prompt, so the user knows to re-enter input\n end\n end\n end", "def decline_suggestion suggestion \n\t\tsuggestion.status = 4\t\n\t\tsuggestion.save\n\t\t#user_reward(suggestion, -5)\n end", "def human_close_reason\n if self.closed?\n if self.client_cancel?\n \"Frage hat sich erledigt\"\n elsif self.mandated? && self.mandated =~ /listed/i\n \"Anwalt wurde gefunden\"\n elsif self.mandated? && self.mandated =~ /unlisted/i\n \"Anwalt wurde gefunden\"\n else\n \"Laufzeit der Frage beendet\"\n end\n end\n end", "def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end", "def disclose\n @data['disclose']\n end", "def disclose\n @data['disclose']\n end", "def reject\n self[:status] = \"Reject\"\n save\n end", "def accept_or_decline_invitation(params = [])\n study_invites = array_of_study_invite(params)\n while study_invites.size > 0 do\n study_invites.each do |option|\n if invitations.first.study_name.text.include?(option.first) && option.last.downcase.include?('accept')\n invitations.first.inv_accept.click\n sleep 5\n study_invites.shift unless study_invites.empty?\n break\n elsif invitations.first.study_name.text.include?(option.first) && option.last.downcase.include?('decline')\n invitations.first.inv_decline.click\n sleep 5\n study_invites.shift unless study_invites.empty?\n break\n end\n end\n end\n end", "def deny\n @issue = Issue.find(params[:id])\n @issue.resolved = 0\n old_submitter = @issue.submitter_id\n @issue.submitter_id = nil\n project = Project.find(@issue.project_id)\n if @issue.save\n flash[:warning] = \"The Solution was Rejected\"\n UserMailer.resolution_denied(@issue, old_submitter).deliver\n redirect_to project_issue_path(project.slug,@issue.id)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n redirect_to project_issue_path(project.slug,@issue.id)\n end\n end", "def entrance_decision_enter_cave_intimidate\n puts \"************************************************************\"\n puts \"Bandit: oh? so you think you're tough? Tell you what, you defeat me and I'll give you my sword and free passage.\"\n puts \"You get in a brawl with the bandit leader and win.\"\n puts \"Bandit: Argh. no more please. you can go in the cave just please no more.\"\n puts \"Bandit sword equipped\"\n puts \"Bandit Sword power: 20\"\n @enter_cave = true\n @bandit_beat = true\n @bandit_blade = true\n end", "def user_accept(user_id)\n\n cancels = {}\n user = User.find(user_id)\n\n # For each trade line\n trade_lines.each do |x|\n if x.inventory_own.user_id == user_id\n # We accept only the user's portion of the trade\n x.user_from_accepted = true\n x.save\n \n # If this inventory item is involved in other trades\n # then those trades are invalidated\n user_own(user_id).inventory_own.trades.each do |y|\n if y.id != x.trade_id\n cancels[y.id] = y\n end\n end\n\n # If this inventory item is involved in other trades\n # then those trades are invalidated\n user_need(user_id).inventory_need.trades.each do |y|\n if y.id != x.trade_id\n cancels[y.id] = y\n end\n end\n \n cancels.keys.each do |z|\n trade = cancels[z]\n\n unless trade.declined?\n trade.trade_lines.each { |w| w.user_from_accepted = false }\n trade.trade_lines.each { |w| w.save }\n note = trade.trade_notes.build\n note.comment = \"Sorry, I accepted another trade\"\n note.user_id = user_id\n trade.save\n end\n end\n end\n end\n end", "def select_as_deleted choices\n if !choices.nil?\n operations.select { |op| choices[\"d#{op.output(OUTPUT).item.id}\".to_sym] == \"Yes\" }.each do |op|\n frag = op.output(OUTPUT).item\n op.error :low_concentration, \"The concentration of #{frag} was too low to continue\"\n frag.mark_as_deleted\n end\n end\n \n operations.each do |op|\n op.input(INPUT).item.mark_as_deleted if op.input(INPUT).item\n end\n end", "def handle_completly_uncontested!\n\n # sole party get three seats\n sole_party = @parties.first\n sole_party.award(3)\n\n # TODO: fix this demeter violation\n other_major = sole_party.null_opposing_major\n other_major.award(1)\n @parties << other_major\n\n # one seat to third party\n # TODO: fix this demeter violation\n third_party = sole_party.null_coalition_minor\n third_party.award(1)\n @parties << third_party\n end", "def actions_after_decline(comment: \"\", user: )\n appointees.where(status: [:prop_waiting, :prop_accepted, :app_waiting, :app_accepted, :direct_app, :direct_app_accepted]).each do |appointee|\n appointee.actions.create(kind: :canceled, comment: comment, user: user)\n end\n end", "def test02_closed_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n \tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_closed)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\tsleep 10 #let content populate\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_closed)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.when_present.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend", "def display_disclaimer()\n # Display Disclaimer\n puts 'The contents of this class must not be considered an offer,'\n puts 'proposal, understanding or agreement unless it is confirmed'\n puts 'in a document signed by at least five blood-sucking lawyers.'\n end", "def user_decline(user_id, comment = nil)\n trade_lines.each { |x| x.user_from_accepted = false }\n trade_lines.each { |x| x.save }\n if comment\n note = trade_notes.build\n note.comment = comment\n note.user_id = user_id\n note.note_type = \"cancel\"\n note.save\n end\n end", "def accept\n if @product.goaled?\n count = params.require(:count)\n @product.bids.not_accepted.oldest(count).each do |bid|\n bid.update! accepted_at: Time.current\n end\n redirect_to [current_role, @product]\n else\n redirect_to [current_role, @product],\n alert: 'Product is not goaled yet.'\n end\n end", "def delete_disputes\n clients.each do |client|\n client.counterparts.each do |counterpart|\n if counterpart.lawsuits.include?(self)\n Dispute.find_by_counterpart_id_and_client_id(counterpart.id,\n client.id).delete\n end\n end\n end\n end", "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end", "def accept!(user_id)\n if self.approved_at.nil?\n # Approvability::Notifier.confirm_approval(self).deliver # Send an email to the contributor\n self.update_attributes(rejected_at: nil, approved_at: Time.now, user: user_id)\n end\n self\n end", "def reject( id, reedo = false, do_amt_reject = false )\n connection.put( \"#{resource_uri}/#{id}/reject\", :headers => { \"Content-Length\" => \"0\" }, :body => { :redo => reedo ? \"true\" : \"false\", :do_amt_reject => do_amt_reject ? \"true\" : \"false\" } )\n end", "def reject_suggestion\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"You have declined the invitation suggestion.\"\n end", "def disbursement_remaining_factor\n approved_amount == 0 ? 0 : 1 - (disbursed_amount / approved_amount.to_f)\n end", "def facilitate_abandonment\n new_client = get_answer_to(\"Is the abandoner a new client? (Y/N)\").downcase\n if new_client == 'y'\n add_client\n abandoning_client = clients.last\n else\n puts \"Choose the adopting client by their number.\"\n display_all_clients\n abandoning_client_index = gets.chomp.to_i - 1\n abandoning_client = clients[abandoning_client_index]\n end\n add_animal\n puts \"Great. #{abandoning_client.name} has given #{animals.last.name} up for adoption.\"\n end", "def do_close\n self.void_pending_purchase_orders\n self.closed_at = Time.now.utc\n self.kase.sweep_max_reward_price_cache if self.kase\n self.send_canceled\n end", "def revoke\r\n @fund -= 15\r\n puts \"Project #{@name} pissed someone off, and they revoked their donation.\"\r\nend", "def reject!(admin, reason)\n unless admin.is_a?(Admin)\n raise \"The author must be a Admin.\"\n end\n self.update_attributes(\n last_reject_reason: reason,\n last_rejected_by: admin.id,\n last_rejected_at: Time.now\n )\n update_status(STATUS_REJECTED)\n TipJournal.write_event_rejected(self, admin)\n # TODO: send email to tipster\n end", "def has_closed_cases\n unless current_user.lawfirm.cases.where(open: false).exists?\n redirect_to new_closed_case_path,\n :flash => {:danger => \"You must fill out or upload information of a closed case to view.\"}\n end\n end", "def verify_request_issue_contending_decision_issue_not_readded(\n page_url,\n decision_review,\n contested_decision_issues\n )\n # verify that not modifying a request issue contesting a decision issue\n # does not result in readding\n\n visit page_url\n expect(page).to have_content(contested_decision_issues.first.description)\n expect(page).to have_content(contested_decision_issues.second.description)\n expect(page).to have_content(\"PTSD denied\")\n\n click_remove_intake_issue_dropdown(\"PTSD denied\")\n\n click_intake_add_issue\n add_intake_rating_issue(\"Issue with legacy issue not withdrawn\")\n\n click_edit_submit\n expect(page).to have_content(\"has been submitted\")\n\n first_not_modified_request_issue = RequestIssue.find_by(\n decision_review: decision_review,\n contested_decision_issue_id: contested_decision_issues.first.id\n )\n\n second_not_modified_request_issue = RequestIssue.find_by(\n decision_review: decision_review,\n contested_decision_issue_id: contested_decision_issues.second.id\n )\n\n expect(first_not_modified_request_issue).to_not be_nil\n expect(second_not_modified_request_issue).to_not be_nil\n\n non_modified_ids = [first_not_modified_request_issue.id, second_not_modified_request_issue.id]\n request_issue_update = RequestIssuesUpdate.find_by(review: decision_review)\n\n # existing issues should not be added or removed\n expect(request_issue_update.added_issues.map(&:id)).to_not include(non_modified_ids)\n expect(request_issue_update.removed_issues.map(&:id)).to_not include(non_modified_ids)\n end", "def test02_post_closed_news_cancel_article_draft\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tcancel_delete\n\tend", "def reset_close_action\n if self.close_action && self.close_action =~ /^no/i\n self.mandated = nil\n self.close_reason = nil\n self.mandated_advocate = nil\n elsif self.close_action && self.close_action =~ /^close/i\n # we might be fine, attributes were already set\n end\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def confirm_acceptance\n return render(:template => 'shared/access_denied', :status => :unauthorized) unless current_user?(@user)\n @short_listed_winner = current_user.short_listed_winnings.find(params[:id])\n if @short_listed_winner.pending?\n if request.get?\n @dispatch = Dispatch.new(current_user.attributes().delete_if{|k,v| ![:address_line_1, :address_line_2, :city, :state, :country, :pin_code, :mobile_number, :phone_number].include?(k.to_sym)})\n @dispatch.prize = @short_listed_winner.prize\n else\n begin\n Dispatch.transaction do |transaction|\n @dispatch = Dispatch.new(params[:dispatch])\n @dispatch.user_id = current_user.id\n @dispatch.country = current_user.country\n @dispatch.prize_id = @short_listed_winner.prize.id\n @dispatch.short_listed_winner_id = params[:id]\n if !@dispatch.prize.needs_dd?\n @dispatch.status = Dispatch::STATUSES[:pending_shipment]\n @dispatch.payment_type = 'N/A'\n end \n @dispatch.save!\n\n @short_listed_winner.accepted = true\n @short_listed_winner.confirmed_on = Time.now\n @short_listed_winner.save!\n \n if @dispatch.prize.needs_dd?\n flash[:notice] = 'Your prize will be dispatched within 30 working days after we receive your DD.'\n else\n flash[:notice] = 'Your prize will be dispatched within 30 working days.'\n end \n PrizeMailer.deliver_prize_confirmed_notification(@dispatch, self)\n return redirect_to(:action => :pending_prizes)\n end\n\t rescue Exception => err\n #logger.error(err.to_s)\n end #begin\n end #get?\n else\n case @short_listed_winner.status\n when 'Accepted' then flash.now[:notice] = 'You have already accepted this prize.'\n when 'Rejected' then flash.now[:notice] = 'You have rejected this prize.'\n when 'Expired' then flash.now[:notice] = 'Oops! Looks like you’re a little late. The confirmation period for your prize claim has expired. But you can still play more contests to WIN more amazing prizes.'\n end\n end # pending?\n render :layout => 'users'\n end", "def deny\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.update_attribute(:approved, false)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def can_reject?\n !accepted? && !rejected? && !withdrawn?\n end", "def close_sale\n self.active = false\n if winner?\n self.owner = winner?\n self.save\n end\n end", "def dislike\n @opportunity = Opportunity.find(params[:id])\n role = if current_user.developer?\n current_user.role_developer\n elsif current_user.organisation?\n current_user.role_organisation\n else\n raise \"Cannot dislike opportunity - invalid role\"\n end\n raise \"Not allowed to dislike\" unless role.can_like?\n\n role.dislike!(@opportunity)\n flash[:notice] = t(\".success\", {title: @opportunity.title})\n redirect_to :root\n end", "def extracosmic_expansive_onstand(lymphatolysis_fissure, french, whauve_diapophysial)\n unsuckled_catsup(apterygota, unfightable_phoneticist)\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def deny(reason)\n user = self.adult_sponsor\n if self.destroy && reason.is_a?(Hash)\n user.group = nil\n user.save\n GroupMailer.send_denied_notice(user, self, reason['email_text']).deliver\n true\n else\n false\n end\n end", "def accept\n @issue = Issue.find(params[:id])\n @issue.resolved = 2\n project = Project.find(@issue.project_id)\n if @issue.save\n flash[:notice] = \"The Solution was Accepted\"\n UserMailer.resolution_approved(@issue, @issue.submitter_id).deliver\n redirect_to project_issue_path(project.slug,@issue.id)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n redirect_to project_issue_path(project.slug,@issue.id)\n end\n end", "def reject!(person, reason)\n if (in_dispute_period? || contested?) && person_can_respond?(person) && response_for(person) != false\n self.class.transaction do\n BountyClaimEvent::BackerDisputed.create!(\n bounty_claim: self,\n person: person,\n description: reason\n )\n BountyClaimResponse.find_or_create_by_claim_and_person(self, person, false, reason) and reload\n end\n end\n end", "def can_be_rejected?\n self.applied?\n end", "def cancel_bid\n @booking = Booking.find(params[:id])\n @booking.presenters.delete(current_user.presenter)\n flash[:success] = \"Success! You've withdrawn your bid.\"\n if @booking.presenters.count < 2\n @booking.help_required = false\n @booking.save\n end\n Notification.send_message(@booking.creator.user, \"#{current_user.presenter.get_private_full_name(current_user)} has withdrawn their bid.\", booking_path(@booking), :cancel_bid)\n redirect_to root_url\n end", "def call\n return broadcast(:has_supports) if @opinion.votes.any?\n\n transaction do\n change_opinion_state_to_withdrawn\n reject_emendations_if_any\n end\n\n broadcast(:ok, @opinion)\n end", "def collectible?\n !collected? && (unanimously_accepted? || !in_dispute_period?) && !contested?\n end", "def reject\n @assignment.active_offer.rejected!\n render_success @assignment.active_offer\n end", "def cancel_request\n\t\tuser = current_user\n\n\t\tassignment = Assignment.find_by(request_id: params[:request_id])\n\t\tuser.accepteds.delete(assignment)\n\t\tpending_status = RequestStatus.find_by(description: \"pending accept\")\n\t\tpending_status.assignments << assignment\n\n\t\tredirect_back fallback_location: '/home'\n\tend", "def editreject\n\t\t@article = Article.find(params[:id])\n\t\t# only submitted articles can be rejected\n\t\tif @article.state != 1\n\t\t\tflash[:notice] = 'Only submitted articles can be rejected.'\n\t\t\tredirect_to :action => 'articles', :state => 1\n\t\tend\n\tend", "def disposable?( include_early_disposal_request_approved_via_transfer = false)\n return false if disposed?\n # otherwise check the policy year and see if it is less than or equal to\n # the current planning year\n return false if policy_replacement_year.blank?\n\n if policy_replacement_year <= current_planning_year_year\n # After ESL disposal\n true\n else\n # Prior ESL disposal request\n last_request = early_disposition_requests.last\n if include_early_disposal_request_approved_via_transfer\n last_request.try(:is_approved?)\n else\n last_request.try(:is_unconditional_approved?)\n end\n end\n end", "def submit_leave_study\n if params[:withdraw].to_s.casecmp(\"withdraw\").zero?\n current_user.revoke_consent!\n redirect_to dashboard_path, notice: \"You left the SleepINNOVATE study.\"\n else\n @withdraw_error = true\n render :leave_study\n end\n end", "def void!(reason)\n return if reason.blank?\n date = self.encounter_datetime.to_date\n\n # void this encounter's observations\n self.observations.each{|observation|\n observation.void!(reason)\n }\n\n # void this encounter's orders\n self.orders.each{|order|\n order.drug_orders.each{|d|\n Pharmacy.new_delivery(d.drug_inventory_id,d.quantity,date)\n }\n order.void!(reason)\n }\n end", "def test02_open_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n\t\tlogin $user_3_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\t\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend", "def consume_food\n if @status == :alive\n # eat the food if it is within my scope\n @food = @food + @food_within_scope.first.eat(@consumption_rate) if !@food_within_scope.empty?\n\n # if I have a storage of food, I'll digest it\n if @food > 0\n @food = @food - (1 * @digestion_rate)\n @food = 0 if @food < 0\n else\n # if i run out of food, i'll starve i.e. die faster\n @starvation_rate = @starvation_rate + 1\n end \n \n end \n end", "def confirm_invitation\n @teammate = Teammate.find(params[:teammate_id])\n return redirect_to forbidden_path unless @teammate.user_id == @current_user.id\n\n if params[:confirm] == 'accept'\n verified = @teammate.verify\n verified ? msg = 'Bem-vindo ao Time de Tripulantes!' : msg = 'Oops! Ocorreu um erro, tente novamente. Caso o erro persista peça para ser adicionado novamente ao time.'\n return redirect_to pitch_teammate_path(@pitch, @teammate), flash: { notice: msg }\n elsif params[:confirm] == 'decline'\n @teammate.destroy\n msg = \"Convite do time #{@teammate.pitch.name} Rejeitado com Sucesso.\"\n return redirect_to root_path, flash: { notice: msg }\n end\n end", "def waiver_submitted\n requested_decision\n end", "def disbursed?\n @disbursement_details.valid?\n end", "def cancel\n investment = Investment.new(session[:investment_attributes])\n investment.skip_validation = true\n investment.status = 1\n if investment.save\n redirect_to investments_path, notice: \"Your Investments successfuly saved!\"\n else\n redirect_to start_wizard_investment_path, alert: \"Something went wrong, your investments hasn't been saved\"\n end\n end", "def test02_post_closed_board_cancel_article_draft\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tcancel_delete\n\tend", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def reject\n if params[:confirm] == \"true\"\n if @refill_request.valid?\n @refill_request.update_attributes(params[:refill_request])\n refill_response_xml = \"<Denied>\n <DenialReasonCode>#{@refill_request.denial_reason.code}</DenialReasonCode>\n <DenialReason>#{@refill_request.denial_reason.description}</DenialReason>\n </Denied>\"\n\n status_code = generate_refreq_xml(@refill_request, refill_response_xml, nil, false, true)\n if Prescription::SUCCESS_STATUSES.include?(status_code)\n medication = @refill_request.medications.first\n medication.update_attributes(:status => status_code)\n @refill_request.update_status MedicationRefill::REFILL_STATUSES[:denied]\n render :update do |page|\n page << \"RedBox.close()\"\n page.replace_html \"medication_status_#{medication.id}\", \"<div class='status_#{medication.display_status.downcase}'>#{medication.display_status}</div>\"\n page.replace_html \"refill_status_#{@refill_request.id}\", \"Rejected\"\n page.replace_html \"actions_#{@refill_request.id}\", \"<td align='center' colspan='10' id='status_#{@refill_request.id}'>Refill Response sent Successfully.</td>\"\n page.visual_effect :highlight, \"status_#{@refill_request.id}\", :duration => 2.0\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", \"Request failed, please try again or contact support\"\n end\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", @refill_request.errors.full_messages\n end\n end\n else\n @header = \"Refill Request - Denial\"\n @denial_reasons = DenialReason.find(:all)\n end\n end", "def reject\n self.update_attributes(:status => REJECTED)\n end", "def reject_automount!\n @reject_automount = true\n end", "def reject\n\t\t@article = Article.find(params[:id])\n\n\t\tif @article.state == 1\n\t if params[:article][:message]\n\t @article.state = 2\n\t @article.message = params[:article][:message] \n\t @article.freezebody = @article.title + \"\\n\\n\" + @article.teaser + \"\\n\\n\" + @article.body + \"\\n\\n\" + @article.version + \"\\n\\n\" + @article.changelog\n\t \n\t if @article.save\n\t flash[:notice] = \"The artile was rejected.\"\n\t redirect_to :action => 'articles', :state => 1\n\t else\n\t render :action => \"editreject\"\n\t end \n\t else\n\t flash[:notice] = \"No reject without reject message.\"\n\t redirect_to :action => 'articles', :state => 1\n\t end\n\t else\n\t flash[:notice] = \"Only submitted articles can be rejected.\"\n\t redirect_to :action => 'articles', :state => 1\n\t end \n\tend", "def approve_adoption\n self[:adoptable] = false\n save\n end", "def donor_can_cancel?\n !received?\n end", "def closed_project\n project = Project.find(params[:id])\n bid = Bid.find(params[:bid_id])\n bid.accepted = true\n project.closed = true\n bid.save\n project.save\n redirect_to project.user.profile\n end", "def confirm_attack\n @active_battler.current_action.set_attack\n process_action\n @windows[Win_Status].clear_dmg_preview\n if (@active_battler != nil)\n @active_battler.perf_action = true\n end\n @windows[Menu_Actor].setup(@active_battler)\n actor_menu_open\n clear_tr_sprites\n end", "def reject_offer\n @auction = @current_user.auctions.find(params[:auction_id])\n @offer = @auction.offers.find(params[:offer_id])\n Alert.transaction do\n Alert.offer_to_reject_response!(@offer, @decision)\n if @decision\n @offer.reject!\n end\n end\n end", "def deny\n self.status = 'denied'\n save\n end", "def sell_confirmed\n end", "def consume\n eated_food = 0;\n player = @game.player\n puts \"you have #{player.food} Units of food\"\n\n loop do\n puts \"What do you Want to eat?\"\n eated_food = gets.to_i\n\n break if eated_food <= player.food && eated_food >= 0\n end\n\n player.food -= eated_food\n player.strength = (player.strength + 5 * eated_food).to_i\n end", "def applyBadConsequence(m)\n if(m.getBadConsequence.isDeath)\n discardAllTreasures\n else\n decrementLevels(m.getBadConsequence.getLevels)\n pbc=m.getBadConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pbc)\n end\n\n end", "def close\n self.closed = true\n self.date_closed = Date.today\n self.save!\n end", "def captives_close\n Directions.each do |dir|\n return true if warrior.look(dir)[0].unit.to_s.to_sym == :Captive\n end\n return false\n end", "def disbursement_factor\n approved_amount == 0 ? 0 : disbursed_amount / approved_amount.to_f\n end", "def accept_bid\n @accepted_bid = Bid.find(params[:bid_id])\n @accepted_bid.status = 1\n @accepted_bid.save\n\n # Changing the project status to 'In Progress' and setting the project deadline\n @project = Project.find(params[:project_id])\n @project.status = 1\n @project.deadline = Date.today + Product.find(@project.product_id).duration\n @project.save\n\n # Rejecting all other project bids\n @rejected_bids = Bid.where(:project_id => @project.id, :status => 0)\n @rejected_bids.each do |bid|\n bid.status = 2\n bid.save\n end\n\n # what happens on dev's dashboard when client accepts a bid ?\n\n flash[:notice] = \"Bid accepted!\"\n redirect_to projects_dashboard_path\n end", "def reject(reason)\n @close_error = reason\n close\n end", "def accept\n @ride = current_user.fares.find_by_id(params[:ride])\n @rider = User.find_by_id(params[:passenger])\n\n @ride.accept(@rider)\n UserMailer.passenger_accept(current_user, @rider).deliver\n redirect_to user_path(current_user)\n end", "def accept\n\t\t@post = Post.find(params[:id])\n\t\t@user_wallet = current_user.wallet\n\t\t@request = Request.where(\"post_id=? AND status=?\",@post.id,\"completed\").first\n\t\t@user_payment =Payment.where(\"post_id=? AND user_id=?\",@post.id,current_user.id).first\n\t\t# comparing two string words\n\t\ts1 = @post.text.split(' ')\n\t\ts2 = @post.updated_text.split(' ')\n\t\tdiff = s2 - s1\n\t\t# getting count of different words\n\t\t@post.words =diff.count\n\t\tp @post.words.inspect\n\t\t\tloop do \n\t\t\t\t@payment_reference = ( \"success\" + [*(0..9)].sample(10).join.to_s )\n\t\t\t\tbreak @payment_reference unless Payment.exists?(reference_id: @payment_reference)\n\t\t\tend\n\n\t\t\t# user return payment\n\t\t\t@payment = Payment.new()\n\t\t\t@payment.amount = @post.words * PaymentCharge.first.per_word_amount.to_f\n\t\t\t@payment.reference_id = @payment_reference\n\t\t\t@payment.status = \"refund\"\n\t\t\t@payment.user_id = current_user.id\n\t\t\t@payment.post_id = @post.id\n\t\t\t# checking if coupon is present \n\t\t\t\tif @user_payment.discount_id.present?\n\t\t\t\t\t@coupon = Coupon.find(@user_payment.discount_id) \n\t\t\t\t\t@coupon_redemption = CouponRedemption.where(\"coupon_id =? AND user_id=?\", @coupon.id,current_user.id).first\n\t\t\t\t\t@payment.discount_id = @coupon.id\n\t\t\t\t\t@payment.payment_type = \"debited\"\n\t\t\t\t\t# if coupon type is percentage\n\t\t\t\t\tif @coupon.coupon_type == \"percentage\"\n\t\t\t\t\t\t\tpercentage_amount = @payment.amount.to_f/100.0 * @coupon.percentage.to_f\n\t\t\t\t\t\t\t# if coupon percentage amount is greater than coupon limit amount\n\t\t\t\t\t\t\tif percentage_amount.to_f > @coupon.amount.to_f\n\t\t\t\t\t\t\t\t@payment.discount_amount = @coupon.amount.to_f\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@payment.discount_amount = percentage_amount.to_f\n\t\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t# if coupon type is amount \n\t\t\t\t\t\tif @payment.amount.to_f > @coupon.amount.to_f\n\t\t\t\t\t\t\t@payment.discount_amount = @coupon.amount.to_f\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@payment.discount_amount = @payment.amount.to_f\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t@user_return_amount = @user_payment.paid_amount.to_f - @payment.amount.to_f + @payment.discount_amount.to_f\n\t\t\t\telse \n\t\t\t\t\t@user_return_amount = @user_payment.paid_amount.to_f - @payment.amount.to_f \n\t\t\t\tend\n\t\t\t@payment.amount = @user_payment.paid_amount.to_f - @user_return_amount.to_f\n\t\t\t@payment.paid_amount = @user_return_amount.to_f\n\t\t\t@balance_amount = @user_payment.paid_amount.to_f - @user_return_amount.to_f\n\t\t\t@user_wallet = User.find(@post.user_id).wallet\n\t\t\t@user_wallet.transaction do\n\t\t\t\t@user_wallet.with_lock do \n\t\t\t\t\t@user_wallet.hold_amount = @user_wallet.hold_amount.to_f - @user_return_amount.to_f\n\t\t\t\t\t@user_wallet.save\n\n\t\t\t\t\t@user_wallet.balance = @user_wallet.balance.to_f + @user_return_amount.to_f\n\t\t\t\t\t@user_wallet.save\n\t\t\t\tend\n\t\t\tend\n\t\t\t@payment.save\n\n\t\t\t# payment for super admin commission to successful proof reading \n\t\t\t@super_admin_payment = Payment.new()\n\t\t\t@super_admin_payment.admin_id = Admin.find_by(:role=>\"Super Admin\").id\n\t\t\t@super_admin_payment.amount = PaymentCharge.first.commission_percentage.to_f/100 * @payment.amount.to_f.round(2)\n\t\t\t@super_admin_payment.reference_id = @payment_reference\n\t\t\t@super_admin_payment.status = \"completed\"\n\t\t\t@super_admin_payment.post_id = @post.id\n\t\t\t@super_admin_payment.paid_amount = @super_admin_payment.amount.to_f\n\t\t\t@super_admin_wallet = Admin.find_by(:role=>\"Super Admin\").wallet\n\t\t\t@super_admin_wallet.transaction do\n\t\t\t\t\t@super_admin_wallet.with_lock do \n\t\t\t\t\t\t@user_wallet.hold_amount = @user_wallet.hold_amount.to_f - @super_admin_payment.paid_amount.to_f\n\t\t\t\t\t\t@user_wallet.save\n\n\t\t\t\t\t\t@super_admin_wallet.balance = @super_admin_wallet.balance.to_f + @super_admin_payment.paid_amount.to_f\n\t\t\t\t\t\t@super_admin_wallet.save\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t@super_admin_payment.save\n\t\t\t\n\t\t\t# payment for proofreader amount \n\t\t\t@payment2 = Payment.new()\n\t\t\t@payment2.admin_id = @request.admin_id\n\t\t\t@payment2.amount = @payment.amount.to_f - @super_admin_payment.paid_amount.to_f\n\t\t\t@payment2.reference_id = @payment_reference\n\t\t\t@payment2.status = \"completed\"\n\t\t\t@payment2.post_id = @post.id\n\t\t\t@payment2.paid_amount = @payment2.amount\n\t\t\t@admin_wallet = Admin.find(@request.admin_id).wallet\n\t\t\t@admin_wallet.transaction do\n\t\t\t\t@admin_wallet.with_lock do \n\t\t\t\t\t@user_wallet.hold_amount = @user_wallet.hold_amount.to_f - @payment2.paid_amount.to_f\n\t\t\t\t\t@user_wallet.save\n\n\t\t\t\t\t@admin_wallet.balance = @admin_wallet.balance.to_f + @payment2.paid_amount.to_f\n\t\t\t\t\t@admin_wallet.save\n\t\t\t\tend\n\t\t\tend\n\t\t\t@payment2.save\n\t\t\t@post.status =\"completed\"\n\t\t\t@post.save\n\t\t\t@request.status=\"completed\"\n\t\t\t@request.save\n\t\t\tredirect_to posts_index_path,notice: \"Thank you ,Please visit again\"\n\tend" ]
[ "0.6121807", "0.6076099", "0.58073515", "0.579287", "0.57599443", "0.5709649", "0.5682923", "0.5675097", "0.56418294", "0.5632729", "0.5626746", "0.56063515", "0.55905163", "0.5515499", "0.54885215", "0.54777116", "0.54693246", "0.54162365", "0.5396278", "0.53781694", "0.53661346", "0.5343702", "0.53407717", "0.53318954", "0.53318954", "0.5322617", "0.52890974", "0.5282816", "0.5263942", "0.52565056", "0.5246271", "0.523747", "0.52319074", "0.5191904", "0.51889634", "0.5183625", "0.51750225", "0.5172861", "0.5163173", "0.51630414", "0.5158402", "0.5145865", "0.5130766", "0.5125884", "0.5125594", "0.5117467", "0.5116113", "0.5104675", "0.5090431", "0.5089851", "0.5088477", "0.5085274", "0.5080479", "0.5069074", "0.50622356", "0.5057286", "0.50379443", "0.50356054", "0.50350046", "0.50290465", "0.50283396", "0.5025123", "0.50205374", "0.5014264", "0.5005941", "0.5004381", "0.5003848", "0.4987888", "0.49831432", "0.4981847", "0.49736416", "0.4970153", "0.49659625", "0.4964764", "0.49619266", "0.4955866", "0.49531838", "0.4951785", "0.4950943", "0.49442536", "0.49438736", "0.49435446", "0.49366304", "0.49318734", "0.4928411", "0.49254224", "0.49185318", "0.4910206", "0.49090675", "0.49075717", "0.49074998", "0.49073187", "0.4903563", "0.49034095", "0.48968187", "0.48931763", "0.48910576", "0.48847967", "0.4881947", "0.48789775", "0.48783016" ]
0.0
-1
Get dispute details Returns all the details of a dispute using the dispute identifier.
def get_dispute_details(dispute_id, opts = {}) data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dispute_details_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_details\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_details, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Dispute'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_details\",\n :header_params => 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: DisputesApi#get_dispute_details\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def details\n @details ||= Tmdb::Collection.detail(@id)\n return @details\n end", "def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def show\n @edetail = Edetail.find_by(id: params[:id])\n end", "def details\n @details ||= Tmdb::Movie.detail(@id)\n return @details\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_details\n puts \"Name: \" + @name\n puts \"Description: \" + @details\n puts \"Exercise Time: \" + @duration\n end", "def index\n @disputes = Dispute.all\n end", "def details\n data.details\n end", "def time_accruals_id_details_detail_id_get(id, detail_id, opts = {})\n data, _status_code, _headers = time_accruals_id_details_detail_id_get_with_http_info(id, detail_id, opts)\n return data\n end", "def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end", "def get_assessment_details_by_id(study_id, assessment_id)\n act = AssessmentDetailsDownloadAction.new(self)\n act.get(study_id, assessment_id)\n end", "def details\n @details ||= Tmdb::TV.detail(@id)\n return @details\n end", "def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end", "def detail\n attributes.fetch(:detail)\n end", "def detail\n attributes.fetch(:detail)\n end", "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def event_detail(id, options = {})\n get \"event_details/#{id}\", options\n end", "def show\n @diezmoanuals = Diezmoanual.find(params[:id])\n end", "def show\n @diocese = Diocese.find(params[:id])\n end", "def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend", "def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end", "def details\n @details ||= fetch_details\n end", "def details\n\n end", "def event_details(reference, event_id, options={})\n options.merge!(reference: reference, event_id: event_id)\n\n get('event/details', options).result\n end", "def _get_entity_detail(detail_name)\n @entity.get_detail(detail_name)\n end", "def details\n return @details\n end", "def details\n return @details\n end", "def details\n return @details\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def retrieve_with_details(repo_id)\n retrieve(repo_id, :details => true)\n end", "def get_details(id)\n if((results = $redis.get(id)).nil?)\n details = get_details_item(id)\n $redis.set(id,details.to_json)\n return details.to_json\n else\n return results\n end\n end", "def details\n end", "def descr\n return text_get(2, id)\n end", "def details\n @attributes[:details]\n end", "def description\n text_get(7, @id)\n end", "def show_details(id_to_show_details_from_db)\n @db.query(\"SELECT * FROM products WHERE id = '#{id_to_show_details_from_db}'\", :symbolize_keys => true).first\n end", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def show\n @diary = Spree::Diary.find(params[:id])\n \n end", "def show\n @exmedicos = Exmedico.find(params[:id])\n end", "def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def deal_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"deals/#{id}\", params)\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end", "def auto_dispute_order_details\n nil\n end", "def show\n @edu_detail = EduDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edu_detail }\n end\n end", "def details(entity_id, request_options = \"\")\n API::request(:get, \"entities/#{entity_id}\" + request_options)\n end", "def show\n\t @description = Description.find(params[:id])\n\t @patient = @description.patient\n authorize! :see, @description.patient\n end", "def parts\n @descriptive_detail.parts\n end", "def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_drug.details\n end", "def show_detail(n)\n puts \"Here's the detail for contact ID #{n}\"\n puts \"================================\"\n puts \"Name: #{Contact.find(n).name}\"\n puts \"Email: #{Contact.find(n).email}\"\n puts Contact.find(n).phone_hash.to_yaml\n puts \"================================\"\n end", "def show\n @service_order_details = ServiceOrderDetail.where(:service_order_id => params[:id])\n @citation = Citation.where(:id => @service_order.citation_id).select(:id)\n @citation_details = CitationDetail.where(:citation_id => @citation)\n end", "def info(id)\n http.get(\"/nfse/#{id}\") do |response|\n respond_with_entity(response)\n end\n end", "def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end", "def show\n @exp_detail = ExpDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exp_detail }\n end\n end", "def details\n data()\n end", "def description_from_identifiers\n self.identifiers.joins(:identifier_type).order('identifier_types.priority DESC').first&.content_redacted\n end", "def vuln_details(vuln_id)\n xml = make_xml('VulnerabilityDetailsRequest', {'vuln-id' => vuln_id})\n response = execute(xml, '1.2')\n if response.success\n response.res.elements.each('VulnerabilityDetailsResponse/Vulnerability') do |vuln|\n return VulnerabilityDetail::parse(vuln)\n end\n end\n end", "def show\n details = get_details(params[:id])\n render_with_protection details\n end", "def demon\n fetch('naruto.demons')\n end", "def get_dono_excecao\n @dono_excecao = DonoExcecao.find(params[:id])\n end", "def article_details(article_id, opts = {})\n data, _status_code, _headers = article_details_with_http_info(article_id, opts)\n return data\n end", "def title\n @descriptive_detail.title\n end", "def get_assessment_details(study_id, instrument_id, ursi: nil)\n act = AssessmentsDownloadAction.new(self)\n assessments = act.get(study_id, instrument_id, ursi)\n assessments.map do |k,v|\n details = AssessmentDetailsDownloadAction.new(self)\n details.get(study_id, k)\n end\n end", "def details_for(**options)\n\t\t\t\t\toptions[:details]\n\t\t\t\tend", "def show\n @diagnosed_disorders = @patient.get_selected_disorders\n @detected_disorders = @patient.get_detected_disorders\n #@gene = @patient.pedia.order(\"pedia_score DESC\")\n @pedia_service = @patient.pedia_services.last\n if @pedia_service.nil?\n @gene = @patient.pedia.order(\"pedia_score DESC\")\n if @gene.count > 0\n gon.results = get_pedia_json(@gene)\n end\n else\n @gene = @pedia_service.pedia.order(\"pedia_score DESC\")\n gon.results = get_pedia_json(@gene)\n end\n @pedia_status = get_status(@patient, @gene)\n @causing_muts = @patient.disease_causing_mutations\n end", "def time_accruals_id_details_get(id, opts = {})\n data, _status_code, _headers = time_accruals_id_details_get_with_http_info(id, opts)\n return data\n end", "def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end", "def diagnosis_details\n\t\tconcept_name = params[:diagnosis_string]\n\t\toptions = concept_set(concept_name).flatten.uniq\n\t\trender plain: (\"<li></li><li>\" + options.join(\"</li><li>\") + \"</li>\").html_safe\n\tend", "def details\n @details ||= assoc(anime_data['_p_details'])\n end", "def get_nominee_info\n nominee = self.nominee_id\n return Nominee.find_by_id(nominee)\n end", "def show\n respond_with DisIndication.find(params[:id])\n end", "def set_dischargue\n @dischargue = Dischargue.find(params[:id])\n end", "def details(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).get do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}\"\n req.body = params\n end\n handle_response(resp)\n end", "def show\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline }\n end\n end", "def show\n @purchase_order_details = @purchase_order.purchase_order_details\n end", "def show\n @purchase_order_details = @purchase_order.purchase_order_details\n end", "def show\n @disbursement = Disbursement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disbursement }\n end\n end", "def show\n @emm_details = Emm.get_emm_details(@emm.id, get_user_id)\n end", "def detail\n @patient = Patient.find(params[:patient_id])\n end", "def private_article_details(article_id, opts = {})\n data, _status_code, _headers = private_article_details_with_http_info(article_id, opts)\n return data\n end", "def display_details\n return @selected.details\n end", "def show\n #Set a dish by given dish id.\n @dish = Dish.dish_by_id(params[:id])\n end", "def show\n # 疾病\n @diseases = MedicineDisease.where(medicine_id: @medicine.id)\n # 药效\n @efficacies = MedicineEfficacy.where(medicine_id: @medicine.id)\n # 药方\n @prescriptions = PrescriptionDetail.where(medicine_id: @medicine.id)\n end", "def diseases\n return @diseases\n end", "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def snippet_user_agent_details(id)\n get(\"/snippets/#{id}/user_agent_detail\")\n end", "def show\n @discipline = Discipline.find(params[:discipline_id])\n @lecturer = @discipline.lecturers.find(params[:id])\n end", "def quote\n fetch('dessinanime.disney.character')\n end", "def get_details\n theSelection = \"sel=Number\" \n @MAP.each do |k, v|\n theSelection << \",\" << v\n end \n \n uri=\"#{$V1HOST['base_uri']}/rest-1.v1/Data/Defect?#{theSelection}&where=Number\"\n details = self.class.get(\"#{uri}=\\'#{@story}\\'\", :verify => false)\n return details\n end", "def get_detail\n return self.inspect\n end", "def private_article_confidentiality_details(article_id, opts = {})\n data, _status_code, _headers = private_article_confidentiality_details_with_http_info(article_id, opts)\n return data\n end", "def details\n\n @design = Design.find(params['id'])\n\n render :partial => 'details'\n end", "def read_detail\r\n read_detail_header.read_claim_payments\r\n self\r\n end", "def show_details\n @courses = Course.all\n # course_id=params[:id]\n # @course_details = CourseDetail.find_by(id: course_id)\n course_id = params[:id] \n @show_course_details= CourseDetail.joins(\"INNER JOIN courses ON courses.id = course_details.course_id\n \").select('course_name,course_image,amount,tutor_name,tutor_info,course_level,category,course_description,course_duration,lecture_hours,course_curriculum,course_details.created_at').where(course_id: course_id)\n logger.info @show_course_details.inspect\n logger.info \"show course name: #{@show_course_details[0].course_name}\"\n end", "def detail(resource_id)\n @do_resource_mixin.detail(resource_id)\n end", "def show_details\n @selected.details\n end" ]
[ "0.6528571", "0.6504726", "0.6429193", "0.6429193", "0.62441564", "0.62161034", "0.61614233", "0.6070044", "0.6012627", "0.5927579", "0.57882786", "0.57763785", "0.5764956", "0.57508475", "0.5748973", "0.57304984", "0.5725318", "0.57224196", "0.57224196", "0.57183236", "0.5627433", "0.56208676", "0.56141627", "0.5607638", "0.56011397", "0.5598136", "0.55904466", "0.5555065", "0.5554317", "0.55466425", "0.55466425", "0.55466425", "0.551598", "0.55016476", "0.54904836", "0.5489773", "0.54886824", "0.5485722", "0.54694235", "0.5451836", "0.54440737", "0.5443871", "0.5433622", "0.54309034", "0.54252815", "0.5422181", "0.5385015", "0.5375723", "0.5375141", "0.53698444", "0.53553694", "0.5351623", "0.5341041", "0.53352857", "0.5329577", "0.53286767", "0.53273946", "0.53199404", "0.53113776", "0.5310921", "0.53079504", "0.5300347", "0.52934563", "0.52811825", "0.5275679", "0.52690774", "0.5258266", "0.52559745", "0.52555406", "0.5251109", "0.5243453", "0.5242338", "0.52364224", "0.52339745", "0.522933", "0.5225321", "0.5220586", "0.5212518", "0.5212005", "0.5212005", "0.52100134", "0.51970434", "0.51865005", "0.5180776", "0.51767814", "0.5174648", "0.51745284", "0.5169855", "0.51696295", "0.516882", "0.5164323", "0.5163755", "0.515535", "0.51519096", "0.5128965", "0.5128881", "0.5127665", "0.5127522", "0.511989", "0.5119776" ]
0.8035517
0
Get dispute details Returns all the details of a dispute using the dispute identifier.
def get_dispute_details_with_http_info(dispute_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...' end # verify the required parameter 'dispute_id' is set if @api_client.config.client_side_validation && dispute_id.nil? fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_details" end pattern = Regexp.new(/^(dsp)_(\w{26})$/) if @api_client.config.client_side_validation && dispute_id !~ pattern fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.get_dispute_details, must conform to the pattern #{pattern}." end # resource path local_var_path = '/disputes/{dispute_id}'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Dispute' # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.get_dispute_details", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#get_dispute_details\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_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end", "def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def details\n @details ||= Tmdb::Collection.detail(@id)\n return @details\n end", "def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def show\n @edetail = Edetail.find_by(id: params[:id])\n end", "def details\n @details ||= Tmdb::Movie.detail(@id)\n return @details\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_details\n puts \"Name: \" + @name\n puts \"Description: \" + @details\n puts \"Exercise Time: \" + @duration\n end", "def index\n @disputes = Dispute.all\n end", "def details\n data.details\n end", "def time_accruals_id_details_detail_id_get(id, detail_id, opts = {})\n data, _status_code, _headers = time_accruals_id_details_detail_id_get_with_http_info(id, detail_id, opts)\n return data\n end", "def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end", "def get_assessment_details_by_id(study_id, assessment_id)\n act = AssessmentDetailsDownloadAction.new(self)\n act.get(study_id, assessment_id)\n end", "def details\n @details ||= Tmdb::TV.detail(@id)\n return @details\n end", "def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end", "def detail\n attributes.fetch(:detail)\n end", "def detail\n attributes.fetch(:detail)\n end", "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def event_detail(id, options = {})\n get \"event_details/#{id}\", options\n end", "def show\n @diezmoanuals = Diezmoanual.find(params[:id])\n end", "def show\n @diocese = Diocese.find(params[:id])\n end", "def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend", "def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end", "def details\n @details ||= fetch_details\n end", "def details\n\n end", "def event_details(reference, event_id, options={})\n options.merge!(reference: reference, event_id: event_id)\n\n get('event/details', options).result\n end", "def _get_entity_detail(detail_name)\n @entity.get_detail(detail_name)\n end", "def details\n return @details\n end", "def details\n return @details\n end", "def details\n return @details\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def retrieve_with_details(repo_id)\n retrieve(repo_id, :details => true)\n end", "def get_details(id)\n if((results = $redis.get(id)).nil?)\n details = get_details_item(id)\n $redis.set(id,details.to_json)\n return details.to_json\n else\n return results\n end\n end", "def details\n end", "def descr\n return text_get(2, id)\n end", "def details\n @attributes[:details]\n end", "def description\n text_get(7, @id)\n end", "def show_details(id_to_show_details_from_db)\n @db.query(\"SELECT * FROM products WHERE id = '#{id_to_show_details_from_db}'\", :symbolize_keys => true).first\n end", "def show\n @diary = Spree::Diary.find(params[:id])\n \n end", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def show\n @exmedicos = Exmedico.find(params[:id])\n end", "def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def deal_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"deals/#{id}\", params)\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end", "def auto_dispute_order_details\n nil\n end", "def show\n @edu_detail = EduDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edu_detail }\n end\n end", "def details(entity_id, request_options = \"\")\n API::request(:get, \"entities/#{entity_id}\" + request_options)\n end", "def show\n\t @description = Description.find(params[:id])\n\t @patient = @description.patient\n authorize! :see, @description.patient\n end", "def parts\n @descriptive_detail.parts\n end", "def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_drug.details\n end", "def show_detail(n)\n puts \"Here's the detail for contact ID #{n}\"\n puts \"================================\"\n puts \"Name: #{Contact.find(n).name}\"\n puts \"Email: #{Contact.find(n).email}\"\n puts Contact.find(n).phone_hash.to_yaml\n puts \"================================\"\n end", "def show\n @service_order_details = ServiceOrderDetail.where(:service_order_id => params[:id])\n @citation = Citation.where(:id => @service_order.citation_id).select(:id)\n @citation_details = CitationDetail.where(:citation_id => @citation)\n end", "def info(id)\n http.get(\"/nfse/#{id}\") do |response|\n respond_with_entity(response)\n end\n end", "def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end", "def show\n @exp_detail = ExpDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exp_detail }\n end\n end", "def details\n data()\n end", "def description_from_identifiers\n self.identifiers.joins(:identifier_type).order('identifier_types.priority DESC').first&.content_redacted\n end", "def vuln_details(vuln_id)\n xml = make_xml('VulnerabilityDetailsRequest', {'vuln-id' => vuln_id})\n response = execute(xml, '1.2')\n if response.success\n response.res.elements.each('VulnerabilityDetailsResponse/Vulnerability') do |vuln|\n return VulnerabilityDetail::parse(vuln)\n end\n end\n end", "def show\n details = get_details(params[:id])\n render_with_protection details\n end", "def demon\n fetch('naruto.demons')\n end", "def get_dono_excecao\n @dono_excecao = DonoExcecao.find(params[:id])\n end", "def article_details(article_id, opts = {})\n data, _status_code, _headers = article_details_with_http_info(article_id, opts)\n return data\n end", "def title\n @descriptive_detail.title\n end", "def get_assessment_details(study_id, instrument_id, ursi: nil)\n act = AssessmentsDownloadAction.new(self)\n assessments = act.get(study_id, instrument_id, ursi)\n assessments.map do |k,v|\n details = AssessmentDetailsDownloadAction.new(self)\n details.get(study_id, k)\n end\n end", "def details_for(**options)\n\t\t\t\t\toptions[:details]\n\t\t\t\tend", "def show\n @diagnosed_disorders = @patient.get_selected_disorders\n @detected_disorders = @patient.get_detected_disorders\n #@gene = @patient.pedia.order(\"pedia_score DESC\")\n @pedia_service = @patient.pedia_services.last\n if @pedia_service.nil?\n @gene = @patient.pedia.order(\"pedia_score DESC\")\n if @gene.count > 0\n gon.results = get_pedia_json(@gene)\n end\n else\n @gene = @pedia_service.pedia.order(\"pedia_score DESC\")\n gon.results = get_pedia_json(@gene)\n end\n @pedia_status = get_status(@patient, @gene)\n @causing_muts = @patient.disease_causing_mutations\n end", "def time_accruals_id_details_get(id, opts = {})\n data, _status_code, _headers = time_accruals_id_details_get_with_http_info(id, opts)\n return data\n end", "def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end", "def diagnosis_details\n\t\tconcept_name = params[:diagnosis_string]\n\t\toptions = concept_set(concept_name).flatten.uniq\n\t\trender plain: (\"<li></li><li>\" + options.join(\"</li><li>\") + \"</li>\").html_safe\n\tend", "def details\n @details ||= assoc(anime_data['_p_details'])\n end", "def get_nominee_info\n nominee = self.nominee_id\n return Nominee.find_by_id(nominee)\n end", "def show\n respond_with DisIndication.find(params[:id])\n end", "def set_dischargue\n @dischargue = Dischargue.find(params[:id])\n end", "def details(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).get do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}\"\n req.body = params\n end\n handle_response(resp)\n end", "def show\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline }\n end\n end", "def show\n @purchase_order_details = @purchase_order.purchase_order_details\n end", "def show\n @purchase_order_details = @purchase_order.purchase_order_details\n end", "def show\n @disbursement = Disbursement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disbursement }\n end\n end", "def show\n @emm_details = Emm.get_emm_details(@emm.id, get_user_id)\n end", "def detail\n @patient = Patient.find(params[:patient_id])\n end", "def private_article_details(article_id, opts = {})\n data, _status_code, _headers = private_article_details_with_http_info(article_id, opts)\n return data\n end", "def display_details\n return @selected.details\n end", "def show\n # 疾病\n @diseases = MedicineDisease.where(medicine_id: @medicine.id)\n # 药效\n @efficacies = MedicineEfficacy.where(medicine_id: @medicine.id)\n # 药方\n @prescriptions = PrescriptionDetail.where(medicine_id: @medicine.id)\n end", "def show\n #Set a dish by given dish id.\n @dish = Dish.dish_by_id(params[:id])\n end", "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def diseases\n return @diseases\n end", "def snippet_user_agent_details(id)\n get(\"/snippets/#{id}/user_agent_detail\")\n end", "def show\n @discipline = Discipline.find(params[:discipline_id])\n @lecturer = @discipline.lecturers.find(params[:id])\n end", "def quote\n fetch('dessinanime.disney.character')\n end", "def get_details\n theSelection = \"sel=Number\" \n @MAP.each do |k, v|\n theSelection << \",\" << v\n end \n \n uri=\"#{$V1HOST['base_uri']}/rest-1.v1/Data/Defect?#{theSelection}&where=Number\"\n details = self.class.get(\"#{uri}=\\'#{@story}\\'\", :verify => false)\n return details\n end", "def get_detail\n return self.inspect\n end", "def details\n\n @design = Design.find(params['id'])\n\n render :partial => 'details'\n end", "def private_article_confidentiality_details(article_id, opts = {})\n data, _status_code, _headers = private_article_confidentiality_details_with_http_info(article_id, opts)\n return data\n end", "def read_detail\r\n read_detail_header.read_claim_payments\r\n self\r\n end", "def show_details\n @courses = Course.all\n # course_id=params[:id]\n # @course_details = CourseDetail.find_by(id: course_id)\n course_id = params[:id] \n @show_course_details= CourseDetail.joins(\"INNER JOIN courses ON courses.id = course_details.course_id\n \").select('course_name,course_image,amount,tutor_name,tutor_info,course_level,category,course_description,course_duration,lecture_hours,course_curriculum,course_details.created_at').where(course_id: course_id)\n logger.info @show_course_details.inspect\n logger.info \"show course name: #{@show_course_details[0].course_name}\"\n end", "def show_details\n @selected.details\n end", "def detail(resource_id)\n @do_resource_mixin.detail(resource_id)\n end" ]
[ "0.8035856", "0.6504682", "0.64283854", "0.64283854", "0.6243345", "0.6215734", "0.6161557", "0.60696095", "0.60122734", "0.5927277", "0.57880384", "0.57761335", "0.5764058", "0.57507944", "0.57487565", "0.5730047", "0.57245874", "0.57224613", "0.57224613", "0.57171255", "0.5627076", "0.5620154", "0.56142956", "0.56067365", "0.5601149", "0.5598368", "0.5590114", "0.5555279", "0.55545396", "0.5546405", "0.5546405", "0.5546405", "0.5515225", "0.5501266", "0.54898846", "0.54894084", "0.5488368", "0.54852366", "0.5469433", "0.5451023", "0.5443461", "0.5442895", "0.5433002", "0.5430388", "0.5425983", "0.54216534", "0.5384892", "0.5375602", "0.53754765", "0.53694254", "0.535531", "0.53518367", "0.534081", "0.5335828", "0.53293204", "0.53284097", "0.5327269", "0.53203595", "0.5311444", "0.53112775", "0.5307697", "0.53002584", "0.52939385", "0.5281312", "0.52756894", "0.52687955", "0.525753", "0.5255818", "0.5255556", "0.5249585", "0.5243115", "0.524158", "0.5236056", "0.523476", "0.5229298", "0.5224654", "0.52201426", "0.52127844", "0.5212014", "0.5212014", "0.52106667", "0.519736", "0.5186071", "0.51806724", "0.51768607", "0.517411", "0.5173955", "0.51694065", "0.51689535", "0.516831", "0.5164174", "0.51633966", "0.5155339", "0.51525056", "0.51295173", "0.5128764", "0.51286095", "0.5126761", "0.511958", "0.51192206" ]
0.6528627
1
Get dispute evidence Retrieves a list of the evidence submitted in response to a specific dispute.
def get_dispute_evidence(dispute_id, opts = {}) data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def index\n @evidence = Evidence.all\n end", "def index\n @evidences = Evidence.all\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end", "def index\n @disputes = Dispute.all\n end", "def diseases\n return @diseases\n end", "def show\n @announcements = @cpd_event.announcements\n end", "def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end", "def set_evidence\n @evidence = Evidence.includes(:book).find params[:id]\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def evidence_params\n params.require(:evidence).permit(\n :book_id,\n :format,\n :format_other,\n :content_type,\n :location_in_book,\n :location_in_book_page,\n :transcription,\n :translation,\n :year_when,\n :year_start,\n :year_end,\n :date_narrative,\n :where,\n :comments,\n :citations,\n :photo,\n :photo_id,\n :context_photo_id,\n :context_image_id,\n content_type_ids: [],\n provenance_agents_attributes: [ :id, :name_id, :role, :_destroy ]\n )\n end", "def index\n\t\t@residences = Residence.all\n\tend", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def submit_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.submit_dispute_evidence\",\n :header_params => 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: DisputesApi#submit_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def entertainers\n self.events.map {|event| event.entertainers }.flatten\n end", "def get_rated_disabilities\n if @headers['va_eauth_birlsfilenumber'].blank?\n Rails.logger.info('Missing `birls_id`', edipi: @headers['va_eauth_dodedipnid'])\n end\n with_monitoring_and_error_handling do\n Rails.cache.fetch(\"evss_rated_disabilities/#{@headers['va_eauth_dodedipnid']}-#{@headers['va_eauth_pnid']}\",\n expires_in: 30.minutes) do\n raw_response = perform(:get, 'ratedDisabilities')\n RatedDisabilitiesResponse.new(raw_response.status, raw_response)\n end\n end\n end", "def raise_dispute(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/raise_dispute\", options).body)\n @attributes = response['items']\n true\n end", "def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end", "def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n icn = UserAccount.where(id: user_account_id).first&.icn\n service = ApiProviderFactory.rated_disabilities_service_provider(\n { auth_headers:, icn: }\n )\n @all_rated_disabilities ||= begin\n response = service.get_rated_disabilities(settings.access_token.client_id, settings.access_token.rsa_key)\n response.rated_disabilities\n end\n end", "def index\n @disc_assessments = DiscAssessment.all\n end", "def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end", "def show\n @excercise = Excercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @excercise }\n end\n end", "def receive_erased_entites()\n\t\t\tentities = Array.new\n\t\t\tuids = @dict.get_attribute 'IterativeSG', 'erased_entities'\n\t\t\treturn nil if uids == nil\n\t\t\tuids.each { |uid| entities << Controller.entities_by_UID[uid]}\n\t\t\treturn entities\n\t\tend", "def endorsement_certificate\n @ecert\n end", "def episodes \n object.episodes.collect do |episode|\n { \n :episode_code => episode.episode_code, \n :episode_name => episode.episode_name\n }\n end \n end", "def show\n @anecdote = Anecdote.find(params[:id])\n \n @ratings = @anecdote.ratings.reverse_order\n end", "def show\n @edetail = Edetail.find_by(id: params[:id])\n end", "def episode\n fetch('cowboy_bebop.episode')\n end", "def educational_attainment\n fetch('demographic.educational_attainment')\n end", "def adjectives\n\t\treturn synsets_dataset.adjectives\n\tend", "def desserts\n self.dessert_ingredients.map {|di| di.dessert}\n end", "def demon\n fetch('naruto.demons')\n end", "def assess_data_with_vro\n response = vro_client.assess_claim(veteran_icn: claim_context.user_icn)\n claim_context.assessed_data = response.dig('body', 'evidence').transform_keys(&:to_sym)\n claim_context.sufficient_evidence = sufficient_evidence?\n end", "def index\n @disbursments = @case.disbursments\n end", "def adjective\n fetch('emotion.adjective')\n end", "def show\n @event = Event.find(params[:id])\n @event_attendees = @event.attendees\n end", "def show\n @event = Event.find(params[:id])\n @event_attendees = Event.find(params[:id]).attendees\n end", "def proof_of_death\n document_category = DocumentCategory.find_by(name: \"Certified Copy Death Certificate\")\n document = documents.where(document_category: document_category).order(\"included desc nulls last\").first\n unless document.present?\n document_category = DocumentCategory.find_by(name: \"Solicitors Death Certificate Verification form\")\n document = documents.where(document_category: document_category).order(\"included desc nulls last\").first\n end\n unless document.present?\n document_category = DocumentCategory.find_by(name: \"Coroner's Interim certificate\")\n document = documents.where(document_category: document_category).order(\"included desc nulls last\").first\n end\n document\n end", "def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end", "def show\n @residence = Residence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @residence }\n end\n end", "def show\n\t@enrollments = Enrollment.where(:participantID => @participant.participantID)\n end", "def index\n @entertainments = Entertainment.all\n end", "def desserts\n dis = DesertIngredient.all.select {|di| di.ingredient == self}\n dis.map {|di| di.dessert}.uniq\n end", "def index\n @clinical_doses = ClinicalDose.all\n end", "def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams << exam if flag == true\n end\n exams\n end", "def audiences\n return @audiences\n end", "def list\n @adventures = @user&.adventures\n @adventures ||= Adventure.none\n end", "def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end", "def threat_assessment_requests\n return @threat_assessment_requests\n end", "def attendees\n EventAttendee.find_all_by_event_id(self.id) \n end", "def index\n @efemerides = Efemeride.all\n end", "def accept_dispute(dispute_id, opts = {})\n accept_dispute_with_http_info(dispute_id, opts)\n nil\n end", "def index\n @anecdotes = Anecdote.all\n end", "def getAdvocacy\n\t\t\n\tend", "def get_assessment_details(study_id, instrument_id, ursi: nil)\n act = AssessmentsDownloadAction.new(self)\n assessments = act.get(study_id, instrument_id, ursi)\n assessments.map do |k,v|\n details = AssessmentDetailsDownloadAction.new(self)\n details.get(study_id, k)\n end\n end", "def emotional_adjective\n fetch('creature.bird.emotional_adjectives')\n end", "def index\n @english_country_residences = EnglishCountryResidence.all\n end", "def find_guests\n @guests = @wedding.guests.approved.where(invited_on: nil).order(:name)\n end", "def reasons\n response[\"reasons\"]\n end", "def resourceType\n 'Evidence'\n end", "def index\n @edesalfacts = Edesalfact.all\n end", "def patients_reinitiated_on_art_ever\n\t\tpatients = []\n\t\tObservation.find(:all, :joins => [:encounter], :conditions => [\"concept_id = ? AND value_coded IN (?) AND encounter.voided = 0 \\\n\t\t\tAND DATE_FORMAT(obs_datetime, '%Y-%m-%d') <= ?\", ConceptName.find_by_name(\"EVER RECEIVED ART\").concept_id,\n\t\t\t\tConceptName.find(:all, :conditions => [\"name = 'YES'\"]).collect{|c| c.concept_id},\n\t\t\t\t@end_date.to_date.strftime(\"%Y-%m-%d\")]).each do | patient |\n\t\t\tpatients << patient.patient_id.to_i\n\t\tend\n\t\treturn patients\n\tend", "def episode_list(sid)\n xml = get('/feeds/episode_list.php', :query => {:sid => sid})\n xml[\"Show\"]\n end", "def show\n # Obtiene todos los adjuntos con id igual al parametro pasado.\n @attacheds = Attached.where(:investigation_id => params[:id])\n end", "def index\n @exams = Exam.all\n end", "def show\n @possible = @event.possible_guests\n end", "def show\n @diagnosed_disorders = @patient.get_selected_disorders\n @detected_disorders = @patient.get_detected_disorders\n #@gene = @patient.pedia.order(\"pedia_score DESC\")\n @pedia_service = @patient.pedia_services.last\n if @pedia_service.nil?\n @gene = @patient.pedia.order(\"pedia_score DESC\")\n if @gene.count > 0\n gon.results = get_pedia_json(@gene)\n end\n else\n @gene = @pedia_service.pedia.order(\"pedia_score DESC\")\n gon.results = get_pedia_json(@gene)\n end\n @pedia_status = get_status(@patient, @gene)\n @causing_muts = @patient.disease_causing_mutations\n end", "def entailments\n _entailments\n end", "def entailments\n _entailments\n end", "def show\n @ideas = @list.ideas;\n end", "def explanations\n return nil unless @id\n\n @explanation ||= response[\"annotations\"].map do |annotation|\n annotation[\"body\"][\"plain\"]\n end\n end", "def index\n @course = Course.find(params[:course_id])\n @exams = @course.exams \n end", "def eds\n @eds_session = get_eds_session\n @eds_fields = get_eds_fields\n end", "def episodes\n Episode.all.select{ |episode| episode.show == self }\n end", "def show\n @user = User.new\n @response = HTTParty.get(\"https://www.eventbriteapi.com/v3/events/#{@event.event_id}/attendees/?token=R3MLTYFWNHNDB53GOBCP\")\n @response1 = HTTParty.get(\"https://www.eventbriteapi.com/v3/events/#{@event.event_id}/?token=R3MLTYFWNHNDB53GOBCP\")\n @peeps = @response['attendees']\n @event_name = @response1['name']['text']\n end", "def index\n @absences = Absence.all\n end", "def index\n @absences = Absence.all\n end", "def dispute\n UserMailer.dispute\n end", "def index\n @certainties = Certainty.all\n end", "def show\n @diezmoanuals = Diezmoanual.find(params[:id])\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def show\n @emissions = Emission.where(\"continent_id = ?\", @emission.continent)\n end", "def vuln_details(vuln_id)\n xml = make_xml('VulnerabilityDetailsRequest', {'vuln-id' => vuln_id})\n response = execute(xml, '1.2')\n if response.success\n response.res.elements.each('VulnerabilityDetailsResponse/Vulnerability') do |vuln|\n return VulnerabilityDetail::parse(vuln)\n end\n end\n end", "def event_details(reference, event_id, options={})\n options.merge!(reference: reference, event_id: event_id)\n\n get('event/details', options).result\n end", "def assessment\n @assessment\n end", "def index\n @eruptions = Eruption.all\n end", "def edit\n @client = Client.find(params[:client_id])\n @visits = @client.visits\n @visit = Visit.find(params[:id])\n @disclaimers = Disclaimers.all\n end", "def show\n @dishes = @chef.dishes\n end", "def attendees(event)\n get(:standard, {:method => \"event.getAttendees\", :event => event})\n end", "def index\n @emergencies = Emergency.all\n end", "def show\n @exmedicos = Exmedico.find(params[:id])\n end" ]
[ "0.65136564", "0.6201981", "0.61271626", "0.6014643", "0.5719737", "0.5661378", "0.55535525", "0.5443012", "0.5431403", "0.5414931", "0.5381682", "0.5347796", "0.5347796", "0.53197044", "0.5310905", "0.5292871", "0.5292871", "0.52774334", "0.51486903", "0.5119194", "0.51098365", "0.5058334", "0.5050143", "0.503656", "0.5007647", "0.49939618", "0.49151024", "0.4908821", "0.48911688", "0.48856187", "0.48558697", "0.48553178", "0.48385316", "0.4814338", "0.47934148", "0.47853017", "0.47821662", "0.47810447", "0.4770153", "0.47693667", "0.47608188", "0.4746549", "0.47350487", "0.47307172", "0.472333", "0.47205856", "0.46847373", "0.46776003", "0.4671231", "0.46702302", "0.46444234", "0.46203548", "0.46202552", "0.4612447", "0.46049848", "0.46035466", "0.45985436", "0.45943752", "0.45872372", "0.45840493", "0.45833847", "0.4578683", "0.45731154", "0.45726934", "0.4571181", "0.4567501", "0.4565163", "0.45531282", "0.45514154", "0.4536924", "0.453578", "0.4535032", "0.45334488", "0.4529418", "0.4527928", "0.45202005", "0.45202005", "0.45179215", "0.45177463", "0.4516993", "0.4509699", "0.45061737", "0.45060554", "0.44941235", "0.44941235", "0.44866183", "0.44849357", "0.4482275", "0.44820186", "0.44803938", "0.4480072", "0.4471551", "0.44714576", "0.4469282", "0.44682425", "0.44670215", "0.446651", "0.44659582", "0.44657788", "0.44648597" ]
0.69512284
0
Get dispute evidence Retrieves a list of the evidence submitted in response to a specific dispute.
def get_dispute_evidence_with_http_info(dispute_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...' end # verify the required parameter 'dispute_id' is set if @api_client.config.client_side_validation && dispute_id.nil? fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence" end pattern = Regexp.new(/^(dsp)_(\w{26})$/) if @api_client.config.client_side_validation && dispute_id !~ pattern fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}." end # resource path local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Evidence' # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.get_dispute_evidence", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#get_dispute_evidence\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_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data\n end", "def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def index\n @evidence = Evidence.all\n end", "def index\n @evidences = Evidence.all\n end", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end", "def index\n @disputes = Dispute.all\n end", "def diseases\n return @diseases\n end", "def show\n @announcements = @cpd_event.announcements\n end", "def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end", "def set_evidence\n @evidence = Evidence.includes(:book).find params[:id]\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def evidence_params\n params.require(:evidence).permit(\n :book_id,\n :format,\n :format_other,\n :content_type,\n :location_in_book,\n :location_in_book_page,\n :transcription,\n :translation,\n :year_when,\n :year_start,\n :year_end,\n :date_narrative,\n :where,\n :comments,\n :citations,\n :photo,\n :photo_id,\n :context_photo_id,\n :context_image_id,\n content_type_ids: [],\n provenance_agents_attributes: [ :id, :name_id, :role, :_destroy ]\n )\n end", "def index\n\t\t@residences = Residence.all\n\tend", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def submit_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.submit_dispute_evidence\",\n :header_params => 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: DisputesApi#submit_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def entertainers\n self.events.map {|event| event.entertainers }.flatten\n end", "def get_rated_disabilities\n if @headers['va_eauth_birlsfilenumber'].blank?\n Rails.logger.info('Missing `birls_id`', edipi: @headers['va_eauth_dodedipnid'])\n end\n with_monitoring_and_error_handling do\n Rails.cache.fetch(\"evss_rated_disabilities/#{@headers['va_eauth_dodedipnid']}-#{@headers['va_eauth_pnid']}\",\n expires_in: 30.minutes) do\n raw_response = perform(:get, 'ratedDisabilities')\n RatedDisabilitiesResponse.new(raw_response.status, raw_response)\n end\n end\n end", "def raise_dispute(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/raise_dispute\", options).body)\n @attributes = response['items']\n true\n end", "def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end", "def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n icn = UserAccount.where(id: user_account_id).first&.icn\n service = ApiProviderFactory.rated_disabilities_service_provider(\n { auth_headers:, icn: }\n )\n @all_rated_disabilities ||= begin\n response = service.get_rated_disabilities(settings.access_token.client_id, settings.access_token.rsa_key)\n response.rated_disabilities\n end\n end", "def index\n @disc_assessments = DiscAssessment.all\n end", "def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end", "def show\n @excercise = Excercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @excercise }\n end\n end", "def receive_erased_entites()\n\t\t\tentities = Array.new\n\t\t\tuids = @dict.get_attribute 'IterativeSG', 'erased_entities'\n\t\t\treturn nil if uids == nil\n\t\t\tuids.each { |uid| entities << Controller.entities_by_UID[uid]}\n\t\t\treturn entities\n\t\tend", "def endorsement_certificate\n @ecert\n end", "def episodes \n object.episodes.collect do |episode|\n { \n :episode_code => episode.episode_code, \n :episode_name => episode.episode_name\n }\n end \n end", "def show\n @anecdote = Anecdote.find(params[:id])\n \n @ratings = @anecdote.ratings.reverse_order\n end", "def show\n @edetail = Edetail.find_by(id: params[:id])\n end", "def episode\n fetch('cowboy_bebop.episode')\n end", "def educational_attainment\n fetch('demographic.educational_attainment')\n end", "def adjectives\n\t\treturn synsets_dataset.adjectives\n\tend", "def desserts\n self.dessert_ingredients.map {|di| di.dessert}\n end", "def demon\n fetch('naruto.demons')\n end", "def assess_data_with_vro\n response = vro_client.assess_claim(veteran_icn: claim_context.user_icn)\n claim_context.assessed_data = response.dig('body', 'evidence').transform_keys(&:to_sym)\n claim_context.sufficient_evidence = sufficient_evidence?\n end", "def index\n @disbursments = @case.disbursments\n end", "def adjective\n fetch('emotion.adjective')\n end", "def show\n @event = Event.find(params[:id])\n @event_attendees = @event.attendees\n end", "def show\n @event = Event.find(params[:id])\n @event_attendees = Event.find(params[:id]).attendees\n end", "def proof_of_death\n document_category = DocumentCategory.find_by(name: \"Certified Copy Death Certificate\")\n document = documents.where(document_category: document_category).order(\"included desc nulls last\").first\n unless document.present?\n document_category = DocumentCategory.find_by(name: \"Solicitors Death Certificate Verification form\")\n document = documents.where(document_category: document_category).order(\"included desc nulls last\").first\n end\n unless document.present?\n document_category = DocumentCategory.find_by(name: \"Coroner's Interim certificate\")\n document = documents.where(document_category: document_category).order(\"included desc nulls last\").first\n end\n document\n end", "def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end", "def show\n @residence = Residence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @residence }\n end\n end", "def show\n\t@enrollments = Enrollment.where(:participantID => @participant.participantID)\n end", "def index\n @entertainments = Entertainment.all\n end", "def desserts\n dis = DesertIngredient.all.select {|di| di.ingredient == self}\n dis.map {|di| di.dessert}.uniq\n end", "def index\n @clinical_doses = ClinicalDose.all\n end", "def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams << exam if flag == true\n end\n exams\n end", "def audiences\n return @audiences\n end", "def list\n @adventures = @user&.adventures\n @adventures ||= Adventure.none\n end", "def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end", "def threat_assessment_requests\n return @threat_assessment_requests\n end", "def attendees\n EventAttendee.find_all_by_event_id(self.id) \n end", "def index\n @efemerides = Efemeride.all\n end", "def accept_dispute(dispute_id, opts = {})\n accept_dispute_with_http_info(dispute_id, opts)\n nil\n end", "def index\n @anecdotes = Anecdote.all\n end", "def getAdvocacy\n\t\t\n\tend", "def get_assessment_details(study_id, instrument_id, ursi: nil)\n act = AssessmentsDownloadAction.new(self)\n assessments = act.get(study_id, instrument_id, ursi)\n assessments.map do |k,v|\n details = AssessmentDetailsDownloadAction.new(self)\n details.get(study_id, k)\n end\n end", "def emotional_adjective\n fetch('creature.bird.emotional_adjectives')\n end", "def index\n @english_country_residences = EnglishCountryResidence.all\n end", "def find_guests\n @guests = @wedding.guests.approved.where(invited_on: nil).order(:name)\n end", "def reasons\n response[\"reasons\"]\n end", "def resourceType\n 'Evidence'\n end", "def index\n @edesalfacts = Edesalfact.all\n end", "def patients_reinitiated_on_art_ever\n\t\tpatients = []\n\t\tObservation.find(:all, :joins => [:encounter], :conditions => [\"concept_id = ? AND value_coded IN (?) AND encounter.voided = 0 \\\n\t\t\tAND DATE_FORMAT(obs_datetime, '%Y-%m-%d') <= ?\", ConceptName.find_by_name(\"EVER RECEIVED ART\").concept_id,\n\t\t\t\tConceptName.find(:all, :conditions => [\"name = 'YES'\"]).collect{|c| c.concept_id},\n\t\t\t\t@end_date.to_date.strftime(\"%Y-%m-%d\")]).each do | patient |\n\t\t\tpatients << patient.patient_id.to_i\n\t\tend\n\t\treturn patients\n\tend", "def episode_list(sid)\n xml = get('/feeds/episode_list.php', :query => {:sid => sid})\n xml[\"Show\"]\n end", "def show\n # Obtiene todos los adjuntos con id igual al parametro pasado.\n @attacheds = Attached.where(:investigation_id => params[:id])\n end", "def index\n @exams = Exam.all\n end", "def show\n @possible = @event.possible_guests\n end", "def show\n @diagnosed_disorders = @patient.get_selected_disorders\n @detected_disorders = @patient.get_detected_disorders\n #@gene = @patient.pedia.order(\"pedia_score DESC\")\n @pedia_service = @patient.pedia_services.last\n if @pedia_service.nil?\n @gene = @patient.pedia.order(\"pedia_score DESC\")\n if @gene.count > 0\n gon.results = get_pedia_json(@gene)\n end\n else\n @gene = @pedia_service.pedia.order(\"pedia_score DESC\")\n gon.results = get_pedia_json(@gene)\n end\n @pedia_status = get_status(@patient, @gene)\n @causing_muts = @patient.disease_causing_mutations\n end", "def entailments\n _entailments\n end", "def entailments\n _entailments\n end", "def show\n @ideas = @list.ideas;\n end", "def explanations\n return nil unless @id\n\n @explanation ||= response[\"annotations\"].map do |annotation|\n annotation[\"body\"][\"plain\"]\n end\n end", "def index\n @course = Course.find(params[:course_id])\n @exams = @course.exams \n end", "def eds\n @eds_session = get_eds_session\n @eds_fields = get_eds_fields\n end", "def episodes\n Episode.all.select{ |episode| episode.show == self }\n end", "def show\n @user = User.new\n @response = HTTParty.get(\"https://www.eventbriteapi.com/v3/events/#{@event.event_id}/attendees/?token=R3MLTYFWNHNDB53GOBCP\")\n @response1 = HTTParty.get(\"https://www.eventbriteapi.com/v3/events/#{@event.event_id}/?token=R3MLTYFWNHNDB53GOBCP\")\n @peeps = @response['attendees']\n @event_name = @response1['name']['text']\n end", "def index\n @absences = Absence.all\n end", "def index\n @absences = Absence.all\n end", "def dispute\n UserMailer.dispute\n end", "def index\n @certainties = Certainty.all\n end", "def show\n @diezmoanuals = Diezmoanual.find(params[:id])\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def show\n @emissions = Emission.where(\"continent_id = ?\", @emission.continent)\n end", "def vuln_details(vuln_id)\n xml = make_xml('VulnerabilityDetailsRequest', {'vuln-id' => vuln_id})\n response = execute(xml, '1.2')\n if response.success\n response.res.elements.each('VulnerabilityDetailsResponse/Vulnerability') do |vuln|\n return VulnerabilityDetail::parse(vuln)\n end\n end\n end", "def event_details(reference, event_id, options={})\n options.merge!(reference: reference, event_id: event_id)\n\n get('event/details', options).result\n end", "def assessment\n @assessment\n end", "def index\n @eruptions = Eruption.all\n end", "def edit\n @client = Client.find(params[:client_id])\n @visits = @client.visits\n @visit = Visit.find(params[:id])\n @disclaimers = Disclaimers.all\n end", "def show\n @dishes = @chef.dishes\n end", "def attendees(event)\n get(:standard, {:method => \"event.getAttendees\", :event => event})\n end", "def index\n @emergencies = Emergency.all\n end", "def show\n @exmedicos = Exmedico.find(params[:id])\n end" ]
[ "0.69512284", "0.65136564", "0.6201981", "0.61271626", "0.5719737", "0.5661378", "0.55535525", "0.5443012", "0.5431403", "0.5414931", "0.5381682", "0.5347796", "0.5347796", "0.53197044", "0.5310905", "0.5292871", "0.5292871", "0.52774334", "0.51486903", "0.5119194", "0.51098365", "0.5058334", "0.5050143", "0.503656", "0.5007647", "0.49939618", "0.49151024", "0.4908821", "0.48911688", "0.48856187", "0.48558697", "0.48553178", "0.48385316", "0.4814338", "0.47934148", "0.47853017", "0.47821662", "0.47810447", "0.4770153", "0.47693667", "0.47608188", "0.4746549", "0.47350487", "0.47307172", "0.472333", "0.47205856", "0.46847373", "0.46776003", "0.4671231", "0.46702302", "0.46444234", "0.46203548", "0.46202552", "0.4612447", "0.46049848", "0.46035466", "0.45985436", "0.45943752", "0.45872372", "0.45840493", "0.45833847", "0.4578683", "0.45731154", "0.45726934", "0.4571181", "0.4567501", "0.4565163", "0.45531282", "0.45514154", "0.4536924", "0.453578", "0.4535032", "0.45334488", "0.4529418", "0.4527928", "0.45202005", "0.45202005", "0.45179215", "0.45177463", "0.4516993", "0.4509699", "0.45061737", "0.45060554", "0.44941235", "0.44941235", "0.44866183", "0.44849357", "0.4482275", "0.44820186", "0.44803938", "0.4480072", "0.4471551", "0.44714576", "0.4469282", "0.44682425", "0.44670215", "0.446651", "0.44659582", "0.44657788", "0.44648597" ]
0.6014643
4
Get disputes Returns a list of all disputes against your business. The results will be returned in reverse chronological order, showing the last modified dispute (for example, where you've recently added a piece of evidence) first. You can use the optional parameters below to skip or limit results.
def get_disputes(opts = {}) data, _status_code, _headers = get_disputes_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @disputes = Dispute.all\n end", "def get_disputes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_disputes ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DisputesApi.get_disputes, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DisputesApi.get_disputes, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'skip'].nil? && opts[:'skip'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"skip\"]\" when calling DisputesApi.get_disputes, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/disputes'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'statuses'] = opts[:'statuses'] if !opts[:'statuses'].nil?\n query_params[:'payment_id'] = opts[:'payment_id'] if !opts[:'payment_id'].nil?\n query_params[:'payment_reference'] = opts[:'payment_reference'] if !opts[:'payment_reference'].nil?\n query_params[:'payment_arn'] = opts[:'payment_arn'] if !opts[:'payment_arn'].nil?\n query_params[:'this_channel_only'] = opts[:'this_channel_only'] if !opts[:'this_channel_only'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DisputePaged'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_disputes\",\n :header_params => 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: DisputesApi#get_disputes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @discs = Disc.all\n end", "def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n icn = UserAccount.where(id: user_account_id).first&.icn\n service = ApiProviderFactory.rated_disabilities_service_provider(\n { auth_headers:, icn: }\n )\n @all_rated_disabilities ||= begin\n response = service.get_rated_disabilities(settings.access_token.client_id, settings.access_token.rsa_key)\n response.rated_disabilities\n end\n end", "def index\n @disbursments = @case.disbursments\n end", "def index\n @disatance_and_times = DisatanceAndTime.all\n end", "def index\n @dis_doseperiods = DisDoseperiod.all\n end", "def index\n @dis_durations = DisDuration.all\n end", "def index\n @discusses = @topic.discusses.order('title ASC')\n end", "def index\n @disfrazs = Disfraz.all\n end", "def index\n @disciplines = Discipline.order(questions_daily_access: :desc)\n end", "def index\n @descoverlies = Descoverly.all\n end", "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def index\n @admin_discounts = Admin::Discount.all\n end", "def possible_discounts\n possible_discounts = []\n discounts_all = set_discounts_arr + extra_discounts_arr\n discounts_all.map do |discount|\n next unless discount_veryfication(discount, ordered_products_total_arr, 1)\n\n discount_ids = discount[0..discount.length - 2]\n product_ids = ordered_products_total_arr\n result = discount_count(discount_ids, product_ids)\n for i in 1..result[1] do\n possible_discounts.push(discount)\n end\n end\n possible_discounts\n end", "def getDiscs(types)\n\tdiscs = Array.new\n\n\t@discs_doc.elements.each('acda-discs/disc') { |elem|\n\t\tdisc = parseDisc(elem, types)\n\t\tdiscs.push disc\n\t}\n\n\tdiscs\nend", "def show\n dis = @case.disbursments.order(id: :desc)\n comments = @case.comments\n @disbursments = dis+comments\n @disbursments = @disbursments.sort_by(&:created_at)\n end", "def index\n skip_authorization\n @discovers = Discover.all\n end", "def index\n @discipuladores = Discipulador.all\n end", "def index\n @discount_activities = DiscountActivity.all\n end", "def index\n @dis_systems = DisSystem.all\n end", "def index\n @dislikes = Dislike.all\n end", "def index\n authorize! :read, Discharge\n @discharges = Discharge.all\n end", "def index\n @injhas_special_biryani_dishes = InjhasSpecialBiryaniDish.all\n end", "def index\n @diet_dishes = DietDish.all\n end", "def index\n @disc_assessments = DiscAssessment.all\n end", "def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\n end", "def delete_disputes\n clients.each do |client|\n client.counterparts.each do |counterpart|\n if counterpart.lawsuits.include?(self)\n Dispute.find_by_counterpart_id_and_client_id(counterpart.id,\n client.id).delete\n end\n end\n end\n end", "def index\n @dislike_counts = DislikeCount.all\n end", "def disgemd_for(klass)\n Recommendable.query(klass, disgemd_ids_for(klass))\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def index\n @do_not_stops = DoNotStop.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def get_rated_disabilities\n if @headers['va_eauth_birlsfilenumber'].blank?\n Rails.logger.info('Missing `birls_id`', edipi: @headers['va_eauth_dodedipnid'])\n end\n with_monitoring_and_error_handling do\n Rails.cache.fetch(\"evss_rated_disabilities/#{@headers['va_eauth_dodedipnid']}-#{@headers['va_eauth_pnid']}\",\n expires_in: 30.minutes) do\n raw_response = perform(:get, 'ratedDisabilities')\n RatedDisabilitiesResponse.new(raw_response.status, raw_response)\n end\n end\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @clinical_doses = ClinicalDose.all\n end", "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def show\n @discos = @artista.discos.order(:publicacion => :desc)\n end", "def index\n @dish_moods = DishMood.all\n end", "def index\n @what_should_avoids = WhatShouldAvoid.all\n end", "def index\n @discussioms = Discussiom.all\n end", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def all_discounts(scans)\n scans.map do |scan|\n product = scan.product\n next unless product.is_a?(BuyXGetXProduct) || product.is_a?(BulkProduct)\n discount_total = scan.discount_total\n next unless discount_total.positive?\n { title: discount_title(scan), amount: priceify_number(discount_total) }\n end.compact\n end", "def index\n @admin_dishes = Admin::Dish.all\n end", "def index\n @music_discs = MusicDisc.all\n end", "def index\n @discount_codes = DiscountCode.all\n end", "def index\n @disappeareds = Disappeared.where(relatives_id: params[:relative_id]).page params[:page]\n end", "def index\n @disciplinas = Disciplina.all\n end", "def hidden\n @posts = Post.hidden.order(face_date: :desc).page(params[:page]).per(20)\n end", "def index\n @detpedidos = Detpedido.all\n end", "def index\n @novedads = Novedad.all.reverse\n end", "def index\n @diezmoanuals = Diezmoanual.all\n end", "def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end", "def index\n @despesas = @condominio.despesas\n end", "def index\n @deces = Dece.all\n end", "def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end", "def index\n @dish_rating_comments = DishRatingComment.all\n end", "def index\n @inchicken_dishes = InchickenDish.all\n end", "def index\n @muscle_diaries = MuscleDiary.all\n end", "def index\n @diliverymen = Diliveryman.all\n end", "def index\n @docters = Docter.all\n end", "def index\n @business_dashes = BusinessDash.all\n end", "def index\n @employee = Employee.find(params[:employee_id])\n @direct_deposits = @employee.direct_deposits.all\n skip_authorization\n end", "def discounts\n @discounts ||= hash[\"Discounts\"].map { |d| Merchant::Discount.new d }\n end", "def index\n @ideas = Idea.text_search(params[:query]).page(params[:page]).per_page(12)\n end", "def index\n @dis_groups = DisGroup.all\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @dish_evaluations = DishEvaluation.all\n end", "def index\n @doses = Dose.all\n end", "def index\n @doses = Dose.all\n end", "def index\n @misses = Miss.all\n end", "def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end", "def fetch_for(criteria, ids_to_be_excluded)\n reimbursable_expenses_criteria(criteria, ids_to_be_excluded).to_a\n end", "def index\n @dishtypes = Dishtype.all\n end", "def list_namespaced_pod_disruption_budget(namespace, opts = {})\n data, _status_code, _headers = list_namespaced_pod_disruption_budget_with_http_info(namespace, opts)\n return data\n end", "def index\n @discounts_products = DiscountsProduct.all\n end", "def get_debates(search_params = {})\n xml = do_request('getDebates', search_params)\n DebateSearch.load_from_xml xml.root\n end", "def index\n @distributor_missed_order_types = DistributorMissedOrderType.all\n end", "def index\n @dis_ingredients = DisIngredient.all\n end", "def disliked\n dislikes.map {|dislike| dislike.dislikeable}\n end", "def index\n @rating_reasons = RatingReason.order(:description).page params[:page]\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def list_discounts(location_id, opts = {})\n data, _status_code, _headers = list_discounts_with_http_info(location_id, opts)\n return data\n end", "def index\n @meal_dishes = MealDish.all\n end", "def index\n @neglected_terms = NeglectedTerm.all\n end", "def index\n @dispenses = Dispense.all\n end", "def index\n @deposits = Deposit.all\n end", "def index\n @doacao_captacaos = DoacaoCaptacao.all\n end", "def index\n @gets = Get.all\n end", "def index\n @despachos = Despacho.all\n end", "def index\n @doencas = Doenca.all\n end", "def index\n @duties = Duty.all.order(\"title asc\")\n end", "def index\n @showdowns = Showdown.unscoped.order(\"created_at DESC\").page(params[:page]).per(CONFIG[:memories_per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @showdowns }\n end\n end", "def index\n @derps = Derp.all\n end" ]
[ "0.65108514", "0.6081465", "0.57753664", "0.5476248", "0.54130894", "0.5400466", "0.5392575", "0.53411204", "0.5335698", "0.5212754", "0.509491", "0.50940126", "0.5081775", "0.5066418", "0.50181496", "0.5004236", "0.4987846", "0.49724054", "0.49682108", "0.49634677", "0.49563244", "0.49490076", "0.4948868", "0.49477735", "0.49238643", "0.490885", "0.48897052", "0.48830298", "0.48794982", "0.48789743", "0.48634833", "0.48634833", "0.4861509", "0.4857085", "0.4857085", "0.4857085", "0.48532733", "0.4840054", "0.4840054", "0.48181826", "0.48168454", "0.48019364", "0.47930163", "0.47862378", "0.47844872", "0.47834292", "0.47673136", "0.4760355", "0.4758796", "0.47333923", "0.4720342", "0.47102708", "0.47074333", "0.47025985", "0.46928117", "0.469022", "0.46855533", "0.46810064", "0.4669605", "0.4663755", "0.46440405", "0.46401834", "0.46393153", "0.46370518", "0.46307403", "0.46243793", "0.4622781", "0.46226817", "0.46210447", "0.462048", "0.46168476", "0.46168476", "0.46158963", "0.46004468", "0.46004468", "0.45930362", "0.45929137", "0.4583605", "0.45809278", "0.45789614", "0.45779252", "0.4576761", "0.4573837", "0.4568427", "0.4568328", "0.4565942", "0.4561349", "0.4558415", "0.45582047", "0.4552527", "0.4535631", "0.4535224", "0.4520186", "0.45141277", "0.45114374", "0.45060012", "0.450165", "0.45007682", "0.44947633", "0.4492625" ]
0.74500763
0
Get disputes Returns a list of all disputes against your business. The results will be returned in reverse chronological order, showing the last modified dispute (for example, where you&39;ve recently added a piece of evidence) first. You can use the optional parameters below to skip or limit results.
def get_disputes_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.get_disputes ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DisputesApi.get_disputes, must be smaller than or equal to 250.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DisputesApi.get_disputes, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'skip'].nil? && opts[:'skip'] < 0 fail ArgumentError, 'invalid value for "opts[:"skip"]" when calling DisputesApi.get_disputes, must be greater than or equal to 0.' end # resource path local_var_path = '/disputes' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil? query_params[:'statuses'] = opts[:'statuses'] if !opts[:'statuses'].nil? query_params[:'payment_id'] = opts[:'payment_id'] if !opts[:'payment_id'].nil? query_params[:'payment_reference'] = opts[:'payment_reference'] if !opts[:'payment_reference'].nil? query_params[:'payment_arn'] = opts[:'payment_arn'] if !opts[:'payment_arn'].nil? query_params[:'this_channel_only'] = opts[:'this_channel_only'] if !opts[:'this_channel_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DisputePaged' # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.get_disputes", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#get_disputes\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_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def index\n @disputes = Dispute.all\n end", "def index\n @discs = Disc.all\n end", "def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n icn = UserAccount.where(id: user_account_id).first&.icn\n service = ApiProviderFactory.rated_disabilities_service_provider(\n { auth_headers:, icn: }\n )\n @all_rated_disabilities ||= begin\n response = service.get_rated_disabilities(settings.access_token.client_id, settings.access_token.rsa_key)\n response.rated_disabilities\n end\n end", "def index\n @disbursments = @case.disbursments\n end", "def index\n @disatance_and_times = DisatanceAndTime.all\n end", "def index\n @dis_doseperiods = DisDoseperiod.all\n end", "def index\n @discusses = @topic.discusses.order('title ASC')\n end", "def index\n @dis_durations = DisDuration.all\n end", "def index\n @disfrazs = Disfraz.all\n end", "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def index\n @descoverlies = Descoverly.all\n end", "def index\n @disciplines = Discipline.order(questions_daily_access: :desc)\n end", "def index\n @admin_discounts = Admin::Discount.all\n end", "def possible_discounts\n possible_discounts = []\n discounts_all = set_discounts_arr + extra_discounts_arr\n discounts_all.map do |discount|\n next unless discount_veryfication(discount, ordered_products_total_arr, 1)\n\n discount_ids = discount[0..discount.length - 2]\n product_ids = ordered_products_total_arr\n result = discount_count(discount_ids, product_ids)\n for i in 1..result[1] do\n possible_discounts.push(discount)\n end\n end\n possible_discounts\n end", "def getDiscs(types)\n\tdiscs = Array.new\n\n\t@discs_doc.elements.each('acda-discs/disc') { |elem|\n\t\tdisc = parseDisc(elem, types)\n\t\tdiscs.push disc\n\t}\n\n\tdiscs\nend", "def index\n @injhas_special_biryani_dishes = InjhasSpecialBiryaniDish.all\n end", "def show\n dis = @case.disbursments.order(id: :desc)\n comments = @case.comments\n @disbursments = dis+comments\n @disbursments = @disbursments.sort_by(&:created_at)\n end", "def index\n @dislikes = Dislike.all\n end", "def index\n skip_authorization\n @discovers = Discover.all\n end", "def index\n authorize! :read, Discharge\n @discharges = Discharge.all\n end", "def index\n @discipuladores = Discipulador.all\n end", "def index\n @discount_activities = DiscountActivity.all\n end", "def index\n @dis_systems = DisSystem.all\n end", "def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\n end", "def index\n @diet_dishes = DietDish.all\n end", "def get_rated_disabilities\n if @headers['va_eauth_birlsfilenumber'].blank?\n Rails.logger.info('Missing `birls_id`', edipi: @headers['va_eauth_dodedipnid'])\n end\n with_monitoring_and_error_handling do\n Rails.cache.fetch(\"evss_rated_disabilities/#{@headers['va_eauth_dodedipnid']}-#{@headers['va_eauth_pnid']}\",\n expires_in: 30.minutes) do\n raw_response = perform(:get, 'ratedDisabilities')\n RatedDisabilitiesResponse.new(raw_response.status, raw_response)\n end\n end\n end", "def index\n @dislike_counts = DislikeCount.all\n end", "def disgemd_for(klass)\n Recommendable.query(klass, disgemd_ids_for(klass))\n end", "def delete_disputes\n clients.each do |client|\n client.counterparts.each do |counterpart|\n if counterpart.lawsuits.include?(self)\n Dispute.find_by_counterpart_id_and_client_id(counterpart.id,\n client.id).delete\n end\n end\n end\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @disc_assessments = DiscAssessment.all\n end", "def show\n @discos = @artista.discos.order(:publicacion => :desc)\n end", "def index\n @do_not_stops = DoNotStop.all\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @dish_moods = DishMood.all\n end", "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def all_discounts(scans)\n scans.map do |scan|\n product = scan.product\n next unless product.is_a?(BuyXGetXProduct) || product.is_a?(BulkProduct)\n discount_total = scan.discount_total\n next unless discount_total.positive?\n { title: discount_title(scan), amount: priceify_number(discount_total) }\n end.compact\n end", "def index\n @clinical_doses = ClinicalDose.all\n end", "def index\n @discussioms = Discussiom.all\n end", "def escalate_dispute\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/escalate_dispute\").body)\n @attributes = response['items']\n true\n end", "def index\n @what_should_avoids = WhatShouldAvoid.all\n end", "def index\n @admin_dishes = Admin::Dish.all\n end", "def index\n @music_discs = MusicDisc.all\n end", "def index\n @discount_codes = DiscountCode.all\n end", "def hidden\n @posts = Post.hidden.order(face_date: :desc).page(params[:page]).per(20)\n end", "def index\n @novedads = Novedad.all.reverse\n end", "def index\n @disappeareds = Disappeared.where(relatives_id: params[:relative_id]).page params[:page]\n end", "def index\n @diezmoanuals = Diezmoanual.all\n end", "def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end", "def index\n @disciplinas = Disciplina.all\n end", "def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end", "def index\n @muscle_diaries = MuscleDiary.all\n end", "def index\n @dish_rating_comments = DishRatingComment.all\n end", "def list_discounts(location_id, opts = {})\n data, _status_code, _headers = list_discounts_with_http_info(location_id, opts)\n return data\n end", "def index\n @inchicken_dishes = InchickenDish.all\n end", "def index\n @business_dashes = BusinessDash.all\n end", "def index\n @despesas = @condominio.despesas\n end", "def discounts\n @discounts ||= hash[\"Discounts\"].map { |d| Merchant::Discount.new d }\n end", "def index\n @diliverymen = Diliveryman.all\n end", "def index\n @detpedidos = Detpedido.all\n end", "def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end", "def index\n @docters = Docter.all\n end", "def disliked\n dislikes.map {|dislike| dislike.dislikeable}\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @deces = Dece.all\n end", "def get_debates(search_params = {})\n xml = do_request('getDebates', search_params)\n DebateSearch.load_from_xml xml.root\n end", "def list_namespaced_pod_disruption_budget(namespace, opts = {})\n data, _status_code, _headers = list_namespaced_pod_disruption_budget_with_http_info(namespace, opts)\n return data\n end", "def index\n @dish_evaluations = DishEvaluation.all\n end", "def index\n @employee = Employee.find(params[:employee_id])\n @direct_deposits = @employee.direct_deposits.all\n skip_authorization\n end", "def index\n @ideas = Idea.text_search(params[:query]).page(params[:page]).per_page(12)\n end", "def index\n @dis_groups = DisGroup.all\n end", "def index\n @dishtypes = Dishtype.all\n end", "def index\n @distributor_missed_order_types = DistributorMissedOrderType.all\n end", "def index\n @meal_dishes = MealDish.all\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n @doses = Dose.all\n end", "def index\n @doses = Dose.all\n end", "def index\n @discounts_products = DiscountsProduct.all\n end", "def index\n @dis_ingredients = DisIngredient.all\n end", "def index\n @misses = Miss.all\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def fetch_for(criteria, ids_to_be_excluded)\n reimbursable_expenses_criteria(criteria, ids_to_be_excluded).to_a\n end", "def index\n @rating_reasons = RatingReason.order(:description).page params[:page]\n end", "def index\n @duties = Duty.all.order(\"title asc\")\n end", "def index\n @showdowns = Showdown.unscoped.order(\"created_at DESC\").page(params[:page]).per(CONFIG[:memories_per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @showdowns }\n end\n end", "def index\n @dutydeals = Dutydeal.all\n end", "def index\n @gets = Get.all\n end", "def index\n @neglected_terms = NeglectedTerm.all\n end", "def index\n @dispenses = Dispense.all\n end", "def index\n @doacao_captacaos = DoacaoCaptacao.all\n end", "def index\n @despachos = Despacho.all\n end" ]
[ "0.74382377", "0.64520586", "0.5750546", "0.55260587", "0.5377636", "0.53636736", "0.53402495", "0.5303429", "0.52986366", "0.51909685", "0.51038843", "0.5068612", "0.5066397", "0.5057508", "0.5022501", "0.5018447", "0.49859756", "0.4984799", "0.49510816", "0.49411726", "0.49379244", "0.49209383", "0.49198624", "0.4915619", "0.49107298", "0.48961818", "0.48795837", "0.48760635", "0.48653114", "0.4863876", "0.483984", "0.483984", "0.483984", "0.48346803", "0.48183203", "0.48081565", "0.4807274", "0.4807274", "0.47880659", "0.47880659", "0.4786715", "0.4774398", "0.477363", "0.47716996", "0.47708505", "0.47638407", "0.4763447", "0.4761218", "0.47509274", "0.47297758", "0.46896085", "0.46872273", "0.4674564", "0.46725997", "0.46688923", "0.46673486", "0.46655062", "0.46649763", "0.46613562", "0.4655845", "0.46465078", "0.4643201", "0.46422228", "0.46401757", "0.4637475", "0.4630653", "0.46170178", "0.4604058", "0.4598186", "0.45929185", "0.45929185", "0.45918313", "0.45913133", "0.45894364", "0.45738426", "0.45692855", "0.45669073", "0.45665386", "0.4558405", "0.45582217", "0.45532274", "0.45515844", "0.45508108", "0.45508108", "0.45507717", "0.45472047", "0.45336854", "0.45215693", "0.45149696", "0.45149696", "0.4510799", "0.4507641", "0.44929555", "0.4486212", "0.44846278", "0.4482924", "0.44822717", "0.44808486", "0.44744346", "0.4474404" ]
0.6060502
2
Get file information Retrieve information about a file that was previously uploaded.
def get_file_information(file_id, opts = {}) data, _status_code, _headers = get_file_information_with_http_info(file_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_details\n return @file_details\n end", "def file_info(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.info\n end", "def uploaded_file\n instance_read(:uploaded_file)\n end", "def file_info(path)\n info File.read(path)\n end", "def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend", "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 file_hash\n return @file_hash\n end", "def file\n files.first\n end", "def file\n files.first\n end", "def file\n return @file\n end", "def file\n return @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def get\n uploaded_file(read) if read\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_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 retrieve_file_details_from_backoffice\n Message.retrieve_file_attachment(current_user, params[:doc_refno], params[:type])\n end", "def get\n file\n end", "def files\n info[\"Files\"].to_a\n end", "def files_info(params = {})\n fail ArgumentError, \"Required arguments 'file' missing\" if params['file'].nil?\n response = @session.do_post \"#{SCOPE}.info\", params\n Slack.parse_response(response)\n end", "def Fileinfo(path)\n Vidibus::Fileinfo::Base.new(path).data\nend", "def file\n @files.first ? @files.first[0] : nil\n end", "def file\n @files.first ? @files.first[0] : nil\n end", "def file_name\n return @file_name\n end", "def file_name\n return @file_name\n end", "def read\n File.read(uploaded.path)\n end", "def file_data\n @client.get_file @file_url\n end", "def file_fields\n self.fields.select { |field| field.type == :file }\n end", "def file_name\n @file_name\n end", "def file_details=(value)\n @file_details = value\n end", "def file_name\n uploaded_file_file_name\n end", "def file_stats\n @stats = @ff.get_stats\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 files_hash\n @files_hash\n end", "def filename\n @file\n end", "def read_info(uid)\n grid_info = files_collection.find(filename: uid).first or raise Tus::NotFound\n grid_info[:metadata]\n end", "def file_info bucket_name, filename\n body_wrap = b2_list_file_names bucketId: (bucket_id bucket_name: bucket_name), maxFileCount: 1, startFileName: filename\n files_hash = body_wrap.files\n raise NotFound, \"#{filename} not found\" unless files_hash.size == 1\n files_hash.first\n end", "def file_description\n @descriptive_detail.file_description\n end", "def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end", "def file\n @file ||= (file_from_path || file_from_uploaded_file!)\n end", "def info(filename, nohash = nil)\n\tf = filename\n\tif test_file(f)\n\t\th = nohash ? (nil) : (Digest::SHA1.hexdigest(File.read(f)))\n\t\treturn [File.mtime(f), File.stat(f).mode.to_s(8).to_i, h]\n\tend\n\treturn []\nend", "def info_file\n @info_file ||= File.join(image_dir, '_info.json')\n end", "def file\n FILE\n end", "def contents\n file_upload.read\n end", "def file_name\n self.file_file_name\n end", "def set_file_info\n @file_info = FileInfo.includes(:component).find(params[:id])\n end", "def info_file\n @info_file ||= File.join(image_dir, '_info.txt')\n end", "def getUploadfile\r\n\t\t\t\t\treturn @uploadfile\r\n\t\t\t\tend", "def successful_files\n @attributes[:successful_files]\n end", "def getFile(file)\n return fileByName.fetch(file, nil)\n end", "def get_metadata(io, context)\n if io.is_a?(UploadedFile)\n io.metadata.dup\n else\n extract_metadata(io, context)\n end\n end", "def path\n @file\n end", "def file\r\n LocalFile\r\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def file_datetime\n @file_datetime\n end", "def file\n @zip_fs_file\n end", "def file_attributes\n {}\n end", "def file_attributes\n {}\n end", "def private_shared_file_detail(file_t)\n get_private_shared_file_detail(file_t)\n end", "def get_file_path\n @path\n end", "def image_file\n return @image_file\n end", "def show\n session[:file_id] = params[:id]\n @file = FileData.find(params[:id])\n end", "def path\n @file\n end", "def get_file(filename, branch_or_tag='master') \n\t\tlog = repo.log(branch_or_tag, filename) \n\t\treturn log.first.tree.contents.first.data\n\tend", "def internal_file_attributes; end", "def file_get_more_information(directory) \n @files = []\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n directory = \"#{@current_directory}/#{directory}\" unless @current_directory == \"\"\n @current_directory = directory \n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") { |d| @files.push(d) unless d == \".\" || d == \"..\" }\n @file_information.store(directory, @files)\n @files = []\n return @file_information\n end", "def read\n file\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 files\n @files=get_endpoint('extra').keys\n end", "def file\n @file ||= find_file\n end", "def original_file # Accessor for probably protected value original_filename\r\n original_filename\r\n end", "def obtain_file_metadata(file_id)\n begin\n metadata = @drive_manager[file_id].get\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n end\n\n metadata = JSON.parse(metadata)\n metadata\n end", "def show\n @item_file = @item.upload_file.first\n end", "def file\n project.objects[fileRef]\n end", "def files\n return @files\n end", "def uploaded_files\n return @_ramaze_uploaded_files || {}\n end", "def txt\n @info_file\n end", "def path\n @file.path\n end", "def current_path\n file.try(:path)\n end", "def path\n @file.path\n end", "def file\n file_id = @attributes[\"file\"]\n file_node = NodeCache.find(file_id)\n file_node ? file_node.name : nil\n end", "def original_filename\n @file_representation[:filename]\n end", "def file_form_field\n @attributes[:file_form_field]\n end", "def file_field; end", "def path\n file.url\n end", "def filename\n @original_filename\n end", "def files\n @files.values\n end", "def get_file_info(object_id:)\n {\n method: \"DOM.getFileInfo\",\n params: { objectId: object_id }.compact\n }\n end", "def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end", "def assignment_upload_file_name\n read_attribute(:file_name)\n end", "def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\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 inspect\n \"File: #{@name} #{@ext}\"\n end", "def file\n file_names[x]\n end" ]
[ "0.789547", "0.7206071", "0.71080536", "0.70930475", "0.6938341", "0.690924", "0.68934846", "0.68429816", "0.68429816", "0.67938507", "0.67938507", "0.6768885", "0.6754712", "0.6754712", "0.6754712", "0.6754712", "0.6694551", "0.6693724", "0.65813357", "0.6571193", "0.65050447", "0.6502479", "0.6495984", "0.6486988", "0.64602417", "0.6449414", "0.6449414", "0.6441591", "0.6441591", "0.6414629", "0.6411912", "0.63752717", "0.6319064", "0.6314245", "0.63039887", "0.6289723", "0.6267446", "0.62674004", "0.62655693", "0.62485504", "0.6235265", "0.6233932", "0.621354", "0.61917925", "0.61907274", "0.6175202", "0.61448824", "0.61414295", "0.6136963", "0.61255586", "0.6124763", "0.61151767", "0.6095006", "0.6081747", "0.60787153", "0.6076118", "0.606789", "0.606401", "0.60564685", "0.6054604", "0.6050872", "0.6050872", "0.60380924", "0.60358846", "0.60337806", "0.60214835", "0.6000395", "0.5997992", "0.59710586", "0.5969234", "0.59671056", "0.5965304", "0.5965304", "0.5965304", "0.5958685", "0.59580624", "0.5951084", "0.59468746", "0.59289724", "0.59275526", "0.59212816", "0.5914766", "0.59092027", "0.5897793", "0.5897572", "0.5895777", "0.58924836", "0.58906025", "0.5888572", "0.58853674", "0.58771014", "0.5861463", "0.58604765", "0.58584815", "0.585676", "0.585451", "0.584185", "0.58371717", "0.58359313", "0.5827539" ]
0.62146795
42
Get file information Retrieve information about a file that was previously uploaded.
def get_file_information_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.get_file_information ...' end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling DisputesApi.get_file_information" end # resource path local_var_path = '/files/{file_id}'.sub('{' + 'file_id' + '}', CGI.escape(file_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FileResult' # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.get_file_information", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#get_file_information\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_details\n return @file_details\n end", "def file_info(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.info\n end", "def uploaded_file\n instance_read(:uploaded_file)\n end", "def file_info(path)\n info File.read(path)\n end", "def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend", "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 file_hash\n return @file_hash\n end", "def file\n files.first\n end", "def file\n files.first\n end", "def file\n return @file\n end", "def file\n return @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def get\n uploaded_file(read) if read\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_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 retrieve_file_details_from_backoffice\n Message.retrieve_file_attachment(current_user, params[:doc_refno], params[:type])\n end", "def get\n file\n end", "def files\n info[\"Files\"].to_a\n end", "def files_info(params = {})\n fail ArgumentError, \"Required arguments 'file' missing\" if params['file'].nil?\n response = @session.do_post \"#{SCOPE}.info\", params\n Slack.parse_response(response)\n end", "def Fileinfo(path)\n Vidibus::Fileinfo::Base.new(path).data\nend", "def file\n @files.first ? @files.first[0] : nil\n end", "def file\n @files.first ? @files.first[0] : nil\n end", "def file_name\n return @file_name\n end", "def file_name\n return @file_name\n end", "def read\n File.read(uploaded.path)\n end", "def file_data\n @client.get_file @file_url\n end", "def file_fields\n self.fields.select { |field| field.type == :file }\n end", "def file_name\n @file_name\n end", "def file_details=(value)\n @file_details = value\n end", "def file_name\n uploaded_file_file_name\n end", "def file_stats\n @stats = @ff.get_stats\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 files_hash\n @files_hash\n end", "def filename\n @file\n end", "def read_info(uid)\n grid_info = files_collection.find(filename: uid).first or raise Tus::NotFound\n grid_info[:metadata]\n end", "def file_info bucket_name, filename\n body_wrap = b2_list_file_names bucketId: (bucket_id bucket_name: bucket_name), maxFileCount: 1, startFileName: filename\n files_hash = body_wrap.files\n raise NotFound, \"#{filename} not found\" unless files_hash.size == 1\n files_hash.first\n end", "def file_description\n @descriptive_detail.file_description\n end", "def get_file_information(file_id, opts = {})\n data, _status_code, _headers = get_file_information_with_http_info(file_id, opts)\n data\n end", "def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end", "def file\n @file ||= (file_from_path || file_from_uploaded_file!)\n end", "def info(filename, nohash = nil)\n\tf = filename\n\tif test_file(f)\n\t\th = nohash ? (nil) : (Digest::SHA1.hexdigest(File.read(f)))\n\t\treturn [File.mtime(f), File.stat(f).mode.to_s(8).to_i, h]\n\tend\n\treturn []\nend", "def info_file\n @info_file ||= File.join(image_dir, '_info.json')\n end", "def file\n FILE\n end", "def contents\n file_upload.read\n end", "def file_name\n self.file_file_name\n end", "def set_file_info\n @file_info = FileInfo.includes(:component).find(params[:id])\n end", "def info_file\n @info_file ||= File.join(image_dir, '_info.txt')\n end", "def getUploadfile\r\n\t\t\t\t\treturn @uploadfile\r\n\t\t\t\tend", "def successful_files\n @attributes[:successful_files]\n end", "def getFile(file)\n return fileByName.fetch(file, nil)\n end", "def get_metadata(io, context)\n if io.is_a?(UploadedFile)\n io.metadata.dup\n else\n extract_metadata(io, context)\n end\n end", "def path\n @file\n end", "def file\r\n LocalFile\r\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def file_datetime\n @file_datetime\n end", "def file\n @zip_fs_file\n end", "def file_attributes\n {}\n end", "def file_attributes\n {}\n end", "def private_shared_file_detail(file_t)\n get_private_shared_file_detail(file_t)\n end", "def get_file_path\n @path\n end", "def image_file\n return @image_file\n end", "def show\n session[:file_id] = params[:id]\n @file = FileData.find(params[:id])\n end", "def path\n @file\n end", "def get_file(filename, branch_or_tag='master') \n\t\tlog = repo.log(branch_or_tag, filename) \n\t\treturn log.first.tree.contents.first.data\n\tend", "def internal_file_attributes; end", "def file_get_more_information(directory) \n @files = []\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n directory = \"#{@current_directory}/#{directory}\" unless @current_directory == \"\"\n @current_directory = directory \n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") { |d| @files.push(d) unless d == \".\" || d == \"..\" }\n @file_information.store(directory, @files)\n @files = []\n return @file_information\n end", "def read\n file\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 files\n @files=get_endpoint('extra').keys\n end", "def file\n @file ||= find_file\n end", "def original_file # Accessor for probably protected value original_filename\r\n original_filename\r\n end", "def obtain_file_metadata(file_id)\n begin\n metadata = @drive_manager[file_id].get\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n end\n\n metadata = JSON.parse(metadata)\n metadata\n end", "def show\n @item_file = @item.upload_file.first\n end", "def file\n project.objects[fileRef]\n end", "def files\n return @files\n end", "def uploaded_files\n return @_ramaze_uploaded_files || {}\n end", "def txt\n @info_file\n end", "def path\n @file.path\n end", "def current_path\n file.try(:path)\n end", "def path\n @file.path\n end", "def file\n file_id = @attributes[\"file\"]\n file_node = NodeCache.find(file_id)\n file_node ? file_node.name : nil\n end", "def original_filename\n @file_representation[:filename]\n end", "def file_form_field\n @attributes[:file_form_field]\n end", "def file_field; end", "def path\n file.url\n end", "def filename\n @original_filename\n end", "def files\n @files.values\n end", "def get_file_info(object_id:)\n {\n method: \"DOM.getFileInfo\",\n params: { objectId: object_id }.compact\n }\n end", "def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end", "def assignment_upload_file_name\n read_attribute(:file_name)\n end", "def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\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 inspect\n \"File: #{@name} #{@ext}\"\n end", "def file\n file_names[x]\n end" ]
[ "0.789547", "0.7206071", "0.71080536", "0.70930475", "0.6938341", "0.690924", "0.68934846", "0.68429816", "0.68429816", "0.67938507", "0.67938507", "0.6768885", "0.6754712", "0.6754712", "0.6754712", "0.6754712", "0.6694551", "0.6693724", "0.65813357", "0.6571193", "0.65050447", "0.6502479", "0.6495984", "0.6486988", "0.64602417", "0.6449414", "0.6449414", "0.6441591", "0.6441591", "0.6414629", "0.6411912", "0.63752717", "0.6319064", "0.6314245", "0.63039887", "0.6289723", "0.6267446", "0.62674004", "0.62655693", "0.62485504", "0.6235265", "0.6233932", "0.62146795", "0.621354", "0.61917925", "0.61907274", "0.6175202", "0.61448824", "0.61414295", "0.6136963", "0.61255586", "0.6124763", "0.61151767", "0.6095006", "0.6081747", "0.60787153", "0.6076118", "0.606789", "0.606401", "0.60564685", "0.6054604", "0.6050872", "0.6050872", "0.60380924", "0.60358846", "0.60337806", "0.60214835", "0.6000395", "0.5997992", "0.59710586", "0.5969234", "0.59671056", "0.5965304", "0.5965304", "0.5965304", "0.5958685", "0.59580624", "0.5951084", "0.59468746", "0.59289724", "0.59275526", "0.59212816", "0.5914766", "0.59092027", "0.5897793", "0.5897572", "0.5895777", "0.58924836", "0.58906025", "0.5888572", "0.58853674", "0.58771014", "0.5861463", "0.58604765", "0.58584815", "0.585676", "0.585451", "0.584185", "0.58371717", "0.58359313", "0.5827539" ]
0.0
-1
Provide dispute evidence Adds supporting evidence to a dispute. Before using this endpoint, you first need to [upload your files](tag/Disputes/paths/~1files/post) using the file uploader. You will receive a file id (prefixed by `file_`) which you can then use in your request. Note that this only attaches the evidence to the dispute, it does not send it to us. Once ready, you will need to submit it. You must provide at least one evidence type in the body of your request.
def provide_dispute_evidence(dispute_id, opts = {}) provide_dispute_evidence_with_http_info(dispute_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end", "def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end", "def submit_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.submit_dispute_evidence\",\n :header_params => 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: DisputesApi#submit_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def evidence_params\n params.require(:evidence).permit(\n :book_id,\n :format,\n :format_other,\n :content_type,\n :location_in_book,\n :location_in_book_page,\n :transcription,\n :translation,\n :year_when,\n :year_start,\n :year_end,\n :date_narrative,\n :where,\n :comments,\n :citations,\n :photo,\n :photo_id,\n :context_photo_id,\n :context_image_id,\n content_type_ids: [],\n provenance_agents_attributes: [ :id, :name_id, :role, :_destroy ]\n )\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def create\n @evidence = @book.evidence.build evidence_params\n\n respond_to do |format|\n if @evidence.save_by current_user\n @evidence.dequeue_photo\n format.html {\n redirect_to @evidence, notice: 'Evidence was successfully created.'\n }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def accept_dispute_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.accept_dispute ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.accept_dispute\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.accept_dispute, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/accept'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.accept_dispute\",\n :header_params => 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: DisputesApi#accept_dispute\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def exam_params\n params.require(:exam).permit(:user_id, :title, :description, :exam_date, :place, files: [], :tag_ids=>[])\n end", "def create\n AttackFile.write(attack_files_params[:filename], attack_files_params[:body])\n\n render status: 201\n end", "def upload_document(file, disability_claim_document)\n uploader = DisabilityClaimDocumentUploader.new(@user.uuid, disability_claim_document.tracked_item_id)\n uploader.store!(file)\n # the uploader sanitizes the filename before storing, so set our doc to match\n disability_claim_document.file_name = uploader.filename\n DisabilityClaim::DocumentUpload.perform_async(auth_headers, @user.uuid, disability_claim_document.to_h)\n end", "def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_evidence\n @evidence = Evidence.includes(:book).find params[:id]\n end", "def certify_event_attendence_post\n #create approval if create approval selected\n @event = Event.find_by_id(params[:event_id])\n if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil\n # check to make sure debriefing is submitted\n # TODO: ^^ This\n # update the event first\n if @event.update(event_certify_params)\n #create certification request\n ecr = EventCertificationRequest.new(event_id: @event.id)\n #create approval\n ecr.approval_id = new_approval(6)\n ecr.user_id = current_user.id\n if ecr.save\n @event.submitted_for_certification = true\n @event.event_certification_request_id = ecr.id\n if @event.save\n render status: 200, json: @event\n else\n render status: 500, json: { message: 'Error Occured. Event could not be submitted for certification' }\n end\n else\n @event.submitted_for_certification = false\n if @event.save\n render status: 500, json: { message: 'ERROR: ECR could not be saved. Event reverted so certification could be made.' }\n else\n render status: 500, json: { message: 'ERROR: ECR could not be saved and the event could not be updated. Data wise this is probably really messed up you will need to contact Rindzer.' }\n end\n end\n else\n render status: 500, json: { message: \"An error occured and the event could not be updated.\" }\n end\n else\n render status: 404, json: { message: 'Either this event was not found or has already been submitted for certification.' }\n end\n end", "def exam_params\n params[:exam]\n params.permit(:file, :posttype, :year, :user_id, :course_id, :examtype, :accepted, :acceptedby)\n end", "def accept_dispute(dispute_id, opts = {})\n accept_dispute_with_http_info(dispute_id, opts)\n nil\n end", "def exhibit_params\n params.require(:exhibit).permit(:name, :registration_number, :iframe, :date_of_receipt, :chronology, :fund_creator,\n :opportunity_for_transportation, :the_degree_of_preservation,\n :tags_string, :authenticity, :the_electronic_version, :size, :cronology,\n :description, pictures_attributes: [:id, :name, :image, :_destroy])\n end", "def exhibit_params\n params.require(:exhibit).permit(:name, :registration_number, :date_of_receipt, :fund_creator,\n :opportunity_for_transportation, :the_degree_of_preservation,\n :tags_string, :biographies_string, :authenticity, :the_electronic_version, :size,\n :description, pictures_attributes: [:id, :name, :image])\n end", "def essay_params\n params.require(:essay).permit(:file)\n end", "def deckfile_params\n params.require(:deckfile).permit(:disposition, :remove, :path, :dataset_id)\n end", "def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end", "def excuse_params\n params.require(:excuse).permit(:content, :count, :occasion, :user_id)\n end", "def add_attachment(summary, file, *ids, **kwargs)\n params = {}\n params[:ids] = ids\n params[:summary] = summary\n params[:content_type] = kwargs.fetch(:content_type, 'application/octet-stream')\n params[:file_name] = kwargs.fetch(:file_name, File.basename(file))\n params[:is_patch] = kwargs[:patch?] if kwargs[:patch?]\n params[:is_private] = kwargs[:private?] if kwargs[:private?]\n params[:comment] = kwargs[:comment] if kwargs[:comment]\n params[:data] = XMLRPC::Base64.new(file.read)\n ret = @client.call('Bug.add_attachment', params)\n handle_faults(ret)\n ret['ids']\n end", "def deed_params\n params.require(:deed).permit(:title, :giver_id, :receiver_id, :content, :image_url)\n end", "def emily_params\n params.require(:emily).permit(:name, :dsc)\n end", "def residence_params\n params.require(:residence).permit(:name, :description)\n end", "def file_example_params\n params.require(:file_example).permit(:system_example_id, :name, :code)\n end", "def moderate(file)\n return if file.nil? || !File.exist?(file)\n\n url = \"#{config.url}?models=moderation,gender,pornography,ad\"\n parse_response client.post(url, prepare_body(file))\n end", "def efimerida_params\n params.require(:efimerida).permit(:text, :date, :category_id, :attachment)\n end", "def indenture_params\n params.require(:indenture).permit(:title, :description, :file_url, :image_url)\n end", "def lecture_params\n params.require(:lecture).permit(:my_file)\n end", "def add_expertise(tag_ids = [], reason)\n tag_ids.each do |tid|\n exp = self.expertises.find_or_create_by(tag_id: tid)\n exp.send(reason) # reason is atom of method names (voted_once, etc.)\n end\n end", "def resourceType\n 'Evidence'\n end", "def tag_attachment_params\n params.require(:tag_attachment).permit(:file, :remark, :attachment_path)\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def meditation_params\n params.require(:meditation).permit(:title, :description, :file, :image)\n end", "def dispute_params\n params.require(:dispute).permit(:company, :policy_name, :policy_text, :policy_link)\n end", "def incidence_params\n params.require(:incidence).permit(:ticket, :type_id, :picture, :motive_id, :description,:ubigeo_id, :reference, :date, :latitud, :longitud)\n end", "def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end", "def file_set_preservation_event(file_set, event_start, outcome, details)\n event = { 'type' => 'File submission', 'start' => event_start, 'outcome' => outcome, 'details' => details,\n 'software_version' => 'Fedora v4.7.5', 'user' => user.uid }\n create_preservation_event(file_set, event)\n end", "def expenses_file_params\n params.require(:expenses_file).permit(:name, :description, :file)\n end", "def add_attachment!(params={})\n raise ArgumentError, \"Error: ids, data, file_name, summary, and content_type are required args\" unless check_params([:ids, :data, :file_name, :summary, :content_type], params)\n rpc_call :add_attachment, params\n end", "def resume_params\n params.require(:resume).permit(:file)\n end", "def eventsmedium_params\n params.permit(:file => [])\n end", "def identification(file, profilId)\n puts \"-----------------------------\"\n puts params\n puts \"-----------------------------\"\n \n file = params[:identification_file]\n puts file\n profileid = params[:profile_id]\n puts \"================================\"\n puts profileid\n \n speaker = Excon.post(\"050735ba-4032-48c3-995a-07a08d293bf5\",\n headers:{\n 'Content-Type' => 'audio/wave',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: file,\n )\n @identified = JSON.parse(speaker.body)\n # @score = @identified['identifiedProfile']['score']\n @score1 = (\"SCORE :\" + @score.to_s) \n return @identified\n end", "def create\n @advertisement = Advertisement.new(params[:advertisement])\n \n @advertisement.uploaded_file = params[:advertisement][:image]\n @advertisement.event_id_id = params[:advertisement][:event_id_id]\n @advertisement.link = params[:advertisement][:link]\n\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully created.' }\n format.json { render json: @advertisement, status: :created, location: @advertisement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def variation_params\n params.require(:variation).permit(\n :tagline,\n :content,\n :asana_id,\n exercise_attributes: %i[id name image],\n tag_ids: [],\n )\n end", "def validate_evidence_files\n return unless (@evidence_files&.size || 0) < 2 && @reason == 'ADS'\n\n errors.add(:evidence_files, :evidence_files_missing_categories)\n end", "def anecdote_params\n params.require(:anecdote).permit(:title, :body, :user_id, :anecdote_image)\n end", "def edgenote_params\n params.require(:edgenote).permit(:caption, :format, :thumbnail_url,\n :content, :embed_code, :website_url,\n :image, :pdf_url, :instructions,\n :photo_credit, :slug, :style, :pull_quote,\n :attribution, :call_to_action,\n :audio, :youtube_slug, :statistics,\n :alt_text, :highlighted, :icon_slug, :file)\n end", "def perform(release_id, pipeline_id = nil)\n release = Release.find_by_id(release_id)\n return unless release\n\n pipeline = Ci::Pipeline.find_by_id(pipeline_id)\n\n ::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute\n end", "def educate_params\n params.require(:educate).permit(:name, :content, :picture)\n end", "def create\n @file_example = FileExample.new(file_example_params)\n\n respond_to do |format|\n if @file_example.save\n format.html { redirect_to @file_example, notice: 'File example was successfully created.' }\n format.json { render :show, status: :created, location: @file_example }\n else\n format.html { render :new }\n format.json { render json: @file_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def debate_params\n params.require(:debate).permit(:title, :image, :content)\n end", "def transcendence_params\n params.require(:transcendence).permit(:title, :description, :image_url, :image)\n end", "def create\n @attention = Attention.new(attention_params)\n\n respond_to do |format|\n if @attention.save\n format.html { redirect_to @attention, notice: 'Attention was successfully created.' }\n format.json { render :show, status: :created, location: @attention }\n else\n format.html { render :new }\n format.json { render json: @attention.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.fileEvidence\"\n end", "def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end", "def debate_params\n params.require(:debate).permit(:topic, :image, :description, :user_id)\n end", "def anecdote_params\n params.require(:anecdote).permit(:text, :user_id, :course_id)\n end", "def permitted_params\n params.require(:announcement).permit(:title, :description, :document, :document_cache)\n end", "def descoverly_params\n params.require(:descoverly).permit(:descovery_time, :type, :description)\n end", "def resume_params\n params.require(:resume).permit(:file, :retained_file, :remove_file, :file_url)\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 advertisement_params\n params.require(:advertisement).permit(:advertisement_id, :title, :body, :image1, :delivery_date)\n end", "def create\n # ignore draft_key param for now\n safe_params = params.require(:event_note).permit(\n :student_id,\n :event_note_type_id,\n :text,\n :is_restricted,\n event_note_attachments_attributes: [:url]\n )\n authorized_or_raise! { Student.find(safe_params[:student_id]) }\n\n event_note = EventNote.new(safe_params.merge({\n is_restricted: safe_is_restricted_value(safe_params[:is_restricted]),\n educator_id: current_educator.id,\n recorded_at: Time.now\n }))\n\n if event_note.save\n serializer = EventNoteSerializer.dangerously_include_restricted_text(event_note)\n render json: serializer.serialize_event_note\n else\n render json: { errors: event_note.errors.full_messages }, status: 422\n end\n end", "def case_params\n params.require(:announcement).permit(:title,:link,:image,:validity,:featured)\n end", "def example_params\n params.require(:example).permit(:description, :recommendation_id, :example_url)\n end", "def paldemic_file_params\n params.require(:paldemic_file).permit(:name, :author, :num_downloads, :num_upvotes, :num_downvotes, :file, :pw, :description)\n end", "def doc_file_params\n params.require(:doc_file).permit(:name, :clarification, :docOwner, :student_id)\n end", "def attachment_params\n params.require(:attachment).permit(:user_id, :essay, :name, :assignment_schedule, :correction_attributes => [:id, :score, :contains_author_data])\n end", "def set_file_example\n @file_example = FileExample.find(params[:id])\n end", "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end", "def exam_params\n params.require(:event)\n .permit(:lecture_title, :description, :email, :duration)\n .merge(num_times: 0)\n .merge(event_type: 'exam')\n end", "def post_params\n params.require(:post).permit(:title, :picture, :approved, :vibe_type, :body, :url, :uid)\n\n end", "def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end", "def document_params\n params.require(:document).permit(:doc_type, :name, :patient_id, images: [])\n end", "def grave_params\n params.require(:grave).permit(:name, :relationship_id, :relationship_name, :gender, :caste_id,:identity_id, :died_at, :age, :number, attachment_attributes: [:id, :document])\n end", "def appoint_responsible_params\n params.require(:appoint_responsible).permit(:email, :user_id, :inheritor_email, :inheritor_id, :accepted, :file)\n end", "def episode_params\n params.require(:episode).permit(:title, :body, :image_url)\n end", "def create\n\n @event = Event.find(params[:event_id])\n file = {}\n\n if params[:flash]\n file[\"name\"] = params[:Filedata].original_filename\n \n extname = File.extname(params[:Filedata].original_filename)[1..-1]\n mime_type = Mime::Type.lookup_by_extension(extname)\n params[:Filedata].content_type = mime_type.to_s unless mime_type.nil?\n\n file[\"attached\"] = params[:Filedata]\n else\n file[\"name\"] = params[:attached].original_filename\n file[\"attached\"] = params[:attached]\n end\n\n file[\"event_id\"] = @event.id\n @attached = Attached.new(file)\n \n\n respond_to do |format|\n if @attached.save\n format.html { redirect_to @event, notice: 'File was successfully uploaded.' }\n format.json { render json: @attached, status: :created, location: @attached }\n else\n format.html { render action: \"edit\"}\n format.json { render json: @attached.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(file_path, params = {})\n return unless file_path\n upload = Vimeo::Advanced::Upload.new(@api_key, @api_secret, @token_hash)\n\n upload.get_quota\n ticket = upload.get_ticket\n puts ticket.inspect\n puts \"ticket---------------\"\n return unless ticket[\"stat\"]==\"ok\" \n ticket_id = ticket[\"ticket\"][\"id\"]\n end_point = ticket[\"ticket\"][\"endpoint\"]\n\n upload_res = upload.upload(file_path, ticket_id, end_point)\n puts JSON.parse(upload_res).inspect\n puts \"upload_res----------\"\n # manifest = upload.verify_manifest(ticket_id, upload_res)\n # puts manifest.inspect\n puts \"manifest----------------\"\n confirm = upload.confirm(ticket_id)\n puts confirm.inspect\n puts \"confirm------------\"\n video_id = confirm[\"ticket\"][\"video_id\"]\n vimeo_video = Vimeo::Advanced::Video.new(@api_key, @api_secret, @token_hash)\n vimeo_video.set_description(video_id, params[:description]) if params[:description]\n vimeo_video.set_title(video_id, params[:title]) if params[:title]\n vimeo_video.add_tags(video_id, params[:tags]) if params[:tags]\n video_id\n rescue exception_block\n end", "def note_params\n params.require(:note).permit(:title, :description, attachments_attributes: [:file, :file_cache])\n end", "def new\n authorize Answer\n @answer = Answer.new\n @answer.attachments.build\n end", "def submission_detail_params\n params.require(:submission_detail).permit(:submission_id, :file_url, :attachment)\n end", "def create_embedded_request(opts = {})\n HelloSign.create_embedded_signature_request(\n test_mode: 1,\n client_id: 'a5a0c7391936852c61f3eaa29a25081e',\n subject: 'Lease Agreement',\n message: 'Awesome!',\n signers: [\n {\n email_address: opts[:email],\n name: opts[:name]\n }\n ],\n files: ['/Users/owner/Downloads/samplelease.pdf']\n )\nend", "def incident_proof_params\n params.require(:incident_proof).permit(:incident_id, :avatar)\n end", "def add_attachment(summary, file, **kwargs)\n @client.add_attachment(summary, file, id, **kwargs).first\n end", "def residence_params\n\t\tparams.require(:residence).permit(:nombre, :provincia, :partido, :ciudad, :direccion, :img_link, :desc)\n\tend", "def create\n recommendation = Recommendation.find(evidence_params[:recommendation_id])\n user = current_user\n if (current_user = recommendation.area.user || current_user.role == 0) then\n @evidence = Evidence.new(evidence_params)\n # Create notifications\n if (user.role === 0)then\n Notification.create(recipient: @evidence.recommendation.area.user, actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n else\n Notification.create(recipient: User.find_by(role: 0), actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n end\n\n respond_to do |format|\n if @evidence.save\n format.html { redirect_to @evidence.recommendation }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path, notice: \"No tienes permisos para realizar esta acción\"\n return\n end\n end", "def advertisement_params\n params.require(:advertisement).permit(:title, :description, :web_url, :start_date, :end_date, {images: []})\n end", "def dis_additive_frequency_params\n params.require(:dis_additive_frequency).permit(:name, :frequency_value, :status_id)\n end", "def dis_additive_frequency_params\n params.require(:dis_additive_frequency).permit(:name, :frequency_value, :status_id)\n end", "def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def past_exam_params\n params.fetch(:past_exam, {})\n .permit(:description, :file, :course_id)\n end" ]
[ "0.69363457", "0.6661003", "0.60244256", "0.5976163", "0.587987", "0.5730977", "0.5699087", "0.56732166", "0.5595771", "0.54009897", "0.54009897", "0.52761143", "0.52133936", "0.51940197", "0.51756847", "0.51579314", "0.51423883", "0.51326764", "0.51253283", "0.5118216", "0.5111797", "0.5104031", "0.50565577", "0.50405544", "0.5029623", "0.5017505", "0.50107145", "0.4994474", "0.49865833", "0.49803427", "0.49751043", "0.4973612", "0.49714005", "0.4968293", "0.49677548", "0.49650446", "0.4960084", "0.4959698", "0.4956522", "0.4956522", "0.4949727", "0.4937344", "0.4935985", "0.4929897", "0.4928107", "0.49241894", "0.49095133", "0.4896345", "0.4894428", "0.4889152", "0.4860177", "0.48444918", "0.48325244", "0.4827956", "0.48240998", "0.48212096", "0.48199734", "0.4795511", "0.47928932", "0.47886902", "0.47881564", "0.47829694", "0.47665742", "0.47656357", "0.47586253", "0.47575384", "0.4751792", "0.47515187", "0.47494677", "0.47446322", "0.47368333", "0.47349128", "0.4734572", "0.47305325", "0.4728447", "0.4727877", "0.47274357", "0.47266507", "0.47159952", "0.47136617", "0.47103104", "0.47084647", "0.4702915", "0.46977335", "0.46975547", "0.46959248", "0.46942917", "0.4692993", "0.468847", "0.46873254", "0.46796104", "0.4679007", "0.46787965", "0.4674632", "0.46745345", "0.46743977", "0.46725643", "0.46725643", "0.46699432", "0.46685678" ]
0.5193103
14
Provide dispute evidence Adds supporting evidence to a dispute. Before using this endpoint, you first need to [upload your files](tag/Disputes/paths/~1files/post) using the file uploader. You will receive a file id (prefixed by &x60;file_&x60;) which you can then use in your request. Note that this only attaches the evidence to the dispute, it does not send it to us. Once ready, you will need to submit it. You must provide at least one evidence type in the body of your request.
def provide_dispute_evidence_with_http_info(dispute_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...' end # verify the required parameter 'dispute_id' is set if @api_client.config.client_side_validation && dispute_id.nil? fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence" end pattern = Regexp.new(/^(dsp)_(\w{26})$/) if @api_client.config.client_side_validation && dispute_id !~ pattern fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}." end # resource path local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request']) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.provide_dispute_evidence", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#provide_dispute_evidence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end", "def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end", "def submit_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.submit_dispute_evidence\",\n :header_params => 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: DisputesApi#submit_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def evidence_params\n params.require(:evidence).permit(\n :book_id,\n :format,\n :format_other,\n :content_type,\n :location_in_book,\n :location_in_book_page,\n :transcription,\n :translation,\n :year_when,\n :year_start,\n :year_end,\n :date_narrative,\n :where,\n :comments,\n :citations,\n :photo,\n :photo_id,\n :context_photo_id,\n :context_image_id,\n content_type_ids: [],\n provenance_agents_attributes: [ :id, :name_id, :role, :_destroy ]\n )\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @evidence = @book.evidence.build evidence_params\n\n respond_to do |format|\n if @evidence.save_by current_user\n @evidence.dequeue_photo\n format.html {\n redirect_to @evidence, notice: 'Evidence was successfully created.'\n }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def accept_dispute_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.accept_dispute ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.accept_dispute\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.accept_dispute, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/accept'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.accept_dispute\",\n :header_params => 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: DisputesApi#accept_dispute\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def exam_params\n params.require(:exam).permit(:user_id, :title, :description, :exam_date, :place, files: [], :tag_ids=>[])\n end", "def set_evidence\n @evidence = Evidence.includes(:book).find params[:id]\n end", "def exhibit_params\n params.require(:exhibit).permit(:name, :registration_number, :iframe, :date_of_receipt, :chronology, :fund_creator,\n :opportunity_for_transportation, :the_degree_of_preservation,\n :tags_string, :authenticity, :the_electronic_version, :size, :cronology,\n :description, pictures_attributes: [:id, :name, :image, :_destroy])\n end", "def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end", "def accept_dispute(dispute_id, opts = {})\n accept_dispute_with_http_info(dispute_id, opts)\n nil\n end", "def exhibit_params\n params.require(:exhibit).permit(:name, :registration_number, :date_of_receipt, :fund_creator,\n :opportunity_for_transportation, :the_degree_of_preservation,\n :tags_string, :biographies_string, :authenticity, :the_electronic_version, :size,\n :description, pictures_attributes: [:id, :name, :image])\n end", "def certify_event_attendence_post\n #create approval if create approval selected\n @event = Event.find_by_id(params[:event_id])\n if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil\n # check to make sure debriefing is submitted\n # TODO: ^^ This\n # update the event first\n if @event.update(event_certify_params)\n #create certification request\n ecr = EventCertificationRequest.new(event_id: @event.id)\n #create approval\n ecr.approval_id = new_approval(6)\n ecr.user_id = current_user.id\n if ecr.save\n @event.submitted_for_certification = true\n @event.event_certification_request_id = ecr.id\n if @event.save\n render status: 200, json: @event\n else\n render status: 500, json: { message: 'Error Occured. Event could not be submitted for certification' }\n end\n else\n @event.submitted_for_certification = false\n if @event.save\n render status: 500, json: { message: 'ERROR: ECR could not be saved. Event reverted so certification could be made.' }\n else\n render status: 500, json: { message: 'ERROR: ECR could not be saved and the event could not be updated. Data wise this is probably really messed up you will need to contact Rindzer.' }\n end\n end\n else\n render status: 500, json: { message: \"An error occured and the event could not be updated.\" }\n end\n else\n render status: 404, json: { message: 'Either this event was not found or has already been submitted for certification.' }\n end\n end", "def exam_params\n params[:exam]\n params.permit(:file, :posttype, :year, :user_id, :course_id, :examtype, :accepted, :acceptedby)\n end", "def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end", "def add_expertise(tag_ids = [], reason)\n tag_ids.each do |tid|\n exp = self.expertises.find_or_create_by(tag_id: tid)\n exp.send(reason) # reason is atom of method names (voted_once, etc.)\n end\n end", "def create\n AttackFile.write(attack_files_params[:filename], attack_files_params[:body])\n\n render status: 201\n end", "def deed_params\n params.require(:deed).permit(:title, :giver_id, :receiver_id, :content, :image_url)\n end", "def excuse_params\n params.require(:excuse).permit(:content, :count, :occasion, :user_id)\n end", "def residence_params\n params.require(:residence).permit(:name, :description)\n end", "def emily_params\n params.require(:emily).permit(:name, :dsc)\n end", "def resourceType\n 'Evidence'\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def set_dispute\n @dispute = Dispute.find(params[:id])\n end", "def dispute_params\n params.require(:dispute).permit(:company, :policy_name, :policy_text, :policy_link)\n end", "def efimerida_params\n params.require(:efimerida).permit(:text, :date, :category_id, :attachment)\n end", "def add_attachment(summary, file, *ids, **kwargs)\n params = {}\n params[:ids] = ids\n params[:summary] = summary\n params[:content_type] = kwargs.fetch(:content_type, 'application/octet-stream')\n params[:file_name] = kwargs.fetch(:file_name, File.basename(file))\n params[:is_patch] = kwargs[:patch?] if kwargs[:patch?]\n params[:is_private] = kwargs[:private?] if kwargs[:private?]\n params[:comment] = kwargs[:comment] if kwargs[:comment]\n params[:data] = XMLRPC::Base64.new(file.read)\n ret = @client.call('Bug.add_attachment', params)\n handle_faults(ret)\n ret['ids']\n end", "def incidence_params\n params.require(:incidence).permit(:ticket, :type_id, :picture, :motive_id, :description,:ubigeo_id, :reference, :date, :latitud, :longitud)\n end", "def upload_document(file, disability_claim_document)\n uploader = DisabilityClaimDocumentUploader.new(@user.uuid, disability_claim_document.tracked_item_id)\n uploader.store!(file)\n # the uploader sanitizes the filename before storing, so set our doc to match\n disability_claim_document.file_name = uploader.filename\n DisabilityClaim::DocumentUpload.perform_async(auth_headers, @user.uuid, disability_claim_document.to_h)\n end", "def essay_params\n params.require(:essay).permit(:file)\n end", "def indenture_params\n params.require(:indenture).permit(:title, :description, :file_url, :image_url)\n end", "def deckfile_params\n params.require(:deckfile).permit(:disposition, :remove, :path, :dataset_id)\n end", "def tag_attachment_params\n params.require(:tag_attachment).permit(:file, :remark, :attachment_path)\n end", "def add_attachment!(params={})\n raise ArgumentError, \"Error: ids, data, file_name, summary, and content_type are required args\" unless check_params([:ids, :data, :file_name, :summary, :content_type], params)\n rpc_call :add_attachment, params\n end", "def identification(file, profilId)\n puts \"-----------------------------\"\n puts params\n puts \"-----------------------------\"\n \n file = params[:identification_file]\n puts file\n profileid = params[:profile_id]\n puts \"================================\"\n puts profileid\n \n speaker = Excon.post(\"050735ba-4032-48c3-995a-07a08d293bf5\",\n headers:{\n 'Content-Type' => 'audio/wave',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: file,\n )\n @identified = JSON.parse(speaker.body)\n # @score = @identified['identifiedProfile']['score']\n @score1 = (\"SCORE :\" + @score.to_s) \n return @identified\n end", "def file_example_params\n params.require(:file_example).permit(:system_example_id, :name, :code)\n end", "def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end", "def lecture_params\n params.require(:lecture).permit(:my_file)\n end", "def file_set_preservation_event(file_set, event_start, outcome, details)\n event = { 'type' => 'File submission', 'start' => event_start, 'outcome' => outcome, 'details' => details,\n 'software_version' => 'Fedora v4.7.5', 'user' => user.uid }\n create_preservation_event(file_set, event)\n end", "def perform(release_id, pipeline_id = nil)\n release = Release.find_by_id(release_id)\n return unless release\n\n pipeline = Ci::Pipeline.find_by_id(pipeline_id)\n\n ::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute\n end", "def descoverly_params\n params.require(:descoverly).permit(:descovery_time, :type, :description)\n end", "def validate_evidence_files\n return unless (@evidence_files&.size || 0) < 2 && @reason == 'ADS'\n\n errors.add(:evidence_files, :evidence_files_missing_categories)\n end", "def edgenote_params\n params.require(:edgenote).permit(:caption, :format, :thumbnail_url,\n :content, :embed_code, :website_url,\n :image, :pdf_url, :instructions,\n :photo_credit, :slug, :style, :pull_quote,\n :attribution, :call_to_action,\n :audio, :youtube_slug, :statistics,\n :alt_text, :highlighted, :icon_slug, :file)\n end", "def meditation_params\n params.require(:meditation).permit(:title, :description, :file, :image)\n end", "def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end", "def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end", "def anecdote_params\n params.require(:anecdote).permit(:title, :body, :user_id, :anecdote_image)\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 resume_params\n params.require(:resume).permit(:file)\n end", "def anecdote_params\n params.require(:anecdote).permit(:text, :user_id, :course_id)\n end", "def exam_params\n params.require(:event)\n .permit(:lecture_title, :description, :email, :duration)\n .merge(num_times: 0)\n .merge(event_type: 'exam')\n end", "def variation_params\n params.require(:variation).permit(\n :tagline,\n :content,\n :asana_id,\n exercise_attributes: %i[id name image],\n tag_ids: [],\n )\n end", "def eventsmedium_params\n params.permit(:file => [])\n end", "def educate_params\n params.require(:educate).permit(:name, :content, :picture)\n end", "def create\n @attention = Attention.new(attention_params)\n\n respond_to do |format|\n if @attention.save\n format.html { redirect_to @attention, notice: 'Attention was successfully created.' }\n format.json { render :show, status: :created, location: @attention }\n else\n format.html { render :new }\n format.json { render json: @attention.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end", "def moderate(file)\n return if file.nil? || !File.exist?(file)\n\n url = \"#{config.url}?models=moderation,gender,pornography,ad\"\n parse_response client.post(url, prepare_body(file))\n end", "def debate_params\n params.require(:debate).permit(:title, :image, :content)\n end", "def permitted_params\n params.require(:announcement).permit(:title, :description, :document, :document_cache)\n end", "def run_padi_upload_20170227_dicom()\n run_padi_upload_20170227(\"dicom\")\n end", "def debate_params\n params.require(:debate).permit(:topic, :image, :description, :user_id)\n end", "def create_embedded_request(opts = {})\n HelloSign.create_embedded_signature_request(\n test_mode: 1,\n client_id: 'a5a0c7391936852c61f3eaa29a25081e',\n subject: 'Lease Agreement',\n message: 'Awesome!',\n signers: [\n {\n email_address: opts[:email],\n name: opts[:name]\n }\n ],\n files: ['/Users/owner/Downloads/samplelease.pdf']\n )\nend", "def denunciation_params\n params.require(:denunciation).permit(:survivor_id, :sender_id)\n end", "def add_attachments\n frm.button(:value=>\"Add Attachments\").click\n AnnouncementsAttach.new(@browser)\n end", "def example_params\n params.require(:example).permit(:description, :recommendation_id, :example_url)\n end", "def expenses_file_params\n params.require(:expenses_file).permit(:name, :description, :file)\n end", "def create\n # ignore draft_key param for now\n safe_params = params.require(:event_note).permit(\n :student_id,\n :event_note_type_id,\n :text,\n :is_restricted,\n event_note_attachments_attributes: [:url]\n )\n authorized_or_raise! { Student.find(safe_params[:student_id]) }\n\n event_note = EventNote.new(safe_params.merge({\n is_restricted: safe_is_restricted_value(safe_params[:is_restricted]),\n educator_id: current_educator.id,\n recorded_at: Time.now\n }))\n\n if event_note.save\n serializer = EventNoteSerializer.dangerously_include_restricted_text(event_note)\n render json: serializer.serialize_event_note\n else\n render json: { errors: event_note.errors.full_messages }, status: 422\n end\n end", "def post_params\n params.require(:post).permit(:title, :picture, :approved, :vibe_type, :body, :url, :uid)\n\n end", "def create\n @advertisement = Advertisement.new(params[:advertisement])\n \n @advertisement.uploaded_file = params[:advertisement][:image]\n @advertisement.event_id_id = params[:advertisement][:event_id_id]\n @advertisement.link = params[:advertisement][:link]\n\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully created.' }\n format.json { render json: @advertisement, status: :created, location: @advertisement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end", "def residence_params\n\t\tparams.require(:residence).permit(:nombre, :provincia, :partido, :ciudad, :direccion, :img_link, :desc)\n\tend", "def transcendence_params\n params.require(:transcendence).permit(:title, :description, :image_url, :image)\n end", "def attachment_params\n params.require(:attachment).permit(:user_id, :essay, :name, :assignment_schedule, :correction_attributes => [:id, :score, :contains_author_data])\n end", "def episode_params\n params.require(:episode).permit(:title, :body, :image_url)\n end", "def case_params\n params.require(:announcement).permit(:title,:link,:image,:validity,:featured)\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.fileEvidence\"\n end", "def resume_params\n params.require(:resume).permit(:file, :retained_file, :remove_file, :file_url)\n end", "def create\n recommendation = Recommendation.find(evidence_params[:recommendation_id])\n user = current_user\n if (current_user = recommendation.area.user || current_user.role == 0) then\n @evidence = Evidence.new(evidence_params)\n # Create notifications\n if (user.role === 0)then\n Notification.create(recipient: @evidence.recommendation.area.user, actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n else\n Notification.create(recipient: User.find_by(role: 0), actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n end\n\n respond_to do |format|\n if @evidence.save\n format.html { redirect_to @evidence.recommendation }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path, notice: \"No tienes permisos para realizar esta acción\"\n return\n end\n end", "def grave_params\n params.require(:grave).permit(:name, :relationship_id, :relationship_name, :gender, :caste_id,:identity_id, :died_at, :age, :number, attachment_attributes: [:id, :document])\n end", "def advertisement_params\n params.require(:advertisement).permit(:advertisement_id, :title, :body, :image1, :delivery_date)\n end", "def episode_params\n params.require(:episode).permit(:name, :storyline, :image, :runtime, :release_at, { user_ids:[] })\n end", "def dis_additive_frequency_params\n params.require(:dis_additive_frequency).permit(:name, :frequency_value, :status_id)\n end", "def dis_additive_frequency_params\n params.require(:dis_additive_frequency).permit(:name, :frequency_value, :status_id)\n end", "def past_exam_params\n params.fetch(:past_exam, {})\n .permit(:description, :file, :course_id)\n end", "def past_exam_params\n params.fetch(:past_exam, {})\n .permit(:description, :file, :course_id)\n end", "def document_params\n params.require(:document).permit(:doc_type, :name, :patient_id, images: [])\n end", "def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def debate_params\n params.require(:debate).permit(:affirmative_id, :negative_id, :creator_id, :challenger_id, :challenger_email, :status, :start_date, :start_time, :topic_id, :public_challenge, :resolution, :affirmative_confirmed, :track_opens)\n end", "def note_params\n params.require(:note).permit(:title, :description, attachments_attributes: [:file, :file_cache])\n end", "def episode_params\n params.require(:episode).permit(:dj_id, :notes, :shadowed)\n end", "def document_params\n params.require(:document).permit(:d_title, :d_content, :d_type, :d_tags, :annex)\n end", "def new\n authorize Answer\n @answer = Answer.new\n @answer.attachments.build\n end", "def episode_params\n params.require(:episode).permit(:q, :tag_id, :tag, :search, :audio_preview_url, :description, :duration_ms, :web_url, :id, :image_url, :name, :release_date, :uri)\n end", "def incident_proof_params\n params.require(:incident_proof).permit(:incident_id, :avatar)\n end", "def sentiment_params\n params.require(:sentiment).permit(:interaction_no, :advocate_id, :url, :status, :score, :magnitude, :sentiment, :detail)\n end" ]
[ "0.68844604", "0.66145897", "0.60603297", "0.59929526", "0.57141435", "0.5713201", "0.5636474", "0.5608927", "0.5389011", "0.5389011", "0.5288435", "0.52189004", "0.5193484", "0.5139676", "0.51297307", "0.5120266", "0.5105473", "0.51007825", "0.5094642", "0.5081448", "0.5067117", "0.505458", "0.5041733", "0.50040966", "0.49999797", "0.49959776", "0.4993267", "0.4972888", "0.49689704", "0.49689704", "0.49470872", "0.49391198", "0.49368382", "0.49304667", "0.49296182", "0.49212706", "0.4915284", "0.49047983", "0.48614782", "0.48591182", "0.48302487", "0.4825892", "0.48257756", "0.48224837", "0.48135963", "0.4812536", "0.48027667", "0.4789678", "0.47870433", "0.47847158", "0.47755513", "0.47732136", "0.47655258", "0.4762798", "0.47606593", "0.47606522", "0.47578615", "0.4751339", "0.47466037", "0.47426605", "0.47362617", "0.473012", "0.4727276", "0.47217932", "0.47126317", "0.47120306", "0.47062644", "0.47031704", "0.46923128", "0.46921027", "0.4689346", "0.4684214", "0.46827185", "0.46734977", "0.4671665", "0.46699294", "0.46607357", "0.466064", "0.46594858", "0.46567866", "0.46545362", "0.4653939", "0.46530652", "0.4649723", "0.46477818", "0.46454108", "0.46419582", "0.46419582", "0.46340477", "0.46340477", "0.46287727", "0.4627053", "0.46180016", "0.46171054", "0.4617012", "0.4615999", "0.46148953", "0.4614467", "0.46105495", "0.4605281" ]
0.589619
4
Submit dispute evidence With this final request, you can submit the evidence that you have previously provided. Make sure you have provided all the relevant information before using this request. You will not be able to amend your evidence once you have submitted it.
def submit_dispute_evidence(dispute_id, opts = {}) submit_dispute_evidence_with_http_info(dispute_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end", "def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end", "def evidence_params\n params.require(:evidence).permit(\n :book_id,\n :format,\n :format_other,\n :content_type,\n :location_in_book,\n :location_in_book_page,\n :transcription,\n :translation,\n :year_when,\n :year_start,\n :year_end,\n :date_narrative,\n :where,\n :comments,\n :citations,\n :photo,\n :photo_id,\n :context_photo_id,\n :context_image_id,\n content_type_ids: [],\n provenance_agents_attributes: [ :id, :name_id, :role, :_destroy ]\n )\n end", "def certify_event_attendence_post\n #create approval if create approval selected\n @event = Event.find_by_id(params[:event_id])\n if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil\n # check to make sure debriefing is submitted\n # TODO: ^^ This\n # update the event first\n if @event.update(event_certify_params)\n #create certification request\n ecr = EventCertificationRequest.new(event_id: @event.id)\n #create approval\n ecr.approval_id = new_approval(6)\n ecr.user_id = current_user.id\n if ecr.save\n @event.submitted_for_certification = true\n @event.event_certification_request_id = ecr.id\n if @event.save\n render status: 200, json: @event\n else\n render status: 500, json: { message: 'Error Occured. Event could not be submitted for certification' }\n end\n else\n @event.submitted_for_certification = false\n if @event.save\n render status: 500, json: { message: 'ERROR: ECR could not be saved. Event reverted so certification could be made.' }\n else\n render status: 500, json: { message: 'ERROR: ECR could not be saved and the event could not be updated. Data wise this is probably really messed up you will need to contact Rindzer.' }\n end\n end\n else\n render status: 500, json: { message: \"An error occured and the event could not be updated.\" }\n end\n else\n render status: 404, json: { message: 'Either this event was not found or has already been submitted for certification.' }\n end\n end", "def submit_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.submit_dispute_evidence\",\n :header_params => 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: DisputesApi#submit_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @evidence = @book.evidence.build evidence_params\n\n respond_to do |format|\n if @evidence.save_by current_user\n @evidence.dequeue_photo\n format.html {\n redirect_to @evidence, notice: 'Evidence was successfully created.'\n }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def perform(release_id, pipeline_id = nil)\n release = Release.find_by_id(release_id)\n return unless release\n\n pipeline = Ci::Pipeline.find_by_id(pipeline_id)\n\n ::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute\n end", "def submit_form_526 # rubocop:disable Metrics/MethodLength\n ClaimsApi::Logger.log('526', detail: '526 - Request Started')\n sanitize_account_type if form_attributes.dig('directDeposit', 'accountType')\n validate_json_schema\n validate_form_526_submission_values!\n validate_veteran_identifiers(require_birls: true)\n validate_initial_claim\n ClaimsApi::Logger.log('526', detail: '526 - Controller Actions Completed')\n\n auto_claim = ClaimsApi::AutoEstablishedClaim.create(\n status: ClaimsApi::AutoEstablishedClaim::PENDING,\n auth_headers:,\n form_data: form_attributes,\n flashes:,\n special_issues: special_issues_per_disability,\n source: source_name,\n cid: token.payload['cid'],\n veteran_icn: target_veteran.mpi.icn\n )\n\n ClaimsApi::Logger.log('526', claim_id: auto_claim.id, detail: 'Submitted to Lighthouse',\n pdf_gen_dis: form_attributes['autoCestPDFGenerationDisabled'])\n\n # .create returns the resulting object whether the object was saved successfully to the database or not.\n # If it's lacking the ID, that means the create was unsuccessful and an identical claim already exists.\n # Find and return that claim instead.\n unless auto_claim.id\n existing_auto_claim = ClaimsApi::AutoEstablishedClaim.find_by(md5: auto_claim.md5)\n auto_claim = existing_auto_claim if existing_auto_claim.present?\n end\n\n if auto_claim.errors.present?\n raise ::Common::Exceptions::UnprocessableEntity.new(detail: auto_claim.errors.messages.to_s)\n end\n\n unless form_attributes['autoCestPDFGenerationDisabled'] == true\n ClaimsApi::ClaimEstablisher.perform_async(auto_claim.id)\n end\n\n ClaimsApi::Logger.log('526', detail: '526 - Request Completed')\n render json: auto_claim, serializer: ClaimsApi::AutoEstablishedClaimSerializer\n end", "def submit\n raise Ch31NilClaimError if @claim.nil?\n\n response = send_to_vre(payload: format_payload_for_vre)\n response_body = response.body\n\n raise Ch31Error if response_body['error_occurred'] == true\n\n log_message_to_sentry(\n 'Temp message for testing',\n :warn,\n { application_intake_id: response_body['application_intake'] },\n SENTRY_TAG\n )\n response_body\n rescue Ch31Error => e\n process_ch_31_error(e, response_body)\n\n response_body\n rescue Ch31NilClaimError => e\n process_nil_claim_error(e)\n end", "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end", "def perform!(claim_params)\n claim = Dispatch::Claim.new(claim_params)\n\n fail InvalidClaimError unless claim.valid?\n\n transaction do\n appeal.update!(dispatched_to_station: claim.station_of_jurisdiction)\n update_claim_establishment!(ep_code: claim.end_product_code)\n\n establish_claim_in_vbms(claim).tap do |end_product|\n review!(outgoing_reference_id: end_product.claim_id)\n end\n end\n\n rescue VBMS::HTTPError => error\n raise parse_vbms_error(error)\n end", "def residence_params\n params.require(:residence).permit(:name, :description)\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def assess_data_with_vro\n response = vro_client.assess_claim(veteran_icn: claim_context.user_icn)\n claim_context.assessed_data = response.dig('body', 'evidence').transform_keys(&:to_sym)\n claim_context.sufficient_evidence = sufficient_evidence?\n end", "def fullassessment_params\n params.require(:fullassessment).permit(:assessment, :date, :assessment_type, :diagnosis, :intervention, :monitoring_evaluation, :client_id)\n end", "def submit\r\n @sess.DoRequests(@request_set)\r\n end", "def disc_assessment_params\n params.require(:disc_assessment).permit(:user_id, :driver_score, :influencer_score, :sociable_score, :conscientious_score)\n end", "def unofficial_submit\n \n feedback_str = request.body.read\n\n @course = Course.where(:id => params[:course_id]).first\n @assessment = Assessment.where(:id => params[:id]).first\n @user = User.where(:email => params[:user]).first\n\n if !@course then\n puts \"ERROR: invalid course\"\n exit\n end\n\n if !@user then\n puts \"ERROR: invalid username (#{user}) for class #{course.id}\"\n exit\n end\n\n if !@assessment then\n puts \"ERROR: Invalid Assessment (#{assessment}) for course #{course.id}\"\n exit\n end\n\n if !@assessment.allow_unofficial then\n puts \"ERROR: This assessment does not allow Unofficial Submissions\"\n exit\n end\n\n @result = params[:result]\n\n if !@result then\n puts \"ERROR: No result!\"\n exit\n end\n\n # Everything looks OK, so append the autoresult to the log.txt file for this lab\n @logger = Logger.new(\"#{Rails.root}/courses/#{@course.name}/#{@assessment.name}/log.txt\")\n @logger.add(Logger::INFO) { \"#{@user.email},0,#{@result}\" }\n\n # Load up the lab.rb file\n modName = @assessment.name + (@course.name).gsub(/[^A-Za-z0-9]/,\"\")\n require(\"#{Rails.root}/assessmentConfig/#{@course.name}-#{@assessment.name}.rb\")\n eval(\"extend #{modName.camelcase}\")\n\n begin\n # Call the parseAutoresult function defined in the lab.rb file. If\n # the list of scores it returns is empty, then we the lab developer is\n # asking us not to create an unofficial submission in the\n # database. Simply return a successful status string to the client and\n # exit.\n scores = parseAutoresult(@result,false)\n\n if scores.keys.length == 0 then \n render :nothing => true and return\n end\n\n # Try to find an existing unofficial submission (always version 0). \n submission = @assessment.submissions.where(:version=>0,:user_id=>@user.id).first\n if !submission then\n submission = @assessment.submissions.new(:version=>0,\n :autoresult=>@result,\n :user_id=>@user.id,\n :submitted_by_id=>0)\n submission.save!()\n else\n #update this one\n submission.autoresult= @result\n submission.created_at = Time.now()\n submission.save!()\n end\n\n\n # Update the scores in the db's unofficial submission using the list\n # returned by the parseAutoresult function\n for key in scores.keys do\n problem = @assessment.problems.where(:name => key).first\n score = submission.scores.where(:problem_id => problem.id).first\n if !score then \n score = submission.scores.new(:problem_id=>problem.id)\n end\n score.score = scores[key]\n score.released = true\n score.grader_id= 0\n score.save!()\n end\n rescue Exception => e\n print e\n end\n\n\n render :nothing => true and return\n\n end", "def create\n params[:submission][:verdict] = 'pending'\n create_base(params[:submission]) \n end", "def process_claim!\n assert_veteran_status\n\n carma_submission = CARMA::Models::Submission.from_claim(claim, build_metadata).submit!\n\n Form1010cg::Submission.new(\n carma_case_id: carma_submission.carma_case_id,\n submitted_at: carma_submission.submitted_at\n )\n end", "def set_evidence\n @evidence = Evidence.includes(:book).find params[:id]\n end", "def dispute_params\n params.require(:dispute).permit(:company, :policy_name, :policy_text, :policy_link)\n end", "def create\n recommendation = Recommendation.find(evidence_params[:recommendation_id])\n user = current_user\n if (current_user = recommendation.area.user || current_user.role == 0) then\n @evidence = Evidence.new(evidence_params)\n # Create notifications\n if (user.role === 0)then\n Notification.create(recipient: @evidence.recommendation.area.user, actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n else\n Notification.create(recipient: User.find_by(role: 0), actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n end\n\n respond_to do |format|\n if @evidence.save\n format.html { redirect_to @evidence.recommendation }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path, notice: \"No tienes permisos para realizar esta acción\"\n return\n end\n end", "def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end", "def incidence_params\n params.require(:incidence).permit(:ticket, :type_id, :picture, :motive_id, :description,:ubigeo_id, :reference, :date, :latitud, :longitud)\n end", "def submit(args = {})\n watercourse.set(args[:watercourse]) if args.key?(:watercourse)\n stop_day.set(args[:stop_day]) if args.key?(:stop_day)\n stop_month.set(args[:stop_month]) if args.key?(:stop_month)\n stop_year.set(args[:stop_year]) if args.key?(:stop_year)\n apply_day.set(args[:apply_day]) if args.key?(:apply_day)\n apply_month.set(args[:apply_month]) if args.key?(:apply_month)\n apply_year.set(args[:apply_year]) if args.key?(:apply_year)\n gauging_station.set(args[:gauging_station]) if args.key?(:gauging_station)\n hof_threshold.set(args[:hof_threshold]) if args.key?(:hof_threshold)\n contact_name.set(args[:contact_name]) if args.key?(:contact_name)\n contact_details.set(args[:contact_details]) if args.key?(:contact_details)\n sender_name.set(args[:sender_name]) if args.key?(:sender_name)\n sender_role.set(args[:sender_role]) if args.key?(:sender_role)\n sender_address.set(args[:sender_address]) if args.key?(:sender_address)\n submit_button.click\n end", "def denunciation_params\n params.require(:denunciation).permit(:survivor_id, :sender_id)\n end", "def update\n respond_to do |format|\n if @evidence.update_by current_user, evidence_params\n format.html { redirect_to [@evidence], notice: 'Evidence was successfully updated.' }\n format.json { render :show, status: :ok, location: @evidence }\n else\n format.html { render :edit }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @visarequest = Visarequest.new(params[:visarequest])\n\n respond_to do |format|\n if @visarequest.save\n flash[:notice] = 'Your Visa Request Application has been successfully submitted.'\n\t\t\n\t\t#send the visa request application of the member to the credit union by email\n\t\tEmailer.deliver_visarequest_email(@visarequest)\n format.html { redirect_to(@visarequest) }\n format.xml { render :xml => @visarequest, :status => :created, :location => @visarequest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @visarequest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def residence_params\n\t\tparams.require(:residence).permit(:nombre, :provincia, :partido, :ciudad, :direccion, :img_link, :desc)\n\tend", "def waiver_submitted\n requested_decision\n end", "def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end", "def preplanned_submit\n @publication = Publication.find(params[:id])\n @publication.lock!\n @publication.preplanned_submit!\n flash[:notice] = \"Preplanned submitted for acceptance.\"\n # flash[:notice] = \"Preplanned submitted for acceptance. Email sent to the author.\"\n # @email = Email.find_by_trigger('preplanned_submit')\n # Notifier.workflow_notification(@publication.user,@email,@publication).deliver\n redirect_to publication_url\n end", "def submits; end", "def create\n if @user.primary_role != \"Student\"\n render :file => \"public/401.html\", :status => :unauthorized \n return\n end\n \n hx = hnp_flag(params[:hx])\n px = hnp_flag(params[:px])\n \n @encounter = Encounter.new(params[:encounter])\n @encounter.hx = hx\n @encounter.px = px\n @encounter.creator = @user\n @encounter.updater = @user\n \n primary_problem = params[:primary_problem]\n secondary_problems = params[:secondary_problems]\n procedures_observed = params[:procedures_observed]\n \n respond_to do |format|\n if @encounter.save\n #save single primary problem\n if primary_problem.include? ' > ' then \n \tdx_xref = Diagnosis.find_by_name primary_problem.split(' > ').last\n \tdx_other = ''\n else\n \tdx_xref = Diagnosis.find_by_name 'Other'\n \tdx_other = primary_problem\n end\n \n @edx = @encounter.diagnoses.new(\"encounter_id\" => @encounter.id, \"dx_type\" => 'P', \"dx_id\" => dx_xref.id, \"other\" => dx_other, \"created_by\" => @user.id, \"updated_by\" => @user.id)\n @edx.save\n \n #loop and save secondary problems\n for sdx in secondary_problems.split(', ')\n \t\t\tif sdx.include? ' > ' then \n \t\t\t\tdx_xref = Diagnosis.find_by_name sdx.split(' > ').last\n \t\t\t\tdx_other = ''\n \t\t\telse\n \t\t\t\tdx_xref = Diagnosis.find_by_name 'Other'\n \t\t\t\tdx_other = sdx\n \t\t\tend\n \t\t\t \n @edx = @encounter.diagnoses.new(\"encounter_id\" => @encounter.id, \"dx_type\" => 'S', \"dx_id\" => dx_xref.id, \"other\" => dx_other, \"created_by\" => @user.id, \"updated_by\" => @user.id)\n @edx.save\n \n end #for dx loop\n \n #loop and save procedures observed\n for po in procedures_observed.split(', ')\n \n \t\t\tif (proc_xref = Procedure.find_by_name(po)) \n \t\t\tthen \n \t\t\t\tproc_xref = Procedure.find_by_name(po)\n \t\t\t\tproc_other = ''\n \t\t\telse \n \t\t\t\tproc_xref = Procedure.find_by_name('Other')\n \t\t\t\tproc_other = po\n \t\t\tend\n \n @po_new = @encounter.procedures.new(\"encounter_id\" => @encounter.id, \"participation_type\" => 'O', \"procedure_id\" => proc_xref.id, \"other\" => proc_other, \"created_by\" => @user.id, \"updated_by\" => @user.id)\n @po_new.save\n end #for procedures observed loop\n \n flash[:notice] = 'Encounter was successfully created.'\n format.html { redirect_to(@encounter) }\n format.xml { render :xml => @encounter, :status => :created, :location => @encounter }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_fall_assessment_params\n params.require(:post_fall_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @adviser = Adviser.new adviser_params\n\n if @adviser.save\n redirect_to advisers_url\n else\n render 'new'\n end\n end", "def debate_params\n params.require(:debate).permit(:affirmative_id, :negative_id, :creator_id, :challenger_id, :challenger_email, :status, :start_date, :start_time, :topic_id, :public_challenge, :resolution, :affirmative_confirmed, :track_opens)\n end", "def assess\n @latest_assessment = @task.assessments.find_or_initialize_by_assessed_on(Time.now.to_date)\n @latest_assessment.attributes = params[:latest_assessment]\n if @latest_assessment.save\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task progress was recorded.'\n flash[:highlight_dom_id] = dom_id(@latest_assessment)\n redirect_to task_path(@task)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'show' }\n end\n end\n end", "def create\r\n @event = Event.find(params[:rsvp][:event_id])\r\n note = params[:rsvp][:notes]\r\n if @event.vacancy?\r\n current_user.attend!(@event, note)\r\n redirect_to event_path(@event), :notice => \"RSVP Saved\"\r\n else\r\n redirect_to event_path(@event), :alert => \"Sorry, No more vacancy for this event\"\r\n end\r\n #@rsvp = Rsvp.new(params[:rsvp])\r\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def create\n @incidence = Incidence.new(incidence_params)\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to @incidence, notice: 'Incidencia creada exitosamente.' }\n format.json { render :show, status: :created, location: @incidence }\n else\n format.html { render :new }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observation = Observation.new(observation_params)\n # @observation.approval_status = \"pending\"\n\n # puts @observation.resource_doi\n \n # if params[:resource_doi]\n # resource = Resource.where(:doi_isbn => params[:resource_doi])\n # if resource.present?\n # @observation.resource_id = resource.first.id\n # puts \"----- WAS present ==============================\"\n # else\n # puts \"----- WAS NOT present ==============================\"\n # begin\n # @doi = JSON.load(open(\"https://api.crossref.org/works/#{params[:resource_doi]}\"))\n # if @doi[\"message\"][\"author\"][0][\"family\"] == \"Peresson\"\n # @doi = \"Invalid\"\n # end\n # rescue\n # @doi = \"Invalid\"\n # end\n # puts @doi\n\n # if not @doi == \"Invalid\"\n\n\n # @resource = Resource.new(resource_params)\n\n # authors = \"\"\n # @doi[\"message\"][\"author\"].each do |a|\n # authors = authors + \"#{a[\"family\"].titleize}, #{a[\"given\"].titleize}, \"\n # end\n\n # @resource.author = authors\n # @resource.year = @doi[\"message\"][\"issued\"][\"date-parts\"][0][0]\n # @resource.title = @doi[\"message\"][\"title\"][0]\n # @resource.journal = @doi[\"message\"][\"container-title\"][0]\n # @resource.volume_pages = @doi[\"message\"][\"volume\"], @doi[\"message\"][\"page\"]\n # @resource.save!\n\n # if @resource.save\n # @observation.resource_id = @resource.id\n # else\n # @observation.errors.add(:base, 'The oid was invalid')\n # end\n # else\n # @observation.errors.add(:base, 'The oid was invalid')\n # end\n # end\n # end\n\n if @observation.save\n # Todo: Uncomment following line in production\n #UploadApprovalMailer.approve(current_user).deliver\n redirect_to @observation, flash: {success: \"Observation was successfully created.\" }\n else\n render action: 'new'\n end\n end", "def save(connection, comment = nil)\n validate\n\n xml = connection.make_xml('VulnerabilityExceptionCreateRequest')\n xml.add_attributes({ 'vuln-id' => @vuln_id,\n 'scope' => @scope,\n 'reason' => @reason })\n case @scope\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id })\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id,\n 'port-no' => @port,\n 'vuln-key' => @vuln_key })\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n xml.add_attributes({ 'site-id ' => @site_id })\n end\n\n @submitter_comment = comment if comment\n if @submitter_comment\n comment_elem = REXML::Element.new('comment')\n comment_elem.add_text(@submitter_comment)\n xml.add_element(comment_elem)\n end\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['exception-id'].to_i if response.success\n end", "def save(connection, comment = nil)\n validate\n\n xml = connection.make_xml('VulnerabilityExceptionCreateRequest')\n xml.add_attributes({ 'vuln-id' => @vuln_id,\n 'scope' => @scope,\n 'reason' => @reason })\n case @scope\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id })\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id,\n 'port-no' => @port,\n 'vuln-key' => @vuln_key })\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n xml.add_attributes({ 'site-id ' => @site_id })\n end\n\n @submitter_comment = comment if comment\n if @submitter_comment\n comment_elem = REXML::Element.new('comment')\n comment_elem.add_text(@submitter_comment)\n xml.add_element(comment_elem)\n end\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['exception-id'].to_i if response.success\n end", "def create\n @absence = AttendanceRecord.find(params[:excuse][:attendance_record_id])\n @excuse = Excuse.new(excuse_params)\n @excuse.attendance_record = @absence\n @excuse.save\n redirect_to excuses_my_absences_path\n end", "def grade!\n uri = URI.parse problem.endpoint.url\n response = Net::HTTP.post_form uri, task: problem.task_name, code: code\n verdict = Verdict.from_endpoint_response response, self\n verdict.save!\n end", "def process_claim!\n raise 'submission already present' if submission.present?\n\n assert_veteran_status\n\n carma_submission = CARMA::Models::Submission.from_claim(claim, build_metadata).submit!(carma_client)\n\n @submission = Form1010cg::Submission.new(\n carma_case_id: carma_submission.carma_case_id,\n submitted_at: carma_submission.submitted_at\n )\n\n submit_attachment\n\n submission\n end", "def perform(email, invitor_id, variation_id, with_media)\n end", "def inspection_params\n params.require(:inspection).permit(:fCondition, :businessCards, :nOD, :nOG, :paid, :reportURL, :footprintURL, :repairs, :permit, :interiorAccess, :verifiedReport, :verifiedComp, :notes, :name, :appointment_id, :report, :completed_appointment_sheet, :client_information_sheet, :footprint_diagram, bids_attributes: [:id, :costRepair, :feeSeismicUpg, :feeAdmin, :_destroy])\n end", "def submit_claim\n resp = if token.present?\n client.submit_claim(token:, patient_icn:, appointment_date:)\n else\n Faraday::Response.new(body: { message: 'Unauthorized' }, status: 401)\n end\n response.build(response: resp).handle\n end", "def assessment_params\n params.fetch(:assessment).permit(:remoteOneValue,:remoteTwoValue,:remoteThreeValue, :remoteFourValue, :remoteFiveValue, :strategyOneValue, :strategyTwoValue, :strategyThreeValue, :strategyFourValue, :strategyFiveValue, :strategySixValue, :name, :email)\n end", "def create\n \n\n #validate idea\n @idea = Idea.new(params[:idea])\n if @idea.valid? && verify_recaptcha(:model => @idea, :message => \"Please try the reCAPTCHA again\")\n #store description in temp database\n @temp_description = TempDescription.new(:description=>@idea.description)\n @temp_description.save\n #logger.debug(\"temp description object: #{@temp_description}\")\n real_description = params[:idea][:description]\n params[:idea][:description] = @temp_description.id\n idea_params = params.to_query\n\n create_idea_string = \"#{request.host}/approved_create?#{idea_params}\"\n\n #send approval email with correct params\n body_string = \"<p>Name: #{@idea.name}</p><p>Description: #{real_description}</p><p>Submitter: #{@idea.submitter_email}</p><p><a href=\\\"#{create_idea_string}\\\">approve</a></p>\"\n Pony.mail({\n :to => 'tmshu1@gmail.com',\n :via => :smtp,\n :body => body_string,\n :subject=> 'Idea Vending Machine: approval required',\n :headers => { 'Content-Type' => 'text/html' },\n :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => 'ideavendingmachine',\n :password => ENV['PASSWORD'],\n :authentication => :plain, # :plain, :login, :cram_md5, no auth by default\n :domain => \"localhost.localdomain\" # the HELO domain provided by the client to the server\n }\n })\n\n #redirect to home, with a flash of success. NEED to do this, so user can't refresh page and spam email me\n flash[:success] = \"Idea submitted for approval. If approved, you will receive an email with #{NUM_IDEAS} ideas\"\n redirect_to root_path\n else\n render action: \"new\"\n end\n \n end", "def analyze(_evidence, _current)\n {\n # Your return has to go here. This reformats the hashed return into\n # chief understands. Remember the output must corrospond to one of the\n # values in the database structure.\n # Typically This would be in the form.\n\n # blank_status:\n # {\n # value: 'Met', # or Unmet\n # confidence: 3, # or what ever you think it should be.\n # explanation: \"My Text to appear in the evidence field\"\n # }\n }\n end", "def submit_fees\n raise('to be implemented by caller')\n end", "def execute()\n # If we are using the simple review request configuration\n if @configurations['configuration_type'] == 'Simple'\n # Encode the csrv, this will ensure that any '#' characters in the\n # InstanceId are escaped.\n csrv = encode_url_parameter(@parameters['csrv'])\n # Concatenate the application path, review request Servlet path, and the\n # encoded InstanceId of the desired submission\n url = \"#{@configurations['application_path']}ReviewRequest?csrv=#{csrv}\"\n # If we are using the advanced review request configuration\n else\n # Build up the HTTP parameter name/value pair Strings\n parameter_strings = @parameters.collect {|name, value|\n # Each parameter pair String maps the parameter to the encoded parameter\n # value. It is important to encode the value so that special characters\n # (such as '#' or '&') don't modify the intended meaning of the URL.\n \"#{name}=#{encode_url_parameter(value)}\" unless value.nil?\n }.compact\n\n # Build up the URL\n url = \"#{@configurations['application_path']}ReviewRequest?#{parameter_strings.join('&')}\"\n end\n\n # Return the results String\n <<-RESULTS\n <results>\n <result name=\"URL\">#{escape(url)}</result>\n </results>\n RESULTS\n end", "def index\n @evidence = Evidence.all\n end", "def do_coaps_posted_03\n # get the Base64 of the incoming signed request\n body = IO.read(\"spec/files/vr_00-D0-E5-F2-00-03.vrq\")\n\n env = Hash.new\n env[\"SSL_CLIENT_CERT\"] = cbor_clientcert_03\n env[\"HTTP_ACCEPT\"] = \"application/voucher-cose+cbor\"\n env[\"CONTENT_TYPE\"] = \"application/voucher-cose+cbor\"\n\n $FAKED_TEMPORARY_KEY = temporary_key\n post '/e/rv', :params => body, :headers => env\n end", "def reject\n if request.post?\n if @ad.mark_as_disapproved!(params[:reason])\n flash[:notice] = 'AD successfully rejected!'\n else\n flash_errors_model @ad\n end\n redirect_to url_for(action: :index)\n end\n end", "def disbursment_params\n params.require(:disbursment).permit(:amount, :details, :case_id, :video, :user_id)\n end", "def assessment_params\n params.require(:assessment).permit(:story_id, :duplicate, :importance, :valence, :match_value_id, :match_strength, :value_violation, :value_violated_id, :comments, :restrict_comments)\n end", "def review(*)\n super.tap do\n __debug_sim('REVIEWER initiates review of the submission.')\n end\n end", "def do_coaps_posted_02\n # get the Base64 of the incoming signed request\n body = IO.read(\"spec/files/vr_00-D0-E5-F2-00-02.vrq\")\n\n env = Hash.new\n env[\"SSL_CLIENT_CERT\"] = cbor_clientcert_02\n env[\"HTTP_ACCEPT\"] = \"application/voucher-cose+cbor\"\n env[\"CONTENT_TYPE\"] = \"application/voucher-cose+cbor\"\n\n $FAKED_TEMPORARY_KEY = temporary_key\n post '/e/rv', :params => body, :headers => env\n end", "def assessment_params\n params.require(:assessment).permit(:number_assesment, :state_id, :location, :inhabited, :habitant, :client_id, :owner_id, :start_date, \n :end_date, \n properties_attributes:[:id, :debt_taxation, :antiquity, :expropriation, :sill, :facilities, :name])\n end", "def create\n @residence = Residence.new(params[:residence])\n\n respond_to do |format|\n if @residence.save\n format.html { redirect_to @residence, notice: 'Residence was successfully created.' }\n format.json { render json: @residence, status: :created, location: @residence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end", "def residence_params\n params.require(:residence).permit(\n :applicant_id,\n :address_id,\n :start,\n :end,\n :reason,\n :landlord_id,\n {address_attributes: [:street, :apt, :city, :state, :zip, :id]},\n {landlord_attributes: [:first_name, :middle_name, :last_name, :cell_phone, :home_phone, :work_phone, :email, :id,\n mail_address_attributes: [:street, :apt, :city, :state, :zip, :id]]})\n end", "def record_submission\n transaction do\n task.update_attributes(completed_at: DateTime.now)\n project.signal_or_raise!(:accept_proposal, nil, self)\n end\n end", "def publish(_ = nil)\n publish_answers\n\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n self.awarder = User.stamper || User.system\n self.awarded_at = Time.zone.now\n if persisted? && !assessment.autograded? && submission_graded_email_enabled?\n execute_after_commit { Course::Mailer.submission_graded_email(self).deliver_later }\n end\n end", "def procurement_params\n params.require(:procurement).permit(:name, :subject, :anounced_date, :close_date, :control_date, :confirmed, :confirmed_date, :effective_date, :approval_date, :approval, :status, :note, :procurer_name)\n end", "def submission_params\n params.require(:submission).permit(:assessment_id, :userId, :userEmail, :Scores, :Answers, :SubmittedAt, :Score, :Duration)\n end", "def send_document_review_notification\n if value == 'verified'\n EventAPI.notify('system.document.verified', record: as_json_for_event_api)\n elsif value == 'rejected'\n EventAPI.notify('system.document.rejected', record: as_json_for_event_api)\n end\n end", "def create\n\t\t@residence = Residence.new(residence_params)\n\n\t\trespond_to do |format|\n\t\t\tif @residence.save\n\t\t\t\tformat.html { redirect_to @residence, notice: 'La residencia se creo correctamente.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @residence }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @residence.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def evaluation_details\n @place = Place.with_translation(params[:id]).first\n @data = {:summary_questions => [], :evaluations => []}\n\n @is_certified = params[:is_certified].to_bool\n disabilities = nil\n type_id = 0\n type_id = params[:type].to_i if params[:type].present?\n if type_id > 0\n disability = nil\n if @is_certified == true\n disability = Disability.is_active_certified.find_by_id(type_id)\n else\n disability = Disability.is_active_public.find_by_id(type_id)\n end\n disabilities = [disability] if disability.present?\n else\n if @is_certified == true\n disabilities = Disability.is_active_certified\n else\n disabilities = Disability.is_active_public\n end\n end\n\n if @place.present? && disabilities.present?\n # get summary questions\n if @is_certified\n @data[:summary_questions] = QuestionCategory.questions_categories_for_venue(question_category_id: @place.custom_question_category_id, is_certified: true, venue_id: @place.venue_id)\n else\n @data[:summary_questions] = QuestionCategory.questions_for_venue(question_category_id: @place.custom_public_question_category_id, is_certified: false, venue_id: @place.venue_id)\n end\n \n disabilities.each do |disability|\n # get evaluation results\n evals = PlaceEvaluation.with_answers(params[:id], disability_id: disability.id, is_certified: @is_certified).sorted\n \n # only record info if this disability has evaluations \n if evals.present?\n qc = QuestionCategory.questions_for_venue(question_category_id: @place.custom_question_category_id, disability_id: disability.id, is_certified: @is_certified, venue_id: @place.venue_id)\n\n eval = Hash.new\n @data[:evaluations] << eval\n\n # record the disability\n eval[:id] = disability.id\n eval[:code] = disability.code\n eval[:name] = disability.name\n\n eval[:question_categories] = qc\n\n # get evaluation results\n eval[:evaluations] = evals\n eval[:evaluation_count] = 0\n \n if eval[:evaluations].present?\n eval[:evaluation_count] = eval[:evaluations].length\n\n # create summaries of evaluations\n eval[:summaries] = PlaceSummary.for_place_disablity(params[:id], disability_id: disability.id, is_certified: @is_certified)\n \n # get user info that submitted evaluations\n eval[:users] = User.for_evaluations(eval[:evaluations].map{|x| x.user_id}.uniq)\n end \n end\n end\n end\n\n respond_to do |format|\n format.html { render layout: 'fancybox'}\n format.json { render json: @data }\n end\n end", "def submit_req\n requisition = OLE_QA::Framework::OLEFS::Requisition.new(@ole)\n requisition.open\n # Set Delivery\n unless requisition.building_search_icon.present?\n requisition.delivery_tab_toggle.click\n end\n requisition.building_search_icon.wait_until_present\n requisition.building_search_icon.click\n lookup = OLE_QA::Framework::OLEFS::Building_Lookup.new(@ole)\n lookup.wait_for_page_to_load\n lookup.building_name_field.set('Wells Library')\n lookup.search_button.click\n lookup.wait_for_page_to_load\n lookup.return_result('Wells Library').when_present.click\n requisition.wait_for_page_to_load\n requisition.room_field.when_present.set('100')\n # Set Vendor\n unless requisition.vendor_search_icon.present?\n requisition.vendor_tab_toggle.click\n end\n requisition.vendor_search_icon.when_present.click\n lookup = OLE_QA::Framework::OLEFS::Vendor_Lookup.new(@ole)\n lookup.wait_for_page_to_load\n lookup.vendor_name_field.set('YBP')\n lookup.search_button.click\n lookup.return_result(/YBP/).when_present.click\n requisition.wait_for_page_to_load\n # Add new bib\n requisition.new_bib_option.when_present.set\n requisition.new_bib_button.when_present.click\n Watir::Wait.until { @ole.browser.windows.count > 1 }\n @ole.browser.windows[-1].use\n bib_ary = [{\n :tag => '245',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + OLE_QA::Framework::String_Factory.alphanumeric(12)\n }]\n bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(@ole)\n create_bib(bib_editor,bib_ary)\n @ole.browser.windows[-1].close\n @ole.browser.alert.ok if @ole.browser.alert.present?\n @ole.browser.windows[0].use\n requisition.wait_for_page_to_load\n requisition.list_price_field.when_present.set(OLE_QA::Framework::String_Factory.numeric(2))\n requisition.location_selector.when_present.select('B-EDUC/BED-STACKS')\n requisition.copies_field.when_present.set('1')\n requisition.add_button.when_present.click\n requisition.wait_for_page_to_load\n requisition.line_item.accounting_lines_toggle.click unless requisition.line_item.chart_selector.present?\n requisition.line_item.chart_selector.when_present.select('BL')\n account = OLE_QA::Framework::Account_Factory.select_account(:BL)[0]\n requisition.line_item.account_number_field.when_present.set(account)\n object = OLE_QA::Framework::Account_Factory.select_object(:BL)[0]\n requisition.line_item.object_field.when_present.set(object)\n requisition.line_item.percent_field.when_present.set('100.00')\n requisition.line_item.add_account_button.when_present.click\n requisition.wait_for_page_to_load\n requisition.submit_button.click\n requisition.wait_for_page_to_load\n requisition.generic_message.wait_until_present\n verify {requisition.document_id.present?}\n req_id = requisition.document_id.text.strip\n req_url = requisition.lookup_url(req_id)\n page_assert(req_url,180) {requisition.wait_for_page_to_load\n requisition.document_type_status.text.include?('Closed')}\n page_assert(req_url,180) {requisition.wait_for_page_to_load\n requisition.view_related_tab_toggle.when_present.click unless requisition.view_related_po_link.present?\n requisition.view_related_po_link.wait_until_present}\n purchase_order = OLE_QA::Framework::OLEFS::Purchase_Order.new(@ole)\n po_id = requisition.view_related_po_link.text.strip\n po_url = requisition.view_related_po_link.href\n @ole.browser.goto(po_url)\n page_assert(po_url,180) {purchase_order.wait_for_page_to_load\n purchase_order.document_status.text.strip == 'FINAL' &&\n purchase_order.document_type_status.text.strip == 'Open'}\n end", "def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def demand_response_params\n params.require(:demand_response).permit(:interval_id, :issuer, :feeder_id, :prosumer_category_id, :event_type, dr_targets_attributes: [:id, :volume, :timestamp])\n end", "def adverse_event_params\n params.require(:adverse_event).permit(:time, :reason_admission, :description, :pregnant, :event_id, :patient_id, :branch_office_id)\n end", "def create\n @event = Event.new(event_params)\n \n if @event.save\n redirect_to @event, success: \"New #{@event.primaryType} event on #{@event.eventDate} has been successfully created.\"\n else\n redirect_to '/events/new', danger: \"Event not created.\"\n end\n \n @cadets = Cadet.where(approved: true).order(:lastName)\n @cadets.each do |cadet|\n if cadet.approved == true\n Attendance.create!(:attended => 1, :cadet_id => cadet.id, :event_id => @event.id)\n end\n end\n end", "def dsr_submission_params\n params.require( :dsr_submission ).permit( \n :dsr_status_record_id,\n :submission_no,\n :sender_doc_id_version,\n :project_doc_id_version,\n :receiver_doc_id_version,\n :submission_receiver_doc_id,\n :submission_project_doc_id,\n :response_sender_doc_id,\n :response_project_doc_id,\n :plnd_submission,\n :actl_submission,\n :xpcd_response,\n :xpcd_response_delta,\n :actl_response,\n :response_status )\n end", "def exhibit_params\n params.require(:exhibit).permit(:name, :registration_number, :iframe, :date_of_receipt, :chronology, :fund_creator,\n :opportunity_for_transportation, :the_degree_of_preservation,\n :tags_string, :authenticity, :the_electronic_version, :size, :cronology,\n :description, pictures_attributes: [:id, :name, :image, :_destroy])\n end", "def request_post\n # purpose_type: profile ID of\n # https://certs.nii.ac.jp/archive/TSV_File_Format/client_tsv/\n\n # S/MIME-multiple-application guard (failsafe)\n smime_num = Cert.where(user_id: current_user.id, purpose_type: 7, state: Cert::State::NEW_GOT_SERIAL).count() # FIXME: rewrite to cover multiple states\n if (smime_num > 0)\n return # FIXME: need error message\n end\n\n ActiveRecord::Base.transaction do \n current_user.cert_serial_max += 1\n current_user.save # TODO: need error check\n end \n \n case params[:cert][\"purpose_type\"].to_i\n when Cert::PurposeType::CLIENT_AUTH_CERTIFICATE\n dn = \"CN=#{current_user.uid},OU=No #{current_user.cert_serial_max.to_s},\" + SHIBCERT_CONFIG[Rails.env]['base_dn']\n\n when Cert::PurposeType::SMIME_CERTIFICATE\n dn = \"CN=#{current_user.name},\" + SHIBCERT_CONFIG[Rails.env]['base_dn']\n else\n # something wrong. TODO: need error handling\n Rails.logger.info \"#{__method__}: unknown purpose_type #{params[:cert]['purpose_type']}\"\n dn = \"\"\n end\n \n request_params = params.require(:cert).permit(:purpose_type).merge(\n {user_id: current_user.id,\n state: Cert::State::NEW_REQUESTED_FROM_USER,\n dn: dn,\n req_seq: current_user.cert_serial_max})\n @cert = Cert.new(request_params)\n @cert.save\n\n Rails.logger.debug \"RaReq.request call: @cert = #{@cert.inspect}\"\n RaReq.request(@cert)\n \n redirect_to request_result_path(@cert.id)\n end", "def consent\n send_data(gen_pdf(params[:wedgetail]), :filename => \"consent.pdf\", :type => \"application/pdf\")\n end", "def p4_submit description\n p4sh \"p4 submit -d #{description.inspect} ...\"\n end", "def create\n @disc_assessment = DiscAssessment.new(disc_assessment_params)\n @disc_assessment.save\n session[:assessment_sequence] = true\n session[:disc_assessment_id] = @disc_assessment.id\n respond_to do |format|\n if @disc_assessment.save\n if session[:assessment_sequence]\n format.html { redirect_to new_value_assessment_path }\n else\n format.html { redirect_to @disc_assessment, notice: 'Disc assessment was successfully created.' }\n format.json { render :show, status: :created, location: @disc_assessment }\n end\n else\n format.html { render :new }\n format.json { render json: @disc_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def assessment_params\n params.require(:icq_assessment).permit(:client_id, :employee_id, :height, :weight,\n :waist, :hip, :next_assessment_date)\n\n end", "def residence_params\n params.require(:residence).permit(\n :applicant_id,\n :address_id,\n :start,\n :end,\n :reason,\n :landlord_id,\n address_attributes: [ :street, :apt, :city, :state, :zip, :id ],\n landlord_attributes: [ :first_name, :middle_name, :last_name,\n :cell_phone, :home_phone, :work_phone, :email, :id ] )\n end", "def vacate_at_attorney_review(mtv_judge, drafting_attorney, lit_support_user)\n # These are ready to be reviewed by the decision drafting attorney on the vacate stream\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"denied\")\n judge_addresses_mtv(jam_task, \"denied\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"dismissed\")\n judge_addresses_mtv(jam_task, \"dismissed\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"straight_vacate\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_readjudication\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_de_novo\", drafting_attorney)\n end\n end", "def submit_dna(sequence)\n\n\n #clustalw2 specific params\n params = Hash.new\n\t params['email'] = 'dunarel@gmail.com'\n params['title'] = 'test_web_service'\n params['sequence'] = sequence\n \n \n #call base class\n return run_params(params)\n\n end", "def aide_params\n params.require(:aide).permit(:result_no, :generate_no, :e_no, :aide_no, :name, :enemy_id, :cost_sp, :bonds, :mhp, :msp, :mep, :range, :fuka_texts, :skill_texts)\n end", "def post_bva_dta_decision_status_details\n issue_list = remanded_sc_decision_issues\n {\n issues: api_issues_for_status_details_issues(issue_list),\n bva_decision_date: decision_event_date,\n aoj_decision_date: remand_decision_event_date\n }\n end", "def pain_assessment_params\n params.require(:pain_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end", "def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end", "def written_exam_params\n params[:written_exam].permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end", "def purchase_sub_existing_edu #much copied from static#students , but much not needed #in case use customer registers but then comes back later to finish purchasing\n @event = Event.find(ENV['demopage'].to_i)\n @commencement_plan = Plan.find_by_my_plan_id(plan_set_commencement) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @students_plan = Plan.find_by_my_plan_id(plan_set_students)\n @all_inclusive_plan = Plan.find_by_my_plan_id(plan_set_all_inclusive)\n @practiceobject = Practiceobject.new \n @practiceobject.event_id = @event.id #for the form_for(@practiceobject) which creatse a new practice object (and another form which just shows the labels - can find a better way for that)\n @registeredandrecordedpos = @event.practiceobjects.registered.recorded.visible\n @registeredandunrecordedpos = @event.practiceobjects.registered.unrecorded.visible\n @unregisteredpos = @event.practiceobjects.unregistered.visible\n @hiddenpos = @event.practiceobjects.hidden\n @hiddenandregisteredpos = @hiddenpos.registered\n @hiddenandunregisteredpos = @hiddenpos.unregistered \n\n @url = demo_record_directory_url(:event_code => @event.event_code)\nend", "def disapprove!(options = {})\n persist = options.fetch(:persist, true)\n transaction do\n self.approved = false\n self.approved_at = Time.now\n save! if persist\n AfterDisapprovalJob.enqueue(self.id)\n end\n end" ]
[ "0.6426868", "0.6416204", "0.6224866", "0.6169022", "0.6168901", "0.58507633", "0.56596124", "0.5583541", "0.5551783", "0.5502571", "0.54677784", "0.5448605", "0.5448605", "0.54181176", "0.53506374", "0.5341992", "0.5329798", "0.5326155", "0.52908725", "0.526332", "0.5239235", "0.5222401", "0.5219614", "0.52136093", "0.519953", "0.51817065", "0.5167187", "0.5158007", "0.51461595", "0.51008815", "0.5089364", "0.5066603", "0.5058556", "0.5058515", "0.5052685", "0.5052492", "0.5040186", "0.5039155", "0.5004176", "0.49931103", "0.49922282", "0.49910635", "0.49894115", "0.49878013", "0.49863145", "0.4984709", "0.4984086", "0.49830705", "0.49781215", "0.49781215", "0.49746904", "0.49555084", "0.49503896", "0.49330541", "0.49263713", "0.49219853", "0.49214908", "0.49143657", "0.49107963", "0.49103335", "0.49080426", "0.48894656", "0.48889694", "0.48885623", "0.4888503", "0.48746237", "0.48653123", "0.48533964", "0.48413762", "0.484071", "0.4840243", "0.4838788", "0.4837534", "0.48298818", "0.48279178", "0.48240244", "0.4821554", "0.4820225", "0.48183262", "0.4814955", "0.48080125", "0.48078957", "0.4807711", "0.48065758", "0.48037088", "0.48010188", "0.48006687", "0.47965732", "0.4796199", "0.4790836", "0.47880152", "0.47796363", "0.4779368", "0.47777182", "0.4773135", "0.47720364", "0.47709742", "0.47641283", "0.47638056", "0.47576678" ]
0.6422297
1
Submit dispute evidence With this final request, you can submit the evidence that you have previously provided. Make sure you have provided all the relevant information before using this request. You will not be able to amend your evidence once you have submitted it.
def submit_dispute_evidence_with_http_info(dispute_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...' end # verify the required parameter 'dispute_id' is set if @api_client.config.client_side_validation && dispute_id.nil? fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence" end pattern = Regexp.new(/^(dsp)_(\w{26})$/) if @api_client.config.client_side_validation && dispute_id !~ pattern fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}." end # resource path local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.submit_dispute_evidence", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#submit_dispute_evidence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end", "def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end", "def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end", "def evidence_params\n params.require(:evidence).permit(\n :book_id,\n :format,\n :format_other,\n :content_type,\n :location_in_book,\n :location_in_book_page,\n :transcription,\n :translation,\n :year_when,\n :year_start,\n :year_end,\n :date_narrative,\n :where,\n :comments,\n :citations,\n :photo,\n :photo_id,\n :context_photo_id,\n :context_image_id,\n content_type_ids: [],\n provenance_agents_attributes: [ :id, :name_id, :role, :_destroy ]\n )\n end", "def certify_event_attendence_post\n #create approval if create approval selected\n @event = Event.find_by_id(params[:event_id])\n if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil\n # check to make sure debriefing is submitted\n # TODO: ^^ This\n # update the event first\n if @event.update(event_certify_params)\n #create certification request\n ecr = EventCertificationRequest.new(event_id: @event.id)\n #create approval\n ecr.approval_id = new_approval(6)\n ecr.user_id = current_user.id\n if ecr.save\n @event.submitted_for_certification = true\n @event.event_certification_request_id = ecr.id\n if @event.save\n render status: 200, json: @event\n else\n render status: 500, json: { message: 'Error Occured. Event could not be submitted for certification' }\n end\n else\n @event.submitted_for_certification = false\n if @event.save\n render status: 500, json: { message: 'ERROR: ECR could not be saved. Event reverted so certification could be made.' }\n else\n render status: 500, json: { message: 'ERROR: ECR could not be saved and the event could not be updated. Data wise this is probably really messed up you will need to contact Rindzer.' }\n end\n end\n else\n render status: 500, json: { message: \"An error occured and the event could not be updated.\" }\n end\n else\n render status: 404, json: { message: 'Either this event was not found or has already been submitted for certification.' }\n end\n end", "def create\n @evidence = @book.evidence.build evidence_params\n\n respond_to do |format|\n if @evidence.save_by current_user\n @evidence.dequeue_photo\n format.html {\n redirect_to @evidence, notice: 'Evidence was successfully created.'\n }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def perform(release_id, pipeline_id = nil)\n release = Release.find_by_id(release_id)\n return unless release\n\n pipeline = Ci::Pipeline.find_by_id(pipeline_id)\n\n ::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute\n end", "def submit_form_526 # rubocop:disable Metrics/MethodLength\n ClaimsApi::Logger.log('526', detail: '526 - Request Started')\n sanitize_account_type if form_attributes.dig('directDeposit', 'accountType')\n validate_json_schema\n validate_form_526_submission_values!\n validate_veteran_identifiers(require_birls: true)\n validate_initial_claim\n ClaimsApi::Logger.log('526', detail: '526 - Controller Actions Completed')\n\n auto_claim = ClaimsApi::AutoEstablishedClaim.create(\n status: ClaimsApi::AutoEstablishedClaim::PENDING,\n auth_headers:,\n form_data: form_attributes,\n flashes:,\n special_issues: special_issues_per_disability,\n source: source_name,\n cid: token.payload['cid'],\n veteran_icn: target_veteran.mpi.icn\n )\n\n ClaimsApi::Logger.log('526', claim_id: auto_claim.id, detail: 'Submitted to Lighthouse',\n pdf_gen_dis: form_attributes['autoCestPDFGenerationDisabled'])\n\n # .create returns the resulting object whether the object was saved successfully to the database or not.\n # If it's lacking the ID, that means the create was unsuccessful and an identical claim already exists.\n # Find and return that claim instead.\n unless auto_claim.id\n existing_auto_claim = ClaimsApi::AutoEstablishedClaim.find_by(md5: auto_claim.md5)\n auto_claim = existing_auto_claim if existing_auto_claim.present?\n end\n\n if auto_claim.errors.present?\n raise ::Common::Exceptions::UnprocessableEntity.new(detail: auto_claim.errors.messages.to_s)\n end\n\n unless form_attributes['autoCestPDFGenerationDisabled'] == true\n ClaimsApi::ClaimEstablisher.perform_async(auto_claim.id)\n end\n\n ClaimsApi::Logger.log('526', detail: '526 - Request Completed')\n render json: auto_claim, serializer: ClaimsApi::AutoEstablishedClaimSerializer\n end", "def submit\n raise Ch31NilClaimError if @claim.nil?\n\n response = send_to_vre(payload: format_payload_for_vre)\n response_body = response.body\n\n raise Ch31Error if response_body['error_occurred'] == true\n\n log_message_to_sentry(\n 'Temp message for testing',\n :warn,\n { application_intake_id: response_body['application_intake'] },\n SENTRY_TAG\n )\n response_body\n rescue Ch31Error => e\n process_ch_31_error(e, response_body)\n\n response_body\n rescue Ch31NilClaimError => e\n process_nil_claim_error(e)\n end", "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end", "def perform!(claim_params)\n claim = Dispatch::Claim.new(claim_params)\n\n fail InvalidClaimError unless claim.valid?\n\n transaction do\n appeal.update!(dispatched_to_station: claim.station_of_jurisdiction)\n update_claim_establishment!(ep_code: claim.end_product_code)\n\n establish_claim_in_vbms(claim).tap do |end_product|\n review!(outgoing_reference_id: end_product.claim_id)\n end\n end\n\n rescue VBMS::HTTPError => error\n raise parse_vbms_error(error)\n end", "def residence_params\n params.require(:residence).permit(:name, :description)\n end", "def provide_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_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 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.provide_dispute_evidence\",\n :header_params => 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: DisputesApi#provide_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def assess_data_with_vro\n response = vro_client.assess_claim(veteran_icn: claim_context.user_icn)\n claim_context.assessed_data = response.dig('body', 'evidence').transform_keys(&:to_sym)\n claim_context.sufficient_evidence = sufficient_evidence?\n end", "def fullassessment_params\n params.require(:fullassessment).permit(:assessment, :date, :assessment_type, :diagnosis, :intervention, :monitoring_evaluation, :client_id)\n end", "def submit\r\n @sess.DoRequests(@request_set)\r\n end", "def disc_assessment_params\n params.require(:disc_assessment).permit(:user_id, :driver_score, :influencer_score, :sociable_score, :conscientious_score)\n end", "def unofficial_submit\n \n feedback_str = request.body.read\n\n @course = Course.where(:id => params[:course_id]).first\n @assessment = Assessment.where(:id => params[:id]).first\n @user = User.where(:email => params[:user]).first\n\n if !@course then\n puts \"ERROR: invalid course\"\n exit\n end\n\n if !@user then\n puts \"ERROR: invalid username (#{user}) for class #{course.id}\"\n exit\n end\n\n if !@assessment then\n puts \"ERROR: Invalid Assessment (#{assessment}) for course #{course.id}\"\n exit\n end\n\n if !@assessment.allow_unofficial then\n puts \"ERROR: This assessment does not allow Unofficial Submissions\"\n exit\n end\n\n @result = params[:result]\n\n if !@result then\n puts \"ERROR: No result!\"\n exit\n end\n\n # Everything looks OK, so append the autoresult to the log.txt file for this lab\n @logger = Logger.new(\"#{Rails.root}/courses/#{@course.name}/#{@assessment.name}/log.txt\")\n @logger.add(Logger::INFO) { \"#{@user.email},0,#{@result}\" }\n\n # Load up the lab.rb file\n modName = @assessment.name + (@course.name).gsub(/[^A-Za-z0-9]/,\"\")\n require(\"#{Rails.root}/assessmentConfig/#{@course.name}-#{@assessment.name}.rb\")\n eval(\"extend #{modName.camelcase}\")\n\n begin\n # Call the parseAutoresult function defined in the lab.rb file. If\n # the list of scores it returns is empty, then we the lab developer is\n # asking us not to create an unofficial submission in the\n # database. Simply return a successful status string to the client and\n # exit.\n scores = parseAutoresult(@result,false)\n\n if scores.keys.length == 0 then \n render :nothing => true and return\n end\n\n # Try to find an existing unofficial submission (always version 0). \n submission = @assessment.submissions.where(:version=>0,:user_id=>@user.id).first\n if !submission then\n submission = @assessment.submissions.new(:version=>0,\n :autoresult=>@result,\n :user_id=>@user.id,\n :submitted_by_id=>0)\n submission.save!()\n else\n #update this one\n submission.autoresult= @result\n submission.created_at = Time.now()\n submission.save!()\n end\n\n\n # Update the scores in the db's unofficial submission using the list\n # returned by the parseAutoresult function\n for key in scores.keys do\n problem = @assessment.problems.where(:name => key).first\n score = submission.scores.where(:problem_id => problem.id).first\n if !score then \n score = submission.scores.new(:problem_id=>problem.id)\n end\n score.score = scores[key]\n score.released = true\n score.grader_id= 0\n score.save!()\n end\n rescue Exception => e\n print e\n end\n\n\n render :nothing => true and return\n\n end", "def create\n params[:submission][:verdict] = 'pending'\n create_base(params[:submission]) \n end", "def process_claim!\n assert_veteran_status\n\n carma_submission = CARMA::Models::Submission.from_claim(claim, build_metadata).submit!\n\n Form1010cg::Submission.new(\n carma_case_id: carma_submission.carma_case_id,\n submitted_at: carma_submission.submitted_at\n )\n end", "def set_evidence\n @evidence = Evidence.includes(:book).find params[:id]\n end", "def dispute_params\n params.require(:dispute).permit(:company, :policy_name, :policy_text, :policy_link)\n end", "def create\n recommendation = Recommendation.find(evidence_params[:recommendation_id])\n user = current_user\n if (current_user = recommendation.area.user || current_user.role == 0) then\n @evidence = Evidence.new(evidence_params)\n # Create notifications\n if (user.role === 0)then\n Notification.create(recipient: @evidence.recommendation.area.user, actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n else\n Notification.create(recipient: User.find_by(role: 0), actor:user, action: \" agregó una evidencia a \" + @evidence.recommendation.name.to_s, notifiable: @evidence)\n end\n\n respond_to do |format|\n if @evidence.save\n format.html { redirect_to @evidence.recommendation }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path, notice: \"No tienes permisos para realizar esta acción\"\n return\n end\n end", "def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end", "def incidence_params\n params.require(:incidence).permit(:ticket, :type_id, :picture, :motive_id, :description,:ubigeo_id, :reference, :date, :latitud, :longitud)\n end", "def submit(args = {})\n watercourse.set(args[:watercourse]) if args.key?(:watercourse)\n stop_day.set(args[:stop_day]) if args.key?(:stop_day)\n stop_month.set(args[:stop_month]) if args.key?(:stop_month)\n stop_year.set(args[:stop_year]) if args.key?(:stop_year)\n apply_day.set(args[:apply_day]) if args.key?(:apply_day)\n apply_month.set(args[:apply_month]) if args.key?(:apply_month)\n apply_year.set(args[:apply_year]) if args.key?(:apply_year)\n gauging_station.set(args[:gauging_station]) if args.key?(:gauging_station)\n hof_threshold.set(args[:hof_threshold]) if args.key?(:hof_threshold)\n contact_name.set(args[:contact_name]) if args.key?(:contact_name)\n contact_details.set(args[:contact_details]) if args.key?(:contact_details)\n sender_name.set(args[:sender_name]) if args.key?(:sender_name)\n sender_role.set(args[:sender_role]) if args.key?(:sender_role)\n sender_address.set(args[:sender_address]) if args.key?(:sender_address)\n submit_button.click\n end", "def denunciation_params\n params.require(:denunciation).permit(:survivor_id, :sender_id)\n end", "def update\n respond_to do |format|\n if @evidence.update_by current_user, evidence_params\n format.html { redirect_to [@evidence], notice: 'Evidence was successfully updated.' }\n format.json { render :show, status: :ok, location: @evidence }\n else\n format.html { render :edit }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def residence_params\n\t\tparams.require(:residence).permit(:nombre, :provincia, :partido, :ciudad, :direccion, :img_link, :desc)\n\tend", "def create\n @visarequest = Visarequest.new(params[:visarequest])\n\n respond_to do |format|\n if @visarequest.save\n flash[:notice] = 'Your Visa Request Application has been successfully submitted.'\n\t\t\n\t\t#send the visa request application of the member to the credit union by email\n\t\tEmailer.deliver_visarequest_email(@visarequest)\n format.html { redirect_to(@visarequest) }\n format.xml { render :xml => @visarequest, :status => :created, :location => @visarequest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @visarequest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end", "def waiver_submitted\n requested_decision\n end", "def preplanned_submit\n @publication = Publication.find(params[:id])\n @publication.lock!\n @publication.preplanned_submit!\n flash[:notice] = \"Preplanned submitted for acceptance.\"\n # flash[:notice] = \"Preplanned submitted for acceptance. Email sent to the author.\"\n # @email = Email.find_by_trigger('preplanned_submit')\n # Notifier.workflow_notification(@publication.user,@email,@publication).deliver\n redirect_to publication_url\n end", "def submits; end", "def create\n if @user.primary_role != \"Student\"\n render :file => \"public/401.html\", :status => :unauthorized \n return\n end\n \n hx = hnp_flag(params[:hx])\n px = hnp_flag(params[:px])\n \n @encounter = Encounter.new(params[:encounter])\n @encounter.hx = hx\n @encounter.px = px\n @encounter.creator = @user\n @encounter.updater = @user\n \n primary_problem = params[:primary_problem]\n secondary_problems = params[:secondary_problems]\n procedures_observed = params[:procedures_observed]\n \n respond_to do |format|\n if @encounter.save\n #save single primary problem\n if primary_problem.include? ' > ' then \n \tdx_xref = Diagnosis.find_by_name primary_problem.split(' > ').last\n \tdx_other = ''\n else\n \tdx_xref = Diagnosis.find_by_name 'Other'\n \tdx_other = primary_problem\n end\n \n @edx = @encounter.diagnoses.new(\"encounter_id\" => @encounter.id, \"dx_type\" => 'P', \"dx_id\" => dx_xref.id, \"other\" => dx_other, \"created_by\" => @user.id, \"updated_by\" => @user.id)\n @edx.save\n \n #loop and save secondary problems\n for sdx in secondary_problems.split(', ')\n \t\t\tif sdx.include? ' > ' then \n \t\t\t\tdx_xref = Diagnosis.find_by_name sdx.split(' > ').last\n \t\t\t\tdx_other = ''\n \t\t\telse\n \t\t\t\tdx_xref = Diagnosis.find_by_name 'Other'\n \t\t\t\tdx_other = sdx\n \t\t\tend\n \t\t\t \n @edx = @encounter.diagnoses.new(\"encounter_id\" => @encounter.id, \"dx_type\" => 'S', \"dx_id\" => dx_xref.id, \"other\" => dx_other, \"created_by\" => @user.id, \"updated_by\" => @user.id)\n @edx.save\n \n end #for dx loop\n \n #loop and save procedures observed\n for po in procedures_observed.split(', ')\n \n \t\t\tif (proc_xref = Procedure.find_by_name(po)) \n \t\t\tthen \n \t\t\t\tproc_xref = Procedure.find_by_name(po)\n \t\t\t\tproc_other = ''\n \t\t\telse \n \t\t\t\tproc_xref = Procedure.find_by_name('Other')\n \t\t\t\tproc_other = po\n \t\t\tend\n \n @po_new = @encounter.procedures.new(\"encounter_id\" => @encounter.id, \"participation_type\" => 'O', \"procedure_id\" => proc_xref.id, \"other\" => proc_other, \"created_by\" => @user.id, \"updated_by\" => @user.id)\n @po_new.save\n end #for procedures observed loop\n \n flash[:notice] = 'Encounter was successfully created.'\n format.html { redirect_to(@encounter) }\n format.xml { render :xml => @encounter, :status => :created, :location => @encounter }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_fall_assessment_params\n params.require(:post_fall_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end", "def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Evidence'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_evidence\",\n :header_params => 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: DisputesApi#get_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @adviser = Adviser.new adviser_params\n\n if @adviser.save\n redirect_to advisers_url\n else\n render 'new'\n end\n end", "def debate_params\n params.require(:debate).permit(:affirmative_id, :negative_id, :creator_id, :challenger_id, :challenger_email, :status, :start_date, :start_time, :topic_id, :public_challenge, :resolution, :affirmative_confirmed, :track_opens)\n end", "def assess\n @latest_assessment = @task.assessments.find_or_initialize_by_assessed_on(Time.now.to_date)\n @latest_assessment.attributes = params[:latest_assessment]\n if @latest_assessment.save\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task progress was recorded.'\n flash[:highlight_dom_id] = dom_id(@latest_assessment)\n redirect_to task_path(@task)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'show' }\n end\n end\n end", "def create\r\n @event = Event.find(params[:rsvp][:event_id])\r\n note = params[:rsvp][:notes]\r\n if @event.vacancy?\r\n current_user.attend!(@event, note)\r\n redirect_to event_path(@event), :notice => \"RSVP Saved\"\r\n else\r\n redirect_to event_path(@event), :alert => \"Sorry, No more vacancy for this event\"\r\n end\r\n #@rsvp = Rsvp.new(params[:rsvp])\r\n end", "def create\n @incidence = Incidence.new(incidence_params)\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to @incidence, notice: 'Incidencia creada exitosamente.' }\n format.json { render :show, status: :created, location: @incidence }\n else\n format.html { render :new }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def create\n @observation = Observation.new(observation_params)\n # @observation.approval_status = \"pending\"\n\n # puts @observation.resource_doi\n \n # if params[:resource_doi]\n # resource = Resource.where(:doi_isbn => params[:resource_doi])\n # if resource.present?\n # @observation.resource_id = resource.first.id\n # puts \"----- WAS present ==============================\"\n # else\n # puts \"----- WAS NOT present ==============================\"\n # begin\n # @doi = JSON.load(open(\"https://api.crossref.org/works/#{params[:resource_doi]}\"))\n # if @doi[\"message\"][\"author\"][0][\"family\"] == \"Peresson\"\n # @doi = \"Invalid\"\n # end\n # rescue\n # @doi = \"Invalid\"\n # end\n # puts @doi\n\n # if not @doi == \"Invalid\"\n\n\n # @resource = Resource.new(resource_params)\n\n # authors = \"\"\n # @doi[\"message\"][\"author\"].each do |a|\n # authors = authors + \"#{a[\"family\"].titleize}, #{a[\"given\"].titleize}, \"\n # end\n\n # @resource.author = authors\n # @resource.year = @doi[\"message\"][\"issued\"][\"date-parts\"][0][0]\n # @resource.title = @doi[\"message\"][\"title\"][0]\n # @resource.journal = @doi[\"message\"][\"container-title\"][0]\n # @resource.volume_pages = @doi[\"message\"][\"volume\"], @doi[\"message\"][\"page\"]\n # @resource.save!\n\n # if @resource.save\n # @observation.resource_id = @resource.id\n # else\n # @observation.errors.add(:base, 'The oid was invalid')\n # end\n # else\n # @observation.errors.add(:base, 'The oid was invalid')\n # end\n # end\n # end\n\n if @observation.save\n # Todo: Uncomment following line in production\n #UploadApprovalMailer.approve(current_user).deliver\n redirect_to @observation, flash: {success: \"Observation was successfully created.\" }\n else\n render action: 'new'\n end\n end", "def save(connection, comment = nil)\n validate\n\n xml = connection.make_xml('VulnerabilityExceptionCreateRequest')\n xml.add_attributes({ 'vuln-id' => @vuln_id,\n 'scope' => @scope,\n 'reason' => @reason })\n case @scope\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id })\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id,\n 'port-no' => @port,\n 'vuln-key' => @vuln_key })\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n xml.add_attributes({ 'site-id ' => @site_id })\n end\n\n @submitter_comment = comment if comment\n if @submitter_comment\n comment_elem = REXML::Element.new('comment')\n comment_elem.add_text(@submitter_comment)\n xml.add_element(comment_elem)\n end\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['exception-id'].to_i if response.success\n end", "def save(connection, comment = nil)\n validate\n\n xml = connection.make_xml('VulnerabilityExceptionCreateRequest')\n xml.add_attributes({ 'vuln-id' => @vuln_id,\n 'scope' => @scope,\n 'reason' => @reason })\n case @scope\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id })\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id,\n 'port-no' => @port,\n 'vuln-key' => @vuln_key })\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n xml.add_attributes({ 'site-id ' => @site_id })\n end\n\n @submitter_comment = comment if comment\n if @submitter_comment\n comment_elem = REXML::Element.new('comment')\n comment_elem.add_text(@submitter_comment)\n xml.add_element(comment_elem)\n end\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['exception-id'].to_i if response.success\n end", "def create\n @absence = AttendanceRecord.find(params[:excuse][:attendance_record_id])\n @excuse = Excuse.new(excuse_params)\n @excuse.attendance_record = @absence\n @excuse.save\n redirect_to excuses_my_absences_path\n end", "def grade!\n uri = URI.parse problem.endpoint.url\n response = Net::HTTP.post_form uri, task: problem.task_name, code: code\n verdict = Verdict.from_endpoint_response response, self\n verdict.save!\n end", "def process_claim!\n raise 'submission already present' if submission.present?\n\n assert_veteran_status\n\n carma_submission = CARMA::Models::Submission.from_claim(claim, build_metadata).submit!(carma_client)\n\n @submission = Form1010cg::Submission.new(\n carma_case_id: carma_submission.carma_case_id,\n submitted_at: carma_submission.submitted_at\n )\n\n submit_attachment\n\n submission\n end", "def perform(email, invitor_id, variation_id, with_media)\n end", "def inspection_params\n params.require(:inspection).permit(:fCondition, :businessCards, :nOD, :nOG, :paid, :reportURL, :footprintURL, :repairs, :permit, :interiorAccess, :verifiedReport, :verifiedComp, :notes, :name, :appointment_id, :report, :completed_appointment_sheet, :client_information_sheet, :footprint_diagram, bids_attributes: [:id, :costRepair, :feeSeismicUpg, :feeAdmin, :_destroy])\n end", "def assessment_params\n params.fetch(:assessment).permit(:remoteOneValue,:remoteTwoValue,:remoteThreeValue, :remoteFourValue, :remoteFiveValue, :strategyOneValue, :strategyTwoValue, :strategyThreeValue, :strategyFourValue, :strategyFiveValue, :strategySixValue, :name, :email)\n end", "def submit_claim\n resp = if token.present?\n client.submit_claim(token:, patient_icn:, appointment_date:)\n else\n Faraday::Response.new(body: { message: 'Unauthorized' }, status: 401)\n end\n response.build(response: resp).handle\n end", "def create\n \n\n #validate idea\n @idea = Idea.new(params[:idea])\n if @idea.valid? && verify_recaptcha(:model => @idea, :message => \"Please try the reCAPTCHA again\")\n #store description in temp database\n @temp_description = TempDescription.new(:description=>@idea.description)\n @temp_description.save\n #logger.debug(\"temp description object: #{@temp_description}\")\n real_description = params[:idea][:description]\n params[:idea][:description] = @temp_description.id\n idea_params = params.to_query\n\n create_idea_string = \"#{request.host}/approved_create?#{idea_params}\"\n\n #send approval email with correct params\n body_string = \"<p>Name: #{@idea.name}</p><p>Description: #{real_description}</p><p>Submitter: #{@idea.submitter_email}</p><p><a href=\\\"#{create_idea_string}\\\">approve</a></p>\"\n Pony.mail({\n :to => 'tmshu1@gmail.com',\n :via => :smtp,\n :body => body_string,\n :subject=> 'Idea Vending Machine: approval required',\n :headers => { 'Content-Type' => 'text/html' },\n :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => 'ideavendingmachine',\n :password => ENV['PASSWORD'],\n :authentication => :plain, # :plain, :login, :cram_md5, no auth by default\n :domain => \"localhost.localdomain\" # the HELO domain provided by the client to the server\n }\n })\n\n #redirect to home, with a flash of success. NEED to do this, so user can't refresh page and spam email me\n flash[:success] = \"Idea submitted for approval. If approved, you will receive an email with #{NUM_IDEAS} ideas\"\n redirect_to root_path\n else\n render action: \"new\"\n end\n \n end", "def analyze(_evidence, _current)\n {\n # Your return has to go here. This reformats the hashed return into\n # chief understands. Remember the output must corrospond to one of the\n # values in the database structure.\n # Typically This would be in the form.\n\n # blank_status:\n # {\n # value: 'Met', # or Unmet\n # confidence: 3, # or what ever you think it should be.\n # explanation: \"My Text to appear in the evidence field\"\n # }\n }\n end", "def submit_fees\n raise('to be implemented by caller')\n end", "def execute()\n # If we are using the simple review request configuration\n if @configurations['configuration_type'] == 'Simple'\n # Encode the csrv, this will ensure that any '#' characters in the\n # InstanceId are escaped.\n csrv = encode_url_parameter(@parameters['csrv'])\n # Concatenate the application path, review request Servlet path, and the\n # encoded InstanceId of the desired submission\n url = \"#{@configurations['application_path']}ReviewRequest?csrv=#{csrv}\"\n # If we are using the advanced review request configuration\n else\n # Build up the HTTP parameter name/value pair Strings\n parameter_strings = @parameters.collect {|name, value|\n # Each parameter pair String maps the parameter to the encoded parameter\n # value. It is important to encode the value so that special characters\n # (such as '#' or '&') don't modify the intended meaning of the URL.\n \"#{name}=#{encode_url_parameter(value)}\" unless value.nil?\n }.compact\n\n # Build up the URL\n url = \"#{@configurations['application_path']}ReviewRequest?#{parameter_strings.join('&')}\"\n end\n\n # Return the results String\n <<-RESULTS\n <results>\n <result name=\"URL\">#{escape(url)}</result>\n </results>\n RESULTS\n end", "def index\n @evidence = Evidence.all\n end", "def do_coaps_posted_03\n # get the Base64 of the incoming signed request\n body = IO.read(\"spec/files/vr_00-D0-E5-F2-00-03.vrq\")\n\n env = Hash.new\n env[\"SSL_CLIENT_CERT\"] = cbor_clientcert_03\n env[\"HTTP_ACCEPT\"] = \"application/voucher-cose+cbor\"\n env[\"CONTENT_TYPE\"] = \"application/voucher-cose+cbor\"\n\n $FAKED_TEMPORARY_KEY = temporary_key\n post '/e/rv', :params => body, :headers => env\n end", "def disbursment_params\n params.require(:disbursment).permit(:amount, :details, :case_id, :video, :user_id)\n end", "def reject\n if request.post?\n if @ad.mark_as_disapproved!(params[:reason])\n flash[:notice] = 'AD successfully rejected!'\n else\n flash_errors_model @ad\n end\n redirect_to url_for(action: :index)\n end\n end", "def assessment_params\n params.require(:assessment).permit(:story_id, :duplicate, :importance, :valence, :match_value_id, :match_strength, :value_violation, :value_violated_id, :comments, :restrict_comments)\n end", "def review(*)\n super.tap do\n __debug_sim('REVIEWER initiates review of the submission.')\n end\n end", "def do_coaps_posted_02\n # get the Base64 of the incoming signed request\n body = IO.read(\"spec/files/vr_00-D0-E5-F2-00-02.vrq\")\n\n env = Hash.new\n env[\"SSL_CLIENT_CERT\"] = cbor_clientcert_02\n env[\"HTTP_ACCEPT\"] = \"application/voucher-cose+cbor\"\n env[\"CONTENT_TYPE\"] = \"application/voucher-cose+cbor\"\n\n $FAKED_TEMPORARY_KEY = temporary_key\n post '/e/rv', :params => body, :headers => env\n end", "def create\n @residence = Residence.new(params[:residence])\n\n respond_to do |format|\n if @residence.save\n format.html { redirect_to @residence, notice: 'Residence was successfully created.' }\n format.json { render json: @residence, status: :created, location: @residence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end", "def assessment_params\n params.require(:assessment).permit(:number_assesment, :state_id, :location, :inhabited, :habitant, :client_id, :owner_id, :start_date, \n :end_date, \n properties_attributes:[:id, :debt_taxation, :antiquity, :expropriation, :sill, :facilities, :name])\n end", "def residence_params\n params.require(:residence).permit(\n :applicant_id,\n :address_id,\n :start,\n :end,\n :reason,\n :landlord_id,\n {address_attributes: [:street, :apt, :city, :state, :zip, :id]},\n {landlord_attributes: [:first_name, :middle_name, :last_name, :cell_phone, :home_phone, :work_phone, :email, :id,\n mail_address_attributes: [:street, :apt, :city, :state, :zip, :id]]})\n end", "def record_submission\n transaction do\n task.update_attributes(completed_at: DateTime.now)\n project.signal_or_raise!(:accept_proposal, nil, self)\n end\n end", "def publish(_ = nil)\n publish_answers\n\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n self.awarder = User.stamper || User.system\n self.awarded_at = Time.zone.now\n if persisted? && !assessment.autograded? && submission_graded_email_enabled?\n execute_after_commit { Course::Mailer.submission_graded_email(self).deliver_later }\n end\n end", "def procurement_params\n params.require(:procurement).permit(:name, :subject, :anounced_date, :close_date, :control_date, :confirmed, :confirmed_date, :effective_date, :approval_date, :approval, :status, :note, :procurer_name)\n end", "def submission_params\n params.require(:submission).permit(:assessment_id, :userId, :userEmail, :Scores, :Answers, :SubmittedAt, :Score, :Duration)\n end", "def send_document_review_notification\n if value == 'verified'\n EventAPI.notify('system.document.verified', record: as_json_for_event_api)\n elsif value == 'rejected'\n EventAPI.notify('system.document.rejected', record: as_json_for_event_api)\n end\n end", "def create\n\t\t@residence = Residence.new(residence_params)\n\n\t\trespond_to do |format|\n\t\t\tif @residence.save\n\t\t\t\tformat.html { redirect_to @residence, notice: 'La residencia se creo correctamente.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @residence }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @residence.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def evaluation_details\n @place = Place.with_translation(params[:id]).first\n @data = {:summary_questions => [], :evaluations => []}\n\n @is_certified = params[:is_certified].to_bool\n disabilities = nil\n type_id = 0\n type_id = params[:type].to_i if params[:type].present?\n if type_id > 0\n disability = nil\n if @is_certified == true\n disability = Disability.is_active_certified.find_by_id(type_id)\n else\n disability = Disability.is_active_public.find_by_id(type_id)\n end\n disabilities = [disability] if disability.present?\n else\n if @is_certified == true\n disabilities = Disability.is_active_certified\n else\n disabilities = Disability.is_active_public\n end\n end\n\n if @place.present? && disabilities.present?\n # get summary questions\n if @is_certified\n @data[:summary_questions] = QuestionCategory.questions_categories_for_venue(question_category_id: @place.custom_question_category_id, is_certified: true, venue_id: @place.venue_id)\n else\n @data[:summary_questions] = QuestionCategory.questions_for_venue(question_category_id: @place.custom_public_question_category_id, is_certified: false, venue_id: @place.venue_id)\n end\n \n disabilities.each do |disability|\n # get evaluation results\n evals = PlaceEvaluation.with_answers(params[:id], disability_id: disability.id, is_certified: @is_certified).sorted\n \n # only record info if this disability has evaluations \n if evals.present?\n qc = QuestionCategory.questions_for_venue(question_category_id: @place.custom_question_category_id, disability_id: disability.id, is_certified: @is_certified, venue_id: @place.venue_id)\n\n eval = Hash.new\n @data[:evaluations] << eval\n\n # record the disability\n eval[:id] = disability.id\n eval[:code] = disability.code\n eval[:name] = disability.name\n\n eval[:question_categories] = qc\n\n # get evaluation results\n eval[:evaluations] = evals\n eval[:evaluation_count] = 0\n \n if eval[:evaluations].present?\n eval[:evaluation_count] = eval[:evaluations].length\n\n # create summaries of evaluations\n eval[:summaries] = PlaceSummary.for_place_disablity(params[:id], disability_id: disability.id, is_certified: @is_certified)\n \n # get user info that submitted evaluations\n eval[:users] = User.for_evaluations(eval[:evaluations].map{|x| x.user_id}.uniq)\n end \n end\n end\n end\n\n respond_to do |format|\n format.html { render layout: 'fancybox'}\n format.json { render json: @data }\n end\n end", "def submit_req\n requisition = OLE_QA::Framework::OLEFS::Requisition.new(@ole)\n requisition.open\n # Set Delivery\n unless requisition.building_search_icon.present?\n requisition.delivery_tab_toggle.click\n end\n requisition.building_search_icon.wait_until_present\n requisition.building_search_icon.click\n lookup = OLE_QA::Framework::OLEFS::Building_Lookup.new(@ole)\n lookup.wait_for_page_to_load\n lookup.building_name_field.set('Wells Library')\n lookup.search_button.click\n lookup.wait_for_page_to_load\n lookup.return_result('Wells Library').when_present.click\n requisition.wait_for_page_to_load\n requisition.room_field.when_present.set('100')\n # Set Vendor\n unless requisition.vendor_search_icon.present?\n requisition.vendor_tab_toggle.click\n end\n requisition.vendor_search_icon.when_present.click\n lookup = OLE_QA::Framework::OLEFS::Vendor_Lookup.new(@ole)\n lookup.wait_for_page_to_load\n lookup.vendor_name_field.set('YBP')\n lookup.search_button.click\n lookup.return_result(/YBP/).when_present.click\n requisition.wait_for_page_to_load\n # Add new bib\n requisition.new_bib_option.when_present.set\n requisition.new_bib_button.when_present.click\n Watir::Wait.until { @ole.browser.windows.count > 1 }\n @ole.browser.windows[-1].use\n bib_ary = [{\n :tag => '245',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + OLE_QA::Framework::String_Factory.alphanumeric(12)\n }]\n bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(@ole)\n create_bib(bib_editor,bib_ary)\n @ole.browser.windows[-1].close\n @ole.browser.alert.ok if @ole.browser.alert.present?\n @ole.browser.windows[0].use\n requisition.wait_for_page_to_load\n requisition.list_price_field.when_present.set(OLE_QA::Framework::String_Factory.numeric(2))\n requisition.location_selector.when_present.select('B-EDUC/BED-STACKS')\n requisition.copies_field.when_present.set('1')\n requisition.add_button.when_present.click\n requisition.wait_for_page_to_load\n requisition.line_item.accounting_lines_toggle.click unless requisition.line_item.chart_selector.present?\n requisition.line_item.chart_selector.when_present.select('BL')\n account = OLE_QA::Framework::Account_Factory.select_account(:BL)[0]\n requisition.line_item.account_number_field.when_present.set(account)\n object = OLE_QA::Framework::Account_Factory.select_object(:BL)[0]\n requisition.line_item.object_field.when_present.set(object)\n requisition.line_item.percent_field.when_present.set('100.00')\n requisition.line_item.add_account_button.when_present.click\n requisition.wait_for_page_to_load\n requisition.submit_button.click\n requisition.wait_for_page_to_load\n requisition.generic_message.wait_until_present\n verify {requisition.document_id.present?}\n req_id = requisition.document_id.text.strip\n req_url = requisition.lookup_url(req_id)\n page_assert(req_url,180) {requisition.wait_for_page_to_load\n requisition.document_type_status.text.include?('Closed')}\n page_assert(req_url,180) {requisition.wait_for_page_to_load\n requisition.view_related_tab_toggle.when_present.click unless requisition.view_related_po_link.present?\n requisition.view_related_po_link.wait_until_present}\n purchase_order = OLE_QA::Framework::OLEFS::Purchase_Order.new(@ole)\n po_id = requisition.view_related_po_link.text.strip\n po_url = requisition.view_related_po_link.href\n @ole.browser.goto(po_url)\n page_assert(po_url,180) {purchase_order.wait_for_page_to_load\n purchase_order.document_status.text.strip == 'FINAL' &&\n purchase_order.document_type_status.text.strip == 'Open'}\n end", "def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def adverse_event_params\n params.require(:adverse_event).permit(:time, :reason_admission, :description, :pregnant, :event_id, :patient_id, :branch_office_id)\n end", "def create\n @event = Event.new(event_params)\n \n if @event.save\n redirect_to @event, success: \"New #{@event.primaryType} event on #{@event.eventDate} has been successfully created.\"\n else\n redirect_to '/events/new', danger: \"Event not created.\"\n end\n \n @cadets = Cadet.where(approved: true).order(:lastName)\n @cadets.each do |cadet|\n if cadet.approved == true\n Attendance.create!(:attended => 1, :cadet_id => cadet.id, :event_id => @event.id)\n end\n end\n end", "def demand_response_params\n params.require(:demand_response).permit(:interval_id, :issuer, :feeder_id, :prosumer_category_id, :event_type, dr_targets_attributes: [:id, :volume, :timestamp])\n end", "def dsr_submission_params\n params.require( :dsr_submission ).permit( \n :dsr_status_record_id,\n :submission_no,\n :sender_doc_id_version,\n :project_doc_id_version,\n :receiver_doc_id_version,\n :submission_receiver_doc_id,\n :submission_project_doc_id,\n :response_sender_doc_id,\n :response_project_doc_id,\n :plnd_submission,\n :actl_submission,\n :xpcd_response,\n :xpcd_response_delta,\n :actl_response,\n :response_status )\n end", "def exhibit_params\n params.require(:exhibit).permit(:name, :registration_number, :iframe, :date_of_receipt, :chronology, :fund_creator,\n :opportunity_for_transportation, :the_degree_of_preservation,\n :tags_string, :authenticity, :the_electronic_version, :size, :cronology,\n :description, pictures_attributes: [:id, :name, :image, :_destroy])\n end", "def request_post\n # purpose_type: profile ID of\n # https://certs.nii.ac.jp/archive/TSV_File_Format/client_tsv/\n\n # S/MIME-multiple-application guard (failsafe)\n smime_num = Cert.where(user_id: current_user.id, purpose_type: 7, state: Cert::State::NEW_GOT_SERIAL).count() # FIXME: rewrite to cover multiple states\n if (smime_num > 0)\n return # FIXME: need error message\n end\n\n ActiveRecord::Base.transaction do \n current_user.cert_serial_max += 1\n current_user.save # TODO: need error check\n end \n \n case params[:cert][\"purpose_type\"].to_i\n when Cert::PurposeType::CLIENT_AUTH_CERTIFICATE\n dn = \"CN=#{current_user.uid},OU=No #{current_user.cert_serial_max.to_s},\" + SHIBCERT_CONFIG[Rails.env]['base_dn']\n\n when Cert::PurposeType::SMIME_CERTIFICATE\n dn = \"CN=#{current_user.name},\" + SHIBCERT_CONFIG[Rails.env]['base_dn']\n else\n # something wrong. TODO: need error handling\n Rails.logger.info \"#{__method__}: unknown purpose_type #{params[:cert]['purpose_type']}\"\n dn = \"\"\n end\n \n request_params = params.require(:cert).permit(:purpose_type).merge(\n {user_id: current_user.id,\n state: Cert::State::NEW_REQUESTED_FROM_USER,\n dn: dn,\n req_seq: current_user.cert_serial_max})\n @cert = Cert.new(request_params)\n @cert.save\n\n Rails.logger.debug \"RaReq.request call: @cert = #{@cert.inspect}\"\n RaReq.request(@cert)\n \n redirect_to request_result_path(@cert.id)\n end", "def consent\n send_data(gen_pdf(params[:wedgetail]), :filename => \"consent.pdf\", :type => \"application/pdf\")\n end", "def create\n @disc_assessment = DiscAssessment.new(disc_assessment_params)\n @disc_assessment.save\n session[:assessment_sequence] = true\n session[:disc_assessment_id] = @disc_assessment.id\n respond_to do |format|\n if @disc_assessment.save\n if session[:assessment_sequence]\n format.html { redirect_to new_value_assessment_path }\n else\n format.html { redirect_to @disc_assessment, notice: 'Disc assessment was successfully created.' }\n format.json { render :show, status: :created, location: @disc_assessment }\n end\n else\n format.html { render :new }\n format.json { render json: @disc_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def p4_submit description\n p4sh \"p4 submit -d #{description.inspect} ...\"\n end", "def assessment_params\n params.require(:icq_assessment).permit(:client_id, :employee_id, :height, :weight,\n :waist, :hip, :next_assessment_date)\n\n end", "def residence_params\n params.require(:residence).permit(\n :applicant_id,\n :address_id,\n :start,\n :end,\n :reason,\n :landlord_id,\n address_attributes: [ :street, :apt, :city, :state, :zip, :id ],\n landlord_attributes: [ :first_name, :middle_name, :last_name,\n :cell_phone, :home_phone, :work_phone, :email, :id ] )\n end", "def vacate_at_attorney_review(mtv_judge, drafting_attorney, lit_support_user)\n # These are ready to be reviewed by the decision drafting attorney on the vacate stream\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"denied\")\n judge_addresses_mtv(jam_task, \"denied\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"dismissed\")\n judge_addresses_mtv(jam_task, \"dismissed\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"straight_vacate\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_readjudication\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_de_novo\", drafting_attorney)\n end\n end", "def submit_dna(sequence)\n\n\n #clustalw2 specific params\n params = Hash.new\n\t params['email'] = 'dunarel@gmail.com'\n params['title'] = 'test_web_service'\n params['sequence'] = sequence\n \n \n #call base class\n return run_params(params)\n\n end", "def aide_params\n params.require(:aide).permit(:result_no, :generate_no, :e_no, :aide_no, :name, :enemy_id, :cost_sp, :bonds, :mhp, :msp, :mep, :range, :fuka_texts, :skill_texts)\n end", "def pain_assessment_params\n params.require(:pain_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end", "def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end", "def post_bva_dta_decision_status_details\n issue_list = remanded_sc_decision_issues\n {\n issues: api_issues_for_status_details_issues(issue_list),\n bva_decision_date: decision_event_date,\n aoj_decision_date: remand_decision_event_date\n }\n end", "def written_exam_params\n params[:written_exam].permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end", "def purchase_sub_existing_edu #much copied from static#students , but much not needed #in case use customer registers but then comes back later to finish purchasing\n @event = Event.find(ENV['demopage'].to_i)\n @commencement_plan = Plan.find_by_my_plan_id(plan_set_commencement) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @students_plan = Plan.find_by_my_plan_id(plan_set_students)\n @all_inclusive_plan = Plan.find_by_my_plan_id(plan_set_all_inclusive)\n @practiceobject = Practiceobject.new \n @practiceobject.event_id = @event.id #for the form_for(@practiceobject) which creatse a new practice object (and another form which just shows the labels - can find a better way for that)\n @registeredandrecordedpos = @event.practiceobjects.registered.recorded.visible\n @registeredandunrecordedpos = @event.practiceobjects.registered.unrecorded.visible\n @unregisteredpos = @event.practiceobjects.unregistered.visible\n @hiddenpos = @event.practiceobjects.hidden\n @hiddenandregisteredpos = @hiddenpos.registered\n @hiddenandunregisteredpos = @hiddenpos.unregistered \n\n @url = demo_record_directory_url(:event_code => @event.event_code)\nend", "def disapprove!(options = {})\n persist = options.fetch(:persist, true)\n transaction do\n self.approved = false\n self.approved_at = Time.now\n save! if persist\n AfterDisapprovalJob.enqueue(self.id)\n end\n end" ]
[ "0.642808", "0.6422609", "0.6417069", "0.622683", "0.616887", "0.58527195", "0.5661865", "0.5584199", "0.5550912", "0.5503086", "0.5468699", "0.54520464", "0.54520464", "0.54188913", "0.53517777", "0.53443056", "0.5330164", "0.53278446", "0.52907276", "0.5263941", "0.5239826", "0.52208513", "0.52192044", "0.5213246", "0.52032566", "0.5182801", "0.516769", "0.51588035", "0.5147709", "0.5100611", "0.5089341", "0.5068725", "0.5060327", "0.50578266", "0.50530076", "0.5052071", "0.5040124", "0.50398165", "0.50039196", "0.49932972", "0.49920678", "0.49906507", "0.4989456", "0.49887162", "0.49886453", "0.49856356", "0.49847963", "0.4984167", "0.49787286", "0.49787286", "0.4976061", "0.49557665", "0.494999", "0.49337247", "0.49259007", "0.49226677", "0.49220052", "0.49136722", "0.49119323", "0.49098378", "0.49084944", "0.4891382", "0.48890465", "0.48879847", "0.48863345", "0.48758942", "0.48662814", "0.48535898", "0.48426667", "0.48423433", "0.48420164", "0.48387086", "0.4838516", "0.48301932", "0.4827641", "0.48236454", "0.4823198", "0.4819777", "0.4818606", "0.48160487", "0.48089612", "0.48087665", "0.4808079", "0.4805435", "0.4803915", "0.48010525", "0.48008245", "0.47971523", "0.47963762", "0.4791514", "0.47900045", "0.47802624", "0.4779192", "0.4778311", "0.47727478", "0.47726858", "0.47722638", "0.47645345", "0.4763532", "0.47565585" ]
0.61684906
5
Upload file Upload a file to use as evidence in a dispute. Your file must be in either JPEG/JPG, PNG or PDF format, and be no larger than 4MB.
def upload_file(file, purpose, opts = {}) data, _status_code, _headers = upload_file_with_http_info(file, purpose, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file\n #TODO\n end", "def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath: #{file_path}\"\n upload_io(io, size, filename).tap do\n io.close\n end\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def upload_file( wikipath, filename )\n p filename\n raw = File.read( filename )\n return if uploaded?( filename, raw )\n\n case filename\n when /[.]#{EXTENSION}$/\n upload_wiki_file( wikipath, filename )\n else\n upload_media_file( wikipath, filename, raw )\n end\n end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def upload_file\n if !params['upload_file'].nil?\n file = params['upload_file']\n file_upload(file)\n else\n p \"filename is empty!!!\"\n end\n end", "def file\n file = params[\"file\"]\n overwrite = (params[\"overwrite\"] == \"yes\")\n\n error_msg = upload_file(file, overwrite)\n if error_msg != nil\n flash[:alert] = error_msg\n redirect_to upload_form_url()\n return\n end\n\n Rails.logger.info(\"Finding aid uploaded: #{file.original_filename}\")\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"file\", ex, current_user)\n end", "def upload_file!(file, description)\n execute!(\n api_method: drive.files.insert,\n body_object: file_description(file, description),\n media: Google::APIClient::UploadIO.new(file, file.content_type),\n parameters: { uploadType: 'multipart', alt: 'json'})\n end", "def upload(file, someone)\n end", "def upload(file_path, file_type = 'text/plain', encrypted = 0)\n response = @client.post('file/upload',\n file: Hurley::UploadIO.new(file_path, file_type),\n no_enc: encrypted)\n verify response,\n internal_server_error: 'File failed to upload'\n end", "def upload\n uploaded_file = params[:file]\n if uploaded_file.size > RubyChallenge::Application.config.file_max_size\n render :status => :request_header_fields_too_large, :text => 'File size exceeded, max 10MB'\n else\n text_file = TextFile.new(\n :name => SecureRandom.uuid(),\n :original_name => uploaded_file.original_filename\n )\n\n saved_file = save_uploaded_file(uploaded_file, text_file.getPath)\n word_counter = WordsCounterService.new(saved_file)\n word_counter.add_restricted_string(RESTRICTED_STR_BLUE)\n word_counter.parse\n\n text_file.total_words = word_counter.total\n text_file.distinct_words = word_counter.distinct\n text_file.words = word_counter.words.to_json\n text_file.save\n\n render json: create_response(text_file)\n end\n end", "def upload_document(file, disability_claim_document)\n uploader = DisabilityClaimDocumentUploader.new(@user.uuid, disability_claim_document.tracked_item_id)\n uploader.store!(file)\n # the uploader sanitizes the filename before storing, so set our doc to match\n disability_claim_document.file_name = uploader.filename\n DisabilityClaim::DocumentUpload.perform_async(auth_headers, @user.uuid, disability_claim_document.to_h)\n end", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end", "def upload\r\n \r\n end", "def upload\n self._create params[:upfile], params[:pictitle]\n end", "def upload_file(filename, file_path=\"\")\n frm.file_field(:id=>\"upload\").set(file_path + filename)\n if frm.div(:class=>\"alertMessage\").exist?\n sleep 2\n upload_file(filename)\n end\n end", "def upload_process\n # アップロードファイルを取得\n file = params[:upfile]\n\n # ファイルのベース名(パスを除いた部分)を取得\n name = file.original_filename\n\n # 許可する拡張子を定義\n permits = ['.jpg', '.jpeg', '.gif', '.png']\n\n # 配列 permits にアップロードファイルの拡張子に合致するものがあるか\n if ! permits.include?(File.extname(name).downcase)\n render :text => \"アップロードできるのは画像ファイルのみ( \" + permits.join(', ') + \" )です。\"\n elsif file.size > 1.megabyte\n render :text => 'ファイルサイズは1MBまでです。'\n else\n # utf8 to sjis\n name = name.kconv(Kconv::SJIS, Kconv::UTF8)\n\n # /public/doc フォルダ配下にアップロードファイルを保存\n File.open(\"public/docs/#{name}\", 'wb') { |f| f.write(file.read) }\n render :text => \"#{name.toutf8}をアップロードしました。\"\n end\n end", "def upload_wiki_file( wikipath, filename )\n raw = File.read( filename ).gsub( \"\\n\", \"\\r\\n\" )\n basename = filename.sub( /[.]#{EXTENSION}$/, '' )\n finalpath = \"#{wikipath}:#{basename}\"\n page = get( edit_url( finalpath ) )\n f = page.form_with( id: 'dw__editform' )\n f.field_with( name: 'wikitext' ).value = raw\n f.field_with( name: 'summary' ).value = 'automated by qscript'\n button = f.button_with( name: 'do[save]' )\n pp @agent.submit( f, button )\n save_uploaded( filename )\n end", "def upload\n end", "def upload\n end", "def img_upload(file)\n\t \t# puts \"++++ #{file.inspect} ++++\"\n\t \tpath=File.dirname(__FILE__) + '/public/uploads/' + file[:filename]\n\t \t# puts \"///////\"\n\t \t# puts path\n\t \tFile.open(path, \"w\") do |upload|\n\t \t\tupload.write(file[:tempfile].read)\n\t end\n\t return file[:filename]\n\t end", "def create\n if params['file'] == nil\n return redirect_to :action => :new\n end\n\n temp_file_path = params['file'].tempfile.path\n inferred_type = infer_type(temp_file_path)\n random_name = SecureRandom.uuid\n\n upload_file(random_name, temp_file_path)\n\n @upload = Upload.new(upload_params)\n @upload['uploadDate'] = Time.now\n @upload['file_extension'] = inferred_type\n @upload['s3_name'] = random_name\n @upload['full_text'] = extract_text(temp_file_path, inferred_type)\n\n if @upload.save\n redirect_to :action => :index, notice: 'Upload was successfully created.'\n else\n render :new\n end\n end", "def upload_file(path, format, file)\n delete path\n append_from_file(path, format, file)\n end", "def upload(file)\n file = File.expand_path(file)\n\n abort \"#{file} does not exist!\" unless File.exist?(file)\n\n dest = dropbox_resolve_file(File.join(destination_directory, File.basename(file)))\n\n if remote_file = dropbox_upload_file(file, dest)\n url(remote_file, method: :create, retries: 0)\n else\n abort \"Couldn't upload file #{file}\"\n end\n rescue APIError => e\n abort e.message\n end", "def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end", "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end", "def file_answer(file_name)\n frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n frm.button(:value=>\"Upload\").click\n end", "def upload_file(dir_name, file, filename = File.basename(file.to_path))\n file = nil\n\n # Upload\n dir = @connection.directories.get(dir_name)\n if dir then\n file = dir.files.create(:key => filename, :body => file) \n else\n @logger.info \"\\nWarning: #{dir_name} does not exist.\\n\"\n end \n file\n end", "def upload(file)\n Item.create(:upload, :file => file)\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def upload_file\n full_path = file_path.join(file_name)\n File.open(full_path, 'wb') do |file|\n file.write(@file.read)\n end\n\n full_path.sub(Rails.root.to_s, '')\n end", "def upload\n uploaded_io = params[:file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.original_filename) \n end\n end", "def upload(file_path, options = {})\n Upload.new(file_path, self, options).upload!\n end", "def save_file\n\t\tif file\n\t\t\tdocuments.create({\n\t\t\t\t:uploaded_file => file,\n\t\t\t\t:user_id => user_id\n\t\t\t})\n\t\tend\n\t\t#`cp \"#{file.path}\" \"#{path}\"` if file\n\tend", "def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end", "def upload_file(file_upload, owner)\n image = MiniMagick::Image.open(file_upload.tempfile.path)\n image.resize \"500x500>\"\n image.format \"jpeg\"\n\n tempfile = Tempfile.new \"item_picture\"\n image.write(tempfile)\n\n owner = \"#{current_user.id}/#{owner}\"\n\n upload = Upload.find_by(owner: owner) || Upload.new(owner: owner)\n\n upload.mime_type = \"image/jpeg\"\n upload.extension = \".jpeg\"\n upload.body = tempfile.read\n\n if upload.save\n StoreUploadToCloudJob.perform_later upload\n\n upload\n end\n end", "def file_upload\n tmp = params[:configfile]\n file = File.join(\"public\", \"uploads\", params[:configfile].original_filename)\n FileUtils.cp tmp.path, file\n puts \"File uploaded to: public/uploads\"\n # Put up file load success alert?\n redirect_to(\"/dashboard/manage\", :notice => \"File #{params[:configfile].original_filename} uploaded\")\n end", "def save_file\n File.open(full_file_path, 'wb') { |file| file.write @file.read } unless @file.nil?\n rescue\n uploading_error\n end", "def upload(path, options={})\n if options[:description]\n options['text'] = options[:description]\n options.delete(:description)\n end\n\n if options[:target]\n options['filename'] = options[:target]\n options.delete(:target)\n end\n\n if options[:summary]\n options['text'] ||= options[:summary]\n options['comment'] = options[:summary]\n options.delete(:summary)\n end\n\n options['comment'] ||= \"Uploaded by MediaWiki::Gateway\"\n options['file'] = File.new(path) if path\n full_name = path || options['url']\n options['filename'] ||= File.basename(full_name) if full_name\n\n raise ArgumentError.new(\n \"One of the 'file', 'url' or 'sessionkey' options must be specified!\"\n ) unless options['file'] || options['url'] || options['sessionkey']\n\n form_data = options.merge(\n 'action' => 'upload',\n 'token' => get_token('edit', options['filename'])\n )\n\n make_api_request(form_data)\n end", "def perform\n check_file # checks if the file uploaded is valid\n save_file_entry # Uploads the file to the server and saves a entry to database\n end", "def upload_file\n upload_thumb if Rails.configuration.thumbnails_enabled\n file_s3_obj.write(@file.tempfile.open, content_type: @file.content_type)\n end", "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end", "def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend", "def post_file(path, file_path, options = {})\n request = Net::HTTP::Post.new(request_uri(path))\n options[:partial_scan] ||= CopyleaksApi::Config.allow_partial_scan\n boundary = \"copyleaks_sdk_#{SecureRandom.hex(4)}\"\n request.body = file_body(file_path, boundary)\n make_request(request, options.merge(boundary: boundary))\n end", "def upload_file(filename,mime)\n file = ActionDispatch::Http::UploadedFile.new(filename: 'test.pdf', type: 'application/pdf', tempfile: File.new(\"#{Rails.root}/spec/fixtures/test.pdf\"))\n file\n end", "def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end", "def save_file(file, name = '')\n if name.size > 0\n filename = name + File.extname(file[:filename])\n else\n filename = file[:filename]\n end\n filename = filename.wiki_filename # convert to wiki friendly name\n ext = File.extname(filename)\n filename = File.basename(filename, ext).gsub('.','-')+ext.downcase #remove periods from basename, messes up route matching\n\n new_file = verify_file_under_repo(File.join(@attach_dir, filename))\n\n FileUtils.mkdir_p(@attach_dir) if !File.exists?(@attach_dir)\n f = File.new(new_file, 'w')\n f.write(file[:tempfile].read)\n f.close\n\n commit_message = \"uploaded #{filename} for #{@basename}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n nil\n end\n end", "def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end", "def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def upload_simple\r\n \r\n end", "def upload(filename, folderid=nil, unzip=true, overwrite=false, details=nil) #filename must include the extension\n end", "def perform\n upload_file\n end", "def upload\n doc = DocumentService::Document.create!({\n original_filename: params[\"original_filename\"],\n content_type: params[\"file\"].content_type,\n document: params['file'].tempfile,\n public: true\n })\n render json: {id: doc.id}, status: :created\n end", "def create_file file, path = nil, options = {}\n ensure_connection!\n # TODO: Raise if file doesn't exist\n # ensure_file_exists!\n fail unless ::File.file? file\n\n options[:acl] = File::Acl.predefined_rule_for options[:acl]\n\n if resumable_upload? file\n upload_resumable file, path, options[:chunk_size], options\n else\n upload_multipart file, path, options\n end\n end", "def upload_file(file_dir, orig_filename, aip_filename, type)\n @log.info 'Uploading file ' + orig_filename\n @log.info \"Renaming #{type} #{aip_filename} -> #{orig_filename}\"\n\n File.rename(file_dir + '/' + aip_filename,\n file_dir + '/' + orig_filename)\n file = File.open(file_dir + '/' + orig_filename)\n\n uploaded_file = Hyrax::UploadedFile.create(file: file)\n uploaded_file.save\n\n file.close\n\n uploaded_file\nend", "def test_upload_file\n remote_file_name = 'TestUploadFile.docx'\n\n request_file_content = File.open(File.join(local_test_folder, local_file))\n request = UploadFileRequest.new(file_content: request_file_content, path: remote_data_folder + '/' + remote_file_name)\n\n result = @words_api.upload_file(request)\n assert_equal false, result.nil?\n end", "def upload(file, identifier, copy = true)\n return \"/images/no_image.gif\" if file.nil?\n\n filename = \"#{identifier.to_s}_#{file[:filename]}\"\n full_path = File.join(self.root, self.path)\n\n if copy\n FileUtils.mkdir_p(full_path)\n FileUtils::cp(file[:tempfile].path, File.join(full_path, filename))\n end\n\n File.join(self.path, filename)\n end", "def upload(file_path, options = {})\n\n # If not logged in, raise this exception\n raise 'Login first!' unless @customer_login_id\n\n # Extract options from the options hash\n multiple_speakers = options[:multiple_speakers] || true\n description = options[:description]\n file_name = File.basename(file_path)\n file_format = File.extname(file_path)\n file_size = File.stat(file_path).size\n # Use the duration if provided in the options hash\n duration = options[:duration] || ::FFMPEG::Movie.new(file_path).duration\n\n # Use the last upload url, or grab a new one\n @upload_url ||= get_upload_url\n\n # Create a connection to the upload url\n connection = Excon.new(@upload_url)\n # Upload to \n connection.put(headers: { \"x-ms-blob-type\" => \"BlockBlob\", \n \"x-ms-date\" => Time.now.to_s, \n \"Content-Length\" => file_size}, body: File.read(file_path))\n\n # Post to the \n response = @savon.call :commit_upload, message: { \"wsdl:sessionID\" => @session_id, \n \"wsdl:url\" => @upload_url, \n \"wsdl:name\" => file_name, \n \"wsdl:description\" => description, \n \"wsdl:duration\" => duration, \n \"wsdl:source\" => \"Ruby API Client\",\n \"wsdl:format\" => file_format, \n \"wsdl:isMultipleSpeakers\" => multiple_speakers }\n \n # Set the upload url to nil so that we don't reuse it \n @upload_url = nil\n\n response\n end", "def create\n AttackFile.write(attack_files_params[:filename], attack_files_params[:body])\n\n render status: 201\n end", "def create\n @upload_file = UploadFile.new(params[:upload_file])\n\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to(@upload_file, :notice => 'Upload file was successfully created.') }\n format.xml { render :xml => @upload_file, :status => :created, :location => @upload_file }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @upload_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def file= file\n unless file.size == 0\n picture = Attachment.new :content => file.read\n picture.save\n write_attribute 'picture_id', picture.id\n end\n end", "def create\n @upload_file = UploadFile.new(params[:upload_file])\n if @upload_file.save\n redirect_to upload_files_path(:doc_no=>@upload_file.doc_no)\n else\n render :action => \"new\"\n end\n end", "def save_file(file, name = '')\n if name.size > 0\n filename = name + File.extname(file[:filename])\n else\n filename = file[:filename]\n end\n FileUtils.mkdir_p(attach_dir) unless File.exists?(attach_dir)\n new_file = File.join(attach_dir, filename)\n\n f = File.new(new_file, 'w')\n f.write(file[:tempfile].read)\n f.close\n\n commit_message = \"uploaded #{filename} for #{@name}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n # FIXME why!??\n nil\n end\n end", "def upload(major)\n unless File.exist?(major)\n puts \"File #{major} not found.\"\n return\n end\n major = File.absolute_path(major)\n response, success = ImgurAPI.upload(major)\n puts response unless success\n if success\n response = \"![#{options[:title].nil? ? 'Screenshot' : options[:title]}](#{response})\" if options[:markdown]\n response = build_HTML_response(response) if options[:html]\n puts \"Copied #{Platform.copy(response)} to clipboard\"\n end\n storage.save\n end", "def execute(file)\n check_args!(file)\n\n resolve_uploader.upload(file)\n end", "def upload_file(filename, file)\n\tpath = \"#{AVATAR_DIR}/#{filename}\"\n\treturn false if File.exists? path\n\tFile.open(path, \"wb\") { |f| f.write(file.read) }\n\ttrue\nend", "def upload_file(file_path, itunes_location)\n # url = URI.parse(self.upload_url_for_location(itunes_location))\n # req = Net::HTTP::Post::Multipart.new(url.path, {\"file\" => UploadIO.new(file_path, \"image/jpeg\")})\n # res = Net::HTTP.start(url.host, url.port) do |http|\n # http.request(req)\n # end\n \n IO::popen('-') do |c|\n exec \"curl -q -F 'file=@#{file.path}' '#{upload_url_for_location(itunes_location)}'\"\n end\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def upload_file(file, file_name, folder = '/cgi-bin/uploads')\n upload_url = 'https://mp.weixin.qq.com/cgi-bin/filetransfer'\\\n '?action=upload_material&f=json&writetype=doublewrite'\\\n \"&groupid=1&ticket_id=#{@ticket_id}\"\\\n \"&ticket=#{@ticket}&token=#{@token}&lang=zh_CN\"\n response = RestClient.post upload_url, file: file,\n Filename: file_name,\n folder: folder\n JSON.parse response.to_s\n end", "def upload\n upload_file = ApplicationUpload.new(params[:file])\n upload_msgs = upload_file.import(Garbage)\n\n flash[:notice] = t(:success_imported, :msg => upload_msgs) unless upload_msgs.blank?\n redirect_to(garbages_url)\n end", "def uploaded_file_params\n params.require(:uploaded_file).permit(:file)\n end", "def upload(type, path)\n File.open(path, 'r') do |file|\n make_request(\n :post, '/upload',\n headers: {\n 'Content-Type' => type, 'Content-Length' => file.size.to_s,\n 'Transfer-Encoding' => 'chunked'\n },\n content: file, base: @media_uri\n )['content_uri']\n end\n end", "def post_file(file_path, deposit_url, headers={})\n\n # Make sure file exists\n raise SwordException, \"Could not find file at \" + file_path if(!File.exists?(file_path))\n\n # Make sure we have a deposit URL\n raise SwordException.new, \"File '#{file_path}' could not be posted via SWORD as no deposit URL was specified!\" if !deposit_url or deposit_url.empty?\n\n # Map our passed in headers to valid HTTP POST headers\n post_headers = http_post_headers(headers)\n puts \"*\"*60\n puts \"Object headers in Connection#post_file are \", post_headers.inspect\n puts \"*\"*60\n\n # POST our file to deposit_url\n post(file_path, deposit_url, post_headers)\n end", "def upload_params\nparams[:upload].permit(:uploaded_file)\nend", "def upload(file, schema, mode = 'FULL')\n schema.upload file, self, mode\n end", "def upload(obj, file_path)\n begin\n res = scribd_user.upload(:file => escape(file_path), :access => access_level)\n obj.update_attributes({:ipaper_id => res.doc_id, :ipaper_access_key => res.access_key})\n rescue\n raise ScribdFuUploadError, \"Sorry, but #{obj.class} ##{obj.id} could not be uploaded to Scribd. \"\n end\n end", "def upload_an_odm(file_path)\n if File.exist?(\"#{file_path}\")\n self.odm_file_input.attach_file(file_path) # theoretically it should work but have not tested out yet.\n else\n raise 'File not found or file does not exist'\n end\n end", "def upload_file_params\n params.require(:upload_file).permit(:title, :date_uploaded, :attachment, :vendor_id, :task_allocation_id)\n end", "def upload(filename)\n begin\n file = File.open(\"#{filename}\")\n response = @client.put_file(\"/#{filename}\",file,true)\n return true\n rescue\n return false\n end\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def upload_params\n params.require(:upload).permit(:election_id, :file_type_id, :public, :file) # Not status, address or checksum.\n end", "def create\n parameters = params[:file_submission]\n assignment = Assignment.find(parameters['assignment_id'])\n definition = AssignmentDefinition.find_by_assignment_id(assignment.id)\n file = parameters['file']\n \n user_id = current_user.id\n unless (not parameters['user_id']) or parameters['user_id'] == ''\n user_id = parameters['user_id']\n end\n \n file.original_filename.gsub!(/[^a-z0-9A-Z.]/, '')\n\n user = User.find(user_id)\n \n logger = Logger.new(\"log/uploads.log\")\n\n logger.info \"#{assignment.course.id}\"\n logger.info \"USER ID: #{user_id} CURRENT USER #{current_user.id}\"\n\t if assignment.course.is_user_student(user_id)\n\t user_id = current_user.id if assignment.course.is_user_student(current_user.id)\n logger.info \"#{Time.now}:: #{current_user.friendly_full_name} (ID# #{current_user.id}) has submitted something for user with ID# #{user_id}.\"\n\t\t oldSubmission = FileSubmission.where(:assignment_id => assignment.id,\n\t\t\t\t\t :course_id => assignment.course_id, :user_id => user_id)[0]\n\t\t unless oldSubmission.nil?\n\t\t\t File.delete(oldSubmission.full_save_path)\n\t\t\t oldSubmission.destroy\n\t\t\t logger.info \"#{Time.now}::\\t #{current_user.friendly_full_name} has just overwritten the old submission.\"\n\t\t end\n\t end\n\n @submission = FileSubmission.new(:course_id => assignment.course_id, :assignment_id => assignment.id, :assignment_definition_id => definition.id, :user_id => user_id, :file => file, :name => file.original_filename, :uploaded_by => current_user.id)\n @submission.save\n\n logger.info \"#{Time.now}:: #{current_user.friendly_full_name} stored submission successfully at #{@submission.full_save_path}.\"\n\n course = Course.find(assignment.course_id)\n\n @assignmentFile = user_id == course.user_id\n @studentFile = !StudentInCourse.find_all_by_user_id_and_course_id(user_id, course.id).empty?\n \n\t\t@assignment = assignment\n\t\t\n render '/assignment/create.js' \n end", "def save_attachment(file, name = '')\n unless name.blank?\n basename = name.scorify\n else\n basename = File.basename(file[:filename]).scorify\n end\n \n ext = File.extname(file[:filename])\n \n # calculate file path\n new_file = File.join(attachment_dir, basename + ext)\n\n # create directory\n FileUtils.mkdir_p(attachment_dir) unless File.exists?(attachment_dir)\n \n # write file\n File.open(new_file, 'w') { |f| file[:tempfile]; f.write(file[:tempfile].read) }\n\n # commit changes\n commit_message = \"uploaded #{filename} for #{@basename.wikify}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n nil\n end\n end", "def execute(msg, url, filename)\n begin\n upload = wiki.upload(url, filename)\n rescue MediaWiki::Butt::UploadInvalidFileExtError => e\n msg.reply('Invalid file extension. Failed to upload!')\n rescue MediaWiki::Butt::EditError => e\n msg.reply(\"General error: #{e.message}\")\n end\n\n if upload\n msg.reply('Uploaded the file to the wiki!'.freeze)\n else\n msg.reply('Failed to upload!')\n end\n end", "def upload\n file = params[:file].original_filename\n activity = file.sub(/\\..*$/,'')\n path = RAILS_ROOT + \"/public/data/\" + activity\n Dir.mkdir path\n datapath = path + \"/data/\"\n Dir.mkdir datapath\n basename = datapath + activity\n smi = File.open(\"#{basename}.smi\",\"w\")\n cl = File.open(\"#{basename}.class\",\"w\")\n params[:file].read.each do |line|\n items = line.split(/\\s+/)\n smi.puts \"#{items[0]}\\t#{items[1]}\"\n cl.puts \"#{items[0]}\\t#{activity}\\t#{items[2]}\"\n end\n if LazarCategory.find_by_name(\"Uploads\").blank?\n cat = LazarCategory.create(:name => \"Uploads\")\n else\n cat = LazarCategory.find_by_name(\"Uploads\")\n end\n LazarModule.create(:endpoint => activity, :directory => path, :lazar_category => cat)\n redirect_to :action => :search\n end", "def add_file(file)\n logger.info(\" ########### add file\")\n if (file.nil?)\n logger.error(\"file is nil\")\n self.original_filename = nil\n self.has_attached_file = false\n return false\n elsif (!check_file?(file))\n logger.error(\"error uploading file\")\n self.original_filename = nil\n self.has_attached_file = false\n\n return false\n else\n self.add_file_datastream(file, :label => file.original_filename, :mimeType => file.content_type, :dsid => 'content', :controlGroup => 'M')\n self.original_filename = file.original_filename\n self.mime_type = file.content_type\n self.has_attached_file = true\n end\n return true\n end", "def upload_file(filename, path, uploaded_io)\n\tstatus = \"File not uploaded properly\"\t\n\tif !File.exists?(path + \"//\" + filename) && File.directory?(path)\n File.open(path + \"//\" + filename, 'w') do |file|\n input = uploaded_io.read\n input.force_encoding('UTF-8')\n file.write(input)\n end\n Upload.create(:file_name => uploaded_io.original_filename, :status => 'Not Processed', :upload_date => Time.now)\n upload_record = Upload.find_by_file_name(uploaded_io.original_filename)\n upload_record.uploaded_by = current_user.email\n upload_record.save\n\t status = \"File has been uploaded successfully, check the uploaded files to see its processing status.\"\n\telsif File.exists?(path + \"//\" + filename)\n\tstatus = \"Duplicate file found in uploads, file not uploaded\" \n\tend\n\tstatus\n end", "def uploadicon=(file)\n unless( file.blank? )\n logger.info(\"original_filename: \" + file.original_filename )\n self.content_type = file.content_type.chomp\n logger.info(\"content_type: \" + self.content_type )\n filename = base_part_of( file.original_filename ) \n \n if(file.length < 300000 )\n @uploadfile = file \n self.was_upload_successful = true\n else\n self.was_upload_successful = false\n end\n \n end\n end", "def store!(file)\n cloud_files_options = {'Content-Type' => file.content_type}\n f = CarrierWave::Storage::UpYun::File.new(uploader, self, uploader.store_path)\n f.store(file.read,cloud_files_options)\n f\n end", "def create\n # アップロードされたファイルのパラメータの中にupload_fileというパラメータを作ってしまった。\n # _form.html.erbの中でf.file_field :upload_fileとやっているのがそれ。\n upload_file = upload_file_params[:upload_file][:upload_file]\n content = {}\n puts upload_file\n puts \"hoge #{upload_file.original_filename}\"\n \n if upload_file != nil\n content[:file] = upload_file.read\n content[:filename] = upload_file.original_filename\n end\n\n @upload_file = UploadFile.new(content)\n puts @upload_file\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to @upload_file, notice: 'Upload file was successfully created.' }\n format.json { render :show, status: :created, location: @upload_file }\n else\n format.html { render :new }\n format.json { render json: @upload_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_gpx\n upload_file(params[:gpx_file]) if params[:gpx_file]\n end", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def upload_file\n filename = request.headers['X-Filename']\n if filename.blank?\n render plain: \"X-Filename header not provided\",\n status: :bad_request and return\n end\n input = request.env['rack.input']\n input.rewind\n input.set_encoding(Encoding::UTF_8)\n @import.save_file(file: input, filename: filename)\n head :no_content\n end", "def upload(filepath)\n\t\t\tif !filepath.is_a? String\n\t\t\t\traise SDKInvalidArgException, '`filepath` must be of type string'\n\t\t\tend\n\n\t\t\treq = APIRequest.new(\n\t\t\t\t@origin,\n\t\t\t\t'/v1/bugs/' + @bugID.to_s() + '/attachments',\n\t\t\t\t'POST',\n\t\t\t\t{\n\t\t\t\t\t'form_data' => true,\n\t\t\t\t\t'file_path' => filepath\n\t\t\t\t}\n\t\t\t)\n\n\t\t\tBugAttachment.new(@origin, req.exec)\n\t\tend", "def simple_file_upload simple_file_upload_file\n absolut_path_file = Dir.pwd.gsub(/\\.tests/, 'tests/files') + '/' + simple_file_upload_file\n\n self.simple_file = absolut_path_file\n end", "def file_upload(path)\n content_type = MIME::Types.type_for(path).first.to_s\n Rack::Test::UploadedFile.new(path, content_type)\n end", "def create\n @upload_file = UploadFile.new(upload_file_params)\n\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to upload_files_path, notice: 'Upload file was successfully created.' }\n format.json { render :show, status: :created, location: @upload_file }\n else\n format.html { render :new }\n format.json { render json: @upload_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def print_upload(id, file_name, file)\r\n dir = \"prints/#{id}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end" ]
[ "0.74860317", "0.7344324", "0.7086532", "0.7070725", "0.69430274", "0.6885737", "0.6860501", "0.68560225", "0.68539363", "0.67689276", "0.67590314", "0.6708648", "0.66976655", "0.6685136", "0.6586008", "0.65588135", "0.6549528", "0.6529776", "0.6525369", "0.6525369", "0.65157264", "0.65029174", "0.64843625", "0.6451071", "0.6437001", "0.6430974", "0.63971764", "0.6385786", "0.6384903", "0.63568246", "0.6352675", "0.6334618", "0.63208646", "0.63087416", "0.6302778", "0.62997293", "0.629788", "0.6294527", "0.62823683", "0.62673444", "0.62635297", "0.6260995", "0.62397563", "0.6235576", "0.6224038", "0.6222851", "0.62149763", "0.6205365", "0.6199786", "0.619265", "0.61739224", "0.6142587", "0.613291", "0.6123741", "0.61168635", "0.6115875", "0.6114865", "0.6113994", "0.611394", "0.61036515", "0.60945296", "0.60941637", "0.60809016", "0.6073866", "0.6067244", "0.60601646", "0.60599697", "0.6059066", "0.60572106", "0.6055262", "0.6052266", "0.60492384", "0.60473615", "0.6043153", "0.6042252", "0.6041003", "0.60388297", "0.6037227", "0.60313284", "0.60246027", "0.6010664", "0.6010664", "0.60096806", "0.6008693", "0.60060596", "0.6002784", "0.5997141", "0.59949505", "0.5993549", "0.5993305", "0.5989618", "0.5986114", "0.5983783", "0.59832937", "0.5980723", "0.5977157", "0.5974912", "0.5973639", "0.59612066", "0.59552" ]
0.6132838
53
Upload file Upload a file to use as evidence in a dispute. Your file must be in either JPEG/JPG, PNG or PDF format, and be no larger than 4MB.
def upload_file_with_http_info(file, purpose, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DisputesApi.upload_file ...' end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling DisputesApi.upload_file" end # verify the required parameter 'purpose' is set if @api_client.config.client_side_validation && purpose.nil? fail ArgumentError, "Missing the required parameter 'purpose' when calling DisputesApi.upload_file" end # resource path local_var_path = '/files' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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(['multipart/form-data']) # form parameters form_params = opts[:form_params] || {} form_params['file'] = file form_params['purpose'] = purpose # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FileUploadResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiSecretKey'] new_options = opts.merge( :operation => :"DisputesApi.upload_file", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DisputesApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file\n #TODO\n end", "def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath: #{file_path}\"\n upload_io(io, size, filename).tap do\n io.close\n end\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def upload_file( wikipath, filename )\n p filename\n raw = File.read( filename )\n return if uploaded?( filename, raw )\n\n case filename\n when /[.]#{EXTENSION}$/\n upload_wiki_file( wikipath, filename )\n else\n upload_media_file( wikipath, filename, raw )\n end\n end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def upload_file\n if !params['upload_file'].nil?\n file = params['upload_file']\n file_upload(file)\n else\n p \"filename is empty!!!\"\n end\n end", "def file\n file = params[\"file\"]\n overwrite = (params[\"overwrite\"] == \"yes\")\n\n error_msg = upload_file(file, overwrite)\n if error_msg != nil\n flash[:alert] = error_msg\n redirect_to upload_form_url()\n return\n end\n\n Rails.logger.info(\"Finding aid uploaded: #{file.original_filename}\")\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"file\", ex, current_user)\n end", "def upload_file!(file, description)\n execute!(\n api_method: drive.files.insert,\n body_object: file_description(file, description),\n media: Google::APIClient::UploadIO.new(file, file.content_type),\n parameters: { uploadType: 'multipart', alt: 'json'})\n end", "def upload(file, someone)\n end", "def upload(file_path, file_type = 'text/plain', encrypted = 0)\n response = @client.post('file/upload',\n file: Hurley::UploadIO.new(file_path, file_type),\n no_enc: encrypted)\n verify response,\n internal_server_error: 'File failed to upload'\n end", "def upload\n uploaded_file = params[:file]\n if uploaded_file.size > RubyChallenge::Application.config.file_max_size\n render :status => :request_header_fields_too_large, :text => 'File size exceeded, max 10MB'\n else\n text_file = TextFile.new(\n :name => SecureRandom.uuid(),\n :original_name => uploaded_file.original_filename\n )\n\n saved_file = save_uploaded_file(uploaded_file, text_file.getPath)\n word_counter = WordsCounterService.new(saved_file)\n word_counter.add_restricted_string(RESTRICTED_STR_BLUE)\n word_counter.parse\n\n text_file.total_words = word_counter.total\n text_file.distinct_words = word_counter.distinct\n text_file.words = word_counter.words.to_json\n text_file.save\n\n render json: create_response(text_file)\n end\n end", "def upload_document(file, disability_claim_document)\n uploader = DisabilityClaimDocumentUploader.new(@user.uuid, disability_claim_document.tracked_item_id)\n uploader.store!(file)\n # the uploader sanitizes the filename before storing, so set our doc to match\n disability_claim_document.file_name = uploader.filename\n DisabilityClaim::DocumentUpload.perform_async(auth_headers, @user.uuid, disability_claim_document.to_h)\n end", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end", "def upload\r\n \r\n end", "def upload\n self._create params[:upfile], params[:pictitle]\n end", "def upload_file(filename, file_path=\"\")\n frm.file_field(:id=>\"upload\").set(file_path + filename)\n if frm.div(:class=>\"alertMessage\").exist?\n sleep 2\n upload_file(filename)\n end\n end", "def upload_process\n # アップロードファイルを取得\n file = params[:upfile]\n\n # ファイルのベース名(パスを除いた部分)を取得\n name = file.original_filename\n\n # 許可する拡張子を定義\n permits = ['.jpg', '.jpeg', '.gif', '.png']\n\n # 配列 permits にアップロードファイルの拡張子に合致するものがあるか\n if ! permits.include?(File.extname(name).downcase)\n render :text => \"アップロードできるのは画像ファイルのみ( \" + permits.join(', ') + \" )です。\"\n elsif file.size > 1.megabyte\n render :text => 'ファイルサイズは1MBまでです。'\n else\n # utf8 to sjis\n name = name.kconv(Kconv::SJIS, Kconv::UTF8)\n\n # /public/doc フォルダ配下にアップロードファイルを保存\n File.open(\"public/docs/#{name}\", 'wb') { |f| f.write(file.read) }\n render :text => \"#{name.toutf8}をアップロードしました。\"\n end\n end", "def upload_wiki_file( wikipath, filename )\n raw = File.read( filename ).gsub( \"\\n\", \"\\r\\n\" )\n basename = filename.sub( /[.]#{EXTENSION}$/, '' )\n finalpath = \"#{wikipath}:#{basename}\"\n page = get( edit_url( finalpath ) )\n f = page.form_with( id: 'dw__editform' )\n f.field_with( name: 'wikitext' ).value = raw\n f.field_with( name: 'summary' ).value = 'automated by qscript'\n button = f.button_with( name: 'do[save]' )\n pp @agent.submit( f, button )\n save_uploaded( filename )\n end", "def upload\n end", "def upload\n end", "def img_upload(file)\n\t \t# puts \"++++ #{file.inspect} ++++\"\n\t \tpath=File.dirname(__FILE__) + '/public/uploads/' + file[:filename]\n\t \t# puts \"///////\"\n\t \t# puts path\n\t \tFile.open(path, \"w\") do |upload|\n\t \t\tupload.write(file[:tempfile].read)\n\t end\n\t return file[:filename]\n\t end", "def create\n if params['file'] == nil\n return redirect_to :action => :new\n end\n\n temp_file_path = params['file'].tempfile.path\n inferred_type = infer_type(temp_file_path)\n random_name = SecureRandom.uuid\n\n upload_file(random_name, temp_file_path)\n\n @upload = Upload.new(upload_params)\n @upload['uploadDate'] = Time.now\n @upload['file_extension'] = inferred_type\n @upload['s3_name'] = random_name\n @upload['full_text'] = extract_text(temp_file_path, inferred_type)\n\n if @upload.save\n redirect_to :action => :index, notice: 'Upload was successfully created.'\n else\n render :new\n end\n end", "def upload_file(path, format, file)\n delete path\n append_from_file(path, format, file)\n end", "def upload(file)\n file = File.expand_path(file)\n\n abort \"#{file} does not exist!\" unless File.exist?(file)\n\n dest = dropbox_resolve_file(File.join(destination_directory, File.basename(file)))\n\n if remote_file = dropbox_upload_file(file, dest)\n url(remote_file, method: :create, retries: 0)\n else\n abort \"Couldn't upload file #{file}\"\n end\n rescue APIError => e\n abort e.message\n end", "def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end", "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end", "def file_answer(file_name)\n frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n frm.button(:value=>\"Upload\").click\n end", "def upload_file(dir_name, file, filename = File.basename(file.to_path))\n file = nil\n\n # Upload\n dir = @connection.directories.get(dir_name)\n if dir then\n file = dir.files.create(:key => filename, :body => file) \n else\n @logger.info \"\\nWarning: #{dir_name} does not exist.\\n\"\n end \n file\n end", "def upload(file)\n Item.create(:upload, :file => file)\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def upload_file\n full_path = file_path.join(file_name)\n File.open(full_path, 'wb') do |file|\n file.write(@file.read)\n end\n\n full_path.sub(Rails.root.to_s, '')\n end", "def upload\n uploaded_io = params[:file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.original_filename) \n end\n end", "def upload(file_path, options = {})\n Upload.new(file_path, self, options).upload!\n end", "def save_file\n\t\tif file\n\t\t\tdocuments.create({\n\t\t\t\t:uploaded_file => file,\n\t\t\t\t:user_id => user_id\n\t\t\t})\n\t\tend\n\t\t#`cp \"#{file.path}\" \"#{path}\"` if file\n\tend", "def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end", "def upload_file(file_upload, owner)\n image = MiniMagick::Image.open(file_upload.tempfile.path)\n image.resize \"500x500>\"\n image.format \"jpeg\"\n\n tempfile = Tempfile.new \"item_picture\"\n image.write(tempfile)\n\n owner = \"#{current_user.id}/#{owner}\"\n\n upload = Upload.find_by(owner: owner) || Upload.new(owner: owner)\n\n upload.mime_type = \"image/jpeg\"\n upload.extension = \".jpeg\"\n upload.body = tempfile.read\n\n if upload.save\n StoreUploadToCloudJob.perform_later upload\n\n upload\n end\n end", "def file_upload\n tmp = params[:configfile]\n file = File.join(\"public\", \"uploads\", params[:configfile].original_filename)\n FileUtils.cp tmp.path, file\n puts \"File uploaded to: public/uploads\"\n # Put up file load success alert?\n redirect_to(\"/dashboard/manage\", :notice => \"File #{params[:configfile].original_filename} uploaded\")\n end", "def save_file\n File.open(full_file_path, 'wb') { |file| file.write @file.read } unless @file.nil?\n rescue\n uploading_error\n end", "def upload(path, options={})\n if options[:description]\n options['text'] = options[:description]\n options.delete(:description)\n end\n\n if options[:target]\n options['filename'] = options[:target]\n options.delete(:target)\n end\n\n if options[:summary]\n options['text'] ||= options[:summary]\n options['comment'] = options[:summary]\n options.delete(:summary)\n end\n\n options['comment'] ||= \"Uploaded by MediaWiki::Gateway\"\n options['file'] = File.new(path) if path\n full_name = path || options['url']\n options['filename'] ||= File.basename(full_name) if full_name\n\n raise ArgumentError.new(\n \"One of the 'file', 'url' or 'sessionkey' options must be specified!\"\n ) unless options['file'] || options['url'] || options['sessionkey']\n\n form_data = options.merge(\n 'action' => 'upload',\n 'token' => get_token('edit', options['filename'])\n )\n\n make_api_request(form_data)\n end", "def perform\n check_file # checks if the file uploaded is valid\n save_file_entry # Uploads the file to the server and saves a entry to database\n end", "def upload_file\n upload_thumb if Rails.configuration.thumbnails_enabled\n file_s3_obj.write(@file.tempfile.open, content_type: @file.content_type)\n end", "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end", "def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend", "def post_file(path, file_path, options = {})\n request = Net::HTTP::Post.new(request_uri(path))\n options[:partial_scan] ||= CopyleaksApi::Config.allow_partial_scan\n boundary = \"copyleaks_sdk_#{SecureRandom.hex(4)}\"\n request.body = file_body(file_path, boundary)\n make_request(request, options.merge(boundary: boundary))\n end", "def upload_file(filename,mime)\n file = ActionDispatch::Http::UploadedFile.new(filename: 'test.pdf', type: 'application/pdf', tempfile: File.new(\"#{Rails.root}/spec/fixtures/test.pdf\"))\n file\n end", "def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end", "def save_file(file, name = '')\n if name.size > 0\n filename = name + File.extname(file[:filename])\n else\n filename = file[:filename]\n end\n filename = filename.wiki_filename # convert to wiki friendly name\n ext = File.extname(filename)\n filename = File.basename(filename, ext).gsub('.','-')+ext.downcase #remove periods from basename, messes up route matching\n\n new_file = verify_file_under_repo(File.join(@attach_dir, filename))\n\n FileUtils.mkdir_p(@attach_dir) if !File.exists?(@attach_dir)\n f = File.new(new_file, 'w')\n f.write(file[:tempfile].read)\n f.close\n\n commit_message = \"uploaded #{filename} for #{@basename}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n nil\n end\n end", "def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end", "def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def upload_simple\r\n \r\n end", "def upload(filename, folderid=nil, unzip=true, overwrite=false, details=nil) #filename must include the extension\n end", "def upload_file(file, purpose, opts = {})\n data, _status_code, _headers = upload_file_with_http_info(file, purpose, opts)\n data\n end", "def perform\n upload_file\n end", "def upload\n doc = DocumentService::Document.create!({\n original_filename: params[\"original_filename\"],\n content_type: params[\"file\"].content_type,\n document: params['file'].tempfile,\n public: true\n })\n render json: {id: doc.id}, status: :created\n end", "def create_file file, path = nil, options = {}\n ensure_connection!\n # TODO: Raise if file doesn't exist\n # ensure_file_exists!\n fail unless ::File.file? file\n\n options[:acl] = File::Acl.predefined_rule_for options[:acl]\n\n if resumable_upload? file\n upload_resumable file, path, options[:chunk_size], options\n else\n upload_multipart file, path, options\n end\n end", "def test_upload_file\n remote_file_name = 'TestUploadFile.docx'\n\n request_file_content = File.open(File.join(local_test_folder, local_file))\n request = UploadFileRequest.new(file_content: request_file_content, path: remote_data_folder + '/' + remote_file_name)\n\n result = @words_api.upload_file(request)\n assert_equal false, result.nil?\n end", "def upload_file(file_dir, orig_filename, aip_filename, type)\n @log.info 'Uploading file ' + orig_filename\n @log.info \"Renaming #{type} #{aip_filename} -> #{orig_filename}\"\n\n File.rename(file_dir + '/' + aip_filename,\n file_dir + '/' + orig_filename)\n file = File.open(file_dir + '/' + orig_filename)\n\n uploaded_file = Hyrax::UploadedFile.create(file: file)\n uploaded_file.save\n\n file.close\n\n uploaded_file\nend", "def upload(file_path, options = {})\n\n # If not logged in, raise this exception\n raise 'Login first!' unless @customer_login_id\n\n # Extract options from the options hash\n multiple_speakers = options[:multiple_speakers] || true\n description = options[:description]\n file_name = File.basename(file_path)\n file_format = File.extname(file_path)\n file_size = File.stat(file_path).size\n # Use the duration if provided in the options hash\n duration = options[:duration] || ::FFMPEG::Movie.new(file_path).duration\n\n # Use the last upload url, or grab a new one\n @upload_url ||= get_upload_url\n\n # Create a connection to the upload url\n connection = Excon.new(@upload_url)\n # Upload to \n connection.put(headers: { \"x-ms-blob-type\" => \"BlockBlob\", \n \"x-ms-date\" => Time.now.to_s, \n \"Content-Length\" => file_size}, body: File.read(file_path))\n\n # Post to the \n response = @savon.call :commit_upload, message: { \"wsdl:sessionID\" => @session_id, \n \"wsdl:url\" => @upload_url, \n \"wsdl:name\" => file_name, \n \"wsdl:description\" => description, \n \"wsdl:duration\" => duration, \n \"wsdl:source\" => \"Ruby API Client\",\n \"wsdl:format\" => file_format, \n \"wsdl:isMultipleSpeakers\" => multiple_speakers }\n \n # Set the upload url to nil so that we don't reuse it \n @upload_url = nil\n\n response\n end", "def upload(file, identifier, copy = true)\n return \"/images/no_image.gif\" if file.nil?\n\n filename = \"#{identifier.to_s}_#{file[:filename]}\"\n full_path = File.join(self.root, self.path)\n\n if copy\n FileUtils.mkdir_p(full_path)\n FileUtils::cp(file[:tempfile].path, File.join(full_path, filename))\n end\n\n File.join(self.path, filename)\n end", "def create\n AttackFile.write(attack_files_params[:filename], attack_files_params[:body])\n\n render status: 201\n end", "def create\n @upload_file = UploadFile.new(params[:upload_file])\n\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to(@upload_file, :notice => 'Upload file was successfully created.') }\n format.xml { render :xml => @upload_file, :status => :created, :location => @upload_file }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @upload_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def file= file\n unless file.size == 0\n picture = Attachment.new :content => file.read\n picture.save\n write_attribute 'picture_id', picture.id\n end\n end", "def create\n @upload_file = UploadFile.new(params[:upload_file])\n if @upload_file.save\n redirect_to upload_files_path(:doc_no=>@upload_file.doc_no)\n else\n render :action => \"new\"\n end\n end", "def save_file(file, name = '')\n if name.size > 0\n filename = name + File.extname(file[:filename])\n else\n filename = file[:filename]\n end\n FileUtils.mkdir_p(attach_dir) unless File.exists?(attach_dir)\n new_file = File.join(attach_dir, filename)\n\n f = File.new(new_file, 'w')\n f.write(file[:tempfile].read)\n f.close\n\n commit_message = \"uploaded #{filename} for #{@name}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n # FIXME why!??\n nil\n end\n end", "def upload(major)\n unless File.exist?(major)\n puts \"File #{major} not found.\"\n return\n end\n major = File.absolute_path(major)\n response, success = ImgurAPI.upload(major)\n puts response unless success\n if success\n response = \"![#{options[:title].nil? ? 'Screenshot' : options[:title]}](#{response})\" if options[:markdown]\n response = build_HTML_response(response) if options[:html]\n puts \"Copied #{Platform.copy(response)} to clipboard\"\n end\n storage.save\n end", "def upload_file(filename, file)\n\tpath = \"#{AVATAR_DIR}/#{filename}\"\n\treturn false if File.exists? path\n\tFile.open(path, \"wb\") { |f| f.write(file.read) }\n\ttrue\nend", "def execute(file)\n check_args!(file)\n\n resolve_uploader.upload(file)\n end", "def upload_file(file_path, itunes_location)\n # url = URI.parse(self.upload_url_for_location(itunes_location))\n # req = Net::HTTP::Post::Multipart.new(url.path, {\"file\" => UploadIO.new(file_path, \"image/jpeg\")})\n # res = Net::HTTP.start(url.host, url.port) do |http|\n # http.request(req)\n # end\n \n IO::popen('-') do |c|\n exec \"curl -q -F 'file=@#{file.path}' '#{upload_url_for_location(itunes_location)}'\"\n end\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def upload_file(file, file_name, folder = '/cgi-bin/uploads')\n upload_url = 'https://mp.weixin.qq.com/cgi-bin/filetransfer'\\\n '?action=upload_material&f=json&writetype=doublewrite'\\\n \"&groupid=1&ticket_id=#{@ticket_id}\"\\\n \"&ticket=#{@ticket}&token=#{@token}&lang=zh_CN\"\n response = RestClient.post upload_url, file: file,\n Filename: file_name,\n folder: folder\n JSON.parse response.to_s\n end", "def upload\n upload_file = ApplicationUpload.new(params[:file])\n upload_msgs = upload_file.import(Garbage)\n\n flash[:notice] = t(:success_imported, :msg => upload_msgs) unless upload_msgs.blank?\n redirect_to(garbages_url)\n end", "def upload(type, path)\n File.open(path, 'r') do |file|\n make_request(\n :post, '/upload',\n headers: {\n 'Content-Type' => type, 'Content-Length' => file.size.to_s,\n 'Transfer-Encoding' => 'chunked'\n },\n content: file, base: @media_uri\n )['content_uri']\n end\n end", "def uploaded_file_params\n params.require(:uploaded_file).permit(:file)\n end", "def post_file(file_path, deposit_url, headers={})\n\n # Make sure file exists\n raise SwordException, \"Could not find file at \" + file_path if(!File.exists?(file_path))\n\n # Make sure we have a deposit URL\n raise SwordException.new, \"File '#{file_path}' could not be posted via SWORD as no deposit URL was specified!\" if !deposit_url or deposit_url.empty?\n\n # Map our passed in headers to valid HTTP POST headers\n post_headers = http_post_headers(headers)\n puts \"*\"*60\n puts \"Object headers in Connection#post_file are \", post_headers.inspect\n puts \"*\"*60\n\n # POST our file to deposit_url\n post(file_path, deposit_url, post_headers)\n end", "def upload_params\nparams[:upload].permit(:uploaded_file)\nend", "def upload(file, schema, mode = 'FULL')\n schema.upload file, self, mode\n end", "def upload(obj, file_path)\n begin\n res = scribd_user.upload(:file => escape(file_path), :access => access_level)\n obj.update_attributes({:ipaper_id => res.doc_id, :ipaper_access_key => res.access_key})\n rescue\n raise ScribdFuUploadError, \"Sorry, but #{obj.class} ##{obj.id} could not be uploaded to Scribd. \"\n end\n end", "def upload_an_odm(file_path)\n if File.exist?(\"#{file_path}\")\n self.odm_file_input.attach_file(file_path) # theoretically it should work but have not tested out yet.\n else\n raise 'File not found or file does not exist'\n end\n end", "def upload_file_params\n params.require(:upload_file).permit(:title, :date_uploaded, :attachment, :vendor_id, :task_allocation_id)\n end", "def upload(filename)\n begin\n file = File.open(\"#{filename}\")\n response = @client.put_file(\"/#{filename}\",file,true)\n return true\n rescue\n return false\n end\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def upload_params\n params.require(:upload).permit(:election_id, :file_type_id, :public, :file) # Not status, address or checksum.\n end", "def create\n parameters = params[:file_submission]\n assignment = Assignment.find(parameters['assignment_id'])\n definition = AssignmentDefinition.find_by_assignment_id(assignment.id)\n file = parameters['file']\n \n user_id = current_user.id\n unless (not parameters['user_id']) or parameters['user_id'] == ''\n user_id = parameters['user_id']\n end\n \n file.original_filename.gsub!(/[^a-z0-9A-Z.]/, '')\n\n user = User.find(user_id)\n \n logger = Logger.new(\"log/uploads.log\")\n\n logger.info \"#{assignment.course.id}\"\n logger.info \"USER ID: #{user_id} CURRENT USER #{current_user.id}\"\n\t if assignment.course.is_user_student(user_id)\n\t user_id = current_user.id if assignment.course.is_user_student(current_user.id)\n logger.info \"#{Time.now}:: #{current_user.friendly_full_name} (ID# #{current_user.id}) has submitted something for user with ID# #{user_id}.\"\n\t\t oldSubmission = FileSubmission.where(:assignment_id => assignment.id,\n\t\t\t\t\t :course_id => assignment.course_id, :user_id => user_id)[0]\n\t\t unless oldSubmission.nil?\n\t\t\t File.delete(oldSubmission.full_save_path)\n\t\t\t oldSubmission.destroy\n\t\t\t logger.info \"#{Time.now}::\\t #{current_user.friendly_full_name} has just overwritten the old submission.\"\n\t\t end\n\t end\n\n @submission = FileSubmission.new(:course_id => assignment.course_id, :assignment_id => assignment.id, :assignment_definition_id => definition.id, :user_id => user_id, :file => file, :name => file.original_filename, :uploaded_by => current_user.id)\n @submission.save\n\n logger.info \"#{Time.now}:: #{current_user.friendly_full_name} stored submission successfully at #{@submission.full_save_path}.\"\n\n course = Course.find(assignment.course_id)\n\n @assignmentFile = user_id == course.user_id\n @studentFile = !StudentInCourse.find_all_by_user_id_and_course_id(user_id, course.id).empty?\n \n\t\t@assignment = assignment\n\t\t\n render '/assignment/create.js' \n end", "def save_attachment(file, name = '')\n unless name.blank?\n basename = name.scorify\n else\n basename = File.basename(file[:filename]).scorify\n end\n \n ext = File.extname(file[:filename])\n \n # calculate file path\n new_file = File.join(attachment_dir, basename + ext)\n\n # create directory\n FileUtils.mkdir_p(attachment_dir) unless File.exists?(attachment_dir)\n \n # write file\n File.open(new_file, 'w') { |f| file[:tempfile]; f.write(file[:tempfile].read) }\n\n # commit changes\n commit_message = \"uploaded #{filename} for #{@basename.wikify}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n nil\n end\n end", "def execute(msg, url, filename)\n begin\n upload = wiki.upload(url, filename)\n rescue MediaWiki::Butt::UploadInvalidFileExtError => e\n msg.reply('Invalid file extension. Failed to upload!')\n rescue MediaWiki::Butt::EditError => e\n msg.reply(\"General error: #{e.message}\")\n end\n\n if upload\n msg.reply('Uploaded the file to the wiki!'.freeze)\n else\n msg.reply('Failed to upload!')\n end\n end", "def upload\n file = params[:file].original_filename\n activity = file.sub(/\\..*$/,'')\n path = RAILS_ROOT + \"/public/data/\" + activity\n Dir.mkdir path\n datapath = path + \"/data/\"\n Dir.mkdir datapath\n basename = datapath + activity\n smi = File.open(\"#{basename}.smi\",\"w\")\n cl = File.open(\"#{basename}.class\",\"w\")\n params[:file].read.each do |line|\n items = line.split(/\\s+/)\n smi.puts \"#{items[0]}\\t#{items[1]}\"\n cl.puts \"#{items[0]}\\t#{activity}\\t#{items[2]}\"\n end\n if LazarCategory.find_by_name(\"Uploads\").blank?\n cat = LazarCategory.create(:name => \"Uploads\")\n else\n cat = LazarCategory.find_by_name(\"Uploads\")\n end\n LazarModule.create(:endpoint => activity, :directory => path, :lazar_category => cat)\n redirect_to :action => :search\n end", "def upload_file(filename, path, uploaded_io)\n\tstatus = \"File not uploaded properly\"\t\n\tif !File.exists?(path + \"//\" + filename) && File.directory?(path)\n File.open(path + \"//\" + filename, 'w') do |file|\n input = uploaded_io.read\n input.force_encoding('UTF-8')\n file.write(input)\n end\n Upload.create(:file_name => uploaded_io.original_filename, :status => 'Not Processed', :upload_date => Time.now)\n upload_record = Upload.find_by_file_name(uploaded_io.original_filename)\n upload_record.uploaded_by = current_user.email\n upload_record.save\n\t status = \"File has been uploaded successfully, check the uploaded files to see its processing status.\"\n\telsif File.exists?(path + \"//\" + filename)\n\tstatus = \"Duplicate file found in uploads, file not uploaded\" \n\tend\n\tstatus\n end", "def add_file(file)\n logger.info(\" ########### add file\")\n if (file.nil?)\n logger.error(\"file is nil\")\n self.original_filename = nil\n self.has_attached_file = false\n return false\n elsif (!check_file?(file))\n logger.error(\"error uploading file\")\n self.original_filename = nil\n self.has_attached_file = false\n\n return false\n else\n self.add_file_datastream(file, :label => file.original_filename, :mimeType => file.content_type, :dsid => 'content', :controlGroup => 'M')\n self.original_filename = file.original_filename\n self.mime_type = file.content_type\n self.has_attached_file = true\n end\n return true\n end", "def uploadicon=(file)\n unless( file.blank? )\n logger.info(\"original_filename: \" + file.original_filename )\n self.content_type = file.content_type.chomp\n logger.info(\"content_type: \" + self.content_type )\n filename = base_part_of( file.original_filename ) \n \n if(file.length < 300000 )\n @uploadfile = file \n self.was_upload_successful = true\n else\n self.was_upload_successful = false\n end\n \n end\n end", "def store!(file)\n cloud_files_options = {'Content-Type' => file.content_type}\n f = CarrierWave::Storage::UpYun::File.new(uploader, self, uploader.store_path)\n f.store(file.read,cloud_files_options)\n f\n end", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def create\n # アップロードされたファイルのパラメータの中にupload_fileというパラメータを作ってしまった。\n # _form.html.erbの中でf.file_field :upload_fileとやっているのがそれ。\n upload_file = upload_file_params[:upload_file][:upload_file]\n content = {}\n puts upload_file\n puts \"hoge #{upload_file.original_filename}\"\n \n if upload_file != nil\n content[:file] = upload_file.read\n content[:filename] = upload_file.original_filename\n end\n\n @upload_file = UploadFile.new(content)\n puts @upload_file\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to @upload_file, notice: 'Upload file was successfully created.' }\n format.json { render :show, status: :created, location: @upload_file }\n else\n format.html { render :new }\n format.json { render json: @upload_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_gpx\n upload_file(params[:gpx_file]) if params[:gpx_file]\n end", "def upload_file\n filename = request.headers['X-Filename']\n if filename.blank?\n render plain: \"X-Filename header not provided\",\n status: :bad_request and return\n end\n input = request.env['rack.input']\n input.rewind\n input.set_encoding(Encoding::UTF_8)\n @import.save_file(file: input, filename: filename)\n head :no_content\n end", "def upload(filepath)\n\t\t\tif !filepath.is_a? String\n\t\t\t\traise SDKInvalidArgException, '`filepath` must be of type string'\n\t\t\tend\n\n\t\t\treq = APIRequest.new(\n\t\t\t\t@origin,\n\t\t\t\t'/v1/bugs/' + @bugID.to_s() + '/attachments',\n\t\t\t\t'POST',\n\t\t\t\t{\n\t\t\t\t\t'form_data' => true,\n\t\t\t\t\t'file_path' => filepath\n\t\t\t\t}\n\t\t\t)\n\n\t\t\tBugAttachment.new(@origin, req.exec)\n\t\tend", "def simple_file_upload simple_file_upload_file\n absolut_path_file = Dir.pwd.gsub(/\\.tests/, 'tests/files') + '/' + simple_file_upload_file\n\n self.simple_file = absolut_path_file\n end", "def file_upload(path)\n content_type = MIME::Types.type_for(path).first.to_s\n Rack::Test::UploadedFile.new(path, content_type)\n end", "def create\n @upload_file = UploadFile.new(upload_file_params)\n\n respond_to do |format|\n if @upload_file.save\n format.html { redirect_to upload_files_path, notice: 'Upload file was successfully created.' }\n format.json { render :show, status: :created, location: @upload_file }\n else\n format.html { render :new }\n format.json { render json: @upload_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def print_upload(id, file_name, file)\r\n dir = \"prints/#{id}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end" ]
[ "0.74871993", "0.73456824", "0.7088171", "0.7073198", "0.69446623", "0.68877584", "0.6860379", "0.6857626", "0.6855806", "0.6772047", "0.67594016", "0.67076725", "0.6698891", "0.66860497", "0.65870047", "0.6560491", "0.6550116", "0.65306544", "0.6526592", "0.6526592", "0.65167946", "0.65036845", "0.64864963", "0.6453922", "0.6437572", "0.643123", "0.63978976", "0.6388622", "0.63860244", "0.6360144", "0.63545734", "0.6335681", "0.6323573", "0.6308373", "0.63032144", "0.63006645", "0.629934", "0.62943673", "0.6284988", "0.6266529", "0.6264116", "0.62630457", "0.6240899", "0.6235481", "0.622456", "0.6223913", "0.62157655", "0.6208317", "0.62002546", "0.6191101", "0.6175171", "0.6144212", "0.61352456", "0.61336523", "0.6124974", "0.6118607", "0.6117286", "0.6116767", "0.6115391", "0.61149406", "0.6102893", "0.60948807", "0.60921514", "0.60803074", "0.60747844", "0.60684884", "0.6061101", "0.606101", "0.6060381", "0.605807", "0.60568583", "0.60523117", "0.60499364", "0.60488147", "0.60437864", "0.60427487", "0.6042548", "0.6038474", "0.6037652", "0.6029786", "0.6026277", "0.6012032", "0.6012032", "0.60090244", "0.60071796", "0.60064167", "0.6004926", "0.59963435", "0.59948635", "0.59945214", "0.59918076", "0.59895325", "0.59864396", "0.5985756", "0.59843177", "0.59823054", "0.5977298", "0.5976129", "0.5975346", "0.5961599", "0.59560704" ]
0.0
-1
A triangle is classified as follows: equilateral All 3 sides are of equal length isosceles 2 sides are of equal length, while the 3rd is different scalene All 3 sides are of different length To be a valid triangle, the sum of the lengths of the two shortest sides must be greater than the length of the longest side, and all sides must have lengths greater than 0: if either of these conditions is not satisfied, the triangle is invalid. Write a method that takes the lengths of the 3 sides of a triangle as arguments, and returns a symbol :equilateral, :isosceles, :scalene, or :invalid depending on whether the triangle is equilateral, isosceles, scalene, or invalid. Rules: Check if the triangle is valid, return a message if not. If it is, THEN return the symbol EXAMPLES: DATA STRUCTURES: INPUT: 3 floats, (turn into an array) OUTPUT: symbol ALGORITHM Check if the triangle is valid / "the sum of the lengths of the two shortest sides must be greater than the length of the longest side, and all sides must have lengths greater than 0" turn into an array and sort the lengths. if any are 0, return :invalid if array elements in first two positions reduce to a number > third element, continue. else return :invalid case when any two consecutive sides are equal, return :isoceles case when 3 consecutive sides are equal, return :equilateral else return :scalene CODE:
def triangle(a, b, c) lengths = [a,b,c].sort return :invalid if lengths.any? { |side| side == 0 } || lengths[0..1].sum <= lengths.max if lengths.each_cons(2).any? { |pair| pair[0] == pair [1] } lengths.uniq.size == 1 ? :equilateral : :isosceles else :scalene end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle(len1, len2, len3)\n lengths = [len1, len2, len3].sort\n return :invalid unless valid_triangle?(lengths)\n return :equilateral if lengths.all?(lengths[0])\n return :scalene if lengths.uniq == lengths\n return :isosceles\nend", "def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n longest_side = sides.max\n\n case\n when largest_side > sides.reduce(:+) - largest_side, sides.include?(0)\n :invalid\n when s1 == s2 && s2 == s3\n :equilateral\n when s1 == s2 || s1 == s3 || s2 == s3\n :issoceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n return :invalid if arr[0] + arr[1] <= arr[2]\n return :equilateral if arr[0] == arr[1] && arr[1] == arr[2]\n return :isosceles if arr.uniq.size == 2\n return :scalene if arr.uniq.size == 3\nend", "def triangle(side_1, side_2, side_3)\n ordered_array = [side_1, side_2, side_3].sort\n if !ordered_array.all? { |side| side > 0 }\n return :invalid\n end\n if (ordered_array[0] + ordered_array[1]) <= ordered_array[2]\n return :invalid\n end\n if (side_1 == side_2) && (side_2 == side_3)\n :equilateral\n elsif (side_1 == side_2) || (side_1 == side_3) || (side_2 == side_3)\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3].sort\n\n if sides.count(0) > 0 || sides[0] + sides[1] <= sides[2]\n :invalid\n elsif sides.uniq.size == 1\n :equilateral\n elsif sides.uniq.size == 2\n :isosceles\n elsif sides.uniq.size == 3\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n if side1 + side2 > side3 && side2 + side3 > side1 && side1 + side3 > side2\n if side1 == side2 && side2 == side3\n return :equilateral\n elsif side1 == side2 || side2 == side3 || side1 == side3\n return :isosceles\n else\n return :scalene\n end\n else\n return :invalid\n end\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n if side1 == side2 && side2 == side3\n :equilateral\n elsif (arr[0] + arr[1]) < arr[2] || arr.include?(0)\n :invalid\n elsif arr[0] == arr[1] || arr[1] == arr[2]\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n side_array = [side1, side2, side3].sort\n if side_array.include?(0)\n :invalid\n elsif !((side1 + side2) > side3) || !((side2 + side3) > side1)\n :invalid\n elsif side1 == side2 && side1 == side3\n :equilateral\n elsif (side1 == side2 && side1 != side3) || side2 == side3 && side2 != side1 || side1 == side3 && side1 != side2\n :isosceles\n elsif side1 != side2 && side1 != side3 && side3 != side2\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort!\n if arr[0] + arr[1] <= arr[2]\n :invalid\n elsif arr[0] == arr[1] && arr[0] == arr[2]\n :equilateral\n elsif arr[0] == arr[1] || arr[0] == arr[2] || arr[1] == arr[2]\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n return :invalid if sides.max > sides.sum / 2 || sides.min.zero?\n case sides.uniq.size\n when 1 then :equilateral\n when 2 then :isosceles\n else :scalene\n end\nend", "def triangle(num1, num2, num3)\n sides = [num1, num2, num3]\n\n sides.sort!\n\n return :invalid if sides[0..1].sum <= sides.last\n\n\n if sides.uniq.size == 1\n :equilateral\n elsif sides.uniq.size == 2\n :isosceles\n elsif sides.uniq.size == 3\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n sides.sort!\n return :invalid if sides.include?(0) || sides[0] + sides[1] < sides[2]\n sides_uniq = sides.uniq\n case sides_uniq.length\n when 1 then return :equilateral\n when 2 then return :isosceles\n when 3 then return :scalene\n end\nend", "def initialize(side_one_length, side_two_length, side_three_length)\n @side_one_length = side_one_length\n @side_two_length = side_two_length\n @side_three_length = side_three_length\n #I find working with an array of the three sides easier than working with the instance variables\n triangle_sides = []\n triangle_sides << @side_one_length\n triangle_sides << @side_two_length\n triangle_sides << @side_three_length\n #No sides of a triangle may be equal to zero\n if triangle_sides.any?{|side| side <= 0}\n raise TriangleError\n #The sum of the lengths of any two sides of a triangle always\n #exceeds the length of the third side. I have to check\n #to see if this is true, and if not I need to raise a \n #TriangleError\n elsif (triangle_sides[0] + triangle_sides[1] <= triangle_sides[2]) || (triangle_sides[1] + triangle_sides[2] <= triangle_sides[0]) || (triangle_sides[0] + triangle_sides[2] <= triangle_sides[1])\n raise TriangleError\n # An equilateral triangle has all sides equal\n elsif triangle_sides.all?{|side| side == triangle_sides[0]}\n @kind = :equilateral \n #An isosceles triangle has 2 sides that are equal, so here I'm checking to see that any two sides are equal.\n elsif triangle_sides[1] == triangle_sides[2] || triangle_sides[0] == triangle_sides[2] || triangle_sides[0] == triangle_sides[1]\n @kind = :isosceles\n #scalene triangles have no equal sides. Similar to what I just did but instead they cannot be equal\n elsif (triangle_sides[0] != triangle_sides[1] || triangle_sides[2]) && (triangle_sides[1] != triangle_sides[2])\n @kind = :scalene\n end\n end", "def triangle(a, b, c)\n return :invalid if [a, b, c].any?(&:zero?) # if any length is 0\n return :invalid unless [a, b, c].sort[0..1].sum > [a, b, c].max # sum of smaller > largest\n return :equilateral if a == b && b == c # if all sides are the same length\n return :isosceles if [a, b, c].uniq.size == 2 # if one length is repeated 2x\n :scalene # all other valid triangles\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n largest_side = sides.max\n\n case\n when 2 * largest_side > sides.reduce(:+), sides.include?(0)\n :invalid\n when side1 == side2 && side2 == side3\n :equilateral\n when side1 == side2 || side1 == side3 || side2 == side3\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n largest_side = sides.max\n\n case\n when 2 * largest_side > sides.reduce(:+), sides.include?(0)\n :invalid\n when side1 == side2 && side2 == side3\n :equilateral\n when side1 == side2 || side1 == side3 || side2 == side3\n :isosceles\n else\n :scalene\n end\nend", "def triangle(first, second, third)\n sides_array = [first, second, third]\n max_value = sides_array.max\n sum_of_smaller_sides = sides_array.sum - max_value\n check_array = sides_array.uniq\n\n if sides_array.include?(0) || sum_of_smaller_sides < max_value\n return :invalid\n elsif check_array.size == 1\n return :equilateral\n elsif check_array.size == 2\n return :isosceles\n else\n return :scalene\n end\nend", "def triangle(a, b, c)\n sides = [a, b, c]\n \n return :invalid if sides.include?(0) || sides.max >= sides.min(2).sum\n return :equilateral if sides.max == sides.min\n return :isosceles if sides.tally.value?(2)\n :scalene\nend", "def triangle(n1, n2, n3)\n sides = [n1, n2, n3].sort\n case\n when sides.any?{|side| side <= 0 }, sides[0..1].sum <= sides.last\n :invalid\n when sides.uniq.size == 1\n :equilateral\n when sides.uniq.size == 2\n :isosceles\n else\n :scalene\n end\nend", "def triangle(a, b, c)\n sides = a, b, c\n case\n when sides.any? { |side| side.zero? }\n :invalid\n when sides.any? { |side| sides.reduce(:+) - side < side }\n :invalid\n when sides.all? { |side| side == sides.first }\n :equilateral\n when sides == sides.uniq\n :scalene\n else\n :isosceles\n end\nend", "def triangle(a, b, c)\n sorted_triangle_sizes = [a, b, c].sort\n return :invalid if sorted_triangle_sizes.include?(0) || sorted_triangle_sizes[0] + sorted_triangle_sizes[1] < sorted_triangle_sizes[2]\n\n return :equilateral if a == b && a == c\n return :isosceles if a == b && a != c\n return :scalene\nend", "def triangle(a, b, c)\n #\n # My first solution\n #\n # # Test that the triangle is valid\n # # No side can be <= 0\n # raise TriangleError if a <= 0 || b <= 0 || c <= 0\n # # Sum of any two sides must be > third side\n # raise TriangleError if a >= b+c || b >= a+c || c >= a+b\n\n # return :equilateral if a == b && b == c\n # return :isosceles if a == b || b == c || a == c\n # return :scalene\n #\n\n #\n # The Stack Overflow assisted version\n #\n\n # Sort the triangle sides in ascending order such that a is the smallest\n a, b, c = sides = [a, b, c].sort\n\n # If a <= 0\n raise TriangleError if a <= 0 || a + b <= c\n # Slightly easier to read version:\n # raise TriangleError unless a > 0 || a + b > c\n\n # Find out how many unique lengths there are. If 1, return :equilateral; if\n # 2, return :isoceles; if 3, return :scalene. Note the clever usage of the\n # negative indexing into the array to directly map the number of unique sides\n # to the type of triangle without needing to pad the array\n [:scalene, :isosceles, :equilateral][-sides.uniq.size]\nend", "def triangle(a, b, c)\n #sort arguments by length\n triangle_array = [a, b, c].sort\n\n #initialize variables to sorted sides\n x = triangle_array[0]\n y = triangle_array[1]\n z = triangle_array[2]\n \n # rule out invalid triangles\n if x + y <= z || (x*y*z) == 0\n return :invalid\n end\n\n if x == y && x == z\n :equilateral\n elsif x == y || x == z || y == z\n :isosceles\n else\n :scalene\n end\nend", "def triangle_bk(s1, s2, s3)\n sorted_sides = [s1, s2, s3].sort\n if sorted_sides.any? { |side| side <= 0} || (sorted_sides[0] + sorted_sides[1] <= sorted_sides[2])\n :invalid\n elsif sorted_sides.all? { |side| side == sorted_sides[0]}\n :equilateral\n elsif sorted_sides[0] != sorted_sides[1] && sorted_sides[1] != sorted_sides[2]\n :scalene\n else\n :isosceles\n end\nend", "def triangle(a, b, c)\n tri = [a, b, c].sort\n\n if tri[0..1].sum <= tri[2] then :invalid\n elsif tri.any? { |side| side <= 0 } then :invalid\n elsif tri[0] == tri[1] && tri[1] == tri[2] then :equilateral\n elsif tri[0] != tri[1] && tri[0] != tri[2] && tri[1] != tri[2] then :scalene\n else :isosceles\n end\nend", "def triangle(a, b, c)\n sides = [a, b, c]\n\n # https://stackoverflow.com/a/11361502\n raise TriangleError if sides.min <= 0\n\n # my original answer\n #sides.each do |item|\n # if item <= 0\n # raise TriangleError\n # end\n #end\n\n # https://stackoverflow.com/a/11361502\n x, y, z = sides.sort\n raise TriangleError if x + y <= z\n\n # my original answer\n #if a + b <= c or b + c <= a or c + a <= b\n # raise TriangleError\n #end\n\n # https://stackoverflow.com/questions/4742692/a-more-elegant-solution-to-ruby-koans-triangle-rb\n case sides.uniq.size\n when 1 then :equilateral\n when 2 then :isosceles\n else :scalene\n end\n\n # my original answer\n #if a == b and b == c\n # :equilateral\n #elsif a == b or b == c or c == a\n # :isosceles\n #else\n # :scalene\n #end\nend", "def triangle(a, b, c)\n sides = [a,b,c]\n validate_sides(sides)\n\n unique_side_lengths = sides.uniq.length\n\n case unique_side_lengths\n when 1\n :equilateral\n when 2\n :isosceles\n when 3\n :scalene\n end\nend", "def triangle(a_side, b_side, c_side)\n # WRITE THIS CODE\n sum = a_side + b_side + c_side\n minimum = [a_side, b_side, c_side].min\n maximum = [a_side, b_side, c_side].max\n raise TriangleError unless minimum.positive? && (maximum < sum - maximum)\n\n return :equilateral if equilateral?(a_side, b_side, c_side)\n\n return :isosceles if isosceles?(a_side, b_side, c_side)\n\n :scalene\nend", "def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n return :invalid if sides.any?(0) || sides.max > sides.reduce(:+) - sides.max\n type_of_triangle(sides)\nend", "def triangle(x,y,z)\n sides = [x, y, z].sort \n return :invalid unless sides.all?{ |e| e.is_a?(Numeric) && e > 0 }\n return :invalid if sides[0] + sides[1] <= sides[2]\n # Now, since the sides are sorted, we can do the following:\n if sides[0] == sides[2]\n :equilateral\n elsif sides[0] == sides[1] || sides[1] == sides[2]\n :isosceles\n else\n :scalene\n end\nend", "def triangle(a,b,c)\n raise TriangleError unless is_valid_triangle?(a,b,c)\n h = [a]\n h << b unless h.include?(b)\n h << c unless h.include?(c)\n return :equilateral if h.length == 1\n return :isosceles if h.length == 2\n :scalene\nend", "def triangle(*sides)\n # could have used sides.includes?(0)\n return :invalid unless sides.none?(&:zero?)\n return :invalid if sides.max > sides.reduce(:+) - sides.max\n return :equilateral if sides.min == sides.max\n return :isosceles if sides.count { |x| x == sides.max } == 2\n :scalene\nend", "def triangle(a, b, c)\n if a==0||b==0||c==0\n\traise TriangleError, \"one of the sides equals zero\"\n end\n if (a+b<=c)||(a+c<=b)||(b+c<=a)\n\traise TriangleError, \"2 any sides must be greater then 1\"\n end\n if a<0||b<0||c<0\n\traise TriangleError, \"negative sides\"\n end\n if (a==b) && (a==c) && (b==c)\n :equilateral\n\telsif (a==b)||(a==c)||(b==c)\n :isosceles\n\telse \n :scalene\nend\n\nend", "def triangle(a, b, c)\n arr = [a, b, c]\n puts \n if checkLengths(arr.dup) || arr.any? {|x| x < 1} \n raise TriangleError, 'That was wrong biatch'\n end\n uni = arr.uniq!\n return :scalene unless uni\n case uni.length \n when 1\n :equilateral\n when 2\n :isosceles\n end\nend", "def triangle(a, b, c)\n if numbers_below_possible(a, b, c)\n raise TriangleError, \"One of the sides are 0 or negative (below allowed)\"\n end\n\n if triangle_not_possible(a, b, c)\n raise TriangleError, \"Triangle not possible with values passed\"\n end\n\n if a == b && a == c\n return :equilateral\n end\n\n if a == b || a == c || b == c\n return :isosceles\n end\n\n :scalene\nend", "def valid_triangle?(a, b, c)\n if (a + b > c) && (a + c > b) && (b + c) > a\n\ttrue\n else\n\tfalse\n end\n\n\n # arr = [a, b, c]\n # largest_side = a\n # index = 0\n # for i in arr\n # \tif i >= largest_side\n # \t\tlargest_side = i\n # \t\tindex_of = arr.index(i)\n # \tend\n # end\n # arr.delete_at(index_of)\n # puts arr\n # angle = (arr[0]**2 + arr[1]**2 - largest_side**2).to_f / (2*arr[0]*arr[1])\n # if largest_side**2 == (arr[0])**2 + (arr[1])**2 - 2*arr[0]*arr[1]*angle\n # \ttrue\n # else\n # \tfalse\n # end\n\n\n\n # if (a**2 == b**2 + c**2) || (b**2 == c**2 + a**2 ) || (c**2 == b**2 + a**2)\n # \ttrue\n # else\n # \tfalse\n # end\n\nend", "def triangle(a, b, c)\n\t\n\tcheckValidity(a,b,c)\n\t\n\tif (equilateral?(a,b,c))\n\t\treturn :equilateral\n\tend\n\tif (isosceles?(a,b,c))\n\t\treturn :isosceles\n\tend\n\t:scalene\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3]\n if arr.sum != 180 || arr.any?(0)\n :invalid\n elsif arr.any?(90)\n :right\n elsif arr.any? { |n| n > 90 }\n :obtuse\n else\n :acute\n end\nend", "def valid_triangle?(a,b,c)\n\n integer_cant_be_zero = (a == 0) || (b == 0) || (c == 0)\n invalid_triangle = ((a + b) < c) || ((b + c) < a) || ((a + c) < b)\n equilateral_triangle = (a == b) && (b == c)\n isoceles_triangle = (a == b) || (b == c) || (a == c)\n c_b_squared_equ_a_squared = (a > b) && (a > c) && (c**2 + b**2 == a**2)\n a_c_squared_equ_b_squared = (b > a) && (b > c) && (c**2 + a**2 == b**2)\n b_a_squared_equ_c_squared = (c > a) && (c > b) && (b**2 + a**2 == c**2)\n\n if integer_cant_be_zero || invalid_triangle\n return false\n elsif equilateral_triangle || isoceles_triangle\n return true\n elsif c_b_squared_equ_a_squared || a_c_squared_equ_b_squared || b_a_squared_equ_c_squared\n return true\n end\n\nend", "def valid_triangle?(side1, side2, side3)\n\n triangle_sides = [side1, side2, side3].sort\n triangle_sides[0] + triangle_sides[1] > triangle_sides[2] \nend", "def valid_triangle?(s1, s2, s3)\n triangle = [s1,s2,s3]\n triangle.sort!\n triangle[2] < triangle[0] + triangle[1] ? true : false\nend", "def valid_triangle?(side1, side2, side3)\n\n triangle_sides=[side1, side2, side3].sort\n\n p (triangle_sides[0] + triangle_sides[1]) > triangle_sides[2]\n\nend", "def triangle(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n return :invalid if invalid_triangle? [angle1, angle2, angle3]\n return :acute if acute? sides\n return :obtuse if obtuse? sides\n return :right if right? sides\nend", "def kind\n# if [side1, side2, side3].uniq?\n# return :scalene\n# elsif side1 == side2 and side2 == side3\n# # self = equilateral\n# return :equilateral\n# else\n# return :isosceles\n# end\n\n\n# if side1 || side2 || side3 < 0\n# begin\n# raise TriangleError\n# rescue TriangleError => error\n# puts error.message\n# end\n if side1 <= 0 || side2 <= 0 || side3 <= 0\n raise TriangleError\n elsif (side1 + side2) <= side3 || (side2 + side3) <= side1 || (side1 + side3) <= side2\n raise TriangleError\n elsif side1 == side2 and side2 == side3\n #self = equilateral\n return :equilateral\n elsif\n side1 == side2 || side2 == side3 || side1 == side3\n #side1 == side2 and side1 != side3 || side2 == side3 and side1 != side3\n # self = isosceles\n return :isosceles\n else\n #self = scalene\n return :scalene\n end\n\n\n end", "def is_triangle(side1,side2,side3)\n sides = [side1,side2,side3]\n unique_sides = sides.uniq.length\n raise TriangleError if triangle_error_found?(sides)\n type_of_triangle(unique_sides)\nend", "def kind\n\n #got some help for the first if..elsif below from a fellow classmate's github:\n\n if side1 + side2 <= side3 || side1 + side3 <= side2 || side2 + side3 <= side1\n raise TriangleError\n\n elsif side1 < 0.0 || side2 < 0.0 || side3 < 0.0\n raise TriangleError\n\n elsif ((side1 == side2) && (side1 == side3) && (side2 == side3))\n :equilateral\n elsif ((side1 == side2) || (side1 == side3) || (side2 == side3))\n :isosceles\n elsif (side1 != side2) && (side1 != side3)\n :scalene\n end\n end", "def test\n # triangle inequality theorem\n if ( ((@a+@b)>@c) && ((@a+@c)>@b) && ((@b+@c)>@a) )\n if (@a==@b && @b==@c)\n @type = \"equilateral\"\n @base = @a\n @height = sqrt((@c**2) - (@a/2.0)**2) # pythagoras\n elsif ((@a*@a + @b*@b) == @c*@c)\n @type = \"right\"\n @base = @a\n @height = @b\n elsif (@a == @b) # smaller sides are equal\n @type = \"isosceles\"\n @base = @c # base is larger side\n @height = sqrt(@b**2 - (@c/2.0)**2)\n elsif (@b == @c) # larger sides are equal\n @type = \"isosceles\"\n @base = @a # base is smaller side\n @height = sqrt(@c**2 - @a**2)\n else\n @type = \"scalene\"\n @base = @c\n \n # simplified algebra used to find height of scalene\n x = (@a**2 + @c**2 - @b**2) / (2.0*@c)\n @height = sqrt(@a**2 - x**2)\n \n end\n @valid = true\n else\n @type = \"not a triangle\"\n @valid = false\n end\n end", "def triangle(num1, num2, num3)\n if (num1 + num2 + num3) != 180\n return :invalid \n elsif num1 == 0 || num2 == 0 || num3 == 0 \n return :invalid\n elsif num1 > 90 || num2 > 90 || num3 > 90\n return :obtuse \n elsif num1 == 90 || num2 == 90 || num3 == 90\n return :right \n else \n :acute\n end\nend", "def test_triangle\n if @side1.eql?(@side2) && @side2.eql?(@side3)\n \"It's an equilateral\"\n elsif @side1.eql?(@side2) || @side2.eql?(@side3)\n \"It's an isosceles\"\n elsif @side1.eql?(@side2) == false && @side2.eql?(@side3) == false\n \"It's a scalene triangle\"\n else\n \"Not a triangle\"\n end\n end", "def kind\n if @side1 <= 0\n raise TriangleError\n elsif @side2 <= 0\n raise TriangleError\n elsif @side3 <= 0\n raise TriangleError\n end\n\n if (@side1 + @side2) <= @side3 || (@side2 + @side3) <= @side1 || (@side1 + @side3) <= @side2\n raise TriangleError\n elsif (@side1 == @side2)&&(@side2 == @side3)&&(@side3 == @side1)\n return :equilateral\n elsif (@side1 != @side2)&&(@side2 != @side3)&&(@side3 != @side1)\n return :scalene\n else\n return :isosceles\n end\n\n\n\n\n\n end", "def kind\n if @side_1 <= 0 || @side_2 <= 0 || @side_3 <= 0\n raise TriangleError\n elsif @side_1 + @side_2 <= @side_3 || @side_1 + @side_3 <= @side_2 || @side_2 + @side_3 <= @side_1\n raise TriangleError\n else\n if @side_2 == @side_1 && @side_3 == @side_1\n :equilateral\n elsif @side_2 == @side_3 || @side_1 == @side_2 || @side_1 == @side_3\n :isosceles\n else\n :scalene\n end\n end\n end", "def valid_triangle? (num1,num2,num3)\n if num1 + num2 < num3\n true\n elsif num1 + num3 < num2\n true\n elsif num2 + num3 < num1\n true\n else\n false\n end\nend", "def triangle_validation (sides) #unsure about stuff in parens here, if need etc\n #if is_triangle(a, b, c) then True elseif print \"This is not a valid triangle\" end\n #if has_3_sides(sides) then True elseif print \"You must enter THREE sides\" end\n\n if not has_3_sides(sides)\n print \"You must enter THREE sides\\n\"\n return false\n end\n if not is_triangle(sides[0], sides[1], sides[2])\n print \"This is not a valid triangle\\n\"\n return false\n end\n return true\n\n #if not is_triangle(a, b, c) then return False and print \"This is not a valid triangle\" end\n #if not has_3_sides(sides) then return False and print \"You must enter THREE sides\" end\n # return True if is_triangle(a, b, c) and has_3_sides(sides)\n #return False if is not has_3_sides(sides)\n #if False print \"You must enter THREE sides\"\nend", "def is_valid_triangle(s1, s2, s3)\n new_arr = [s1, s2, s3]\n new_arr.sort!\n if new_arr[0] + new_arr[1] <= new_arr[2]\n false\n else\n true\n end\nend", "def triangle(a1, a2, a3)\n angles = [a1, a2, a3]\n\n return :invalid if angles.sum != 180 || angles.include?(0)\n return :right if angles.include?(90)\n return :acute if angles.max < 90\n return :obtuse if angles.max > 90\nend", "def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n return :invalid if angles.include?(0) || angles.sum != 180\n \n if angles.include?(90) then :right\n elsif angles.select {|angle| angle > 90}.size > 0 then :obtuse\n else :acute\n end\n\nend", "def valid_triangle?(a, b, c)\n if (a==0 || b==0 || c==0)\n return false\n elsif (a+b<=c) || (a+c<=b) || (c+b<=a)\n return false\n elsif (a==b && a==c && b==c)\n return true\n elsif (a==b || a==c || b==c)\n return true\n elsif (((a**2)+(b**2))==(c**2) || ((a**2)+(c**2))==(b**2) || ((c**2)+(b**2))==(a**2))\n return true\n else\n return false\n end\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n\n # angles.sum = angles.reduce(:+) \n return :invalid if angles.sum != 180 || angles.any?(0)\n return :right if angles.any?(90)\n return :acute if angles.all? { |angle| angle < 90 }\n :obtuse\nend", "def triangle(ang1, ang2, ang3)\n ary = [ang1, ang2, ang3].sort\n return :invalid if ary.sum != 180 || ary.include?(0)\n if ary[-1] < 90\n :acute\n elsif ary[-1] == 90\n :right\n else\n :obtuse\n end\nend", "def triangle(x, y, z)\n sides = [x, y, z]\n largest_side = sides.max\n\n # binding.pry\n case\n when sides.inject(:+) != 180, sides.include?(0)\n puts :invalid\n when sides.inject(:+) == 180 && sides.include?(90)\n puts :right\n when sides.inject(:+) == 180 && largest_side > 90\n puts :obtuse\n else \n puts :acute\n end\nend", "def valid_triangle?(a, b, c)\n a + b > c && b + c > a && c + a > b\nend", "def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend", "def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend", "def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend", "def isTriangle(a, b, c)\n a, b, c = [a, b, c].sort\n a + b > c\nend", "def validity \n if @a + @b <= @c || @c + @a <= @b || @b + @c <=@a\n puts \"These is not a valid triangle, please make sure 2 sides are greater than the addition of one.\"\n return false \n else \n return true \n end \n end", "def valid_triangle?(a, b, c)\n if (a + b > c) && (a + c > b) && (b + c > a)\n true\n else\n false\n end\nend", "def valid_triangle(deg1, deg2, deg3)\n return :invalid if deg1 + deg2 + deg3 != 180\n return :invalid if deg1 <= 0 || deg2 <= 0 || deg3 <= 0\n :valid\nend", "def valid_triangle?(side1, side2, side3)\n\tif ((side1 + side2 > side3) && (side2 + side3 > side1) && (side3 + side1 > side2))\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def valid_triangle?(a, b, c)\n if a == 0 or b == 0 or c == 0\n return false\n elsif a == b and b == c and a == c\n return true\n elsif a + b < c or a + c < b or b + c < a\n return false\n else\n return true\n end\nend", "def test_different_lengths_of_triangles_and_compare_to_radius(radius)\n sum = 0\n # the greatest length of one of the triangle sides is 2 * radius\n max_length = 2 * radius\n # the smallest length is 1\n (1..max_length).each do |a|\n (a..max_length).each do |b|\n (b..max_length).each do |c|\n sorted = [a,b,c].sort\n next if bad_combo?(sorted)\n if radius.to_f == (calculated_radius = get_circle_radius_for_side_lengths(sorted).to_f rescue 0)\n puts \"A: #{a}, B: #{b}, C: #{c}\"\n sum += radius \n elsif (calculated_radius.to_i.to_f != calculated_radius.to_f rescue true)# combo sucks, ignore for next time\n ignore_combo(sorted)\n end\n end\n end\n end\n if sum > 0\n @successful_radii[radius] ||= []\n @successful_radii[radius] << sum/radius # count of triangles\n end\n return sum\nend", "def valid_triangle?(a, b, c)\n ((a+b>c) && (b+c>a) && (a+c>b))? true:false\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n largest_angle = angles.max\n\n case\n when angles.sum != 180, angles.include?(0)\n :invalid\n when largest_angle > 90\n :obtuse\n when largest_angle == 90\n :right\n else\n :acute\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180\n return :invalid if angles.any? {|angle| angle <= 0}\n return :right if angles.any? {|angle| angle == 90}\n return :acute if angles.all? {|angle| angle < 90}\n return :obtuse if angles.any? {|angle| angle > 90}\nend", "def valid_triangle?(a,b,c)\n if a != 0 && b != 0 && c != 0\n if a >= b\n largest = a \n sum = b \n else largest = b\n sum = a\n end\n \n if c > largest \n sum += largest \n largest = c \n else sum = c\n end\n\n if sum >= largest \n return \"true\"\n else return \"false\"\n end\n\n else\n return false\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless is_triangle?(angles)\n\n case\n when angles.any? { |a| a == 90 }\n :right\n when angles.all? { |a| a < 90 }\n :acute\n else\n :obtuse\n end\nend", "def valid_triangle? triple\n a, b, c = triple\n return false if a + b <= c\n return false if a + c <= b\n return false if b + c <= a\n\n true\nend", "def valid_triangle?(a, b, c)\n if a + b > c && a + c > b && b + c > a\n return true\n else\n return false\n end\nend", "def valid_triangle?(num_1, num_2, num_3)\n if (num_1 + num_2 > num_3) && (num_2 + num_3 > num_1) && (num_1 + num_3 > num_2)\n return true\n else\n return false\n end\nend", "def triangle(first, second, third)\n angles = [first, second, third]\n return :invalid unless angles.sum == 180 && angles.none?(0)\n\n case\n when angles.any?(90) then :right\n when angles.all? { |angle| angle < 90 } then :acute\n when angles.one? { |angle| angle > 90 } then :obtuse\n else :invalid\n end\nend", "def isTriangle(a,b,c)\n (a+b>c && a+c>b && c+b>a)? true : false\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n case\n when angles.inject(:+) != 180 then :invalid\n when angles.any? { |angle| angle <= 0 } then :invalid\n when angles.any? { |angle| angle > 90 } then :obtuse\n when angles.any? { |angle| angle == 90 } then :right\n else :acute\n end\nend", "def isTriangle(a,b,c)\n a + b > c && b + c > a && a + c > b\nend", "def isTriangle(a,b,c)\n if (a > 0) || (b > 0) || (c > 0)\n if ((a + b) > c) && ((a + c) > b) && ((b + c) > a)\n return true\n else\n return false\n end\n else\n return false\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n \n case \n when angles.reduce(:+) != 180 || angles.include?(0)\n :invalid\n when angles.count(90) == 1\n :right\n when angles.count {|an| an < 90} == 3\n :acute\n when angle1 > 90 || angle2 > 90 || angle3 > 90 \n :obtuse\n end\nend", "def right_triangle?(side_a, side_b, side_c)\n side_a**2 + side_b**2 == side_c**2\nend", "def isTriangle(a,b,c)\n a + b > c && b + c > a && a + c > b\nend", "def is_valid_triangle?(sides)\n !(sides.include?(0) || sides.sum != 180)\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n return :invalid unless angles.sum == 180 && angles.none?(&:zero?) # no 0s and sum to 180\n return :right if angles.any? { |x| x == 90 }\n return :obtuse if angles.any? { |x| x > 90 }\n :acute\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n case\n when angles.any? { |x| x <= 0 } || angles.sum != 180 then :invalid\n when angles.any? { |x| x == 90 } then :right\n when angles.all? { |x| x < 90 } then :acute\n when angles.any? { |x| x > 90 } then :obtuse\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n\n case\n when angles.reduce(:+) != 180, angles.include?(0)\n :invalid\n when angles.include?(90)\n :right\n when angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend", "def isTriangle(a,b,c)\n # your code\n a, b, c = [a, b, c].sort\n if a + b > c\n true\n else \n false\n end\nend", "def validate_triangle()\n if @data.class != Array || @data.empty?\n raise ERR_INVALID_ARRAY_INPUT\n end\n\n @data.reduce(0) do |t, curr|\n t + curr.reduce(0) { |total, n| total + n }\n end rescue raise msg_invalid_array\n\n total_items = @data.reduce(0) { |total, n| total + n.length }\n\n if total_items != sum_up_to_one(@data.length)\n raise ERR_INVALID_TRIANGLE\n end\n end", "def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n\n case \n when angles.sum != 180 || angles.include?(0)\n :invalid\n when angles.any?(90)\n :right\n when angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend", "def valid_triangle?(a, b, c)\n # Your code goes here!\n if (c + b > a) && (a + c > b) && (a + b >c)\n true\n else\n false\n end\n \nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless angles.sum == 180 && angles.all?(&:positive?)\n\n if angles.include?(90)\n :right\n elsif angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend", "def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n case\n when angles.inject(:+) != 180 || angles.include?(0)\n :invalid\n when angles.include?(90)\n :right\n when angles.any? { |angle| angle > 90}\n :obtuse\n when angles.all? { |angle| angle < 90 }\n :acute\n end\nend", "def isTriangle(a,b,c)\n a+b>c && a + c > b && b + c > a ? true : false\nend", "def valid_triangle?(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n\n return true if sides.reduce(:+) == 180 && sides.all? { | num| num > 0}\n false\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180 || angles.min.zero?\n case angles.max\n when 90 then :right\n when 0...90 then :acute\n else :obtuse\n end\nend" ]
[ "0.8402058", "0.8227042", "0.81234264", "0.80984694", "0.80696553", "0.8068965", "0.80656135", "0.8054786", "0.8053299", "0.8009254", "0.80003613", "0.7982491", "0.7967838", "0.79548883", "0.7942188", "0.7942188", "0.7902684", "0.7875767", "0.781432", "0.78044724", "0.77980804", "0.7761176", "0.7753586", "0.77211964", "0.7664557", "0.76640946", "0.76367754", "0.76367575", "0.763528", "0.7587197", "0.7529936", "0.75290674", "0.7497605", "0.74549854", "0.7421858", "0.74077344", "0.7397549", "0.728492", "0.72698355", "0.7249068", "0.7218904", "0.7207313", "0.7187543", "0.7141319", "0.71024525", "0.71006703", "0.70634747", "0.70290565", "0.70108837", "0.69838786", "0.6972467", "0.69241416", "0.69180316", "0.6907791", "0.6906095", "0.6880422", "0.6880129", "0.6871006", "0.68444526", "0.6844262", "0.68347496", "0.6824946", "0.6824946", "0.6824946", "0.6816947", "0.6811065", "0.67922056", "0.6791231", "0.67859524", "0.6783545", "0.67770356", "0.6776877", "0.67757905", "0.676937", "0.67547935", "0.67404264", "0.6714853", "0.6711893", "0.6711198", "0.6709127", "0.67037046", "0.6698095", "0.66957045", "0.66956854", "0.6692175", "0.6691285", "0.669002", "0.66754776", "0.66698766", "0.6658842", "0.66496897", "0.66474295", "0.66377425", "0.6631166", "0.66301024", "0.6577059", "0.65662175", "0.6563689", "0.65571326", "0.6554298" ]
0.82080084
2
GET /jobapplications GET /jobapplications.json
def index @user=current_user @jobapplications = @user.jobapplications end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @jobapplications = Jobapplication.all\n end", "def index\n @job_applications = JobApplication.all\n end", "def applications_list\n get \"applications\"\n end", "def index\n @job_applications = @job_applications_active\n end", "def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end", "def index\n @job_site_applications = JobSiteApplication.all\n end", "def show\n @application = Application.find(params[:id])\n \n if @application.nil? or @application.job.nil?\n redirect_to \"/\", :alert=>\"You do not have access to this page\"\n return false\n end\n\n return unless appAccess?(@application.job.id)\n\n @job = @application.job\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def index\n jobs = current_user.hr.jobs\n @applications = Array.new\n jobs.each do |job|\n job_faculties_map = Hash.new\n job_faculties_map[job] = Array.new\n if job.faculties.length > 0\n job.faculties.each do |faculty|\n job_faculties_map[job] << faculty\n end\n @applications << job_faculties_map\n end\n end\n @applications\n end", "def index\n if current_user.admin?\n @job_applications = JobApplication.all\n else\n @job_applications = JobApplication.where(job: Job.where(user: current_user.company.users))\n end\n @job_applications = @job_applications.where(status: params[:status]) if params[:status].present?\n @job_applications = @job_applications.where(response_status: params[:response_status]) if params[:response_status].present?\n @job_applications = @job_applications.where(job: Job.find(params[:job])) if params[:job].present?\n end", "def index\n if current_user.role == 'employee'\n @job_applications_made = current_user.employee.job_applications\n else\n @job_applications = JobApplication.all\n end\n end", "def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def get_applications_of_user\n respond_to do |format|\n format.json {\n @project_applications = ProjectApplication.where(:user_id => @current_user.id)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n @job_applications = JobApplication.for_status params[:status_type]\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end", "def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def get_applications_of_project\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:project_id => Project.find_by_id(param[:id]))\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend", "def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end", "def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end", "def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end", "def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_with @applications = Application.all\n end", "def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end", "def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end", "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def index\n @jobs = Job.all\n if current_role == :admin\n @applications = Application.all\n elsif current_role == :recruiter\n @applications = Application.all.select{|n| @jobs.exists?(n.job_id) && @jobs.find(n.job_id).company_id == current_user.company_id}\n else\n @applications = Application.all.select{|n| n.user_id==current_user.id}\n end\n end", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def show\n @other_job_applications = @job_application.user.job_applications.where.not(id: @job_application.id)\n render layout: request.xhr? ? false : \"admin/simple\"\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end", "def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def applications\n get(PLURAL_PATH, RESOURCE)\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end", "def show\n @job_applications = @job_offer.job_applications.group_by(&:state)\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end", "def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end", "def index\n @client_applications = ClientApplication.all\n end", "def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def show\n # @applicant_job_history = ApplicantJobHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant_job_history }\n end\n end", "def show\n \n @job = Job.find(params[:id])\n @application = Application.find(:first,:conditions=>['job_id=? and user_id=?',@job.id,current_user.id]) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end", "def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend", "def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def application(job,params={})\n if (@application[extract_job(job)] && !params[:force])\n return @application[extract_job(job)]\n end\n @application[extract_job(job)] = get_application(job)\n end", "def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if current_user.admin\n @planning_applications = PlanningApplication.all\n else\n @planning_applications = current_user.planning_applications\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @planning_applications }\n end\n end", "def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def index\n $lmc_left_menu = \"lmw_all_jobs\"\n $lmc_subleft_menu = \"lmw_job_applications\"\n @user = current_user\n @job_applications_ids = current_user.job_applications.pluck(:job_id)\n @job_applications = Job.where(id: @job_applications_ids).text_search(params[:query], params[:town], params[:status])\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end", "def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end", "def show\n @vacancy = Vacancy.find(params[:id])\n @new = JobApplication.where(state: \"send\", vacancy_id: @vacancy.id).includes(:user)\n @forwarded = JobApplication.where(state: \"manager_review\", vacancy_id: @vacancy.id).includes(:user)\n @reviewed = JobApplication.where(state: \"manager_review_listed\", vacancy_id: @vacancy.id).includes(:user)\n @employed = JobApplication.where(state: \"employed\", vacancy_id: @vacancy.id).includes(:user)\n @rejected = JobApplication.where(state: \"rejected\", vacancy_id: @vacancy.id).includes(:user)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end", "def fetch_job\n JSON.parse(RestClient.get(url).body)\n end", "def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jobapp = Jobapp.new(jobapp_params)\n\n if @jobapp.save\n flash[:success] = \"Jobapp was successfully created.\"\n redirect_to action: \"index\"\n else\n @jobapps = Jobapp.all\n\n render :new, locals: {jobapp: @jobapp,jobapps: @jobapps}\n end\n end", "def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index\n @applications = @opportunity.applications\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def show\n render json: @job\n end", "def show\n render json: @job\n end", "def find_kapp_webhook_jobs(kapp_slug, params={}, headers=default_headers)\n @logger.info(\"Finding webhook jobs in the \\\"#{kapp_slug}\\\" Kapp\")\n get(\"#{@api_url}/kapps/#{kapp_slug}/webhookJobs\", params, headers)\n end" ]
[ "0.75712025", "0.7509937", "0.7328586", "0.72294647", "0.71561056", "0.714754", "0.70906514", "0.6986119", "0.6917373", "0.68683404", "0.6811004", "0.68095404", "0.6804624", "0.6743325", "0.67002386", "0.6697153", "0.6695857", "0.6694836", "0.6694836", "0.6689123", "0.6674831", "0.66729844", "0.6622333", "0.6588466", "0.6581722", "0.6516574", "0.6503951", "0.6492583", "0.6482338", "0.6422113", "0.6409324", "0.6386419", "0.6352568", "0.6336666", "0.6334322", "0.6331768", "0.6322143", "0.63157064", "0.63157064", "0.63016677", "0.62966865", "0.627759", "0.62530047", "0.6240574", "0.62391347", "0.62391347", "0.62391347", "0.62391347", "0.62391347", "0.62391347", "0.62391347", "0.62381464", "0.62298286", "0.6227774", "0.6216053", "0.6196523", "0.61838263", "0.61838263", "0.61838263", "0.61838263", "0.6183725", "0.6179578", "0.6170479", "0.6165425", "0.6158633", "0.6151601", "0.61125785", "0.61061597", "0.6104687", "0.6102171", "0.60827154", "0.6081877", "0.60756767", "0.60734737", "0.6061617", "0.60608846", "0.60568106", "0.60463905", "0.6034009", "0.6034009", "0.6033672", "0.60297626", "0.6018944", "0.60067123", "0.5998838", "0.5997984", "0.5992481", "0.5992481", "0.59882224", "0.5987084", "0.59868777", "0.5982972", "0.5979441", "0.5979173", "0.59787905", "0.597526", "0.59679806", "0.59640527", "0.59640527", "0.5960689" ]
0.70363295
7
GET /jobapplications/1 GET /jobapplications/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @jobapplications = Jobapplication.all\n end", "def index\n @job_applications = JobApplication.all\n end", "def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end", "def index\n @job_applications = @job_applications_active\n end", "def show\n @application = Application.find(params[:id])\n \n if @application.nil? or @application.job.nil?\n redirect_to \"/\", :alert=>\"You do not have access to this page\"\n return false\n end\n\n return unless appAccess?(@application.job.id)\n\n @job = @application.job\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end", "def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def index\n @user=current_user\n @jobapplications = @user.jobapplications\n end", "def index\n @job_site_applications = JobSiteApplication.all\n end", "def applications_list\n get \"applications\"\n end", "def index\n @job_applications = JobApplication.for_status params[:status_type]\n end", "def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end", "def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend", "def index\n if current_user.admin?\n @job_applications = JobApplication.all\n else\n @job_applications = JobApplication.where(job: Job.where(user: current_user.company.users))\n end\n @job_applications = @job_applications.where(status: params[:status]) if params[:status].present?\n @job_applications = @job_applications.where(response_status: params[:response_status]) if params[:response_status].present?\n @job_applications = @job_applications.where(job: Job.find(params[:job])) if params[:job].present?\n end", "def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end", "def get_applications_of_project\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:project_id => Project.find_by_id(param[:id]))\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def index\n jobs = current_user.hr.jobs\n @applications = Array.new\n jobs.each do |job|\n job_faculties_map = Hash.new\n job_faculties_map[job] = Array.new\n if job.faculties.length > 0\n job.faculties.each do |faculty|\n job_faculties_map[job] << faculty\n end\n @applications << job_faculties_map\n end\n end\n @applications\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend", "def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end", "def index\n if current_user.role == 'employee'\n @job_applications_made = current_user.employee.job_applications\n else\n @job_applications = JobApplication.all\n end\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end", "def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end", "def get_applications_of_user\n respond_to do |format|\n format.json {\n @project_applications = ProjectApplication.where(:user_id => @current_user.id)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n \n @job = Job.find(params[:id])\n @application = Application.find(:first,:conditions=>['job_id=? and user_id=?',@job.id,current_user.id]) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end", "def show\n # @applicant_job_history = ApplicantJobHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant_job_history }\n end\n end", "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.html.erb\n format.json { render json: @application }\n end\n end", "def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @other_job_applications = @job_application.user.job_applications.where.not(id: @job_application.id)\n render layout: request.xhr? ? false : \"admin/simple\"\n end", "def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end", "def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend", "def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end", "def fetch_job\n JSON.parse(RestClient.get(url).body)\n end", "def show\n render json: @job\n end", "def show\n render json: @job\n end", "def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def get_job_status id\n response = get \"http://#{@host}/loadbalancers/tenant/#{@tenant}/jobs/#{id}\"\n raise LBModelException.new \"Expected HTTP 200 but got #{response.code} instead\" unless response.code == 200\n\n JSON.parse(response)\n end", "def show\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_active_job }\n end\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @jobs = Job.all\n if current_role == :admin\n @applications = Application.all\n elsif current_role == :recruiter\n @applications = Application.all.select{|n| @jobs.exists?(n.job_id) && @jobs.find(n.job_id).company_id == current_user.company_id}\n else\n @applications = Application.all.select{|n| n.user_id==current_user.id}\n end\n end", "def show\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_compact }\n end\n end", "def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end", "def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end", "def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end", "def show\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_job }\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_with @applications = Application.all\n end", "def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def show\n @device = Device.find(params[:device_id])\n @job = @device.jobs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend", "def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n add_breadcrumb @job_application, @job_application\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def show\n respond_to do |format|\n format.json {\n\n @project_application = ProjectApplication.find_by_id(params[:id])\n\n if @project_application\n render :json => @project_application\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def application(job,params={})\n if (@application[extract_job(job)] && !params[:force])\n return @application[extract_job(job)]\n end\n @application[extract_job(job)] = get_application(job)\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.json { render json: @application }\n end\n end" ]
[ "0.73974156", "0.73329115", "0.7152045", "0.7107909", "0.7035161", "0.6915667", "0.6854348", "0.6854348", "0.68477976", "0.6820289", "0.67768854", "0.6769192", "0.6695022", "0.6662767", "0.6658025", "0.6588435", "0.65872395", "0.6585567", "0.6582794", "0.65645397", "0.65485036", "0.65485036", "0.65099734", "0.64984035", "0.6496604", "0.6486091", "0.6486091", "0.6486091", "0.6486091", "0.6486091", "0.6486091", "0.6486091", "0.64820063", "0.6468864", "0.64677596", "0.64490336", "0.64422625", "0.6413936", "0.6407902", "0.6406976", "0.63727224", "0.6369402", "0.63655055", "0.63624436", "0.6356585", "0.635581", "0.6342871", "0.63083845", "0.6305808", "0.6294852", "0.62821233", "0.6276056", "0.62658817", "0.62629116", "0.6249917", "0.62312496", "0.6226651", "0.62224686", "0.62224686", "0.62224686", "0.62224686", "0.62224686", "0.62220997", "0.62193775", "0.62010735", "0.6190838", "0.6190838", "0.61852866", "0.6179422", "0.6162371", "0.61594874", "0.6152575", "0.615058", "0.61441296", "0.6139903", "0.61398244", "0.61384857", "0.61322296", "0.61169034", "0.6116283", "0.6116283", "0.6113322", "0.61129296", "0.61023533", "0.6091535", "0.6091535", "0.60889864", "0.60832536", "0.60821927", "0.6081507", "0.6080033", "0.60700274", "0.6066692", "0.6064131", "0.60610586", "0.6057988", "0.6054851", "0.6036086", "0.6035297", "0.60237145", "0.60015446" ]
0.0
-1
POST /jobapplications POST /jobapplications.json
def create @user=current_user @job=Job.find(session[:job_id]) @jobapplication = @user.jobapplications.build(job:@job) @jobapplication.name=jobapplication_params[:name] @jobapplication.phone=jobapplication_params[:phone] @jobapplication.major=jobapplication_params[:major] @jobapplication.coverletter=jobapplication_params[:coverletter] @jobapplication.status="Pending" @jobapplication.job_name=@job.name @jobapplication.email=current_user.email @jobapplication.job_id=@job.id JobNotifier.received(@jobapplication).deliver respond_to do |format| if @jobapplication.save(jobapplication_params) format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' } format.json { render :show, status: :created, location: @jobapplication } else format.html { render :new } format.json { render json: @jobapplication.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.job_applications.where(job_id: params[:job_application][:job_id]).count > 0\n respond_to do |format|\n format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_error') }\n end\n else\n @job_application = current_user.job_applications.new(job_application_params)\n #Create EQ Answers\n if params.has_key?(\"answer\")\n Answer.create(eq_answer_params(params[\"answer\"]))\n else\n params[\"answers\"].each do |answer|\n Answer.create(eq_answer_params(answer))\n end\n end\n #Create EQ Answers end\n respond_to do |format|\n if @job_application.save\n @job = @job_application.job\n @job_owner = @job_application.job.users.first\n @applicant = current_user\n UserMailer.new_job_applicant_email(@job, @job_owner, @applicant ).deliver_now\n format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_success') }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def create\n @job = Job.find(params[:job_id])\n @application = Application.new(application_params)\n @application.job = @job\n @application.user = current_user\n\n if @application.save\n redirect_to developers_applications_path\n else\n redirect_to job_path(@job)\n end\n end", "def create\n @job_application = JobApplication.new(params[:job_application])\n @users = User.find :all\n @job_postings = JobPosting.find :all\n \n respond_to do |format|\n if @job_application.save\n flash[:notice] = 'JobApplication was successfully created.'\n format.html { redirect_to(@job_application) }\n format.xml { render :xml => @job_application, :status => :created, :location => @job_application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n if @job_application.save\n flash[:notice] = \"Your application has been made successfully\"\n redirect_to jobs_path\n else\n flash[:error] = \"Error saving your application\"\n redirect_to jobs_path\n end\n end", "def create\n @jobapp = Jobapp.new(jobapp_params)\n\n if @jobapp.save\n flash[:success] = \"Jobapp was successfully created.\"\n redirect_to action: \"index\"\n else\n @jobapps = Jobapp.all\n\n render :new, locals: {jobapp: @jobapp,jobapps: @jobapps}\n end\n end", "def create\n @jobapplication = Jobapplication.new(jobapplication_params)\n\n respond_to do |format|\n if @jobapplication.save\n @foundjob = Job.find(@jobapplication.job_id)\n @foundemployerid = @foundjob.employer_id.to_i\n @foundemployer = Employer.find(@foundemployerid)\n UserNotifier.jobapplication_submitted_email(@foundemployer).deliver\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }\n format.json { render :show, status: :created, location: @jobapplication }\n else\n format.html { render :new }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(params[:application])\n @application.job = Job.find(params[:id])\n respond_to do |format|\n if @application.save\n format.html { redirect_to '/', notice: 'Application was received.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def jobapplication_params\n params.require(:jobapplication).permit(:name, :email, :job_name, :phone, :status, :user_id, :job_id, :coverletter, :major)\n end", "def jobapplication_params\n params.require(:jobapplication).permit(:job_id, :jobseeker_id, :coverletter, :status)\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create\n @job_application = JobApplication.new(params[:job_application])\n @job_application.activation_key = ActiveSupport::SecureRandom.hex(4)\n \n respond_to do |format|\n if @job_application.save\n JobApplicationMailer.deliver_job_application_confirmation(@job_application)\n flash[:notice] = 'You have successfully applied for teh job.'\n format.html { render :action => \"job_application_success\" }\n format.xml { render :xml => @job_application, :status => :created, :location => @job_application }\n else\n format.html { render :action => \"error\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def application_params\n params.fetch(:application, {}).permit(:job_id)\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(params[:application])\n #@application.bids.build\n # @bid = Bid.new(params[:bid])\n #check_bid = @bid.valid?\n @job = Job.find_by_id(@application.job_id)\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n flash[:notice] = 'Application was successfully created.'\n format.html { redirect_to(applications_url) }\n format.xml { render :xml => @application, :status => :created, :location => @application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.status = \"pending review\"\n @job_application.job_seeker_id = current_user.id\n @job = Job.find_by_id(@job_id)\n @job_application.job_id = flash[:job_id].to_i\n @job_application.application_deadline = Job.find_by_id(flash[:job_id].to_i).application_deadline\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_application = JobApplication.new(params[:job_application])\n @vacancy = Vacancy.find_by_id(params[:vacancy_id]);\n if user_signed_in? && !current_user.admin?\n applicant = Applicant.find_by_id(current_user.id)\n @job_application.applicant_id = current_user.id\n @job_application.vacancy_id = @vacancy.id\n end\n \n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @vacancy, notice: 'Job application was successfully created.' }\n format.json { render json: @job_application, status: :created, location: [applicant, @job_application] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def job_application_params\n params.require(\n :job_application\n ).permit(\n :resume,\n :job_ad_id,\n :job_seeker_id,\n :recruiter_id\n )\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end", "def index\n @jobapplications = Jobapplication.all\n end", "def create\n @client_application = ClientApplication.new(client_application_params)\n\n respond_to do |format|\n if @client_application.save\n format.html { redirect_to @client_application, notice: 'Client application was successfully created.' }\n format.json { render :show, status: :created, location: @client_application }\n else\n format.html { render :new }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def job_application_params\n params.require(:job_application).permit(:apply_job_info, :price_per_hour, :job_id, :user_id)\n end", "def application_params\n params.require(:application).permit(:job_id, :id, :current_company, :linkedin_url, :portfolio_url, :add_info,\n :gender, :race, :veteran, :disability, :resume, :application_status)\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def submission\n if @job.status?\n @application = Application.new(application_params)\n email_api = Email_api.new\n if email_api.email(@application)\n render json: @application, status: :OK\n else\n render json: @application.errors, status: :bad_request\n end\n else\n render plain: job_not_active, status: :unprocessable_entity\n end\n end", "def create\n @jenkins_app_config = JenkinsAppConfig.new(jenkins_app_config_params)\n\n respond_to do |format|\n if @jenkins_app_config.save\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully created.' }\n format.json { render :show, status: :created, location: @jenkins_app_config }\n else\n format.html { render :new }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html {\n flash[:success] = 'Application ' + @application.name + ' was successfully created.'\n redirect_to [:admin, @application]\n }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"new\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applicant_job = ApplicantJob.new(applicant_job_params)\n\n respond_to do |format|\n if @applicant_job.save\n format.html { redirect_to @applicant_job, notice: 'Applicant job was successfully created.' }\n format.json { render :show, status: :created, location: @applicant_job }\n else\n format.html { render :new }\n format.json { render json: @applicant_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @job_applications = JobApplication.all\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_application = UserApplication.new(user_application_params)\n\n respond_to do |format|\n if @user_application.save\n format.html { redirect_to @user_application, notice: 'User application was successfully created.' }\n format.json { render :show, status: :created, location: @user_application }\n else\n format.html { render :new }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_application = TaskApplication.new(task_application_params)\n\n respond_to do |format|\n if @task_application.save\n format.html { redirect_to @task_application, notice: 'Task application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n current_user.application = @application\n current_user.save\n format.html { redirect_to @application, notice: 'Application successfully sent in.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create\n @employment_application = EmploymentApplication.new(employment_application_params)\n\n respond_to do |format|\n if @employment_application.save\n # alert the appropriate person at MWC\n ApplicationMailer.new_employment_application(@employment_application.id).deliver!\n\n # destroy their resume to save space on the machine\n @employment_application.resume.destroy\n @employment_application.resume.clear\n @employment_application.save\n\n format.html { redirect_to \"/\", notice: 'Your employment application was received. We will contact you shortly if we choose to proceed with your application.' }\n format.json { render :show, status: :created, location: @employment_application }\n else\n format.html { render :new, alert: 'There was an error while processing your application. Please try again.' }\n format.json { render json: @employment_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def job_application_params\n params.require(:job_application).permit(:candidate_id, :open_job_id, :red, :yellow, :green)\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def create\n @activity_application = @meetup_event.activity_applications.new(activity_application_params_for_create)\n\n respond_to do |format|\n if @activity_application.save\n format.html {redirect_to [@meetup_event, @activity_application], notice: 'Activity application was successfully created.'}\n format.json {render :show, status: :created, location: meetup_event_activity_application_path(@meetup_event, @activity_application)}\n else\n format.html {render :new}\n format.json {render json: @activity_application.errors, status: :unprocessable_entity}\n end\n end\n end", "def jobapp_params\n params.require(:jobapp).permit(:designation_id, :number_of_post, :job_type, :experience, :age, :job_location, :salary, :post_date, :last_date_to_apply, :close_date, :status, :short_description, :description)\n end", "def activate_app\n key = Key.new\n key.host = params[:data][:host]\n key.app_dataset_id = params[:data][:app_dataset_id]\n key.api_key = params[:data][:api_key]\n key.app_name = params[:controller]\n\n existing_job_board = JobBoard.find_by(app_dataset_id: params[:data][:app_dataset_id])\n unless existing_job_board.present?\n JobBoard.create(app_dataset_id: params[:data][:app_dataset_id])\n end\n\n respond_to do |format|\n format.json { render json: { success: key.save }}\n end\n end", "def create_job(job:, params: {})\n response = HTTParty.post(\"#{@host}/api/jobs\", body: {job: job, api_key: @api_key}.merge(params))\n \n return response\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end", "def application_params\n params.require(:application).permit(:j_id, :job_id, :user_id, :gender, :additional_info, :portfolio_url, :linkedin_url, :current_company, :disability_status, :veteran_status, :race, :status, :resume)\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def job_application_params\n params.require(:job_application).permit(:job_offer_id, :user_id, :first_name, :last_name, :current_position, :phone, :address_1, :address_2, :postal_code, :city, :country, :website_url)\n end", "def create\n @appman = Appman.new(appman_params)\n @appman.user_id = session[:user_id]\n respond_to do |format|\n if @appman.save\n UpdateStackStatusJob.perform_later(@appman) \n format.html { redirect_to @appman, notice: 'Appman was successfully created.' }\n format.json { render :show, status: :created, location: @appman }\n else\n format.html { render :new }\n format.json { render json: @appman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_application = ProjectApplication.new(project_application_params)\n\n respond_to do |format|\n if @project_application.save\n format.html { redirect_to @project_application, notice: 'Project application was successfully created.' }\n format.json { render :show, status: :created, location: @project_application }\n else\n format.html { render :new }\n format.json { render json: @project_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def job_application_params\n params.require(:job_application).permit(:candidate_id, :job_id, :rejection_reason)\n end", "def job_application_params\n params.require(:job_application).permit(:coverletter, :job_id, :employee_id, :status, :review_employee, :rating_employee, :rating_employer, :review_employer)\n end", "def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_job(json_payload)\n conn = @client.post do |req|\n req.url '/api/v2/job/create'\n req.headers[\"Authorization\"] = @token\n req.body = json_payload\n end\n conn.body\n end", "def create\n job = Job.create(job_params)\n render json: job\n end", "def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@job_application = JobApplication.new(params[:job_application])\n @job_application = current_user.job_applications.new(params[:job_application])\n #@job_application.job_posting_id = JobPostings.find(params[:job_posting_id]) # job_posting.id \n #@job_posting = JobPosting.find(params[:job_posting_id])\n #@job_application.job_posting_id = @job_posting.id\n #@job_application.job_posting_id = params[:job_application][:job_posting_id]\n\n respond_to do |format|\n if @job_application.save\n # send email to HR person who posted the job\n @job_posting = JobPosting.find(@job_application.job_posting_id)\n @HR_person = User.find(@job_posting.user_id)\n RecieveApplicationMailer.recieve_application_email(@HR_person, @job_application).deliver\n\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render json: @job_application, status: :created, location: @job_application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def apply(application, params={})\n response = @http.post(\"/application/submit\", application.to_xml)\n check_status(response)\n response_application_parser.parse(response.body).first\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\n end", "def index\n @job_applications = @job_applications_active\n end", "def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @application = Application.new(params[:application])\n p @params\n user = User.find_by_user(params['requester'])\n puts user\n\n @application['user_id'] = user.id\n @application['status'] = 0\n @application['apply_date'] = Time.now\n\n\n @application['to'] = params[:application]['to'].join(\",\")\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to :action => \"index\", notice: 'Application was successfully created.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: t('job_applications_controller.job_applications_delete_success') }\n format.json { head :no_content }\n end\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url}\n format.json { head :no_content }\n end\n end", "def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n IO.popen([\"mail\", \"-s\", \"New Application request\", \"jon@railsclass.com\"], \"w\") {|f|\n f.puts @app.name;\n f.puts @app.email;\n f.puts @app.phone;\n f.puts @app.date;\n f.puts @app.employment;\n f.puts @app.currently;\n f.puts @app.looking_for;\n f.puts @app.experience;\n f.puts @app.ideas;\n f.puts @app.linkedin;\n f.puts @app.heard_from;\n f.close_write;\n }\n\n gb = Gibbon::API.new\n \n name_array = app_params[:name].split\n first_name = app_params[:name]\n last_name = \"\"\n if name_array.length > 1 && name_array[0].length > 0 && name_array[1].length > 0\n first_name = name_array[0]\n last_name = name_array[1]\n end\n puts \"subscribing new user to list\"\n \n gb.lists.subscribe({:id => \"75aba6bef3\", :email => {:email => app_params[:email]}, :merge_vars => {:FNAME => first_name, :LNAME => last_name}, :double_optin => true})\n\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to root_path, notice: \"A lovely application! We'll be in touch soon!\" }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_application_attachment = JobApplicationAttachment.new(params[:job_application_attachment])\n @job_applications = JobApplication.find :all\n respond_to do |format|\n if @job_application_attachment.save\n flash[:notice] = 'JobApplicationAttachment was successfully created.'\n format.html { redirect_to(@job_application_attachment) }\n format.xml { render :xml => @job_application_attachment, :status => :created, :location => @job_application_attachment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_application_attachment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @agent_application = AgentApplication.new(agent_application_params)\n @agent_application.user = current_user\n\n respond_to do |format|\n if @agent_application.save\n format.html { redirect_to @agent_application, notice: 'Agent application was successfully created.' }\n format.json { render :show, status: :created, location: @agent_application }\n else\n format.html { render :new }\n format.json { render json: @agent_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end" ]
[ "0.7316559", "0.73024595", "0.7293769", "0.71754336", "0.7073491", "0.6844435", "0.6822148", "0.6792305", "0.6749265", "0.66450775", "0.6501808", "0.6499864", "0.6431803", "0.63994956", "0.6330132", "0.63185525", "0.6286922", "0.6230224", "0.61914474", "0.6160016", "0.6154924", "0.61451566", "0.6134411", "0.61258215", "0.6077892", "0.6056332", "0.6051837", "0.60485375", "0.6042126", "0.60268384", "0.6017964", "0.6008878", "0.60070795", "0.60014576", "0.5999226", "0.599544", "0.5994703", "0.5993749", "0.5981723", "0.59758955", "0.59691703", "0.596087", "0.5958705", "0.5957129", "0.5952777", "0.59489715", "0.594631", "0.594631", "0.59429944", "0.5936261", "0.5934208", "0.5876792", "0.5871089", "0.5871089", "0.5871089", "0.5871089", "0.5871089", "0.5871089", "0.5871089", "0.58474976", "0.5843855", "0.58298457", "0.5828826", "0.5826411", "0.58220243", "0.58220243", "0.58213955", "0.5813376", "0.5807911", "0.57903373", "0.57871526", "0.57854235", "0.57839245", "0.578022", "0.5778346", "0.5776647", "0.57722527", "0.57696766", "0.57685643", "0.5763655", "0.57615197", "0.5746212", "0.5722673", "0.5710846", "0.5700202", "0.5696779", "0.5691947", "0.568768", "0.56812453", "0.5677061", "0.56749165", "0.56726867", "0.5668988", "0.5666924", "0.56563014", "0.5654753", "0.56496036", "0.56433123", "0.56422144", "0.56405205" ]
0.66165906
10
PATCH/PUT /jobapplications/1 PATCH/PUT /jobapplications/1.json
def update @user=current_user @job=Job.find(session[:job_id]) @jobapplication.job_name=@job.name @jobapplication.email=current_user.email respond_to do |format| if @jobapplication.update(jobapplication_params) format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully updated.' } format.json { render :show, status: :ok, location: @jobapplication } else format.html { render :edit } format.json { render json: @jobapplication.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@jobapp = Jobapp.find(params[:id])\n\n respond_to do |format|\n if @jobapp.update_attributes(params[:jobapp])\n format.html { redirect_to @jobapp, notice: 'Jobapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to vacancy_path(@job_application.vacancy_id), notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n flash[:notice] = 'JobApplication was successfully updated.'\n format.html { redirect_to(@job_application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n flash[:notice] = 'JobApplication was successfully updated.'\n format.html { redirect_to(@job_application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to jobs_path, notice: 'Your review has been submitted' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "def update\n if @jobapp.update(jobapp_params)\n flash[:success] = \"Jobapp was successfully updated.\"\n redirect_to action: \"index\"\n else\n render \"edit\" \n end\n end", "def update\n respond_to do |format|\n if @job_site_application.update(job_site_application_params)\n format.html { redirect_to @job_site_application, notice: 'Job site application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_site_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @applicant_job.update(applicant_job_params)\n format.html { redirect_to @applicant_job, notice: 'Applicant job was successfully updated.' }\n format.json { render :show, status: :ok, location: @applicant_job }\n else\n format.html { render :edit }\n format.json { render json: @applicant_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job(job:)\n response = HTTParty.put(\"#{@host}/api/jobs/#{job[:id]}\", body: {job: job, api_key: @api_key})\n \n return response.success?\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def update\n respond_to do |format|\n if @launched_job.update(launched_job_params)\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jobapplication.update(jobapplication_params)\n if((cookies[:employerID]!=\"\") && (!cookies[:employerID].is_a?NilClass))\n @foundjobseeker = Jobseeker.find(@jobapplication.jobseeker_id)\n UserNotifier.jobapplication_status_update_email(@foundjobseeker).deliver\n end\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobapplication }\n else\n format.html { render :edit }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end", "def set_job_application\n @job_application = JobApplication.find(params[:id])\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @job.update(job_params)\n @job.update(category: @category)\n @job.update(keywords: @keywords)\n render json: @job, status: :accepted\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end", "def update\n byebug\n respond_to do |format|\n if @job.update(send(\"#{@job.type.underscore.to_sym}_params\"))\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n if @job_compact.update_attributes(params[:job_compact])\n format.html { redirect_to @job_compact, notice: 'Job compact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_compact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize!(@job)\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n if @job.update_attributes(params[:job])\n response_message = {:message => \"Job updated successfully.\", :job => @job}\n else\n response_message = {:message => \"Job updation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end", "def update\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n if @emp_job.update_attributes(params[:emp_job])\n format.html { redirect_to @emp_job, notice: 'Emp job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emp_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @create_job.update(create_job_params)\n format.html { redirect_to @create_job, notice: 'job was successfully updated.' }\n format.json { render :show, status: :ok, location: @create_job }\n else\n format.html { render :edit }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n if @training_active_job.update_attributes(params[:training_active_job])\n format.html { redirect_to @training_active_job, notice: 'Active job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @training_active_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n if @job_item.update_attributes(params[:job_item])\n format.html { redirect_to [@job, @job_item], notice: 'Job item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @act_job.update(act_job_params)\n format.html { redirect_to @act_job, notice: 'Act job was successfully updated.' }\n format.json { render :show, status: :ok, location: @act_job }\n else\n format.html { render :edit }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @job = current_member.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(job_params)\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully accepted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, success: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = current_user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = t('jobs_controller.update.success')\n format.html { redirect_to @job}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @myjob.update(myjob_params)\n format.html { redirect_to @myjob, notice: 'Myjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @myjob }\n else\n format.html { render :edit }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single camp_application based on the id\n camp_application = CampApplication.find_by(id: the_id)\n\n # update it\n if camp_application.update!(\n camp_id: params[:camp_id],\n application_id: params[:application_id]\n )\n render json: camp_application.as_json\n else\n render json: {errors: camp_application.errors.full_messages}\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n record_activity :update, @job\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if UbiquoJobs.manager.update(params[:id], params[:job])\n flash[:notice] = t(\"ubiquo.jobs.job_edited\")\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n format.js\n else\n flash[:error] = t(\"ubiquo.jobs.cant_edit\")\n format.html { render :action => \"edit\" }\n format.xml { render :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @employment_application.update(employment_application_params)\n format.html { redirect_to @employment_application, notice: 'Employment application was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_application }\n else\n format.html { render :edit }\n format.json { render json: @employment_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_application.update(client_application_params)\n format.html { redirect_to @client_application, notice: 'Client application was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_application }\n else\n format.html { render :edit }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to root_path, notice: 'Application was successfully submitted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to mentor_job_path(@job), notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_form.update(job_form_params)\n format.html { redirect_to @job_form, notice: 'Job form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end", "def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @saved_job = SavedJob.find(params[:id])\n\n respond_to do |format|\n if @saved_job.update_attributes(params[:saved_job])\n format.html { redirect_to @saved_job, :notice => 'Saved job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @saved_job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_application.update(task_application_params)\n format.html { redirect_to @task_application, notice: 'Task application was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @task_application }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pending_job.update(pending_job_params)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully updated.' }\n format.json { render :show, status: :ok, location: @pending_job }\n else\n format.html { render :edit }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @applied_job.update(applied_job_params)\n format.html { redirect_to @applied_job, notice: 'Applied job was successfully updated.' }\n format.json { render :show, status: :ok, location: @applied_job }\n else\n format.html { render :edit }\n format.json { render json: @applied_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app_request.update(app_request_params)\n format.html { redirect_to @app_request, notice: 'App request was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_request }\n else\n format.html { render :edit }\n format.json { render json: @app_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity } \n end\n end\n end", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jenkins_app_config.update(jenkins_app_config_params)\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully updated.' }\n format.json { render :show, status: :ok, location: @jenkins_app_config }\n else\n format.html { render :edit }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_list = JobList.find(params[:id])\n\n respond_to do |format|\n if @job_list.update_attributes(params[:job_list])\n format.html { redirect_to @job_list, notice: 'Job list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.74559945", "0.7407683", "0.73970324", "0.73759025", "0.7363393", "0.7295005", "0.7295005", "0.72880805", "0.7264011", "0.7177406", "0.70021", "0.70021", "0.68578064", "0.68068326", "0.6768039", "0.6692797", "0.6682828", "0.6642247", "0.65920436", "0.65756685", "0.65515107", "0.65515107", "0.65515107", "0.6503026", "0.6503026", "0.6485511", "0.64579487", "0.6456323", "0.6450048", "0.6450048", "0.6450048", "0.6450048", "0.6450048", "0.6450048", "0.6450048", "0.644542", "0.642663", "0.6420449", "0.6413032", "0.6393123", "0.63913965", "0.63784873", "0.6377677", "0.63627476", "0.6328745", "0.6327846", "0.6316955", "0.63047355", "0.63018143", "0.62963337", "0.6281447", "0.6272627", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.627147", "0.6270747", "0.62681776", "0.6261858", "0.62448525", "0.6239563", "0.6237061", "0.6233908", "0.62269634", "0.621956", "0.6218377", "0.6209311", "0.61969244", "0.61865246", "0.6185464", "0.61828727", "0.6178419", "0.61736554", "0.6169644", "0.616639", "0.6159899", "0.6135806", "0.6124851", "0.61243284", "0.61218756", "0.6115788", "0.6112836", "0.6108241", "0.609925", "0.60953444", "0.60947716", "0.6084878", "0.6084545", "0.6068383", "0.6068383" ]
0.67780286
14
DELETE /jobapplications/1 DELETE /jobapplications/1.json
def destroy @jobapplication.destroy respond_to do |format| format.html { redirect_to jobapplications_url, notice: 'Jobapplication was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@application.job.id)\n id = @application.job.id\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to show_apps_path(:id=>id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to job_applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to job_applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.delete\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'Job application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: t('job_applications_controller.job_applications_delete_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_applications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_applications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'Job application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'Job application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_site_application.destroy\n respond_to do |format|\n format.html { redirect_to job_site_applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @launched_job.destroy\n respond_to do |format|\n format.html { redirect_to launched_jobs_url }\n format.json { head :no_content }\n end\n end", "def delete\n job_resource.delete\n end", "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_item = @job.job_items.find(params[:id])\n @job_item.destroy\n\n respond_to do |format|\n format.html { redirect_to [@job] }\n format.json { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant_job.destroy\n respond_to do |format|\n format.html { redirect_to applicant_jobs_url, notice: 'Applicant job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobapp.destroy\n flash[:success] = \"Jobapp was successfully destroyed\"\n redirect_to action: \"index\"\n end", "def destroy\n if UbiquoJobs.manager.delete(params[:id])\n flash[:notice] = t(\"ubiquo.jobs.job_removed\")\n else\n flash[:error] = t(\"ubiquo.jobs.cant_remove\")\n end\n\n respond_to do |format|\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to client_path(@job.client), notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @job = Mugen::Job.delete(params[:id])\n \n respond_to do |format|\n format.html { redirect_to(mygengo_jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @training_active_job = Training::ActiveJob.find(params[:id])\n @training_active_job.destroy\n\n respond_to do |format|\n format.html { redirect_to training_active_jobs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: \"Job was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @db_job.destroy\n respond_to do |format|\n format.html { redirect_to db_jobs_url, notice: 'Db job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @emp_job = EmpJob.find(params[:id])\n @emp_job.destroy\n\n respond_to do |format|\n format.html { redirect_to emp_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_compact = JobCompact.find(params[:id])\n @job_compact.destroy\n\n respond_to do |format|\n format.html { redirect_to job_compacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_scope_addition = JobScopeAddition.find(params[:id])\n jid = @job_scope_addition.jobs_id\n jsa_id = params[:id]\n recs = AdditionTaskRecord.find_all_by_jobs_id(jsa_id)\n delete_records(recs)\n @job_scope_addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"#{job_scope_additions_url}?jid=#{jid}\") }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize!(@job)\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend", "def destroy\n @act_job.destroy\n respond_to do |format|\n format.html { redirect_to act_jobs_url, notice: 'Act job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end", "def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n redirect_to root_url\n end", "def destroy\n respond_with Job.find(params[:id]).delete\n end", "def destroy\n @saved_job = SavedJob.find(params[:id])\n @saved_job.destroy\n\n respond_to do |format|\n format.html { redirect_to saved_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = current_member.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Job.destroy(params[:id])\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to mentor_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Application deleted.\"\n return\n else\n puts \"Missing arguments\"\n return\n end \nend", "def destroy\n ensure_authenticated!\n job = OAR::Job.find(params[:id])\n authorize!(job.user)\n\n url = uri_to(\n site_path(\n params[:site_id]\n )+\"/internal/oarapi/jobs/#{params[:id]}.json\",\n :out\n )\n http = EM::HttpRequest.new(url).delete(\n :timeout => 5,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Accept' => media_type(:json)\n }\n )\n\n continue_if!(http, :is => [200,202,204,404])\n\n if http.response_header.status == 404\n raise NotFound, \"Cannot find job##{params[:id]} on the OAR server\"\n else\n response.headers['X-Oar-Info'] = (\n JSON.parse(http.response)['oardel_output'] || \"\"\n ).split(\"\\n\").join(\" \") rescue \"-\"\n\n location_uri = uri_to(\n resource_path(params[:id]),\n :in, :absolute\n )\n\n render :text => \"\",\n :head => :ok,\n :location => location_uri,\n :status => 202\n end\n end", "def destroy\n @job = Job.find_by_job_number(params[:id])\n if admin?\n @job.destroy\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_list = JobList.find(params[:id])\n @job_list.destroy\n\n respond_to do |format|\n format.html { redirect_to job_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n flash[:success] = \"Job successfully destroyed\"\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @sfjob = Sfjob.find(params[:id])\n @sfjob.destroy\n\n respond_to do |format|\n format.html { redirect_to sfjobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applied_job.destroy\n respond_to do |format|\n format.html { redirect_to applied_jobs_url, notice: 'Applied job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to @job, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @myjob.destroy\n respond_to do |format|\n format.html { redirect_to myjobs_url, notice: 'Myjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_job.destroy\n respond_to do |format|\n format.html { redirect_to saved_jobs_url, notice: t('saved_jobs_controller.saved_jobs_delete_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application_attachment = JobApplicationAttachment.find(params[:id])\n @job_application_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_application_attachments_url) }\n format.xml { head :ok }\n end\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy_applicant\n @job_user = JobUser.find(params[:id])\n @job = @job_user.job\n @job_user.delete\n redirect_to job_path(@job)\n end", "def destroy\n @jenkins_app_config.destroy\n respond_to do |format|\n format.html { redirect_to jenkins_app_configs_url, notice: 'Jenkins app config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, success: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_status = JobStatus.find(params[:id])\n @job_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_job_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job_detail.destroy\n respond_to do |format|\n format.html { redirect_to job_job_details_url, notice: 'Job detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.destroy(params[:id])\n redirect_to jobs_path\n end", "def destroy\n @worker_job.destroy\n respond_to do |format|\n format.html { redirect_to worker_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url, notice: 'Jobsite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobtype = Jobtype.find(params[:id])\n if @jobtype.destroy\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end", "def destroy\n authorize! :destroy, @db_job_status\n @db_job_status.destroy\n respond_to do |format|\n format.html { redirect_to db_job_statuses_url, notice: 'Db job status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @create_job.destroy\n respond_to do |format|\n format.html { redirect_to create_jobs_url, notice: 'Create job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7766266", "0.76326525", "0.7621548", "0.7621548", "0.76016533", "0.7578017", "0.74692094", "0.7395062", "0.7395062", "0.73557", "0.73557", "0.73368776", "0.7278601", "0.7101841", "0.70281655", "0.70260906", "0.7018765", "0.70097303", "0.6998382", "0.6972625", "0.69351816", "0.69281864", "0.69281864", "0.69281864", "0.69281864", "0.6927884", "0.69269115", "0.6914309", "0.6888135", "0.6874375", "0.6859245", "0.68510467", "0.684896", "0.6843938", "0.6841118", "0.6840409", "0.68266666", "0.6810279", "0.67994267", "0.6795204", "0.67905504", "0.678961", "0.67895794", "0.6786438", "0.67796314", "0.6777889", "0.6765869", "0.67629725", "0.67553395", "0.6754831", "0.67513335", "0.6748925", "0.6736349", "0.6710808", "0.6703981", "0.6692753", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.667233", "0.66605204", "0.666007", "0.666007", "0.666007", "0.666007", "0.666007", "0.666007", "0.666007", "0.666007", "0.6659167", "0.66478574", "0.66397154", "0.66387844", "0.6635886", "0.66342425", "0.66331273", "0.6623017", "0.6615689", "0.6615689", "0.66143775", "0.6602472", "0.6600559", "0.6588146", "0.65852535", "0.65792674", "0.6576918", "0.65755284", "0.6569261", "0.65514797", "0.65503824", "0.6544627" ]
0.73185956
12
Use callbacks to share common setup or constraints between actions.
def set_jobapplication @jobapplication = Jobapplication.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def jobapplication_params params.require(:jobapplication).permit(:name, :email, :job_name, :phone, :status, :user_id, :job_id, :coverletter, :major) 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
Recipeusers should return the user instances who have recipe cards with this recipe
def users RecipeCard.all.select { |c| c.recipe == self }.map { |c| c.user } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_recipes\n RecipeCard.all.select do |recipe_cards|\n recipe_cards.user == self \n end\n end", "def users\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end", "def users\n recipes = RecipeCard.all.select { |recipecard| recipecard.recipe == self}\n recipes.collect {|recipe_card| recipe_card.user}\n end", "def recipes\n RecipeCard.all.select do |recipecard|\n recipecard.user == self\n end\n end", "def recipe_cards \n RecipeCard.all.select do |recipe|\n recipe.user == self\n end \n end", "def recipe_cards\n RecipeCard.all.select { |recipe_card| recipe_card.user == self}\n end", "def recipes\n\t\tRecipeCard.all.select { |recipe_card| recipe_card.user == self }\n\tend", "def users\n RecipeCard.all.select do |card|\n card.recipe == self\n end.map do |card|\n card.user\n end\n end", "def find_user_recipe_cards\n RecipeCard.all.map{|rcard| rcard if rcard.user_O == self}.compact\n\n end", "def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end", "def users\n\t\tRecipeCard.all.map do |recipe_card| \n\t\t\tif recipe_card.recipe == self \n\t\t\t\trecipe_card.user \n\t\t\tend\n\t\tend.compact\n\tend", "def recipes\n RecipeCard.all.map{|recipe_card| recipe_card.recipe if recipe_card.user == self}.compact\n end", "def recipe_cards\n user_recipecards = RecipeCard.all.select do |recipecard|\n recipecard.user == self\n end\nend", "def recipecards\n RecipeCard.all.select do | card |\n card.user == self\n end\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def recipes\n Recipe.all.select {|recipes| recipes.user == self}\n end", "def users\n RecipeCard.all.map{|recipe_card| recipe_card.user if recipe_card.recipe_O == self}.compact\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n # RecipeCard.name\n end.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def recipes\n # should return all of the recipes this user has recipe cards for\n\n # first match up the user with their recipe cards\n # my_recipe_cards = RecipeCard.all.select do |recipe_card| #rc\n # # self == recipe_card.user # recipe_card.user == self\n # recipe_card.user == self\n # end\n\n # binding.pry\n # then take that array and get the recipes out of it\n self.recipe_cards.map do |recipe_card| # what is this an array of?\n recipe_card.recipe\n end\n # [recipe card objects for that user]\n\n # return an array of recipes\n end", "def cards\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end", "def recipes\n recipe_card_array = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n\n recipe_card_array.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def users\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe_name == self\n end.map do |recipe_card|\n recipe_card.user\n end\n end", "def users\n recipe_cards.map do |r|\n r.user\n end\n end", "def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end", "def users\n self.recipe_cards.map {|recipe_card| recipe_card.user}\n end", "def recipe_belongs_to_user(user)\n if user.recipes.select {|s| s.users == users}.count > 0\n return true\n else\n return false\n end\n end", "def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end", "def users\n users_arr = RecipeCard.all.select do |recipe_card_ob|\n #binding.pry\n recipe_card_ob.recipe == self\n end\n users_arr.map do |user_ob|\n #binding.pry\n user_ob.user\n end\nend", "def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end", "def my_recipe_cards\n RecipeCard.all.select do |recipecard|\n recipecard.recipe == self\n end\n end", "def recipe_cards\n RecipeCard.all.select {|recipe_card| recipe_card.recipe == self}\n end", "def users\n recipes.map {|recipe| recipe.user}\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end", "def safe_recipes\n safe_recipes_array =[]\n #get all the recipies of a user\n all_user_rec = self.recipes\n #get user allergens\n user_allergens = self.allergens\n all_user_rec.each do |recipe|\n y = 0\n recipe.ingredients.each do |ingredient|\n if user_allergens.include?(ingredient)\n y = 1\n end\n end\n safe_recipes_array << recipe if y == 0\n end\n safe_recipes_array\n\n #return array of recipe objects that are safe\n\n end", "def user_counter \n RecipeCard.all.select{|cards|cards.recipe == self}.count \n end", "def recipe_cards #return array of recipecards with this recipe\n RecipeCard.all.select do |card|\n card.recipe == self\n end\n #to test in pry, use instance ex. r1.recipe_cards\n end", "def index\n @recipe_users = RecipeUser.all\n end", "def index\n @recipes = Recipe.where(user_id: current_user.id)\n end", "def recipe_helper\n RecipeCard.all.select do |card|\n card.recipe == self\n end\n end", "def my_recipes\n @recipes = @user.savedrecipe.recipe\n end", "def user\n\t\t@recipes = Recipe.find_by_user_id(params[:id])\n\t\trespond_with @recipes\n\tend", "def users\n self.user_cards.map do |card|\n card.user\n end\n end", "def safe_recipes\n all_recipes = RecipeCard.all.map { |c| c.recipe }\n all_recipes.uniq.select { |r| (allergens & r.ingredients).empty? }\n end", "def users\n\t\t@recipes = Recipe.where('published = ?',1).find_by_user_id(params[:id])\n\t\trespond_with @recipes\t\n\tend", "def eligible_owners\n User.where('users.id != ?', @cookbook.user_id)\n end", "def get_recipe_names\n users_recipes.map {|ur| ur.recipe.name}\n end", "def safe_recipes\n #Look at each allergen. Look at each recipeingredient to determine if any ingredients match any allergens. return recipe if not\n allergens = self.user_allergens ##array of allergies (ingredients objects)\n ri_array = RecipeIngredient.all\n binding.pry\n allergens.each do |allergen|\n binding.pry\n ri_array.delete_if {|recipeingredient| recipeingredient.ingredient == allergen}\n end\n binding.pry\n ri_array.map {|recipeingredient| recipeingredient.recipe}\n\n\n end", "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end", "def show_recipes_in_my_kitchen\n list_recipes(@user.recipes.order(:title) ) # just list all recipes associated to the users kitchen\n end", "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end", "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end", "def show\n @user_account= UserAccount.find_by(username: session[:user_id])\n @recipes = Recipe.where(\"recipe_writer = :writer\", writer: session[:user_id]) \n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def get_active_recipe_ids\n users_recipes.find_all {|ur| ur.active}.map {|ur| ur.recipe_id}\n end", "def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end", "def find_recipe_profiles(user)\n profiles = []\n faves = find_favorite_recipes(user)\n faves.each do |recipe|\n profiles << create_recipe_profile(recipe)\n end\n return profiles\n end", "def user_recipe_connection(recipe_id)\n if user.recipes.where(id: recipe_id) == Recipe.all.where(id: recipe_id)\n recipe_finder(recipe_id)\n else\n UserRecipe.create(name: self.user.name, user_id: self.user.id, recipe_id: recipe_id)\n recipe_finder(recipe_id)\n end\n end", "def safe_recipes\n #want all of the recipes that do not contain ingredients in allergens (array of ingredients)\n #look through all of our recipes\n my_ingredients = self.recipes.map do |recipe|\n #for each recipe, get the ingredients\n recipe.ingredients #array, map makes it an array within an array\n end.flatten.uniq\n #see if any of those ingredients are not our allergens\n my_safe_ingredients = my_ingredients.select do |ingredient|\n !(self.allergens.include?(ingredient))\n end\n #select all recipe ingredients that have our safe ingredients\n my_safe_ris = RecipeIngredient.all.select do |ri|\n my_safe_ingredients.include?(ri.ingredient)\n end\n #return the recipe\n my_safe_ris.map do |ri|\n ri.recipe\n end\n\n end", "def clean_up_user_recipes\n\n allergen_found = 0\n\n self.recipes.each do |r|\n i = r.ingredients.compact\n\n # for each ingredient\n i.each do |ingr| \n ## see if user is allergic\n get_allergy_ids.each do |ua_id|\n if (ingr.allergen1_id == ua_id) or (ingr.allergen2_id == ua_id) or (ingr.allergen3_id == ua_id)\n allergen_found = 1\n break\n end\n end\n end\n ## set active to false if user has selected an allergy that conflicts with the recipe\n if allergen_found == 1 \n ur = UsersRecipe.find(:first, :conditions => {:user_id => self.id, :recipe_id => r.id})\n ur.active = false\n ur.save! \n end\n allergen_found = 0\n end \n end", "def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def allergens_ingredients\n Allergen.all.select {|allergen| allergen.user == self}\n end", "def initialize(user, recipe, date, rating)\n @user = user\n @recipe = recipe\n @date = date\n @rating = rating\n @@all << self # adds current RecipeCard to the list of all RecipeCards\n end", "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end", "def index\n @recipe = Recipe.new\n @recipes = current_user.recipes.page(params[:page]).per(15)\n end", "def sharedCards\n \tcus_shared_with_user = cards_users.where(user_id: self.id, is_shared: true)\n\n \t# Have a list of CardsUsers, but want a list of Shared Cards\n \tshared_cards = []\n \tcus_shared_with_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\tshared_cards.push(card)\n \tend\n \tshared_cards\n end", "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "def user_reviews\n Review.all.select {|review| review.user == self}\n end", "def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end", "def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end", "def index\n @recipes = Recipe.all\n @recipe = Recipe.new\n @user = User.find_by_id(current_user.id)\n end", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def set_recipe\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n end", "def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end", "def show\n\t\tload_recipe\n\t\t\t\n\t\tload_recipes_set(@recipe.user)\n\t\t\n\t\t@recipe_index = @recipes_set.index(@recipe)\n\t\t\n\t\trecipe = [@recipe]\n\t\t@other_recipes_set = @recipes_set - recipe\n\t\trecipes_conditions = recipe_conditions(recipe_photo_required_cond, recipe_status_cond, recipe_privacy_cond, recipe_is_draft_cond)\n\n same_title_recipes_conditions_list = [ \"recipes.title = '#{@recipe.title}'\", \"recipes.common_title = '#{@recipe.title}'\" ]\n\t\tif (common_title = @recipe.common_title) && !common_title.blank?\n\t\t\tsame_title_recipes_conditions_list += [ \"recipes.common_title = '#{common_title}'\", \"recipes.title = '#{common_title}'\" ]\n\t\tend\n\t\tsame_title_recipes_conditions = \"#{recipes_conditions} AND (#{same_title_recipes_conditions_list.join(' OR ')})\"\n\t\t@same_title_recipes_set = recipes_for(nil, same_title_recipes_conditions, nil, 'RAND()') - recipe\n\t\t@same_title_recipes_set_count = @same_title_recipes_set.size\n\n related_recipes_conditions = recipes_conditions\n\t\t@related_recipes_set = taggables_for(nil, 'Recipe', @recipe.tag_list, related_recipes_conditions, nil, nil, nil, 'RAND()') - recipe - @same_title_recipes_set\n\t\t\n\t\t@favorite_users_set = favorite_users(@recipe.favorites.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t@favorite_users_set_count = @favorite_users_set.size\n\t\t@entried_matches_set = entried_matches(@recipe.entries.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t\n\t\tcurrent = Time.now\n\t\tif @recipe.match_id && (@match = Match.find_by_id_and_entriable_type(@recipe.match_id, 'Recipe')) && @match.doing?(current)\n\t\t\t@entry = @match.find_entry(@recipe)\n\t\tend\t\t\t\t\t\t\t\t\t\t\t\n\t\t\n\t\tshow_sidebar\n\t\t\n\t\trecipe_title = item_title(@recipe)\n\t\trecipe_common_title = @recipe.common_title.strip if !@recipe.common_title.blank?\n\t\trecipe_username = user_username(@recipe.user, true, true)\n\t\trecipe_link_url = item_first_link(@recipe)\n\t\t\n\t\tinfo = \"#{RECIPE_CN} - #{recipe_title}\"\n\t\tset_page_title(info)\n\t\tset_block_title(info)\n\t\t@meta_description = \"这是#{recipe_title}#{add_brackets(recipe_common_title, '(', ')')}的#{RECIPE_CN}信息, 来自#{recipe_username}. \"\n\t\t@meta_keywords = []\n @meta_keywords << @recipe.tag_list if !@recipe.tag_list.blank?\n @meta_keywords += [ recipe_title, recipe_username, recipe_link_url ]\n @meta_keywords << recipe_common_title if !recipe_common_title.blank?\n @meta_keywords += default_meta_keywords('Recipe')\n#\t\t@meta_keywords = [recipe_common_title] + @meta_keywords if !recipe_common_title.blank?\n\n respond_to do |format|\n format.html do\n \tlog_count(@recipe)\n end\n # format.xml { render :xml => @recipe }\n end\n end", "def card_exists?(user)\n all_cards = user.cards.all.count\n all_cards >= 0\n end", "def popular_recipe_card\n RecipeCard.all.select do |recipe_card_ob|\n #binding.pry\n # to test this pry - call this method on an instance of a Recipe\n #(IE - taco.popular_recipe_card)\n recipe_card_ob.recipe == self\n end\nend", "def matchable_users(&block)\n users = @users.values.select { |u| u.sessions.length > 0 && !u.matched }\n block.call users\n end", "def reviews\n Review.all.select do |r|\n r.user == self\n end\n end", "def match\n not_gifted_array = self.users.map{|user| user.id}\n self.users.each do |user|\n while !user.match\n match = not_gifted_array.sample\n if (user.id != match)\n not_gifted_array.delete(match)\n user.update({match: match})\n end\n end\n end\n end", "def selected_recipes\n SelectedRecipe.where(recipe_id: self.id )\n end", "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end", "def cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n end", "def authoringredientrecipesearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def possible_users\n ids = []\n ids = condition.scan(/\\d+/) if condition.present?\n User.where(:id => ids)\n end", "def recommend\n recs = []\n User.all.each do |user|\n if user.hotspots.include?(self)\n user.hotspots.each do |hs|\n recs << hs\n end#user.hotspots end\n end#if include? end\n return recs.uniq\n end#users.each end\n end", "def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end", "def authoringredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n \n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n \n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def find_with_only_user(user)\n uid = user.is_a?(::Starbot::Contact) ? user.id : user\n rooms.values.select{|r| r.users.count == 2 && r.users.map{|u| u.id }.include?(uid) }\n end", "def match\n users_that_match = []\n User.collect_users_and_interests.each do |user, interests_array|\n total_match = count_common_interests(interests_array, self)\n if (is_a_match(total_match) == true) && (user.id != self.id) && (user.location_id == self.location_id)\n users_that_match << user\n end\n end\n users_that_match\n end", "def all_cards(user)\n user.cards.count\n end", "def my_photos\n Photo.all.select do |photo|\n photo.user == self\n end\n end", "def recipes\n @recipes ||= []\n end", "def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end", "def reviews\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review\n # end\n # end\n # output\n Review.all.select { |review| review.user == self }\n end" ]
[ "0.85119873", "0.8280848", "0.8184995", "0.8129581", "0.81121093", "0.8044279", "0.801113", "0.7995644", "0.78879833", "0.78483945", "0.77488613", "0.7734068", "0.77138174", "0.7708338", "0.7701722", "0.766035", "0.7639224", "0.7599163", "0.759865", "0.75705534", "0.7559834", "0.74404335", "0.74120015", "0.7399144", "0.7389077", "0.7163172", "0.71526223", "0.706681", "0.6848689", "0.6824925", "0.6797885", "0.6792777", "0.6773675", "0.6765554", "0.67394024", "0.66160226", "0.65729433", "0.65034735", "0.62465924", "0.6131936", "0.60886264", "0.60516816", "0.6048714", "0.60472137", "0.6034831", "0.6004909", "0.59966964", "0.59747404", "0.59690017", "0.59356683", "0.59219515", "0.59163016", "0.5906172", "0.589679", "0.58939695", "0.5893134", "0.58513844", "0.5829135", "0.58097523", "0.57876474", "0.57480365", "0.57424694", "0.57202166", "0.56823593", "0.5671225", "0.5671225", "0.56329054", "0.56147474", "0.55747503", "0.5526839", "0.55238014", "0.55147004", "0.549556", "0.54692775", "0.5455446", "0.5439153", "0.5425754", "0.5402569", "0.5396476", "0.53951514", "0.53932667", "0.53842896", "0.53746927", "0.53708464", "0.53661513", "0.5363276", "0.53619057", "0.535475", "0.5332036", "0.5323897", "0.5308168", "0.52851653", "0.5285049", "0.5279502", "0.52789235", "0.5266621", "0.5235942", "0.52221906", "0.52184695", "0.52038944" ]
0.775207
10
Recipeingredients should return all of the ingredients in this recipe
def ingredients RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end", "def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end", "def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end", "def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end", "def ingredients\n RecipeIngredients.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end", "def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingre|\n recipe_ingre.recipe == self\n end.map {|recipe_ingre| recipe_ingre.ingredient}\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end", "def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end", "def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end", "def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end", "def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end", "def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end", "def recipes\n return self.selected_recipes.map do |selected_recipe|\n selected_recipe.recipe\n end\n # recipes = []\n # self.selected_recipes.each do |selected_recipe|\n # recipes << selected_recipe.recipe\n # end\n # return recipes\n end", "def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end", "def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end", "def allergens\n # first get an array of all possible allergic ingredients\n allergic_ingredients = Allergen.all.map do |allergen|\n allergen.ingredient\n end.uniq\n\n # iterate through this recipes ingredients and see if they're\n # in the list of allergic ingredients\n self.ingredients.select do |ingredient|\n allergic_ingredients.include? ingredient\n end\n end", "def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end", "def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end", "def ingredients\n Ingredient.all.select do |ingredient_instance|\n ingredient_instance.makes == self\n end\n end", "def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end", "def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end", "def get_recipes(recipe_name, recipe_tag, recipe_ingredients)\n\t\t\t\trecipes_ids = Set.new\n\t\t\t\tingredients_upcase = Set.new\n\t\t\t\t#search by\n\t\t\t\tcase\n\t\t\t\twhen !recipe_name.blank?\n\t\t\t\t\trecipes_ids = Recipe.where('UPPER(name) LIKE UPPER(?)', \"%#{recipe_name}%\").pluck(:id)\n\t\t\t\twhen !recipe_tag.blank?\n\t\t\t\t\trecipes_ids = RecipeTag.where('UPPER(tag) LIKE UPPER(?)', \"%#{recipe_tag}%\").pluck(:recipe_id)\n\t\t\t\twhen !recipe_ingredients.blank?\n\n\t\t\t\t\tingredients = recipe_ingredients.to_s.delete \"[\"\n\t\t\t\t\tingredients = ingredients.delete \"]\"\n\t\t\t\t\tingredients = ingredients.delete \" \"\n\n\t\t\t\t\tingredients_array = ingredients.split(\",\") \n\n\t\t\t\t\tingredients_array.each do |ingredient|\n\t\t\t\t\t\tingredients_upcase << ingredient.upcase\n\t\t\t\t\tend\n\n\t\t\t\t\trecipes_ids = RecipeIngredient.where('UPPER(ingredient) IN (?)', ingredients_upcase).pluck(:recipe_id)\n\t\t\t\telse\n\t\t\t\t\trecipes_ids = Recipe.all.pluck(:id)\n\t\t\t\tend\n\t\t\t\t#get recipes matching the ID\n\t\t\t\tif !recipes_ids.blank?\n\t\t\t\t\trecipes = Recipe.where(\"id IN (?)\", recipes_ids).order('created_at DESC')\n\t\t\t\t\t#get tags and ingredients for each recipe\n\t\t\t\t\trecipes.each do |recipe|\n\t\t\t\t\t\trecipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)\n\t\t\t\t\t\trecipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)\n\t\t\t\t\tend\n\n\t\t\t\t\treturn recipes\n\t\t\t\tend\n\t\t\tend", "def get_ingredients_names\n self.ingredients.map{|ingredient| ingredient.name}\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end", "def all\n # returns all recipes\n @recipes\n end", "def ingredient_names\n self.ingredients.map do |ing|\n ing.name\n end\n end", "def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end", "def allergens\n ingredients.select { |i| Allergen.ingredients.include?(i) }\n end", "def recipes\n @recipes ||= []\n end", "def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end", "def print_needed_ingredients\n puts \"\\n\\n\\s\\e[4m#{self.name} Recipe\\e[0m\"\n self.ingredients.each { |ingredient| puts \"\\s- #{ingredient.name}: #{RecipeIngredient.find_by(recipe_id: self.id, ingredient_id: ingredient.id).amount} cl\" }\n if self.recipe_specials.collect{|x| x.special if x.special}.uniq != [nil]\n self.recipe_specials.collect{|x| x.special if x.special}.uniq.each{|y| puts \"\\s- Special: #{y}\"}\n elsif self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq != [nil]\n puts \"\\s- Garnish: #{self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq[0]}\"\n end\n puts \"\\s- Preparation: #{self.preparation}\"\n end", "def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end", "def all\n return @recipes\n end", "def safe_recipes\n #want all of the recipes that do not contain ingredients in allergens (array of ingredients)\n #look through all of our recipes\n my_ingredients = self.recipes.map do |recipe|\n #for each recipe, get the ingredients\n recipe.ingredients #array, map makes it an array within an array\n end.flatten.uniq\n #see if any of those ingredients are not our allergens\n my_safe_ingredients = my_ingredients.select do |ingredient|\n !(self.allergens.include?(ingredient))\n end\n #select all recipe ingredients that have our safe ingredients\n my_safe_ris = RecipeIngredient.all.select do |ri|\n my_safe_ingredients.include?(ri.ingredient)\n end\n #return the recipe\n my_safe_ris.map do |ri|\n ri.recipe\n end\n\n end", "def allergens_ingredients\r\n Allergen.all.select {|allergen| allergen.ingredient == self}\r\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def allergens\n allergy_for_this_recipe = Allergy.all.select do |allergy|\n ingredients.include?(allergy.ingredient)\n end\n allergy_for_this_recipe.map do |allergy|\n allergy.ingredient\n end.uniq\n end", "def items_for_recipe(recipe)\n\t\t# Everything will be stored in terms of ounces\n\t\tids = []\n\t\t# Loop through the structured ingredients\n\t\trecipe.each do |r|\n\t\t\t# Pull all items from database with matching length\n\t\t\titems = Item.allForName(r[\"name\"])\n\t\t\t# Mostly for proof of concept, if there is only one item matching, add it to the list.\n\t\t\tif items.length == 1\n\t\t\t\tids << items.first.id\n\t\t\telse\n\t\t\t\t# Loop through resulting items from database.\n\t\t\t\titems.each do |item|\n\t\t\t\t\t# Compare quantities, if the recipe calls for a quantity of less than the item,\n\t\t\t\t\t# add it to the database and exit the loop. \n\t\t\t\t\tif r[\"qty\"] <= item.qty\n\t\t\t\t\t\tids << item.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Return the list of matching IDs\n\t\treturn ids\n\tend", "def index\n @recipeingredients = Recipeingredient.all\n end", "def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end", "def allergens\n ingredients_array=[]\n ingredients.each do |ingredient|\n # binding.pry\n if ingredient.allergens\n # binding.pry\n ingredients_array << ingredient.allergens\n end\n end\n arr= ingredients_array.flatten.map do |allergen|\n allergen.ingredient\n end\n arr.uniq\n end", "def index\n @ingredient_recipes = IngredientRecipe.all\n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end", "def ingredients(url)\n recipe_html_string = open(url).read\n\n recipe = Hangry.parse(recipe_html_string)\n ingredients = recipe.ingredients.map{\n |ingredient|\n Ingreedy.parse(ingredient)\n }\n end", "def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend", "def index\n @recipe_ingredients = RecipeIngredient.all\n end", "def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def custom_regimen_ingredients\n arv_extras_concepts = Concept.joins(:concept_names).where(\n concept_name: { name: ['INH', 'CPT', 'Pyridoxine', 'Rifapentine', 'INH / RFP'] }\n )\n Drug.where(concept: arv_extras_concepts) + Drug.arv_drugs.order(name: :desc)\n end", "def model_ingredients(args)\n options = set_model_ingredients_defaults(args)\n set_common_options(options)\n set_model_ingredients_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all ingredients\n obj_list = Ingredient.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end", "def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def recipes\n @recipes.sort.collect {|id| $data_recipes[id] }\n end", "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end", "def getIngredientsNames\n \tingArray = []\n \tingredients.each do |ingredient|\n \t\tingArray.push(ingredient.name)\n \tend\n \treturn ingArray\n end", "def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end", "def inline_ingredients\n ingredients.to_a.map(&:name).join(' ')\n end", "def get_recipe_ingredient_list(url, ingredients, a, need, got)\n page = HTTParty.get(url)\n parse_page = Nokogiri::HTML(page)\n scraped_ingredient = []\n parse_page.css(\".ingredient-description\").map do |a|\n ing = a.text\n scraped_ingredient.push(ing)\n end\n\n for i in scraped_ingredient\n j = 0\n while j < a\n if i.downcase.include?(ingredients[j].downcase) == false\n need.push(i)\n j += 1\n else\n got.push(i)\n j += 1\n end\n end\n end\nend", "def allergens\n self.ingredients.select{|ing|\n allergen_ingredients.include?(ing)}\n end", "def all\n return @recipearray\n end", "def safe_recipes\n #Look at each allergen. Look at each recipeingredient to determine if any ingredients match any allergens. return recipe if not\n allergens = self.user_allergens ##array of allergies (ingredients objects)\n ri_array = RecipeIngredient.all\n binding.pry\n allergens.each do |allergen|\n binding.pry\n ri_array.delete_if {|recipeingredient| recipeingredient.ingredient == allergen}\n end\n binding.pry\n ri_array.map {|recipeingredient| recipeingredient.recipe}\n\n\n end", "def index\n @recipe_ingredients_units = RecipeIngredientsUnit.all\n end", "def index\n recipe_items = current_user.recipes.includes(recipe_items: :ingredient).find(params[:recipe_id]).recipe_items\n render json: { recipe_items: recipe_items}.to_json(include: :ingredient), status: :ok\n end", "def for_ingredient_group(ingredient_group_id)\n ingredient_group = IngredientGroup.find_by_id(ingredient_group_id)\n if ingredient_group.present?\n recipe_ingredients = RecipeIngredient.where(:ingredient_id => ingredient_group.ingredient_ids )\n recipes = recipe_ingredients.collect {|ri| ri.recipe }\n return recipes.uniq\n end\n return [ self.approved, FAIL_SEARCH_MESSAGE ]\n end", "def find_ingredients\n self.content.scan(/E\\d{3,4}|E.\\d{3,4}/).map do |number|\n Ingredient.where([\"substring(number from '\\\\d+')::integer = ?\", number])\n end.flatten.map(&:id).uniq\n end", "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end", "def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end", "def get_recipe_titles(user_ingredients)\n \n search_params = 'http://www.recipepuppy.com/api/?i=' + user_ingredients.join(\",\")\n \n\n recipes = []\n search_string = RestClient.get(search_params)\n search_hash = JSON.parse(search_string)\n relevant_recipes = search_hash[\"results\"]\n relevant_recipes.collect do |recipe|\n recipes << recipe[\"title\"].strip\n end\n \n recipes\nend", "def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def allergens\n self.ingredients.map do |ingredient|\n Allergen.all.map do |allergen|\n ingredient if allergen.ingredient_O == ingredient\n end.compact\n end.flatten.uniq\n end", "def get_recipe_ingredients\n puts \"\\nWhat ingredients are in your recipe? Please enter ingredients separated by commas with no ands.\\n \".colorize(:green).bold\n user_ingredients = gets.strip\n if valid_user_input?(user_ingredients)\n user_ingredients.split(/\\s*\\,\\s*/)\n else\n puts \"\\nInvalid ingredients!\\n \".colorize(:red).bold\n get_recipe_ingredients\n end\n end", "def allergens\n self.ingredients.select do |ingre|\n Allergy.all.map {|allergy| allergy.ingredient}.uniq.include?(ingre)\n end\n end", "def get_ingredients \n # get rid of all characters that are not: a-z A-Z 0-9 - [] () . ' / , blank;\n clean_ingredients = self.ingredients.gsub(%r{[^a-zA-Z0-9\\-\\[\\]\\.\\,\\'\\(\\)\\/\\s]}, '')\n return clean_ingredients.split(', ').each { |ingredient| ingredient.strip! }\n end", "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end", "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "def add_ingredients(ingredients_array)\n # ingredients_array[0] = RecipeIngredient.new(name, ingredients_array[0], self)\n ingredients_array.each do |ingredient|\n RecipeIngredient.new(ingredient.name, ingredient, self)\n end\n end", "def ingredients_list\n ing_gen(\"Large onion\", \"1\") #1\n ing_gen(\"Garlic cloves\", \"4\")\n ing_gen(\"Fresh parsley\", \"1/4 cup\")\n ing_gen(\"Mozzarella\", \"1 lb\") #4\n ing_gen(\"Whole peeled tomatoes\", \"3 12-ounce cans\") #5\n ing_gen(\"Dried penne\", \"1 lb\")\n ing_gen(\"Salt\", \"to taste\")\n ing_gen(\"Extra virgin olive oil\", \"2 tablespoons\")\n ing_gen(\"Chicken stock\", \"1 cup\")\n ing_gen(\"Spicy italian sausage\", \"1 lb\")\n ing_gen(\"Dried oregano\", \"1 tablespoon\")\n ing_gen(\"Crushed red pepper\", \"1 teaspoon\")\n ing_gen(\"Unsalted butter\", \"2 tablespoon\")\n ing_gen(\"Heavy cream\", \"1 cup\")\n ing_gen(\"Ricotta\", \"12 ounces\")\n #ing_gen(\"Parmigiano-Reggiano\", \"3 ounces\")\n\n puts \"#{@ingredients.length}\"\n puts \"Ingredient:\\t\\t Amount\"\n\n i = 0\n while i < @ingredients.length\n j = i + 1\n puts \" > #{@ingredients[i]}\\t\\t #{@ingredients[j]}\"\n i += 2\n end\nend", "def recipe_ingredients(perfect_10_recipe)\n return perfect_10_recipe\nend", "def potential_allergen_ingredients\n allergens.map{ [_1, find_allergen_ingredients(_1)] }\n end", "def set_recipes\n @recipes = Recipe.includes(:ingredients).all #includes will cache the ingredients info and keep it there for later use, instead of querying again for this info later when it is needed\n @message = \"No Recipes Found\" if @recipes.empty?\n end", "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end", "def associate_ingredients_to_recipes\n Recipe.all.each do |recipe|\n 5.times do\n recipe.ingredients << Ingredient.all.sample\n end\n \n recipe.ingredients = recipe.ingredients.uniq\n \n while recipe.ingredients.count < 5\n recipe.ingredients << Ingredient.all.sample\n recipe.ingredients = recipe.ingredients.uniq\n end\n end\nend", "def recipe_ingredients(recipe_hash)\n recipe_hash.each do |ingredient,amount|\n \"#{amount} of #{ingredient}\"\n end\nend", "def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end", "def ingredients\n rec_ing_arr = RecipeIngredient.all.select do |recipe_ingredient_ob|\n #binding.pry\n recipe_ingredient_ob.recipe == self\n end\n rec_ing_arr.map do |recipe_ob|\n recipe_ob.ingredient\n end\nend", "def shopping_list\n self.ingredients.map {|i| i.name}.uniq\n end", "def by_ingredients(query)\n # \"OR\" behavior by default\n apply_filter_list \"ingredients\", query\n\n self\n end" ]
[ "0.831865", "0.81206983", "0.8068893", "0.7958368", "0.7869872", "0.77806467", "0.77555805", "0.77555805", "0.7738875", "0.77230746", "0.77155066", "0.7692386", "0.759416", "0.753531", "0.75210756", "0.7517456", "0.74817824", "0.745634", "0.74436855", "0.74042046", "0.73536646", "0.725873", "0.7229523", "0.72022766", "0.718775", "0.7186629", "0.71693534", "0.71629876", "0.7142137", "0.7141315", "0.71260625", "0.7081678", "0.70779395", "0.7069181", "0.7049461", "0.70220095", "0.70199645", "0.70006746", "0.7000582", "0.6983815", "0.69733715", "0.69695413", "0.6960469", "0.69519657", "0.6908756", "0.6876827", "0.6876827", "0.6876827", "0.6874854", "0.68670356", "0.6850256", "0.68234414", "0.67909956", "0.67905974", "0.6779405", "0.6767383", "0.67655975", "0.6762858", "0.6749265", "0.67196554", "0.67123127", "0.6663693", "0.6656897", "0.6637358", "0.6622277", "0.6599221", "0.65983826", "0.6590955", "0.65784425", "0.65567046", "0.6555964", "0.6554787", "0.6543645", "0.6540924", "0.6527809", "0.65228647", "0.65184295", "0.65170795", "0.65145373", "0.65138936", "0.6501261", "0.6492126", "0.64740545", "0.6461855", "0.6457886", "0.6439906", "0.64331174", "0.6426683", "0.6425115", "0.64127684", "0.64088154", "0.6408793", "0.63829356", "0.638254", "0.63772744", "0.6354167", "0.6353988", "0.63494474", "0.6337528", "0.6331161" ]
0.778758
5
Recipeallergens should return all of the ingredients in this recipe that are allergens
def allergens ingredients.select { |i| Allergen.ingredients.include?(i) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allergens\n # first get an array of all possible allergic ingredients\n allergic_ingredients = Allergen.all.map do |allergen|\n allergen.ingredient\n end.uniq\n\n # iterate through this recipes ingredients and see if they're\n # in the list of allergic ingredients\n self.ingredients.select do |ingredient|\n allergic_ingredients.include? ingredient\n end\n end", "def allergens\n allergy_for_this_recipe = Allergy.all.select do |allergy|\n ingredients.include?(allergy.ingredient)\n end\n allergy_for_this_recipe.map do |allergy|\n allergy.ingredient\n end.uniq\n end", "def allergens\n self.ingredients.map do |ingredient|\n Allergen.all.map do |allergen|\n ingredient if allergen.ingredient_O == ingredient\n end.compact\n end.flatten.uniq\n end", "def allergens\n unique_allergen_ingredients = Allergen.all.map do |allergen|\n allergen.ingredient\n end.uniq\n\n (self.ingredients & unique_allergen_ingredients)\n end", "def allergens\n self.allergy.map do |allergen|\n allergen.ingredient\n end.uniq\n end", "def allergens_ingredients\r\n Allergen.all.select {|allergen| allergen.ingredient == self}\r\n end", "def allergens\n self.ingredients.select do |ingre|\n Allergy.all.map {|allergy| allergy.ingredient}.uniq.include?(ingre)\n end\n end", "def allergens\n ingredients_array=[]\n ingredients.each do |ingredient|\n # binding.pry\n if ingredient.allergens\n # binding.pry\n ingredients_array << ingredient.allergens\n end\n end\n arr= ingredients_array.flatten.map do |allergen|\n allergen.ingredient\n end\n arr.uniq\n end", "def allergens\n self.ingredients.select{|ing|\n allergen_ingredients.include?(ing)}\n end", "def allergens\r\n\t\tallergies = Allergen.all.select do |allergen|\r\n\t \t\tallergen.ingredient == self\r\n\t \tend\r\n\tend", "def allergens\r\n Allergen.all.select do |allergen|\r\n allergen.ingredient == self\r\n end\r\n end", "def potential_allergen_ingredients\n allergens.map{ [_1, find_allergen_ingredients(_1)] }\n end", "def allergens\n Allergen.all.select { |a| a.user == self }.map { |a| a.ingredient }\n end", "def allergens\n my_allergies = Allergy.all.select do |allergy|\n allergy.user == self\n end\n my_allergies.map do |allergy|\n allergy.ingredient\n end\n end", "def allergens\n allergen_array = Allergen.all.select do |allergen|\n allergen.user == self\n end\n\n allergen_array.map do |allergen|\n allergen.ingredient\n end\n end", "def allergens\n users_allergens = Allergen.all.select { |allergen| allergen.user == self}\n users_allergens.collect {|allergen| allergen.ingredient}\n end", "def allergens\n ing = self.ingredients\n ing.select do |ingredient|\n Allergen.all.any? do |allergen|\n allergen.ingredient == ingredient\n end\n end\n\n end", "def allergens\n self.ingredients.each do |ingredient|\n Allergen.all.each do |alergy|\n alergy.ingredient == ingredient\n end\n end\n end", "def allergens\n #Loop through Allergy\n #Find allergies for that user\n #Return ingredients that user is allergic to \n user_allergies = Allergy.all.select do |allergy|\n allergy.user == self\n end\n user_allergies.map do |allergy|\n allergy.ingredient\n end\n end", "def allergens\n array = []\n Allergen.all.each do |allergen_instance|\n ingredients.each do |ingredient|\n if allergen_instance.ing == ingredient\n array << allergen_instance.ing\n end\n end\n end\n array\nend", "def allergens\n Allergen.all.map {|allergen| allergen.ingredient_O if allergen.user_O == self}.compact\n end", "def allergens_ingredients\n Allergen.all.select {|allergen| allergen.user == self}\n end", "def allergens\n allergy_instances = Allergy.all.select do |allergy|\n self.ingredients.include?(allergy.ingredient)\n end \n end", "def allergens\n ingredients & Allergy.ingredients \n end", "def allergens\n Allergy.all.map do |x|\n if x.user.name == self.name\n x.ingredient.name\n end\n end\n end", "def safe_recipes\n #Look at each allergen. Look at each recipeingredient to determine if any ingredients match any allergens. return recipe if not\n allergens = self.user_allergens ##array of allergies (ingredients objects)\n ri_array = RecipeIngredient.all\n binding.pry\n allergens.each do |allergen|\n binding.pry\n ri_array.delete_if {|recipeingredient| recipeingredient.ingredient == allergen}\n end\n binding.pry\n ri_array.map {|recipeingredient| recipeingredient.recipe}\n\n\n end", "def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end", "def allergens ###?????\n a = Allergen.all.select do |user_ingr| \n user_ingr.user == self\n end\n a.map do |ing| #binding.pry\n ing.ingredient \n #.name\n end\n end", "def match_allergens\n matched = {}\n dangerous = potential_allergen_ingredients\n until dangerous.empty?\n # NOTE: Find a single-item ingredient list\n allergen, ingredient = dangerous.find{ _2.size == 1 }\n matched[allergen] = ingredient.first\n\n # NOTE: Now remove the matched ingredient; this removes the\n # matched ingredient from the other ingredient lists.\n dangerous = dangerous.map{ [_1, _2 - ingredient] }\n\n # NOTE: Now remove the matched allergen\n dangerous = dangerous.reject{ _1.first == allergen }\n end\n matched\n end", "def safe_recipes\n #want all of the recipes that do not contain ingredients in allergens (array of ingredients)\n #look through all of our recipes\n my_ingredients = self.recipes.map do |recipe|\n #for each recipe, get the ingredients\n recipe.ingredients #array, map makes it an array within an array\n end.flatten.uniq\n #see if any of those ingredients are not our allergens\n my_safe_ingredients = my_ingredients.select do |ingredient|\n !(self.allergens.include?(ingredient))\n end\n #select all recipe ingredients that have our safe ingredients\n my_safe_ris = RecipeIngredient.all.select do |ri|\n my_safe_ingredients.include?(ri.ingredient)\n end\n #return the recipe\n my_safe_ris.map do |ri|\n ri.recipe\n end\n\n end", "def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end", "def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end", "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end", "def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end", "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n RecipeIngredients.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingre|\n recipe_ingre.recipe == self\n end.map {|recipe_ingre| recipe_ingre.ingredient}\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end", "def ingredients\n RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }\n end", "def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def ingredients\n Ingredient.all.select do |ingredient_instance|\n ingredient_instance.makes == self\n end\n end", "def print_needed_ingredients\n puts \"\\n\\n\\s\\e[4m#{self.name} Recipe\\e[0m\"\n self.ingredients.each { |ingredient| puts \"\\s- #{ingredient.name}: #{RecipeIngredient.find_by(recipe_id: self.id, ingredient_id: ingredient.id).amount} cl\" }\n if self.recipe_specials.collect{|x| x.special if x.special}.uniq != [nil]\n self.recipe_specials.collect{|x| x.special if x.special}.uniq.each{|y| puts \"\\s- Special: #{y}\"}\n elsif self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq != [nil]\n puts \"\\s- Garnish: #{self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq[0]}\"\n end\n puts \"\\s- Preparation: #{self.preparation}\"\n end", "def translate_allergens\n potential_allergen_ingredients.map(&:last).flatten.sort.uniq\n end", "def index\n @allergens_ingredients = AllergensIngredient.all\n end", "def all\n # returns all recipes\n @recipes\n end", "def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end", "def all\n return @recipes\n end", "def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end", "def clean_up_user_recipes\n\n allergen_found = 0\n\n self.recipes.each do |r|\n i = r.ingredients.compact\n\n # for each ingredient\n i.each do |ingr| \n ## see if user is allergic\n get_allergy_ids.each do |ua_id|\n if (ingr.allergen1_id == ua_id) or (ingr.allergen2_id == ua_id) or (ingr.allergen3_id == ua_id)\n allergen_found = 1\n break\n end\n end\n end\n ## set active to false if user has selected an allergy that conflicts with the recipe\n if allergen_found == 1 \n ur = UsersRecipe.find(:first, :conditions => {:user_id => self.id, :recipe_id => r.id})\n ur.active = false\n ur.save! \n end\n allergen_found = 0\n end \n end", "def safe_recipes\n all_recipes = RecipeCard.all.map { |c| c.recipe }\n all_recipes.uniq.select { |r| (allergens & r.ingredients).empty? }\n end", "def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end", "def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def bakery\n\t\tDessert.all.select do |dessert_obj|\n\t\t\tdessert_obj.ingredient == self\n\t\tend.map do |obj|\n\t\t\tobj.bakery\n\t\tend\n\tend", "def for_ingredient_group(ingredient_group_id)\n ingredient_group = IngredientGroup.find_by_id(ingredient_group_id)\n if ingredient_group.present?\n recipe_ingredients = RecipeIngredient.where(:ingredient_id => ingredient_group.ingredient_ids )\n recipes = recipe_ingredients.collect {|ri| ri.recipe }\n return recipes.uniq\n end\n return [ self.approved, FAIL_SEARCH_MESSAGE ]\n end", "def allergen?\r\n !!Allergen.all.find do |allergen|\r\n allergen.ingredient == self\r\n end\r\n end", "def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end", "def safe_recipes\n safe_recipes_array =[]\n #get all the recipies of a user\n all_user_rec = self.recipes\n #get user allergens\n user_allergens = self.allergens\n all_user_rec.each do |recipe|\n y = 0\n recipe.ingredients.each do |ingredient|\n if user_allergens.include?(ingredient)\n y = 1\n end\n end\n safe_recipes_array << recipe if y == 0\n end\n safe_recipes_array\n\n #return array of recipe objects that are safe\n\n end", "def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def custom_regimen_ingredients\n arv_extras_concepts = Concept.joins(:concept_names).where(\n concept_name: { name: ['INH', 'CPT', 'Pyridoxine', 'Rifapentine', 'INH / RFP'] }\n )\n Drug.where(concept: arv_extras_concepts) + Drug.arv_drugs.order(name: :desc)\n end", "def allergens\n Allergy.all.select{|allergies| allergies.user == self}\n end", "def allergens\n Allergen.all.select do |allergen|\n allergen.user == self\n end.map do |ele|\n ele.allergy_name\n end\n end", "def all\n return @recipearray\n end", "def recipes\n return self.selected_recipes.map do |selected_recipe|\n selected_recipe.recipe\n end\n # recipes = []\n # self.selected_recipes.each do |selected_recipe|\n # recipes << selected_recipe.recipe\n # end\n # return recipes\n end", "def allergens\n\t\tAllergen.all.select { |allergen| allergen.user == self }\n\tend", "def set_allergens_ingredient\n @allergens_ingredient = AllergensIngredient.find(params[:allergens_ingredients_id])\n end", "def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end", "def transport_ingredients_to_glass\n\n # Abort if there is no glass inside the replicator.\n return unless glass_inside_replicator\n\n # Go through recipe and transport each ingredient\n # from pantry to glass, one by one.\n @recipe.ingredients.each do |ingredient_name|\n @enterprise.transporter.energize(\n @enterprise.pantry.find_ingredient(ingredient_name),\n @enterprise.pantry.shelf,\n glass_inside_replicator.inside\n )\n end\n end", "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end", "def allergens\n Allergen.all.select do |allergen_instance|\n if allergen_instance.user == self\n return allergen_instance.ing\n end\n end\n end", "def ingredient_names\n self.ingredients.map do |ing|\n ing.name\n end\n end", "def allergens\n users.map do |user_ob|\n #binding.pry\n user_ob.allergens.each do |allergen_ob|\n #binding.pry\n allergen_ob\n end\n end.flatten\nend", "def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end", "def by_ingredient_search(query)\n ingredient_query = Ingredient.where('name LIKE ?', \"%#{query}%\")\n if ingredient_query.any?\n return self.approved.where(:id => ingredient_query.collect(&:recipes).flatten.uniq.collect(&:id))\n end\n return self.approved\n end", "def get_ingredients_names\n self.ingredients.map{|ingredient| ingredient.name}\n end", "def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end", "def getIngredientsNames\n \tingArray = []\n \tingredients.each do |ingredient|\n \t\tingArray.push(ingredient.name)\n \tend\n \treturn ingArray\n end", "def ingredients\n rec_ing_arr = RecipeIngredient.all.select do |recipe_ingredient_ob|\n #binding.pry\n recipe_ingredient_ob.recipe == self\n end\n rec_ing_arr.map do |recipe_ob|\n recipe_ob.ingredient\n end\nend", "def allergens\n Allergen.all.select do |allergy|\n allergy.user == self \n end \n end", "def show\n recipe_ingredients = RecipeIngredient.where(recipe_id: @recipe[:id])\n recipe_ingredient_ids = recipe_ingredients.pluck(:ingredient_id)\n @recipe_ingredients = recipe_ingredients.group_by(&:ingredient_id)\n @ingredients_like_ids = []\n fridge_items = FridgeItem.all\n fridge_items.each do |fi|\n @ingredients_like_ids << find_ingredients_like(fi.ingredient_id)\n end\n @ingredients_like_ids.flatten!\n @ingredients = Ingredient.find(recipe_ingredient_ids)\n @fridge_item_ids = []\n @ingredients.each do |ingredient|\n if @ingredients_like_ids.include?(ingredient.id)\n @fridge_item_ids << ingredient.id\n end\n end\n @fridge_item = FridgeItem.new\n end", "def ingredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.all.find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.all.find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end \n return @recipes\n end", "def shopping_list\n self.ingredients.map {|i| i.name}.uniq\n end", "def extract_ingredients(meal_data, main_ingredient)\n # if COUNTER < 100\n # result = []\n meal_data[\"meals\"].each do |meal|\n for i in 1..20 do\n if meal[\"strIngredient#{i}\"]\n if meal[\"strIngredient#{i}\"].downcase == main_ingredient.downcase\n puts meal\n end\n else\n get_recipes_from_api(main_ingredient)\n puts meal\n end\n end\n # if result.length == 0\n # get_recipes_from_api(main_ingredient)\n # end\n # # COUNTER += 1\n # # else\n # # p \"Sorry, can't find #{main_ingredient}\"\n # end\n # p result\nend\nend", "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end", "def recipeingredientsearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def all_there?(recipe, on_hand)\n recipe.keys.each do |ingredient|\n return false if !(on_hand.keys.include? ingredient)\n end\n\n true\nend", "def by_ingredients(query)\n # \"OR\" behavior by default\n apply_filter_list \"ingredients\", query\n\n self\n end", "def allergens_ingredient_params\n params.require(:allergens_ingredient).permit(:ingredient_id, :allergen_id)\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end", "def ingredients_list\n ing_gen(\"Large onion\", \"1\") #1\n ing_gen(\"Garlic cloves\", \"4\")\n ing_gen(\"Fresh parsley\", \"1/4 cup\")\n ing_gen(\"Mozzarella\", \"1 lb\") #4\n ing_gen(\"Whole peeled tomatoes\", \"3 12-ounce cans\") #5\n ing_gen(\"Dried penne\", \"1 lb\")\n ing_gen(\"Salt\", \"to taste\")\n ing_gen(\"Extra virgin olive oil\", \"2 tablespoons\")\n ing_gen(\"Chicken stock\", \"1 cup\")\n ing_gen(\"Spicy italian sausage\", \"1 lb\")\n ing_gen(\"Dried oregano\", \"1 tablespoon\")\n ing_gen(\"Crushed red pepper\", \"1 teaspoon\")\n ing_gen(\"Unsalted butter\", \"2 tablespoon\")\n ing_gen(\"Heavy cream\", \"1 cup\")\n ing_gen(\"Ricotta\", \"12 ounces\")\n #ing_gen(\"Parmigiano-Reggiano\", \"3 ounces\")\n\n puts \"#{@ingredients.length}\"\n puts \"Ingredient:\\t\\t Amount\"\n\n i = 0\n while i < @ingredients.length\n j = i + 1\n puts \" > #{@ingredients[i]}\\t\\t #{@ingredients[j]}\"\n i += 2\n end\nend", "def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end", "def vegan_recipe\n Recipe.where(vegan: true).map { |n| n.recipe_payload }\n end" ]
[ "0.8864544", "0.8522095", "0.83239913", "0.831388", "0.82978874", "0.82944256", "0.8280847", "0.8275587", "0.82043684", "0.81491953", "0.81074446", "0.80986637", "0.7996668", "0.798221", "0.79390764", "0.79221576", "0.7914425", "0.7863859", "0.7794745", "0.7776271", "0.773701", "0.7582076", "0.75202537", "0.7419651", "0.7393913", "0.72425705", "0.7182828", "0.714428", "0.7139378", "0.7132233", "0.7129847", "0.71018076", "0.70329076", "0.70278335", "0.70208025", "0.70061123", "0.700396", "0.700396", "0.6991714", "0.69780207", "0.69778746", "0.6977635", "0.6949223", "0.6933772", "0.68792236", "0.68134815", "0.6763194", "0.67567074", "0.67262745", "0.6599221", "0.6590035", "0.65785426", "0.65632105", "0.6522173", "0.65219635", "0.649792", "0.6484873", "0.64707845", "0.64707845", "0.64707845", "0.6466602", "0.646338", "0.645572", "0.6432465", "0.63965416", "0.6358761", "0.6324617", "0.62889844", "0.62880296", "0.6265941", "0.6230173", "0.62005115", "0.61940616", "0.61848456", "0.61794597", "0.61746776", "0.6152507", "0.6139496", "0.6122137", "0.60993725", "0.60678846", "0.60644203", "0.6051512", "0.6041019", "0.60031843", "0.5979001", "0.59272236", "0.5921808", "0.59200376", "0.5911646", "0.5897245", "0.58893156", "0.5878692", "0.5866801", "0.58432317", "0.5834724", "0.5823101", "0.5793071", "0.57904613", "0.5785385" ]
0.8500018
2
Recipeadd_ingredients should take an array of ingredient instances as an argument, and associate each of those ingredients with this recipe
def add_ingredients(ingredients) ingredients.each { |i| RecipeIngredient.new(self, i) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end", "def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend", "def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end", "def add_ingredients(ingredients_array)\n # ingredients_array[0] = RecipeIngredient.new(name, ingredients_array[0], self)\n ingredients_array.each do |ingredient|\n RecipeIngredient.new(ingredient.name, ingredient, self)\n end\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end", "def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end", "def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end", "def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end", "def add_ingredients(arr_of_ingredient_ids)\n arr_of_ingredient_ids.each do |id|\n RecipeIngredient.find_or_create_by(\n recipe_id: self.id,\n ingredient_id: id\n )\n end\n end", "def add_ingredients(ingredients)\n RecipeIngredient.new(ingredients, self)\nend", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end", "def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end", "def add_ingredients(new_ingredients_arr)\n new_ingredients_arr.each do |new_ingredients|\n #binding.pry\n RecipeIngredient.new(self, new_ingredients)\n end\nend", "def add_ingredient(ingredient)\n @ingredients.push(ingredient)\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 @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end", "def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: recipe.id\n end\n end", "def create_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 add_ingredient(ingredient)\n\t\t@ingredients.push(ingredient)\n\tend", "def ingredient_logic(ingredient)\n if all_ingredients.include?(ingredient)\n new_recipe_ingredient = ingredient_instance(ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n else\n new_recipe_ingredient = Ingredient.create(name: ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n end\n end", "def 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 add_ingredientusers(ingredients)\n ingredients.each {|ingredient| IngredientUser.create(user_id: self.id, ingredient_id: ingredient.id)}\n end", "def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end", "def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end", "def add_recipe(recipe:, multiplier: 1)\n full_names = recipe.ingredients_full_names(multiplier: multiplier)\n full_names.map { |ingredient| create_task(ingredient) }\n # TODO: count the responses instead of the given list\n full_names.count\n end", "def add_ingredient(r,i)\n new_ingredient_pair = gets_new_ingredient_pair\n i << new_ingredient_pair\nend", "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 test_add_multiple_recipes\n\t\tputs \"TEST 5\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\n\t\t@db.addFood(\"burger\", \"124124\")\n\t\t@db.addFood(\"Bacon\", \"814\")\n\t\t@db.addFood(\"Lettuce\", \"12\")\n\t\t@db.addFood(\"Tomato\",\"14\")\n\t\t@db.addRecipe(\"BLT\" , [\"bacon\",\"lettuce\",\"tomato\"])\n\t\t@db.addRecipe(\"Bacon Burger\", [\"Bacon\",\"burger\"])\n\n\t\tassert( @db.size == 6, \"There should be 6 items in db, 4 foods, 2 recipes\")\n\t\tassert( @db.is_Recipe?(\"BLT\") , \"Should be BLT recipe\" )\n\t\tassert( @db.is_Recipe?(\"Bacon Burger\") , \"bacon burger should be a recipe\" )\n\t\t\n\t\t@db.addRecipe(\"BLT\" , [\"bacon\",\"lettuce\",\"tomato\"])\n\t\tassert( @db.size == 6, \"Cannot add duplicate recipies\")\n\n\t\t@db.addRecipe(\"NewRecipe\", [])\n\t\tassert( @db.size == 6, \"cannot add recipe with empty foods\")\n\n\t\t@db.addRecipe(\"Copy Recipe\", [\"bacon\", \"bacon\"])\n\t\tassert( @db.size == 7, \"Size should be 7, add copy food on recipe\")\n\n\tend", "def add_recipe(recipe)\n @recipes.push(recipe)\n save\n end", "def ingredient_add_helper(recipe_id)\n added_ingredient = prompt.ask(\"What ingredient would you like to add\")\n new_recipe_ingredient_arr = user.recipes.where(id: recipe_id)[0].ingredient.split(\", \") << added_ingredient\n ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n end", "def ingredients_attributes=(ingredients_hash)\n ingredients_hash.each do |i|\n ingredient = Ingredient.find_or_create_by(name: i[:name], quantity: i[:quantity])\n self.ingredients << ingredient\n end\nend", "def add_recipe(recipe)\n if database.has_key? recipe[0]\n puts('Recipe already in Database.')\n else\n ingredients_list = []\n recipe[1..-1].each do |ingredient|\n if database.has_key? ingredient\n temp = database[ingredient]\n ingredients_list.push(temp)\n else\n puts('Missing ingredient(s)')\n break\n end\n end\n temp = Recipe.new(recipe[0], ingredients_list)\n database[temp.name] = temp\n end\n end", "def associate_ingredients_to_recipes\n Recipe.all.each do |recipe|\n 5.times do\n recipe.ingredients << Ingredient.all.sample\n end\n \n recipe.ingredients = recipe.ingredients.uniq\n \n while recipe.ingredients.count < 5\n recipe.ingredients << Ingredient.all.sample\n recipe.ingredients = recipe.ingredients.uniq\n end\n end\nend", "def ingredient_params\n params.require(:ingredient).permit(:name, :recipe_ids => [])\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 = 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 = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n Instruction.multi_save(params[:instructions], @recipe)\n Ingredient.multi_save(params[:ingredients], @recipe)\n current_user.recipes << @recipe\n current_user.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_ingredient_list\n return if @ingredient_list.blank?\n\n # if this recipe was just created, save original_ingredient_list\n if original_ingredient_list.blank?\n self.original_ingredient_list = @ingredient_list\n end\n \n if @ingredient_list.is_a?(String)\n ingr_array = @ingredient_list.split(/\\n/)\n else\n ingr_array = @ingredient_list\n end\n\n # Usually Rails just sets the key to null. To really delete the record, the following two lines are needed\n ingredients_recipes.each {|ir| ir.delete}\n ingredients_recipes.reload\n \n ingr_array.each_with_index do |line, index|\n line.strip!\n next if line.empty?\n \n # check for groups first, then ingredients. Groups are deliminated with stars like this: *Group*\n attrs = {}\n if line =~ /^\\*(.*)\\*$/\n attrs[:description] = $1\n attrs[:group] = true\n else\n # If a comma, assume everything past is a comment so only parse the first part but then \n # add it back in before processing the description\n line.downcase!\n comma_index = line.index(\",\")\n desc_part = ''\n unless comma_index.blank?\n desc_part = line.slice!(comma_index .. -1)\n end\n attrs[:ingredient] = Ingredient.find_name_and_create(line)\n attrs[:weight] = Ingredient.find_num(line)\n attrs[:unit] = Ingredient.find_unit(line)\n line.slice!(desc_part) # Make sure desc_part is not included twice\n \n # if using the whole_unit, take it out here so it doesn't get repeated in the description\n if attrs[:unit] == 'whole' && !attrs[:ingredient].whole_unit.blank?\n line.slice!(attrs[:ingredient].whole_unit)\n end\n attrs[:description] = Ingredient.find_description(line + desc_part) \n end\n attrs[:line_num] = index\n attrs[:recipe_id] = self.id\n \n ingredient_recipe = IngredientsRecipe.create!(attrs)\n ingredients_recipes << ingredient_recipe\n Ingredient.standardize_unit(ingredient_recipe)\n end\n @ingredient_list = nil\n end", "def create\n\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 createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend", "def create\n @recipe = 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 recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def ingredients_attributes=(ingredients_attributes)\n self.ingredients.destroy_all\n ingredients_attributes.each do |ingredient_attribute|\n # additional logic in the recipes controller rejects invalid ingredients\n \n self.ingredients.create(ingredient_attribute) unless all_blank?(ingredient_attribute)\n end\n end", "def update\n @recipe.ingredients.clear\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n\n @recipe.update(recipe_params)\n redirect_to @recipe\n end", "def addRecipe(name, ingredients)\n calories = 0\n keys = @BasicHash.keys\n ingredients.each do |ingredient|\n ingredient.chomp!\n # if the ingredient is in the basicFood\n if @BasicHash.has_key? ingredient\n calories += @BasicHash[ingredient].calories.to_i\n else\n puts \"Can't find the ingredient\"\n puts \"#{ingredient}\"\n end\n #Making recipe object and adding it to the hash\n myrecipes = Recipe.new(name, ingredients, calories)\n @RecipeHash[name] = myrecipes\n end\n end", "def set_recipes(fridge)\r\n # put recipes you want to puts manumally\r\n recipe_ingredients = {\"Teriyaki\" =>[\"chicken\",\"sugar\",\"mirin\",\"soy sauce\"],\r\n \"Curry rice\" => [\"rice\",\"curry mix\",\"potato\",\"onion\",\"beef\",\"carrot\"],\r\n \"Oyakodon\" => [\"chicken\",\"sugar\",\"mirin\",\"soy sauce\",\"rice\",\"egg\",\"onion\"],\r\n \"Takoyaki\" => [\"flour\",\"octopus\",\"ginger\",\"dashi\"],\r\n \"Nikujyaga\" => [\"beef\",\"sugar\",\"mirin\",\"soy sauce\",\"carrot\",\"onion\",\"potato\"],\r\n \"Octopus Sashimi\" => [\"octopus\",\"soy sauce\"],\r\n \"Miso soup\" => [\"miso\",\"dashi\"]}\r\n\r\n # set recipes_array to make new instence of Recipe\r\n recipes_array = {\"Teriyaki\" => [\"http://natashaskitchen.com/2015/12/11/easy-teriyaki-chicken/\",15],\r\n \"Curry rice\" => [\"http://www.japanesecooking101.com/curry-and-rice-recipe/\",40],\r\n \"Oyakodon\" => [\"http://www.justonecookbook.com/oyakodon/\",30],\r\n \"Takoyaki\" => [\"http://www.justonecookbook.com/takoyaki-recipe/\",20],\r\n \"Nikujyaga\" => [\"http://www.justonecookbook.com/nikujaga/\",30],\r\n \"Octopus Sashimi\" => [\"http://www.makesushi.com/sashimi/\",5],\r\n \"Miso soup\" =>[ \"http://steamykitchen.com/106-simple-10-minute-miso-soup.html\",5]}\r\n\r\n # make new instance and put to fridge.recipes\r\n recipes_array.each do |key,value|\r\n new_recipe = Recipe.new(key,value[0],value[1])\r\n new_recipe.ingredients = recipe_ingredients[\"#{key}\"]\r\n fridge.recipes << new_recipe\r\nend # recipes_array each end\r\nend", "def add_recipe(new_recipe)\n @recipearray << new_recipe\n update_csv\n end", "def add(name, description, ingredients, instructions)\n recipe = Bukaresep::Recipe.new(name, description, ingredients, instructions)\n\n return false unless recipe.valid?\n\n @service.add(recipe)\n end", "def ingredient(ingredient_name, units)\n RecipeIngredient.new(ingredient_name, units)\n end", "def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end", "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def test_recipe_within_recipe\n @fdb = setup\n idk = Recipe.new(\"Double PB&J\", [@fdb.get_recipe(\"PB&J Sandwich\"), @fdb.get_recipe(\"PB&J Sandwich\")])\n \n bool = @fdb.add_recipe(\"Double PB&J\", [\"PB&J Sandwich\", \"PB&J Sandwich\"])\n assert(bool == true, \"whoops fuck you\")\n end", "def add_to_database(recipe)\n\t\t# Parsing the recipe line\n\t\trecipe_db = Recipe.new(\n\t\t\ttitle: recipe[\"recipe\"][\"label\"].to_s,\n\t\t\timage: recipe[\"recipe\"][\"image\"].to_s,\n\t\t\tdescription: recipe[\"recipe\"][\"source\"].to_s,\n\t\t\tuser_id: 1\n\t\t\t)\n\t\trecipe_db.save\n\t\tputs recipe_db.errors.messages\n\t\tputs \"ID: #{recipe_db.id}\"\n\t\tputs \"TITLE: #{recipe_db.title}\"\n\t\tputs \"IMAGE: #{recipe_db.image}\"\n\t\t# Parsing the ingredients line\n\t\trecipe[\"recipe\"][\"ingredientLines\"].each do |ingredient|\n\t\t\t# Retrieving the ingredient\n\t\t\tingredient_db = Ingredient.create(\n\t\t\t\tname: ingredient,\n\t\t\t\trecipe_id: recipe_db.id\n\t\t\t\t)\n\t\t\trecipe_db.ingredients << ingredient_db\n\t\tend\n\n\t\trecipe_db\n\tend", "def initialize(ingredient, recipe)\n @recipe = recipe\n @ingredient = ingredient\n @@all << self\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 recipe_params\n params.require(:recipe).permit(:name,:description, ingredient_ids: [])\n end", "def add_recipe(recipe)\n @recipes << recipe\n # need to call save_to_csv\n save_to_csv\n end", "def add_to_cookbook(recipe)\n @cookbook.push(recipe)\n end", "def use(new_recipe)\n recipes.push(new_recipe)\n end", "def addIngredient(description, amount, unit=\"oz\")\n\n\t\t\t# this rather interesting looking line is creating\n\t\t\t# a new \"instance\" of an \"Ingredient object\" (that\n\t\t\t# is, creates a value of our Ingredient type),\n\t\t\t# and appends (that is the \"<<\" bit) the new value\n\t\t\t# on to the array \"@ingredient\"\n\t\t\t#\n\t\t\t# The values in \"description\", \"amount\", and \"unit\"\n\t\t\t# are passed into the \"initialize\" method of the \n\t\t\t# ingredient class defined just above\n\t\t@ingredient << Ingredient.new(description, amount, unit)\n\tend", "def add_ingredient_by_name(new_ingredient)\n #self.ingredients < Ingredient.find_ingredient_by_name(new_ingredient)\n end", "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end", "def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end", "def addIngredient(description, amount, unit=\"oz\")\n\n\t\t@ingredient << Ingredient.new(description, amount, unit)\n\tend", "def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_add_recipe\n @fdb = setup\n assert(@fdb.recipes.length >= 2, \"at least 2 recipes were originally added from the file\")\n end", "def add_ingredients(*ing)\n ing.join(', ')\nend", "def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\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 @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 build_empty_ingredients\n 10.times { recipe_ingredients.build.build_ingredient }\n end", "def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end", "def extended_ingredients=(extended_ingredients)\n if !extended_ingredients.nil? && extended_ingredients.length < 0\n fail ArgumentError, 'invalid value for \"extended_ingredients\", number of items must be greater than or equal to 0.'\n end\n\n @extended_ingredients = extended_ingredients\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 ingredient_params\n params[:ingredient][:ingredient_list] ||= [] \n params.require(:ingredient).permit(:name, ingredient_list: [])\n end", "def add_recipe(recipe)\n @recipes << recipe\n save_csv\n end", "def add_recipe(recipe)\n @recipes << recipe\n\n save_csv\n end", "def fillRecipeAssoc(a_recipe)\n # Setup for more automation w/faker gem later\n ingredients_name = \"A thing to put in it\"\n direction_step = \"Do this thing...\"\n # Do the thing\n a_recipe.ingredients.build(name: ingredients_name).save(validate: false)\n a_recipe.directions.build(step: direction_step).save(validate: false)\nend", "def enter_ingredients\n puts \"\\nPlease input your ingredients below. Separate each ingredient with a comma.\\n\"\n\n ingredients = gets.strip\n recipes = EverythingButTheKitchenSink::SpoonacularApi.get_recipes(ingredients)\n EverythingButTheKitchenSink::TransformData.get_id_and_title(recipes)\n end", "def ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n puts \" \"\n p \"Ingredient(s) successfully updated!\"\n sleep(1.3)\n user.recipes.where(id: recipe_id).update(ingredient: new_recipe_ingredient_arr.join(\", \"))\n recipe_ingredients(recipe_id)\n end", "def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end", "def recipe_params\n params.require(:recipe).permit(\n :title, \n :description, \n :instructions, \n :ingredient_count, \n ingredient_ids: [],\n ingredients_attributes: [\n :name, \n :description, \n recipe_ingredients_attributes: [\n :quantity\n ]\n ]\n \n )\n end", "def add_recipe(recipe)\n raise \"[#{self}] duplicate recipe #{recipe.recipe_id} defined.\" if @recipes.has_key?(recipe.recipe_id)\n\n @recipes[recipe.recipe_id] = recipe\n end", "def add_multiple_food_items(items)\n items.each do |item|\n item['_id'] = FoodItem.create_id item[:api_key], item[:item_id]\n FoodItem.new_item item\n end\n items\n end", "def command_newRecipe(name, ingredients)\n bool = @database.add_recipe(name, ingredients)\n if bool == false\n puts \"Recipe already in database or ingredients not in database\"\n end\n @dbChanged = true\n end", "def model_ingredients(args)\n options = set_model_ingredients_defaults(args)\n set_common_options(options)\n set_model_ingredients_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all ingredients\n obj_list = Ingredient.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end", "def recipe_params\n params.require(:recipe).permit(:name, :body, :foto, ingredients_attributes: Ingredient.attribute_names.map(&:to_sym).push(:_destroy))\n end", "def set_recipe_ingredients_unit\n @recipe_ingredients_unit = RecipeIngredientsUnit.find(params[:id])\n end", "def test_add_1_recipe\n\t\tputs \"TEST 4\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\t\t@db.addRecipe(\"Cookies\", [\"Flour\", \"BakingSoda\"] )\n\t\tassert( @db.empty?, \"DB should still be empty after adding recipe with non existing foods\" )\n\t\t@db.addFood(\"Flour\", \"84\" )\n\t\t@db.addFood(\"BakingSoda\", \"123\" )\n\t\tassert( @db.size == 2, \"there should be 2 foods,ready for recipe\" )\n\t\t@db.addRecipe(\"Cookies\", [\"Flour\", \"BakingSoda\"] )\n\t\tassert( @db.size == 3, \"With recipe, size should == 3\" )\n\t\tassert( @db.is_Recipe?(\"Cookies\") , \"Cookies should be a recipe\" )\n\tend", "def add_recipe(recipe)\n @recipes << recipe\n write_csv\n end", "def add_recipe(recipe)\n @recipes << recipe\n write_csv\n end", "def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts recipe_params[:ingredients], recipe_params[:recipe], recipe_params[:user_id]\n recipe = Recipe.create(recipe_params[:recipe])\n if(recipe.valid?)\n Ingredient.create_and_assign(recipe_params[:ingredients], recipe.id)\n newUR = UserRecipe.create(recipe_id: recipe.id, user_id: recipe_params[:user_id])\n render json: UserRecipeSerializer.new(newUR).to_serialized_json\n else\n render json: recipe.errors.full_messages\n end\n end", "def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end", "def initialize ingredient\n @dog = Ingredient.new 'a dog', ['Invisible Dog', 'Breakfast Sausage', 'Beef', 'Mystery Meat', 'Polish', 'Ice Cream', 'Sushi'], 7\n @bun = Ingredient.new 'a bun', ['Classic', 'Whole Wheat', 'Lettuce', 'Cheeto', 'Cotton Candy', 'Seaweed'], 6\n @condiment = Ingredient.new 'some condiments', ['Nutella', 'String Cheese', 'Fruit Loops', 'Sprinkles', 'Onions', 'Ketchup', 'Chips', 'Mustard'], 8\n end", "def ingredient_params\n params.require(:ingredient).permit(:item_id, :qty, :recipe_id).merge({recipe_id: @recipe.id})\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(name)\n @cookbook.add_recipe(name)\n end", "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 ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end" ]
[ "0.8711776", "0.8697517", "0.86636746", "0.8630636", "0.85630447", "0.8423689", "0.8303031", "0.8141886", "0.80498856", "0.7979934", "0.79763687", "0.7749771", "0.7695438", "0.7366467", "0.72614163", "0.7234819", "0.7225639", "0.71945655", "0.71579236", "0.7117883", "0.7087235", "0.7038837", "0.7022807", "0.6984257", "0.6936188", "0.68891186", "0.6788077", "0.6689229", "0.6675788", "0.6649241", "0.6615162", "0.6543355", "0.65204436", "0.64376646", "0.6425656", "0.6374088", "0.637036", "0.6354688", "0.63460124", "0.6333084", "0.62993973", "0.6291964", "0.6285225", "0.6277793", "0.6271703", "0.62315345", "0.616045", "0.61522853", "0.61453867", "0.6144913", "0.61307335", "0.6106586", "0.60916114", "0.6088637", "0.6087523", "0.6085701", "0.6073208", "0.60697377", "0.60680443", "0.6064452", "0.6043816", "0.6029991", "0.6027391", "0.60235727", "0.6003129", "0.59951204", "0.5958345", "0.59582955", "0.5956816", "0.5942589", "0.5941332", "0.59352636", "0.59314686", "0.5923693", "0.5899019", "0.58829445", "0.5862031", "0.58527833", "0.58517295", "0.5849532", "0.5844062", "0.5809432", "0.5788624", "0.5788617", "0.57860154", "0.5772415", "0.5771428", "0.5759845", "0.57538974", "0.57518905", "0.57518905", "0.5744799", "0.5723571", "0.5723058", "0.5703299", "0.57031965", "0.56906754", "0.5690613", "0.56859696", "0.56786454" ]
0.86144197
4
Connect to a Cherwell server.
def initialize(web_service_url, username=nil, password=nil) @url = web_service_url @url.chop! if @url =~ /\/$/ # Remove any trailing slash @username = username @password = password @client = Cherby::Client.new(@url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end", "def connect_to_server\n @service.connect(connect_settings)\n end", "def connect_to_mycroft\n if ARGV.include?(\"--no-tls\")\n @client = TCPSocket.open(@host, @port)\n else\n socket = TCPSocket.new(@host, @port)\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.cert = OpenSSL::X509::Certificate.new(File.open(@cert))\n ssl_context.key = OpenSSL::PKey::RSA.new(File.open(@key))\n @client = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)\n begin\n @client.connect\n rescue\n end\n end\n end", "def connect()\n @sock = TCPSocket.open(@server, @port)\n end", "def connect_to_server\n @socket = TCPSocket.open(@serverip, @serverport)\n end", "def connect\n TCPSocket.open(@host, @port)\n end", "def connect\n connection.connect\n nil\n end", "def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end", "def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n end\n \n info \"Transport is #{ @session.transport.class }\"\n end", "def connect_server(server)\n run_script('connect', server)\n end", "def connect\n @connection_manager.connect\n end", "def connect()\n @s = @s || TCPsocket.open(@host, @port)\n end", "def connect\n auth = authentication_prompt()\n\n socket = TCPSocket.new( @server, @port )\n raise RuntimeError, \"Unable to connect to #{@port}\" unless socket\n print \"Connecting at #{Time.now} to #{@port} ... \"\n\n authenticate_with_server( socket, auth[:u], auth[:p] )\n\n return socket\n end", "def connect(server)\n opts = server_opts(server)\n Connection.new(self, opts)\n end", "def connect\n @connection = Net::HTTP.new(@params[:server], @params[:port])\n @connection.use_ssl = true if @params[:scheme] == 'https'\n @connection.start\n end", "def connect_to_unit\n puts \"Connecting to '#{@host}...\"\n begin\n tcp_client = TCPSocket.new @host, @port\n @ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client, @context\n @ssl_client.connect\n rescue Exception => e\n puts \"Could not connect to '#{@host}: #{e}\"\n end\n end", "def connect_to_server\n fail \"connect_server called without remote established\" if @remote.nil?\n host, port = @remote\n LOGGER.info \"Establishing new connection with #{host}:#{port}\"\n @server_side = ServerConnection.request(host, port, self)\n @server_side.pending_connect_timeout = @connect_timeout\n @server_side.comm_inactivity_timeout = @inactivity_timeout\n end", "def connect_to_server\n request_builder = ::NewRelic::Agent::Connect::RequestBuilder.new( \\\n @service,\n Agent.config,\n event_harvest_config,\n environment_for_connect\n )\n connect_response = @service.connect(request_builder.connect_payload)\n\n response_handler = ::NewRelic::Agent::Connect::ResponseHandler.new(self, Agent.config)\n response_handler.configure_agent(connect_response)\n\n log_connection(connect_response) if connect_response\n connect_response\n end", "def connect(server)\n Connection.new(self, server, server_opts(server))\n end", "def connect\n ssl_socket.connect\n handshake.execute!\n end", "def connect\n connection.tap do |c|\n c.start\n end\n end", "def connect \n log \"Connecting\"\n @socket = TCPSocket.new(config[:server], 6667)\n write \"USER #{config[:nick]} #{config[:nick]} #{config[:nick]} :#{config[:nick]}\"\n write \"NICK #{config[:nick]}\"\n write \"JOIN ##{config[:channel]}\"\n end", "def connect(host, port, use_ssl = false)\n @socket = TCPSocket.new(host, port.to_i)\n if use_ssl\n @socket = OpenSSL::SSL::SSLSocket.new(@socket)\n @socket.sync_close\n @socket.connect\n end\n read_greeting\n end", "def connect\n Drone::Client.connect\n end", "def connect\n unless connected?\n hostname = 'api.syncano.com'\n port = 8200\n\n sleep(3)\n\n Thread.new do\n begin\n EM.run do\n EM.connect(hostname, port, Syncano::SyncConnection)\n end\n rescue Exception => e\n p e.message\n p e.backtrace\n end\n end\n\n timeout = 30\n\n while connection.blank? && timeout > 0\n timeout -= 1\n sleep 1\n end\n\n raise ::Syncano::ConnectionError.new('Connection timeout') unless timeout > 0\n\n timeout = 300\n\n while (response = connection.get_response('auth')).blank? && timeout > 0\n timeout -= 1\n sleep 1.0/10.0\n end\n\n raise ::Syncano::ConnectionError.new(response.error) if response.status == 'NOK'\n end\n end", "def connect(conn)\n\t\t@host = conn.to_s\n\t\tbegin\n\t\t\t@conn.connect(@host)\n\t\trescue IOException\n\t\t\traise IOError, \"Cannot connect to #{@host}\"\n\t\tend\n\tend", "def connect\n sock = TCPSocket.new(@host, @port)\n if @ssl\n sock = OpenSSL::SSL::SSLSocket.new(sock)\n sock.sync_close = true\n sock.connect\n sock.post_connection_check(@host) if @verify_ssl\n end\n sock\n end", "def connect\n EM.run do\n client = Faye::WebSocket::Client.new(@url)\n reconnect_url = nil\n\n client.on :message do |msg|\n message_received(client, msg)\n end\n\n client.on :open do |e|\n OutputLogger.logger.info 'Connection Opened!'\n end\n\n client.on :close do |e|\n OutputLogger.logger.info 'Connection closed, trying to reconnect.'\n\n reconnect\n end\n\n client.on :error do |e|\n OutputLogger.logger.error e.inspect\n end\n\n client.on 'transport:down' do |e|\n OutputLogger.logger.info 'Connection down.'\n end\n\n client.on 'transport:up' do |e|\n OutputLogger.logger.info 'Connection back up, trying to reconnect.'\n\n reconnect\n end\n end\n end", "def connect!\n end", "def connect\n Connection.new\n end", "def connect\n @cluster.connect\n end", "def connect\n require 'osc-ruby' unless defined?(::OSC)\n port = additional_params[:port] || 3333\n @client = OSC::Server.new(port)\n super\n end", "def connect!\n @connection = Net::HTTP.new(@server, 80)\n if @ssl\n @connection.use_ssl = true\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @connection.start\n end", "def connect(host, port)\n @host = host\n @port = port\n\n @socket = TCPSocket.new(@host, @port)\n start(@socket)\n end", "def connect\n @socket = TCPSocket.open @host, @port\n @connected = !@socket.closed?\n end", "def connect\n @connection.open\n end", "def connect!(options={})\n execute_on_servers(options) { }\n end", "def connect\n end", "def connect\n http = Net::HTTP.new @host, @port\n # http.set_debug_output($stdout)\n http.use_ssl = @ssl\n http.start\n http\n end", "def enotify_connect\n begin\n print \"=== Connecting to emacs... \".cyan\n @sock = TCPSocket.new(@enotify_host, @enotify_port)\n enotify_register\n puts \"Success!\".green\n rescue SocketError, Errno::ECONNREFUSED => e\n puts \"Failed!\".red\n rescue_sock_error\n end\n end", "def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end", "def _connect!\n _log { \"_connect! #{uri}\" } if @verbose >= 1\n stream = _client_connect!\n _log { \"_connect! stream=#{stream}\" } if @verbose >= 1\n _after_connect! stream\n stream\n rescue ::Exception => err\n raise err.class, \"Cannot connect to #{self.class} #{uri}: #{err.inspect}\", err.backtrace\n end", "def connect!\n request! :connect\n end", "def connect!; end", "def connect!; end", "def connect\n client = Mysql2::Client.new(:host => HOST,\n :username => USERNAME,\n :password => PASSWORD,\n :database => DATABASE)\n end", "def connect\n return true if @status == :connected\n connection_options = {\n host: @host,\n port: @port,\n user: @user,\n password: @password,\n path: @path,\n use_ssl: @use_ssl,\n }\n @server = ::XMLRPC::Client.new3(connection_options)\n @status = :connected\n end", "def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end", "def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end", "def connect\n addr = Socket.getaddrinfo(@host, nil, Socket::AF_INET)\n sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)\n sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1\n\n if @ssl\n sock = OpenSSL::SSL::SSLSocket.new(sock)\n sock.sync_close = true\n end\n\n if @timeout\n secs = Integer(@timeout)\n usecs = Integer((@timeout - secs) * 1_000_000)\n optval = [secs, usecs].pack(\"l_2\")\n sock.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval\n sock.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval\n end\n\n sock.connect(Socket.pack_sockaddr_in(@port, addr[0][3]))\n sock.post_connection_check(@host) if @ssl and @verify_ssl\n sock\n rescue Errno::EHOSTUNREACH\n raise ConnectionError.new @host, @port\n rescue Errno::ECONNREFUSED\n raise ConnectionError.new @host, @port\n end", "def connect\n @connector.connect\n @p.set_connection @connector\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 local_connect(body)\n host = _pop_token(body)\n port = _pop_token(body).to_i\n if host.length < 1\n begin\n host, port = @var[:last_connection]\n rescue\n raise \"usage: /connect <hostname> [port]\"\n end\n end\n port = 9000 if port == 0\n begin\n connect(host, port)\n @var[:last_connection] = [ host, port ]\n _save_env\n rescue\n _notice \"Could not connect to #{host}:#{port} - #{$!}\", :error\n end\nend", "def connection\n @connection.connect\n end", "def connect\n begin\n @mSocket = Net::Telnet::new(\"Host\" => @mHostname,\"Port\" => @mPort)\n print(\"addr| \", @mSocket.addr.join(\":\"), \"\\n\")\n print(\"peer| \", @mSocket.peeraddr.join(\":\"), \"\\n\")\n @mSocket.puts \"USER rubybot 0 * Testing\"\n @mSocket.puts \"NICK #{@mNick}\"\n @mSocket.puts \"JOIN #{@mChannel}\"\n @mSocket.puts \"PRIVMSG NickServ identify ruby-bot\"\n\n # Status of -1 is active / connected\n # I know, this doesn't make much sense\n @mStatus = -1\n\n # print the silly message for the lolz\n rubicante_message \n rescue SocketError\n storeDebug(\"can't connect\")\n end\n end", "def connect!\n @connection = Connection::Factory.create(@options[:transport], @options[:transport_wrapper], @current_server, @options[:timeout])\n @connection.connect!\n @client = @client_class.new(@options[:protocol].new(@connection.transport, *@options[:protocol_extra_params]))\n rescue Thrift::TransportException, Errno::ECONNREFUSED => e\n @transport.close rescue nil\n raise e\n end", "def connect(args)\n if (args.size != 2)\n puts \"usage: connect [host] [port]\"\n return\n else\n @connections.add(args[0], args[1])\n puts \"connected to #{args[0]}:#{args[1]}\"\n end\n end", "def connect!\n start_em\n @client.ensure_connect\n end", "def connect\n @socket = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(@host, @port), OpenSSL::SSL::SSLContext.new)\n @socket.sync_close = true\n\n begin\n @socket.connect\n rescue Exception => e\n STDOUT.puts \"Error: #{e}\"\n exit(1)\n end\n\n # Modify socket's singleton class to include the Chat::Sendable module.\n class << @socket\n include Chat::Sendable\n include Chat::Receivable\n end\n\n # Ask the user for a username (\"displayName\")\n STDOUT.print \"Enter your display name (no spaces): \"\n display_name = STDIN.gets\n if display_name.nil?\n exit(1)\n end\n\n # Clean display_name and ensure that it has no spaces.\n display_name.chomp!\n unless display_name =~ /^\\S+$/\n puts \"Invalid display name.\"\n exit(1)\n end\n\n @socket.send Greeting.build(VERSION, display_name)\n\n # Await the response.\n loop do\n begin\n response = @socket.receive\n rescue Exception => e\n STDERR.puts \"Error: #{e.message}\"\n exit(1)\n end\n\n case response\n when :EOF\n STDERR.puts \"Connection lost.\"\n exit(1)\n when :SKIP\n # Malformed packet. Ignore it and keep listening.\n next\n when AcceptGreeting\n STDOUT.puts \"Connected to server!\"\n STDOUT.puts help\n break\n when DeclineGreeting\n STDERR.puts \"Server rejected connection. Reason: #{response[:reason]}\"\n exit(1)\n else\n STDOUT.puts \"Received unrecognized message. Ignoring.\"\n end\n end\n end", "def connect\r\n begin\r\n TCPSocket.new(@server, @port) #used for checking the connection\r\n puts \"Connection successful!\"\r\n run()\r\n rescue => exception\r\n puts \"Failed to connect to : #{@server}:#{@port}\"\r\n puts \"Closing...\"\r\n sleep(2)\r\n end\r\n \r\n end", "def connect(host=\"localhost\", port=2230)\n output_stream.puts \"sending request for a new game...\"\n EventMachine::run {\n EventMachine::connect host, port, GameBroker, &method(:setup_handler)\n }\n end", "def initialize(host, port = 389, login_dn, base_dn, password)\n @host = host\n @port = port\n @login_dn = login_dn\n @base_dn = base_dn\n @password = password\n\n return connect\n end", "def connect\n retry_count = 0\n begin\n @socket = TCPSocket.new(@current_server[:host], @current_server[:port])\n rescue => ex\n warn \"Faild to connect: #{ex.class} (server: #{@current_server})\"\n warn ex.message\n retry_count += 1\n if retry_count > 3\n set_current_server\n warn \"Connecting another server: #{@current_server}\"\n retry_count = 0\n end\n sleep 1\n retry\n end\n @socket.autoclose = true\n nil\n end", "def connect_to_cassandra\n if @client\n @client.disconnect! rescue nil\n end\n @client = nil\n\n @cassandra_servers.each do |server|\n begin\n c = ::Cassandra.new @keyspace, server\n ring = c.ring\n @client = c\n break\n rescue ThriftClient::NoServersAvailable\n @logger.warn \"Cassandra server #{server} seems to be unavailable.\"\n end\n end\n\n if @client\n @logger.info \"Connected to Cassandra: #{@client.inspect}\"\n else\n raise \"Could not connect to any server in server list: #@cassandra_servers\"\n end\n\n @client\n end", "def connect\n platform.connect\n end", "def connect_cassandra\n @client = Cql::Client.connect(hosts: ['localhost'])\n @client.use('oink')\nend", "def connect!(in_user, in_password, in_host)\n begin\n @sa_connection=OpswareClient\n @sa_connection.connect(\"https\".to_java, in_host, port, in_user, in_password, true)\n require 'sasync/hpsa_tools/hpsa_tools'\n extend Sasync::HpsaTools\n rescue NativeException => e\n puts \"Error during connection with error: #{e}\"\n return\n end\n\n self.initialize_framework\n #puts @sa_connection.isConnected\n #puts connection_info\n end", "def connection(host)\n RobotArmy::GateKeeper.shared_instance.connect(host)\n end", "def open_connection\n @connection = TCPSocket.new(server, port)\n @context = OpenSSL::SSL::SSLContext.new\n @context.cert = @cert\n @context.key = @key\n\n @socket = OpenSSL::SSL::SSLSocket.new(@connection, @context) if @connection\n @socket.sync_close = true\n @socket.connect\n\n get_frame\n end", "def connect(username, password)\n @username, @password = username, password\n\n @read_thread = self.class.start_read_thread(helper, @socket.getInputStream)\n @write_thread = self.class.start_write_thread(helper, @socket.getOutputStream)\n @write_thread.send_cmd CMD00_ConnectRequest.new\n end", "def connect\n @connection.create\n end", "def connect\n\t\tsocket = TCPSocket.open(@host, @port) # Connect to server\n\t\tsocket.print(@request) # Send request\n\t\tresponse = socket.read # Read complete response\n\t\t\n\t\tputs \"------------------------------------\"\n\t\tputs \"Request to server: #{@request}\"\n\t\tputs \"------------------------------------\"\n\t\tputs \"Response is:\"\n\t\tputs \"\"\n\t\tputs response\n\tend", "def connect opts\n opts = DefaultOptions.merge opts\n\n params = [\n # for EventMachine.connect\n opts[:host],\n opts[:port],\n self,\n\n # pass the *merged* options to SimpleTelnet#initialize\n opts\n ]\n\n # start establishing the connection\n connection = EventMachine.connect(*params)\n\n # set callback to be executed when connection establishing\n # fails/succeeds\n f = Fiber.current\n connection.connection_state_callback = lambda do |obj=nil|\n @connection_state_callback = nil\n f.resume obj\n end\n\n # block here and get result from establishing connection\n state = Fiber.yield\n\n # raise if exception (e.g. Telnet::ConnectionFailed)\n raise state if state.is_a? Exception\n\n # login\n connection.instance_eval { login }\n\n begin\n yield connection\n ensure\n # Use #close so a subclass can execute some kind of logout command\n # before the connection is closed.\n connection.close unless opts[:keep_alive]\n end\n\n return connection\n end", "def connection\n @connection ||= KJess::Connection.new( host, port )\n end", "def connect!\n @connection = Net::HTTP.new(@url.host, @url.port)\n if @ssl\n @connection.use_ssl = true\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @connection.start\n end", "def connect\n\tend", "def connect!\n EventMachine.run do\n EventMachine::MQTT::ClientConnection.connect(@server) do |c|\n c.subscribe(@topic)\n c.receive_callback do |message|\n handle_incoming_message(message)\n end\n end\n end\n end", "def connect(server)\n opts = server_opts(server)\n\n connection_params = if opts[:host].nil? && opts[:port].nil? && opts[:database]\n # use a cataloged connection\n opts.values_at(:database, :user, :password)\n else\n # use uncataloged connection so that host and port can be supported\n 'Driver={IBM DB2 ODBC DRIVER};' \\\n \"Database=#{opts[:database]};\" \\\n \"Hostname=#{opts[:host]};\" \\\n \"Port=#{opts[:port] || 50000};\" \\\n 'Protocol=TCPIP;' \\\n \"Uid=#{opts[:user]};\" \\\n \"Pwd=#{opts[:password]};\" \\\n end \n\n Connection.new(connection_params)\n end", "def server_connect(target, port, remote = nil)\n send_data(\"CONNECT #{target} #{port} #{remote}\".strip)\n end", "def connect(host, port, timeout)\r\n conn = EventMachine.connect(host, port, ConnectionClient) do |c|\r\n c.pending_connect_timeout = [Float(timeout), 0.1].max\r\n end\r\n\r\n setup_connect_callbacks(conn, Fiber.current)\r\n end", "def connect; end", "def connect client_id, host, port, &block\n @client_id = client_id\n @ws = WebSocket::EventMachine::Client.connect :uri => 'ws://' + host + ':' + port.to_s\n @ws.onopen {\n @state = :state_connected\n @password = Utils.md5 @password if @md5\n @ws.send ['register', {\n :type => 'client',\n :client_id => @client_id,\n :username => @username,\n :password => @password,\n :md5 => @md5\n }].to_json\n }\n @ws.onmessage { |msg, type|\n begin\n event, msg = parse msg\n case event\n when 'register'\n process_register_msg msg, &block\n when 'client'\n process_client_msg msg\n else\n end\n rescue => err\n end\n }\n @ws.onclose { |code, reason|\n @state = :state_closed\n emit 'close'\n }\n @ws.onerror { |err|\n if @state == :state_inited\n block_given? and yield err\n end\n emit 'error', err\n }\n end", "def connect(*) end", "def connect\n @socket = TCPSocket.new(@domain, @port)\n @parser = Jabber::Protocol.Parser.new(socket, self)\n\n register_parsing_thread\n register_polling_thread\n\n @status = CONNECTED\n end", "def connect_connection(connection)\n begin\n connection.connect!\n rescue Exception\n connection.disconnect!(reason: :error)\n raise\n end\n end", "def connect\n socket.connect(@host, @port)\n @connected = true\n rescue SocketError => e\n warn e\n end", "def connect\n begin\n @socket_server = TCPSocket.open(@host, @port.to_i)\n rescue Errno::ECONNREFUSED => e\n raise PcapLogger::SocketWriterException.new(\"Cannot connect to host: #{@host} on port: #{@port}\")\n end\n end", "def connect\n @connection_pool.get_connection\n end", "def connect\n start_listener!\n end", "def connect\n @client = Redis.new(host: @host, port: @port)\n @logger.info(\"Connecting to database #{@host}:#{@port}\")\n end", "def connect (host, port)\n\t\tclose\n\n\t\tbegin\n\t\t\t@socket = TCPSocket.new host, port\n\t\trescue Exception => e\n\t\t\temit :error, e\n\t\tend\n\n\t\tthreads\n\tend", "def connection\n # Establish connection (if not established yet).\n if not @conn then\n # Connect.\n @conn =\n if use_secure_connection? then Socket_IO.open(\"https://socketio.mtgox.com/socket.io\")\n else Socket_IO.open(\"http://socketio.mtgox.com/socket.io\"); end\n # Subscribe to ticker.\n @conn.send Socket_IO::JSONMsg[\n \"op\" => \"mtgox.subscribe\",\n \"type\" => \"ticker\"\n ]\n end\n #\n return @conn\n end", "def connect\n client.connect(config.host, config.port)\n client.auth(config.password)\n client.send(Jabber::Presence.new.set_type(:available))\n\n self.roster = Jabber::Roster::Helper.new(client)\n roster.wait_for_roster\n\n self.rooms = self.config.rooms.collect do |room_name|\n Robut::Room.new(self, room_name).tap {|r| r.join }\n end\n\n if self.config.enable_private_messaging\n Robut::PM.new(self, rooms)\n end\n\n trap_signals\n self\n end", "def connect\n hostname = 'localhost'\n port = 2000\n s = TCPSocket.open(hostname, port)\n\n s.puts(Time.now.ctime)\n s.puts \"Closing the connection. Bye!\"\n s.close\nend", "def connect()\n\t\t\t# Check queen(s) for peer list\n\n\t\t\t# Connect to peers\n\t\tend", "def connect(host = DEFAULT_HOST, port = DEFAULT_PORT)\n self.socket = create_socket(host, port)\n\n identify\n\n remote_host = socket.peeraddr[3]\n remote_port = socket.peeraddr[1]\n\n logger.info(\"Connected to #{remote_host}:#{remote_port}.\")\n return true\n rescue Errno::ECONNREFUSED\n logger.error('Connection refused! Is the Broker running?')\n return false\n end", "def connect(ssl_context: nil)\n @client.connect(@url, options: {ssl_context: ssl_context})\n end", "def connect\n begin\n port = get_debugger_port\n rescue\n # Sometimes this will fail if we don't wait long enough, try one more time\n sleep(2)\n port = get_debugger_port\n end\n connect_host_port(\"localhost\", port)\n end", "def open_connection\n @connection = TCPSocket.new(@server, @port)\n @socket = OpenSSL::SSL::SSLSocket.new(@connection)\n \n # Synchronously close the connection & socket\n @socket.sync_close\n \n # Connect\n @socket.connect\n \n # Get the initial frame\n get_frame\n end", "def client\n @client ||= CFoundry::Client.new(@target.to_s).tap do |c|\n c.login(@username, @password)\n end\n end", "def connect_socket\n @irc = Net::YAIL.new(\n :address => @servers[@nextserver],\n :port => @port,\n :username => @nick,\n :realname => @realname,\n :nicknames => @nicks,\n :silent => false,\n :loud => false\n )\n\n # Simple hook for welcome to allow auto-joining of the channel\n EVENTS.each do |event|\n @irc.prepend_handler(event.to_sym,\n self.method((\"handle_\" + event).to_sym))\n end\n end" ]
[ "0.7371458", "0.7313136", "0.7259561", "0.7010325", "0.69426316", "0.6922263", "0.6897776", "0.68103325", "0.6802547", "0.6785887", "0.676887", "0.6711448", "0.67098147", "0.66701186", "0.6661631", "0.6649645", "0.66492826", "0.66154134", "0.6595982", "0.6592526", "0.65782297", "0.6551354", "0.6531751", "0.6509321", "0.65065646", "0.64836824", "0.6482658", "0.6471063", "0.64698744", "0.6454773", "0.6452004", "0.6440444", "0.6419546", "0.6400549", "0.6392015", "0.637609", "0.63642305", "0.63614416", "0.635764", "0.63355774", "0.6334693", "0.632656", "0.63237715", "0.630246", "0.630246", "0.6289612", "0.6281565", "0.6269542", "0.6269542", "0.62635285", "0.62530804", "0.62503", "0.6247482", "0.6247014", "0.62443334", "0.62376964", "0.62114537", "0.6202471", "0.619599", "0.6181707", "0.61784023", "0.61739427", "0.61709064", "0.61673665", "0.616725", "0.6152068", "0.6150415", "0.61287415", "0.6124833", "0.6119301", "0.61148924", "0.61127466", "0.61017406", "0.6096466", "0.6093074", "0.6087255", "0.6081404", "0.6077933", "0.6069801", "0.60678595", "0.605489", "0.60474205", "0.60467696", "0.6023803", "0.6002847", "0.5995883", "0.59943473", "0.59897476", "0.598493", "0.5979442", "0.597775", "0.5977105", "0.5974135", "0.59733045", "0.59692407", "0.5962938", "0.59586114", "0.59545654", "0.59499764", "0.59442747", "0.5938683" ]
0.0
-1
Login to Cherwell using the given credentials. Return true if login succeeded, or raise `LoginFailed` if login failed.
def login(username=nil, password=nil) creds = { :userId => username || @username, :password => password || @password, } begin response = @client.call(:login, :message => creds) rescue => e # This can happen if a bad URL is given raise Cherby::LoginFailed, e.message end # This can happen if invalid credentials are given if response.body[:login_response][:login_result] == false raise Cherby::LoginFailed, "Cherwell returned false status" end # Store cookies so subsequent requests will be authorized @client.cookies = response.http.cookies # Double-check that login worked if self.last_error raise Cherby::LoginFailed, "Cherwell returned error: '#{self.last_error}'" end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n username = find_username\n password = find_password\n\n Log.info(\"Logging in as #{username}... \", newline: false)\n\n conn = Faraday.new(url: \"https://redacted.ch/\")\n response = conn.post do |request|\n request.url \"login.php\"\n request.headers[\"User-Agent\"] = RedactedBetter.user_agent\n request.body = { username: username, password: password }\n end\n\n handle_login_response(response)\n rescue Faraday::TimeoutError\n Log.error(\"Logging in timed out. Perhaps Redacted is down?\")\n false\n end", "def login(**credentials)\n authentication(**credentials).authenticated?.tap do |success|\n setup_session if success\n end\n end", "def login\n VkMusic.log.info(\"Client#{@id}\") { 'Logging in...' }\n login = Request::Login.new\n login.call(agent)\n login.send_form(@login, @password, agent)\n return true if login.success?\n\n VkMusic.log.warn(\"Client#{@id}\") { \"Login failed. Redirected to #{login.response.uri}\" }\n false\n end", "def login\n form_data = {\"j_username\" => @username, \"j_password\" => @password}\n response = rally_post(\"/slm/platform/j_platform_security_check.op\", form_data, true)\n # essential for subsequent calls to rally to authenticate internally\n @session_cookie = get_session_cookie(response)\n end", "def login!(passwd = nil)\n self.password = passwd || self.password\n response = client.login(username.to_s, password.to_s)\n apply_attributes! response.result\n self.session_token.present?\n end", "def login\n\t\tbegin\n\t\t\tr = execute(make_xml('LoginRequest', { 'sync-id' => 0, 'password' => @password, 'user-id' => @username }))\n\t\trescue APIError\n\t\t\traise AuthenticationFailed.new(r)\n\t\tend\n\t\tif(r.success)\n\t\t\t@session_id = r.sid\n\t\t\treturn true\n\t\tend\n\tend", "def login(username, password)\n @username = username\n @password = password\n challenge, response = getchallenge\n login_vars = {\n 'username' => @username,\n 'clientversion' => CLIENT,\n 'auth_method' => 'challenge',\n 'auth_challenge' => challenge,\n 'auth_response' => response\n }\n if @mood_list == true\n login_vars['getmoods'] = 0\n elsif @mood_list.kind_of? Array\n i = @mood_list.max { |a,b| a['id'] <=> b['id'] }\n login_vars['getmoods'] = i['id']\n end\n login = self.call('LJ.XMLRPC.login', login_vars)\n @fastserver = login['fastserver'] == 1\n @usejournals = login['usejournals']\n @logged_in = true\n @next_check_ok = 0\n @friendgroups = login['friendgroups']\n if @mood_list\n if @mood_list == true\n @mood_list = login['moods']\n else\n @mood_list << login['moods']\n end\n end\n if login.has_key?('message')\n @message = login['message']\n return true\n else\n return false\n end\n rescue XMLRPC::FaultException => e\n raise LjException.new(e.faultCode, e.faultString)\n end", "def login\n capture_session(self.class.post( \"/api/login\", {:body => {:user => @user, :passwd => @password, :api_type => 'json'}, :debug_output => @debug} ) )\n logged_in?\n end", "def logon(browser, creds=credentials)\n name, email, password = creds\n browser.goto COMMUNITY_URL\n browser.url.should == COMMUNITY_URL\n\n # note, mac ff needs a couple of attempts to scroll view to Login\n login_elem = browser.link(:text, 'Login')\n scroll_right browser, login_elem\n attempt(3) { login_elem.hover }\n attempt(3) { login_elem.click }\n\n email_xpath = '//*[@id=\"login_form\"]//*[@id=\"email\"]'\n password_xpath = '//*[@id=\"login_form\"]//*[@id=\"password\"]'\n\n browser.text_field(:xpath, email_xpath).when_present.set email\n browser.text_field(:xpath, password_xpath).set password\n browser.button(:name, 'login').click\n end", "def login!\n raise LoginFailed, 'Could not login with provided username and password' if !self.login\n return @last_login\n end", "def login(*credentials)\n basic_authorize(*credentials)\n end", "def login(username, password)\n open_session do |sess|\n# If we want to emulate https\n# sess.https!\n sess.post_via_redirect \"/sessions\", \"session[login_name]\" => username, \"session[password]\" => password\n assert_equal '/', sess.path\n assert_equal Constants::LOGGED_IN_NOTICE, sess.flash[:notice]\n# Unemulate https\n# sess.https!(false)\n end\n end", "def login(arguments)\n raise ArgumentError, \"Required argument 'username' is missing.\" unless arguments.key? :username\n raise ArgumentError, \"Required argument 'password' is missing.\" unless arguments.key? :password\n\n # log out first\n client.logout if client\n\n # log in with credentials\n @client.login(arguments[:username], arguments[:password])\n end", "def login\n response = client.call :login, :message => { :username => username, :password => password }\n response.body[:login_response][:result]\n end", "def login\n receive_until_token(@login_token)\n enter_login unless @logged_in\n if @password # if password was passed, else try without password\n receive_until_token(@password_token)\n enter_password unless @logged_in\n end\n receive_until_token(@prompt)\n @logger.info(\"logged in\") if @logger\n end", "def login(username, password)\n begin\n @agent.get(LOGIN_FORM_URL) do |page|\n saml_page = page.form_with(:action => LOGIN_URL) do |login|\n login.USER = username\n login.PASSWORD = password\n login.TARGET = MY_USAGE_URL\n end.submit\n token = saml_page.form_with(:action => SAML_URL).submit\n usage_page = token.form_with(:action => MY_ENERGY_USE_URL).submit\n @data_page = usage_page.link_with(:text => \"Green Button - Download my data\").click\n end\n @authenticated = true\n rescue Exception => e\n @last_exception = e\n return false\n end\n end", "def login\n RestClient.post(\"#{base_url}/j_spring_security_check\", {:j_username => username, :j_password => password}) do |response, request, result, &block|\n @cookies = response.cookies\n @cookies.delete('Path')\n if [301, 302, 307].include? response.code\n response\n else\n response.return!(request, result, &block)\n end\n end\n end", "def login (username=\"alien\", password=\"password\")\n\t\tif @connected\n\t\t\tbegin\n\t\t\t\t@sock.write \"#{username}\\r\\n\"\n\t\t\t\treceive()\n\t\t\t\t@sock.write \"#{password}\\r\\n\"\n\t\t\t\ts = receive()\n\t\t\t\t\n\t\t\t\tif s.include? \"Error:\"\n\t\t\t\t\terr_msg = s.scan(/(Error: )(.*)/).flatten[1]\n\t\t\t\t\tclose()\n\t\t\t\t\traise \"Trouble logging in. \" << err_msg\n\t\t\t\t\t@connected = false\n\t\t\t\tend\n\t\t\trescue\n\t\t\t\traise\n\t\t\tend\n\t\tend\n\n\t\treturn @connected\n\tend", "def login\n begin\n File.open(\"#{Settings.root}/tmp/cookies.txt\").read \n rescue Exception => e\n `curl --user-agent \"#{user_agent}\" -s -c #{Settings.root}/tmp/cookies.txt http://online.wsj.com/home-page` \n `curl --user-agent \"#{user_agent}\" -s -c #{Settings.root}/tmp/cookies.txt -d \"user=justin@justinrich.com&password=2p2aia5\" http://commerce.wsj.com/auth/submitlogin` \n end\n true\n end", "def try_to_login\n User.login(self.name, self.password)\n end", "def login(username, password)\n logout\n rest_client = ::Syncano.client(api_key: api_key)\n self.auth_key = rest_client.users.login(username, password)\n !self.auth_key.nil?\n end", "def login(username, password)\n response = post(LOGIN_SUBMIT_URL, 'fnid' => fnid, 'u' => username, 'p' => password)\n @username = username\n @password = password\n unless @cookie = response.header['set-cookie']\n raise LoginError, \"Login credentials did not work.\"\n end\n end", "def login(username, password)\n wait_until { login_btn.visible? }\n username_tb.type_text(username)\n password_tb.type_text(password)\n login_btn.click\n end", "def login \n headless = Headless.new\n headless.start\n \n @browser = Watir::Browser.start LOGIN_URL\n\n # Delete all expired cookies\n delete_cookies_if_expire\n # Use unexpired cookies that match the given email and password\n the_cookies = use_cookies\n\n # Fresh login\n if the_cookies.nil?\n browser.text_field(id: 'username').set email\n browser.text_field(id: 'password').set password\n browser.button(name: 'button').click\n save_cookies\n # Cookies still exist\n else\n browser.cookies.clear\n the_cookies.each do |cookies|\n browser.cookies.add(cookies[:name], cookies[:value])\n end\n browser.goto BASE_URL \n end\n end", "def login(username, password)\n session.context.login(name, username, password)\n end", "def logs_in?(user, password)\n \n @http = (@use_ssl? ? Net::HTTPS : Net::HTTP).new(@server, (@use_ssl ? 443 : 80))\n \n with_viewstate_and_connection(@http) do | payload |\n login_form_values = {\n \"txtUserName\" => user.to_s,\n \"txtUserPass\" => password.to_s,\n \"cmdLogin\" => \"cmdLogin\",\n \"listSpeed\" => \"Broadband\",\n \"__VIEWSTATE\" => payload,\n }\n \n begin\n @http.start do |http|\n form_post = Net::HTTP::Post.new(LOGIN_URL)\n form_post.set_form_data(login_form_values, '&')\n response = http.request(form_post); response.value\n end\n rescue Net::HTTPRetriableError => e\n if e.message =~ /302/ # RWW will return a redirect if the user is found\n return true\n end\n end\n return false\n end\n end", "def login(username = nil, password = nil)\n self.username, self.password = username, password if username && password\n self.instance.login\n end", "def login\r\n cf_cookies = {}\r\n\r\n ways = {\r\n 'RDS bypass' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], true) },\r\n 'RDS login' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], false) },\r\n 'Administrator login' => Proc.new { |foo| administrator_login(datastore['USERNAME'], datastore['PASSWORD']) },\r\n }\r\n ways.each do |what, how|\r\n these_cookies = how.call\r\n if got_auth? these_cookies\r\n print_status \"Authenticated using '#{what}' technique\"\r\n cf_cookies = these_cookies\r\n break\r\n end\r\n end\r\n\r\n fail_with(Exploit::Failure::NoAccess, \"Unable to authenticate\") if cf_cookies.empty?\r\n cf_cookies\r\n end", "def login(username, pwd)\n # we don't really need the @login_token. If login fails, an exception will be thrown\n @login_token = @jira.login(username, pwd)\n puts \"Logged in user #{username} to Jira with access token #{@login_token}\" if @dry_run\n @login_token\n end", "def login(username, password)\n raise AssertionError, \"You're already logged in\" if browser.link(href: '/logout').present?\n change_endpoint(:login)\n username_field = browser.text_field(id: 'username')\n update_action_log(:text_field, !username_field.nil? && username_field.present?)\n username_field.set(username)\n update_action_log(:set_text, username_field.value == username)\n\n browser.text_field(id: 'password').set(password)\n input_button = browser.input(type: 'submit')\n update_action_log(:input, !input_button.nil? && input_button.present?)\n\n input_button.click\n sleep 2\n update_action_log(:submit_login, browser.link(href: '/logout').present?)\n update_action_log(\n :link,\n browser.link(href: '/logout').present? || browser.link(href: '/login').present?\n )\n browser.link(href: '/logout').present?\n end", "def login(username, password)\n self.username.set username\n self.password.set password\n log_in.click\n end", "def login(email = @email, password = @password)\n response = Backendless.login email, password\n if response\n process_login_response email, password, response\n store_creddentials\n 'Login success'\n else\n abort('Login failed')\n end\n end", "def login\n response = @client.call(:login,\n cookies: @auth_cookie,\n message: {\n username: @username, \n password: decrypt(@password)\n })\n\n @auth_cookie = response.http.cookies if @auth_cookie.nil?\n @login_token = response.hash[:envelope][:body][:login_response][:login_result]\n response\n end", "def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end", "def login\n make_login_call\n end", "def login(nickname, password)\n @nickname = nickname\n @password = password\n @login_agent = Mechanize.new\n\n page = @login_agent.get(LOGIN_URI)\n\n login_form = page.forms.find { |form|\n LOGIN_URI + form.action == LOGIN_URI\n } or raise 'Cannot locate a login form'\n\n login_form.set_fields(:email => @nickname, :password => @password)\n\n page = login_form.submit\n\n login_form = page.forms.find { |form|\n LOGIN_URI + form.action == LOGIN_URI\n } and raise 'Login failed'\n\n page = @login_agent.get(ROOT_URI + \"/account/api\")\n remote_key = page.parser.xpath(\"(//table[@class='remotekey']//td[@class='value'])[2]/text()\").to_s\n\n api_login(nickname, remote_key)\n end", "def login(username, access_key)\n return false unless username.present? && access_key.present?\n\n params = { :login => uri_encode(username), :code => access_key }\n response = self.class.get('/login.aspx', :query => params)\n xml = response.parsed_response\n\n if response.success? && !xml['bbapi'].has_key?('error')\n self.session_id = retrieve_cookie(response, SESSION_ID_COOKIE)\n self.auth_token = retrieve_cookie(response, AUTH_TOKEN_COOKIE)\n return true\n else\n return false\n end\n end", "def login\n return @last_login if !@last_login.nil? && @last_login < @last_login + SESSION_TIMEOUT\n response = post '/account.php', {\n 'action' => 'login',\n 'username' => @username,\n 'password' => @password\n }\n if response_status_message(response) != RESPONSE_MESSAGES[:LOGIN_FAILED]\n @last_login = Time.now\n @authenticated = true\n return @last_login\n else\n @last_login = nil\n @authenticated = false\n end\n end", "def execLogin\n timer = WebCrawler::startTime\n login=true\n begin\n if @vars[:loginPage]=='' then return nil end\n @session.visit @vars[:loginPage]\n @session.driver.find_css(@vars[:usernameInput]).first.set @vars[:username]\n @session.driver.find_css(@vars[:passwordInput]).first.set @vars[:password]\n if @vars[:captcha]!=''\n @session.driver.find_css(@vars[:captchaInput]).first.set @vars[:captcha]\n end\n @session.driver.find_css(@vars[:loginSubmit]).first.click\n rescue Selenium::WebDriver::Error::WebDriverError ,\n Selenium::WebDriver::Error::UnknownError => e\n WebCrawler::logError 'webcrawler.driver', e.message\n login=false\n rescue => e\n WebCrawler::logError 'webcrawler.login', e.message\n login=false\n end\n WebCrawler::logTime timer, 'login.visit', @vars[:loginPage]\n if ((@vars[:sleepLogin]).to_i)>0\n sleep(((@vars[:sleepLogin]).to_i.to_f)/1000)\n end\n return login\n end", "def login\n \t# Find a user with params\n \tuser = User.authenticate(@credentials[:password], @credentials[:username])\n \tif user\n\t \t# Save them in the session\n\t \tlog_in user\n\t \t# Redirect to articles page\n\t \tredirect_to articles_path\n\telse\n\t\tredirect_to :back, status: :created\n\tend\n end", "def login?\n if login\n return true\n else\n return nil\n end\n end", "def login(email, password)\n unless verify_response(post(\"login\", :email_address => email, :password => password), :redirect_to => url_for(:only_path => false))\n raise Error, \"Campfire login failed\"\n end\n # ensure that SSL is set if required on this account\n raise SSLRequiredError, \"Your account requires SSL\" unless verify_response(get, :success)\n @logged_in = true\n end", "def login_with_proper_credentials\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, VALID_PASSWORD)\r\n\r\n click_on_button(SUBMIT_BUTTON_ID)\r\n\r\n end", "def configure_login_credentials\n # Clear saved cookie\n Utilities.remove_cookie\n\n account = prompt_for_account\n Utilities.log(\"Trying to login...\")\n session = Communication::SessionManager.new(account)\n session.login(force: true) do\n Utilities.log(\"Success (#{session.myself[:full_name]}).\", { type: :success })\n end\n rescue LogworkException::InvalidCredentials\n Utilities.log(\"Invalid username or password.\", { type: :error })\n rescue LogworkException::APIResourceNotFound, LogworkException::NotSuccessStatusCode\n Utilities.log(\"Seems that you have entered an invalid JIRA Server URL.\", { type: :error })\n end", "def login(login = users(:zero_user).login, password = \"testpassword\",\n remember_me = true, session: self)\n login = login.login if login.is_a?(User) # get the right user field\n session.visit(\"/account/login/new\")\n\n session.within(\"#account_login_form\") do\n session.fill_in(\"user_login\", with: login)\n session.fill_in(\"user_password\", with: password)\n session.check(\"user_remember_me\") if remember_me == true\n\n session.first(:button, type: \"submit\").click\n end\n end", "def login(browser = getBrowser(@displays, @headless))\n if @displayProgress\n puts \"\\x1B[90mAttempting to establish connection with: #{@login_uri}\\x1B[0m\"\n end\n browser.goto(@login_uri)\n browser.text_field(:name => 'username').set @username\n browser.text_field(:name => 'password').set @pin\n browser.checkbox(:name => 'remember').set\n browser.input(:type => 'submit', :value => 'Continue').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed first page\\x1B[0m\"\n end\n browser.select_list(:name => 'firstAnswer').option(:value => getCharAt(browser.label(:for => 'lettera').text.gsub(/[^0-9]/, ''), @security)).select\n browser.select_list(:name => 'secondAnswer').option(:value => getCharAt(browser.label(:for => 'letterb').text.gsub(/[^0-9]/, ''), @security)).select\n browser.input(:type => 'submit', :value => 'Log in').click\n if browser.link(:id => 'confirmpd').exists?\n browser.link(:id => 'confirmpd').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed occasional confirmation page\\x1B[0m\\n\"\n end\n end\n if @displayProgress\n puts \"\\x1B[90mSuccessfully logged in to BarclayCard\\x1B[0m\\n\"\n end\n browser\n end", "def check_login\n action = \"check_login\"\n url = build_url(action)\n\n # Create data for post\n data = post_data(action)\n\n # The raw should be the terminal number on success\n response = parse(ssl_post(url, data)) { |raw| { code: raw[0..6] } }\n success = response[:code] == @options[:terminal_no] ? true : false\n Response.new(\n success,\n \"\",\n response,\n authorization: \"\",\n test: test?\n )\n end", "def _login(username, password)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.users_path}/login.#{@configuration.api_request_format}\"\n response = post url, body: {user: username, password: Digest::MD5.hexdigest(password)}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end", "def login(login, password)\n raise NotImplementedError\n end", "def login(force: false)\n if SessionManager.logged_in? && !force\n raise LogworkException::UserAlreadyLoggedIn.new,\n \"You are already logged in.\"\n end\n\n params = {\n \"username\" => credentials.username,\n \"password\" => credentials.password\n }\n\n Communicator.instance.post(\"/rest/auth/#{Constants::JIRA_AUTH_VERSION}/session\", params) do |body, res|\n parse_login_response(body, res) { yield if block_given? }\n end\n end", "def login_to_lfcom(username, password)\r\n visit LFSOAP::CONST_LF_LOGIN_URL\r\n fill_in 'atg_loginEmail', with: username\r\n fill_in 'atg_loginPassword', with: password\r\n click_button 'Log In'\r\n end", "def login\n self.session = GData::Client::Calendar.new if session.nil?\n @token = session.clientlogin(username,password)\n true\n end", "def authenticate(username, password)\n true\n end", "def login\n\t\tnavigate(@login_path)\n\n\t\tlogin_form = find_by_xpath(@signin_xpath)\n\t\tlogin_field = find_by_id('login_field')\n\t\tpassword_field = find_by_id('password')\n\n\t\tlogin_field.send_keys(@username); sleep 1\n\t\tpassword_field.send_keys(@password); sleep 1\n\n\t\tlogin_form.click; sleep 15\n\tend", "def check_credentials(username, password)\n return false\n end", "def login (login = nil, password = nil, account_id=nil, external_auth=nil, domain=nil)\n\n if (login != nil && password == nil)\n # user given --> use generic user password\n # TODO: generate password (see https://forge.switch.ch/redmine/issues/2355)\n password = @pointconfig[\"generic_user_password\"]\n elsif (login == nil) && (password == nil)\n login = @pointconfig[\"username\"]\n password = @pointconfig[\"password\"]\n end\n\n res = query(\"login\",\n \"login\" => login,\n \"password\" => password,\n \"account-id\" => account_id,\n \"external-auth\" => external_auth,\n \"domain\" => domain)\n\n cookies = res.response[\"set-cookie\"]\n puts cookies.inspect\n cookies.split(\";\").each{|s|\n array = s.split(\"=\")\n if array[0] == \"BREEZESESSION\"\n @sessionid = array[1]\n end\n }\n puts \"ACS: Logged in\"\n return res.body\n end", "def try_login(credential)\n data = \"j_username=#{Rex::Text.uri_encode(credential.public)}&\"\n data << \"j_password=#{Rex::Text.uri_encode(credential.private)}&\"\n data << 'loginButton=Login'\n\n opts = {\n 'uri' => '/j_security_check',\n 'method' => 'POST',\n 'data' => data,\n 'headers' => {\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Cookie' => \"JSESSIONID=#{self.jsession}\",\n }\n }\n\n send_request(opts)\n end", "def login(args = { })\n # POST /svc/Login\n # Host: eval.parkmedia.tv\n # Content-type: application/x-www-form-urlencoded\n # Content-length: 25\n #\n # username=foo&password=bar\n\n # ERROR RESPONSE\n # --------------\n # HTTP/1.0 403 Access Forbidden\n # Content-type: text/plain\n #\n # Error=BadAuthentication\n\n # SUCCESS RESPONSE\n # ----------------\n # HTTP/1.0 200 OK\n # Content-type: text/plain\n # Set-Cookie: JSESSIONID=123456789\n #\n # JSESSIONID=123456789\n\n self.http_cookie = nil\n data = { }\n\n username = args[:username]\n password = args[:password]\n\n data['password'] = password if password\n data['username'] = username if username\n\n #logger.debug { \"Logging In As User: '#{username}' Using Password: #{password ? 'yes' : 'no'}\" }\n http_post_form('Login', data)\n self.http_cookie = response['set-cookie'] if response and response.code == '200'\n http_cookie\n end", "def authorize(login, password)\n return true unless CloudCrowd.config[:use_http_authentication]\n return CloudCrowd.config[:login] == login &&\n CloudCrowd.config[:password] == password\n end", "def login_with_username username, password, callback\n\t\t\t@method_callbacks['login'] = callback\n\t\t\t@auth_client = SRP::Client.new\n\t\t\t@username = username\n\t\t\t@password = password\n\t\t\t\n\n\t\t\ta = @auth_client.start_authentication()\n\t\t\tid = @ddp.call( 'beginPasswordExchange', { 'A' => a, user: { username: username } } )\n\n\t\t\t@method_callbacks[id] = { method: self.method(:handle_login_challenge), result: false, updated: false }\n\t\tend", "def login(login,pass,hash = nil)\n\n #login_from_session_ok = false\n #if (!hash.nil? && hash.length>0)\n #\t@connect = Connect.new\n #\t@id = @connect.login_from_cookie(hash)\n #\tif(!@id)\n #\t\t@connect = nil\n #\telse\n #\t\tlogin_from_session_ok = true\n #\t\t@me = true\n #\tend\n #end\n #unless(login_from_session_ok)\n @connect = Connect.new(login,pass)\n @id = @connect.login\n return @id unless @id\n @me = true\n #end\n\n self\n end", "def login\n validate_arguments!\n\n Turbot::Auth.login\n display \"Authentication successful.\"\n end", "def connect_login(global = true)\n ftpsock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"a001 LOGIN #{user} #{pass}\\r\\n\")\n\n if (res !~ /^a001 OK/)\n print_status(\"Authentication failed\")\n return false\n end\n\n return true\n end", "def login (website, username, password = nil)\n return true if @website == website and browser.hidden(:name, 'sno').exist?\n \n @website = website\n puts \"[BrowserOperator] Login #{username} #{password}\"\n if password.nil?\n result = login_from_online_session username\n else\n result = fill_login_information username, password\n end\n \n browser.table(:id, 'table_html_body').wait_until_present(@time_out) if result\n result \n end", "def login(user,pass)\n enter_text(user_field, user)\n enter_text(pass_field, pass)\n sleep 1\n # wait_for_login_done\n end", "def login\n\n username = prompt.ask(\"Enter your username:\\n\")\n while !User.find_by(username: username)\n puts \"Username not found - please try again.\\n\"\n username = prompt.ask(\"Enter your username:\\n\")\n end\n\n password = prompt.mask(\"Enter your password:\")\n while User.find_by(username: username).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your password:\")\n end\n \n self.user_id = User.find_by(username: username).id\n puts \"Successfully logged in! Welcome #{User.return_username(user_id)}!\\n\"\n\n show_threads\n end", "def able_to_login?(args = {})\n begin\n telnet = Net::Telnet::new(\"Host\" => args[:ip], \"Port\" => args[:port])\n telnet.login(args[:user], args[:password])\n return true\n rescue => e\n return false\n end\n end", "def authenticate!\n user = connection.authenticate!(credentials_hash)\n\n if user\n success!(user)\n else\n fail!('Could not log in')\n end\n rescue Net::LDAP::LdapError\n fail!('Could not log in')\n end", "def log_in(username, password)\n logger.info \"Logging in as #{username}\"\n wait_for_element_and_type(username_input, username)\n wait_for_element_and_type(password_input, password)\n wait_for_element_and_click sign_in_button\n when_exists(sign_out_link, Config.short_wait)\n end", "def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end", "def login\n unless (@login and @password)\n raise \"Can't log in without login and password\"\n end\n \n lform = @agent.get('https://login.yahoo.com/config/login').form('login_form')\n lform.login = @login\n lform.passwd = @password\n begin\n @agent.submit(lform, lform.buttons.first)\n rescue Exception => e\n puts \"Oops: #{e}\"\n end\n end", "def login\n # check if file credential exists\n if File.file?(@@credentials_file)\n puts 'Credentials file found!'.bold\n unless yes?(\"Overwrite #{@@credentials_file}? |no|\".bold.yellow)\n puts \"Aborted.\".red.bold\n exit\n end\n end\n\n # Ask for username and password, mask the password and make it\n # green if it's the correct password, red if the access was denied.\n # Aborts if the password is empty.\n puts 'Write your username and password for ' + 'RubyGems.org'.yellow.bold\n username = ask('Username:'.yellow.bold)\n password = ask('Password:'.yellow.bold, echo: false)\n (puts \"Aborted.\".red.bold; exit) if password.empty?\n\n # fakes a masked password as long as the username,\n # for style purposes only.\n masked_password = '*' * username.length\n print masked_password unless options[:show_password]\n\n begin\n Tmg.write_credentials(username, password)\n rescue RuntimeError\n puts \"\\b\" * masked_password.length + masked_password.red.bold\n puts 'Access Denied.'.red.bold\n exit\n else\n puts \"\\b\" * masked_password.length + masked_password.green.bold\n puts \"Credentials written to #{@@credentials_file}\".green.bold\n end\n end", "def login(username, password)\n login_url = get(BASE_URL).match(/href=\"([^\"]+)\">login<\\/a>/)[1]\n form_html = get(BASE_URL + login_url)\n fnid = form_html.match(/<input type=hidden name=\"fnid\" value=\"([^\"]+)\"/)[1]\n response = post(LOGIN_SUBMIT_URL, 'fnid' => fnid, 'u' => username, 'p' => password)\n @username = username\n @password = password\n unless @cookie = response.header['set-cookie']\n raise LoginError, \"Login credentials did not work.\"\n end\n end", "def make_login user, password\n server = Configuration.SERVER\n addr = Configuration.CLIOWL_ADDRESS\n \n HttpHelper.post \"http://#{server}#{addr}/login\", { 'user' => user, 'password' => password }\n end", "def login(satellite_url, satellite_login, satellite_password)\n t = 0\n @client = XMLRPC::Client.new2(satellite_url)\n begin\n @key = @client.call('auth.login', satellite_login, satellite_password, timeout=480)\n rescue EOFError, TimeoutError, RuntimeError => ex\n t += 1\n if t > 3 # Give up after 3 attempts\n puts 'Too many attempts to authenticate. Exiting.'\n exit\n end\n puts \"#{ex.class}, retrying authentication...\"\n retry\n rescue XMLRPC::FaultException\n puts 'Login failed, invalid credentials.'\n exit\n end\nend", "def authenticates_with?(login, pass, encryption_type=nil)\n return false unless self.send(props[:login]) == login\n encrypted(pass, encryption_type) == self.send(props[:crypted_password])\n end", "def login(email, password)\n unless login_with_email_and_password(email, password).uri == @uri\n raise Error, \"Campfire login failed\"\n end\n @lobby = agent.page\n @rooms = get_rooms(@lobby)\n @logged_in = true\n end", "def validate_credentials(passwd)\n token = Security.logon_user(@username, nil, passwd,\n LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT)\n true\n rescue Chef::Exceptions::Win32APIError => e\n Chef::Log.trace(e)\n # we're only interested in the incorrect password failures\n if /System Error Code: 1326/.match?(e.to_s)\n return false\n end\n\n # all other exceptions will assume we cannot logon for a different reason\n Chef::Log.trace(\"Unable to login with the specified credentials. Assuming the credentials are valid.\")\n true\n end", "def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end", "def login\n @rforce.login( @login , @password )\n end", "def authenticate(*credentials, &block)\n raise ArgumentError, 'at least 2 arguments required' if credentials.size < 2\n\n if credentials[0].blank?\n return authentication_response(return_value: false, failure: :invalid_login, &block)\n end\n\n if @sorcery_config.downcase_username_before_authenticating\n credentials[0].downcase!\n end\n\n user = sorcery_adapter.find_by_credentials(credentials)\n\n unless user\n return authentication_response(failure: :invalid_login, &block)\n end\n\n set_encryption_attributes\n\n if user.respond_to?(:active_for_authentication?) && !user.active_for_authentication?\n return authentication_response(user: user, failure: :inactive, &block)\n end\n\n @sorcery_config.before_authenticate.each do |callback|\n success, reason = user.send(callback)\n\n unless success\n return authentication_response(user: user, failure: reason, &block)\n end\n end\n\n unless user.valid_password?(credentials[1])\n return authentication_response(user: user, failure: :invalid_password, &block)\n end\n\n authentication_response(user: user, return_value: user, &block)\n end", "def pap_login(username,password)\n if (!username.kind_of?(String))\n raise ArgumentError, \"Expected String for username, but #{username.class} provided.\"\n end\n\n if (!password.kind_of?(String))\n raise ArgumentError, \"Expected String for password, but #{password.class} provided.\"\n end\n\n # open a socket to the server\n socket = open_socket()\n\n # make start packet\n header = TacacsPlus::TacacsHeader.new\n if (@session_id)\n header.session_id = @session_id\n else\n header.randomize_session_id!\n end\n header.minor_version_one!\n body = TacacsPlus::AuthenticationStart.new\n body.action_login!\n body.authen_type_pap!\n body.priv_lvl = 1\n body.user = username\n body.data = password\n\n session = ClientSession.new()\n session.request = PacketStruct.new(header,body)\n session.type = :authentication\n session.getuser = username\n session.getpass = password\n\n # process server dialog\n attempt = process_response(session, socket)\n\n return(attempt)\n end", "def login(username = users(:common).username, pass = \"testpassword\")\n post login_url, params: {session: {username: username, password: pass}}\n end", "def login(try_password)\n pass = Password.new(self.password.encode('ascii-8bit'))\n return pass == try_password\n end", "def login(password)\n authenticate(password) && set_token && save! && token\n end", "def login(user, password)\n\t@connection.cmd('String' => \"login #{user} #{password}\\r\",'Match' => /error id=0 msg=ok\\n/, 'Timeout' => 3)\nend", "def validate_login(user_name, password)\n if user_name.blank? || password.blank?\n flash_now(:error, get_blank_message(user_name, password))\n return false\n end\n\n # No validate file means only remote authentication is allowed\n return false unless Settings.validate_file\n\n ip = Settings.validate_ip ? request.remote_ip : nil\n authenticate_response = User.authenticate(user_name, password, ip: ip)\n custom_status = Settings.validate_custom_status_message[authenticate_response]\n\n if authenticate_response == User::AUTHENTICATE_BAD_PLATFORM\n flash_now(:error, I18n.t('main.external_authentication_not_supported'))\n elsif custom_status\n flash_now(:error, custom_status)\n elsif authenticate_response == User::AUTHENTICATE_SUCCESS\n return true\n else\n flash_now(:error, Settings.incorrect_login_message || I18n.t('main.login_failed'))\n end\n false\n end", "def login(username,password,quick=false)\n if (!username.kind_of?(String))\n raise ArgumentError, \"Expected String for username, but #{username.class} provided.\"\n end\n\n if (!password.kind_of?(String))\n raise ArgumentError, \"Expected String for password, but #{password.class} provided.\"\n end\n\n\n # open a socket to the server\n socket = open_socket()\n\n # make start packet\n header = TacacsPlus::TacacsHeader.new\n if (@session_id)\n header.session_id = @session_id\n else\n header.randomize_session_id!\n end\n body = TacacsPlus::AuthenticationStart.new\n body.action_login!\n body.authen_type_ascii!\n body.priv_lvl = 1\n body.user = username if (quick)\n\n session = ClientSession.new()\n session.request = PacketStruct.new(header,body)\n session.type = :authentication\n session.getuser = username\n session.getpass = password\n\n # process server dialog\n attempt = process_response(session, socket)\n\n return(attempt)\n end", "def login user, password\n @username = user\n @ctx.login user, password\n end", "def login(browser = getBrowser(@displays, @headless))\n if @displayProgress\n puts \"\\x1B[90mAttempting to establish connection with: #{@login_uri}\\x1B[0m\"\n end\n browser.goto(@login_uri)\n browser.text_field(:name => 'frmLogin:strCustomerLogin_userID').set @username\n browser.text_field(:name => 'frmLogin:strCustomerLogin_pwd').set @password\n browser.checkbox(:name => 'frmLogin:loginRemember').set\n browser.input(:id => 'frmLogin:btnLogin1').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed first page\\x1B[0m\"\n end\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo1').option(:value => \"&nbsp;#{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo1').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo2').option(:value => \"&nbsp;#{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo2').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo3').option(:value => \"&nbsp;#{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo3').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.input(:id => 'frmentermemorableinformation1:btnContinue').click\n until browser.link(:title => 'View the latest transactions on your Lloyds Account').exists? do\n # Email Confirmation Page\n if browser.input(:id => 'frm2:btnContinue2', :type => 'image').exists?\n browser.input(:id => 'frm2:btnContinue2', :type => 'image').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) email confirmation page\\x1B[0m\\n\"\n end\n end\n # Offers Page\n if browser.link(:title => 'Not right now').exists?\n browser.link(:title => 'Not right now').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) offers page\\x1B[0m\\n\"\n end\n end\n # Occasional 'Important Update' Page\n if browser.checkbox(:id => 'frmmandatoryMsgs:msgList1:0:chktmpMsgRead1').exists?\n browser.checkbox(:id => 'frmmandatoryMsgs:msgList1:0:chktmpMsgRead1').set\n if @displayProgress\n puts \"\\x1B[90mTicked checkbox to confirm I've read a message\\x1B[0m\\n\"\n end\n end\n if browser.checkbox(:id => 'frmmandatoryMsgs:tmpAllMsgsRead').exists?\n browser.checkbox(:id => 'frmmandatoryMsgs:tmpAllMsgsRead').set\n if @displayProgress\n puts \"\\x1B[90mTicked checkbox to never show a message again\\x1B[0m\\n\"\n end\n end\n if browser.input(:id => 'frmmandatoryMsgs:continue_to_your_accounts2').exists?\n browser.input(:id => 'frmmandatoryMsgs:continue_to_your_accounts2').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) important information page\\x1B[0m\\n\"\n end\n end\n if browser.li(:class => 'primaryAction').link(:index => 0).exists?\n browser.li(:class => 'primaryAction').link(:index => 0).click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) offers page\\x1B[0m\\n\"\n end\n end\n end\n if @displayProgress\n puts \"\\x1B[90mSuccessfully logged in to Lloyds\\x1B[0m\\n\"\n end\n sleep(2)\n browser\n end", "def login\n email = params[:email]\n password = params[:password]\n render plain: User.check_credentials(email, password)\n end", "def login\n open(@credentials_file, 'r').readlines.first.strip if valid_file?(@credentials_file)\n end", "def cookie_login\n @current_player = Player.find(cookies[:player_id])\n @current_player.password_hash == cookies[:password_hash] \n rescue \n false\n end", "def login\n # pull the user info from the user model with the login params\n user = User.find_by_login(params[:login])\n # Authenciate with password\n if user and user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:user_login] = user.login\n session[:user_authority] = user.authority\n # redirect to the landing page\n redirect_to \"/projects\"\n # failed \n else\n redirect_to login_url, alert: \"無効なID、パスワードの組み合わせです。\"\n end\n end", "def _login(meth, *args)\n begin\n @session = _do_call(\"session.#{meth}\", args)\n rescue Errors::HostIsSlave => e\n @uri = @uri.dup\n @uri.host = e.description[0]\n @uris.unshift(@uri).uniq!\n @client = nil\n retry\n end\n\n @login_meth = meth\n @login_args = args\n after_login\n true\n end", "def login(partner_id, username=KalturaNotImplemented, password=KalturaNotImplemented, extra_params=KalturaNotImplemented, udid=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id)\n\t\t\tclient.add_param(kparams, 'username', username)\n\t\t\tclient.add_param(kparams, 'password', password)\n\t\t\tclient.add_param(kparams, 'extraParams', extra_params)\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('ottuser', 'login', 'KalturaLoginResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def login_by_login_id(login_id, password, partner_id=KalturaNotImplemented, expiry=86400, privileges='*')\n\t\t\tkparams = {}\n\t\t\t# The user's email address that identifies the user for login\n\t\t\tclient.add_param(kparams, 'loginId', login_id);\n\t\t\t# The user's password\n\t\t\tclient.add_param(kparams, 'password', password);\n\t\t\t# The identifier of the partner account\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id);\n\t\t\t# The requested time (in seconds) before the generated KS expires (By default, a KS expires after 24 hours).\n\t\t\tclient.add_param(kparams, 'expiry', expiry);\n\t\t\t# Special privileges\n\t\t\tclient.add_param(kparams, 'privileges', privileges);\n\t\t\tclient.queue_service_action_call('user', 'loginByLoginId', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def authenticate(login, password)\n u = find_in_state :first, :active, \n :conditions => [\"admin_users.login = ? OR admin_users.email = ?\", login, login]\n u && u.authenticated?(password) ? u : nil\n end", "def login(email, password)\n login_link = @driver.find_element(:id, 'login-nav')\n login_link.click\n $verbose ? puts('logging in as ' + email) : nil\n # fill out login form\n complete_login_process(email, password)\n # wait for redirect to finish by checking for footer element\n handle_oauth_redirect(email)\n # accept SCP terms of service if needed\n accept_scp_tos\n $verbose ? puts('login successful') : nil\n end", "def authenticate!(login, password, group_names = nil)\n user = valid_login?(login, password)\n\n return user if user && is_member?(user.dn, group_names)\n end" ]
[ "0.69659966", "0.6943631", "0.68029386", "0.6529158", "0.65098614", "0.6448102", "0.6405253", "0.6319349", "0.63108695", "0.6307422", "0.6305286", "0.6197721", "0.61966246", "0.61807466", "0.61802006", "0.6169368", "0.6163685", "0.6154385", "0.6147033", "0.61369807", "0.6130096", "0.612779", "0.60977024", "0.60962045", "0.6090432", "0.6072334", "0.6069304", "0.604712", "0.6040748", "0.6009247", "0.60048443", "0.599855", "0.59891695", "0.5982415", "0.59799635", "0.5952136", "0.59457797", "0.5939373", "0.5928318", "0.59194356", "0.591209", "0.5887135", "0.5886043", "0.5882227", "0.58733594", "0.58619905", "0.5851812", "0.5847723", "0.58450174", "0.5841434", "0.58392686", "0.58340144", "0.583303", "0.5832263", "0.58260083", "0.5819055", "0.57974195", "0.5787196", "0.5781143", "0.57752264", "0.5771824", "0.5769728", "0.5752023", "0.5745914", "0.57426226", "0.5741916", "0.57294184", "0.5723074", "0.57220143", "0.5714143", "0.5711494", "0.5709516", "0.570446", "0.5699787", "0.56981975", "0.5696239", "0.5690807", "0.5680989", "0.56783026", "0.56751823", "0.5672242", "0.5662365", "0.56616026", "0.5642215", "0.5629931", "0.5620345", "0.5607049", "0.5605826", "0.5593616", "0.5592542", "0.5588", "0.5585694", "0.55822676", "0.55778205", "0.55742186", "0.55715394", "0.5567966", "0.55664146", "0.5564064", "0.5558214" ]
0.7541474
0
Log out of Cherwell.
def logout return @client.logout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n reset_session\n @current_baby = nil\n end", "def log_out\n forget(current_baby)\n reset_session\n @current_baby = nil\n end", "def logout\n validate_arguments!\n\n Turbot::Auth.logout\n display \"Local credentials cleared.\"\n end", "def log_out\n\t\tsession.delete(:golfer_id)\n\t\t@current_golfer = nil\n\tend", "def exec_logout\n core_destroySession\n redirect_to lato_core.login_path\n end", "def log_out\n forget(current_company)\n session.delete(:company_id)\n @current_company = nil\n end", "def logoff\n end", "def logout\n session[:ccc9527] = nil\n redirect_to root_path\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 reset_session\n @current_user = nil\n end", "def log_out\n\t\tsession.delete(:authorization)\n\tend", "def log_out \n session.clear\n @current_user = nil\n end", "def log_out\n\t \tsession.delete(:user_id)\n\t \t@current_user =nil\n\t end", "def logged_out\n end", "def logged_out\n end", "def logged_out\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 hubssolib_log_out\n # Causes the \"hubssolib_current_[foo]=\" methods to run, which\n # deal with everything else.\n self.hubssolib_current_user = nil\n self.hubssolib_current_session = nil\n end", "def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user= nil\n\tend", "def logout\n Heroku::Auth.logout\n display \"Local credentials cleared.\"\n end", "def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end", "def destroy\n\t\tlog_out\n\t\tUTEPSSO.deauthenticate(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tredirect_to root_url\n\tend", "def log_out\n\t\tsession.delete(:id)\n\t\t@current_user = nil\n\t\tadmin_session(false)\n\tend", "def destroy\n\t\tsession[:chef] = nil\n\t\tflash[:success] = \"You have logged out\"\n\t\tredirect_to root_path\n\tend", "def destroy\n @current_user = nil\n\n # Remove the hip_session id, since that kind of goes along\n # with login. Yeah, this code is far away from where hip_session\n # gets created making for confusion, sorry.\n #session.delete(:hip_session_id)\n # actually, destroy the whole damn session, why not, we're redirecting\n # them elsewhere anyway.\n reset_session\n\n # Remove shib cookies to log out of local Shib Service Provider.\n # But this doesn't work anyway, not sure why.\n #cookies.keys.find_all {|k| k =~ /^_shibsession_/ || k =~ /^_shibstate_/}.each { |cookie| cookies.delete(cookie) }\n\n redirect_to \"https://login.johnshopkins.edu/cgi-bin/logoff.pl\"\n\n end", "def log_out\n forget(current_user)\n reset_session\n @current_user = nil\n end", "def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n forget current_user\n reset_session\n @current_user = nil\n end", "def logout\n send_command( KonoEppLogout.new, 1500 )\n end", "def destroy\n log_out\n end", "def log_out\n session.delete(:user_id)\n session.delete(:destination)\n @current_user = nil\n @current_dest = 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 session.delete(:officer_id)\n @current_officer = nil\n end", "def log_out\n session.delete(:user_id)\n session.delete(:type)\n @current_user = nil\n end", "def logout\n if @logged_in\n cmd(\"exit\", true, true, @logout_token)\n handle_logout\n end\n end", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend", "def logout\n end", "def logout\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:danger] = 'Logoff realizado!'\n end", "def log_out\n forget(current_doctor)\n session.delete(:doctor_id)\n @current_doctor = 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\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\t\tforget(current_user)\n\t\tsession.delete(:investor_id)\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:username)\n session.delete(:token)\n @current_user = nil\n end", "def log_out\n session.delete(:uid)\n @current_user = nil\n end", "def destroy\n user_id = app_session.current_user_id\n current_user_session.register_logout\n\n app_session.logged_out\n DeterLab.logout(user_id)\n SslKeyStorage.delete(user_id)\n\n ActivityLog.for_user(user_id).add(:logout, user_id)\n rescue DeterLab::NotLoggedIn\n # That's ok. We are logging out anyway\n ensure\n redirect_to :login, notice: t(\".success\")\n end", "def logoff()\n #This is a stub, used for indexing\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end", "def 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", "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", "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\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 session.delete :user_id\n @current_user = nil\n end", "def sso_logout\n # Logout of Bobcat first while we still have the PDS_HANDLE cookie\n bobcat_logout.logout!\n # Then clear all library.nyu.edu cookies\n cookies.clear(domain: ENV['LOGIN_COOKIE_DOMAIN'])\n # If a user logs into client application and then logs out of that application\n # and then tries to login to another SSO client application, passive shibboleth\n # will be called and log them in automatically, this stops that\n session[:_check_passive_shibboleth] = true\n end", "def logout\n\t\t\tPicombo::Session.instance.unset('loggedin')\n\t\t\tPicombo::Session.instance.unset('user')\n\t\tend", "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\tsession[:user_id] = nil\n\tend", "def log_out\n session.clear\n cookies.clear\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil \n end", "def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end", "def log_out\n forget(current_user)\n session.delete(:username)\n @current_user = nil\n end", "def log_out\n\t\tcookies.delete(:cookie_id)\n\n\tend", "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 forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end" ]
[ "0.7800335", "0.76600605", "0.76157767", "0.7568101", "0.7521433", "0.7515926", "0.74795145", "0.7462159", "0.743068", "0.7399095", "0.7354413", "0.73315316", "0.73011285", "0.72919923", "0.72919923", "0.72919923", "0.7273882", "0.7273882", "0.7273882", "0.7273882", "0.7272976", "0.72628695", "0.7254833", "0.7238131", "0.7227733", "0.72234905", "0.7223215", "0.7220543", "0.7219038", "0.72146726", "0.72138584", "0.7212232", "0.7206782", "0.72036195", "0.72010106", "0.7198186", "0.7197689", "0.7194376", "0.71943516", "0.7192922", "0.7191227", "0.71904826", "0.71904826", "0.7158289", "0.7151952", "0.71427804", "0.71427804", "0.71427804", "0.71427804", "0.71427804", "0.7137866", "0.7137866", "0.7137866", "0.7137866", "0.7137866", "0.71368194", "0.7130928", "0.7126972", "0.71234107", "0.7122616", "0.7118894", "0.7111542", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.71103334", "0.710309", "0.70996976", "0.70985466", "0.70957464", "0.70943147", "0.7091979", "0.7086383", "0.7082103", "0.7077254", "0.7074443", "0.7074359", "0.70733887", "0.7071428", "0.70684123", "0.7061699", "0.7057825" ]
0.0
-1
Get the Cherwell incident with the given public ID, and return an Incident object.
def incident(id) incident_xml = get_object_xml('Incident', id) error = self.last_error if error raise Cherby::NotFound.new("Cannot find Incident '#{id}': #{error}") else return Incident.new(incident_xml.to_s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.\n if !result.nil?\n incident['IncidentID'] = result\n return incident\n else\n return nil\n end\n end", "def incident_id\n @incident_id || IncidentId.new(self)\n end", "def incident_id\n @attrs['IncidentID']\n end", "def show\n begin\n @incident = Incident.find(params[:id])\n rescue\n logger.error \"Attempt to access unknown incident report #{params[:id]}\"\n redirect_to incidents_url, notice: 'Sorry, invalid Incident ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\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 get_incident_by_problemid(problemid)\n # use problemid from nagios as a filter passed as incident_key\n res = RestClient.get INCIDENT_QUERY_URL, :params => {:fields => \"#{problemid}\"} \n end", "def set_incident\n @incident = Incident.find_by_sql(\"SELECT * FROM incidents WHERE incident_id =#{params[:id]};\" )[0]\n end", "def set_inciting_incident\n @inciting_incident = IncitingIncident.find(params[:id])\n end", "def client_from_external_id(ext_id)\n resp = get CLIENT_API_PATH, params: { 'externalId' => ext_id }\n result = process_response(resp)\n Resources::Client.new(result)\n rescue Errors::NotFound\n nil\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def fetch_by_id(invoice_id)\n response = do_http_get(\"#{url_for_resource(Quickeebooks::Online::Model::Invoice::REST_RESOURCE)}/#{invoice_id}\")\n Quickeebooks::Online::Model::Invoice.from_xml(response.body)\n end", "def get_invoice_by_id(invoice_id)\n get_invoice(invoice_id)\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def get_client_by_id client_id\n @clients[client_id]\n end", "def client_from_id(id)\n resp = get \"#{CLIENT_API_PATH}/#{id}\"\n result = process_response(resp)\n Resources::Client.new(result)\n rescue Errors::NotFound\n nil\n end", "def get_ci(id)\n xml = RestClient.get \"#{@base_url}/ci/#{id}\", {:accept => :xml, :content_type => :xml}\n return XmlSimple.xml_in(xml)\n end", "def get_incident(incident_id, opts = {})\n data, _status_code, _headers = get_incident_with_http_info(incident_id, opts)\n data\n end", "def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end", "def find_company(company_id)\n company = Company.find_by_id(company_id)\n halt 404 unless company\n\n company\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def get_cave(id)\n @caves.each { |cave| return cave if(cave.id.to_i == id.to_i) }\n end", "def set_incident\n @incident = @quote.incidents.find(params[:id])\n\n end", "def set_incident\n @incident = current_user.incidents.find(params[:id])\n end", "def set_incidente\n @incidente = Incidente.accessible_by(current_ability).find(params[:id])\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 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 get_cuisine\n @cuisine = Cuisine.find(params[:id])\n end", "def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incident }\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.xml { render :xml => @incident }\n end\n end", "def company_id\n self.dig_for_string(\"agentSummary\", \"office\", \"companyId\")\n end", "def show(id)\n @client = Locomotive::Client.get(id)\n raise NotFound unless @client\n display @client\n end", "def show(id)\n @contract = Locomotive::Contract.get(id)\n raise NotFound unless @contract\n display @contract\n end", "def set_public_hospital\n @public_hospital = PublicHospital.find(params[:id])\n end", "def show\n @issuance = Issuance.where(id: params[:id]).first\n end", "def set_incident\n @incident = Incident.includes(:images).find(params[:id])\n end", "def set_encounter\n @encounter = Encounter.find(params[:id])\n end", "def set_encounter\n @encounter = Encounter.find(params[:id])\n end", "def set_encounter\n @encounter = Encounter.find(params[:id])\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def new\n return if auth(\"website_administrator\")\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @incident }\n end\n end", "def get id\n doc = database.get id\n new(doc)\n end", "def find_by_external_id(external_id)\n {}\n end", "def investor(id:)\n Investor.find(id)\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 get_ice(cool_centrifuge=true)\n show do\n title \"Get Ice\"\n separator\n note \"<b>Keeping samples and reagents cold is important to slow down enzymes that may diminish nucleic acid integrity.</b>\"\n check \"Grab a foam bucket from underneath the sink.\"\n check \"Go to the #{ICE_LOC} ice machine and fill up your bucket.\"\n # check \"Fill a foam ice bucket, located underneath sink.\"\n if cool_centrifuge\n check \"Set a benchtop and large centrifuge to 4°C\"\n end\n end\n end", "def get_by_id(id)\n self.class.get(\"/aldebaran-instances/instances/#{id}\", :basic_auth => @auth)\n end", "def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end", "def issue_from_id(id)\n json_file('partystances').detect { |i| i['id'] == id } \n end", "def hominid\n @hominid ||= Hominid::API.new(configuration.mailchimp_api_key)\n end", "def create\n @incident = Incident.new(params[:incident])\n\t@incident.project = session[:project]\n\n respond_to do |format|\n if @incident.save\n flash[:notice] = t 'flash.incident_create'\n format.html { redirect_to(@incident) }\n format.xml { render :xml => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, :notice => 'Incident was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_claim(id:)\n get(\"claims/#{id}\")\n end", "def set_iceandfire\n @iceandfire = Iceandfire.find(params[:id])\n end", "def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end", "def get_incident_with_http_info(incident_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IncidentsApi.get_incident ...'\n end\n # verify the required parameter 'incident_id' is set\n if @api_client.config.client_side_validation && incident_id.nil?\n fail ArgumentError, \"Missing the required parameter 'incident_id' when calling IncidentsApi.get_incident\"\n end\n # resource path\n local_var_path = '/data/v1/incidents/{INCIDENT_ID}'.sub('{' + 'INCIDENT_ID' + '}', CGI.escape(incident_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'IncidentResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"IncidentsApi.get_incident\",\n :header_params => 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: IncidentsApi#get_incident\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find(vendor_id)\n @client.get(\"/#{@model}/#{vendor_id}\")\n end", "def set_clinical_icd\n @clinical_icd = ClinicalIcd.find(params[:id])\n end", "def set_encounter\n @encounter = Encounter.find(params[:id])\n end", "def get_by_unique(id)\n Event.new(self, @connection.request(:show_by_origin, {:id => id}))\n end", "def find_cuisine\n if params[:spice_id]\n @spice = Cuisine.find(params[:spice_id])\n end\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 find_institute\n @institute = Institute.find(params[:id])\n end", "def _find_citation_id_in_db(pmid, name, authors, year)\n # PMID is a string. Do a little clean-up.\n pmid = pmid.to_i.to_s\n\n citation = nil\n\n if !pmid.eql?('0')\n # Try to find citation already in system.\n citation = Citation.find_by(pmid:)\n return citation.id if citation\n\n puts 'Unable to locate PMID in system'\n puts 'Attempting to efetch'\n import_citations_from_pubmed_array(@project, [pmid], false)\n citation = Citation.find_by(pmid:)\n return citation.id if citation\n\n puts 'Unable to efetch'\n\n else\n puts 'Find citation by name'\n citation = Citation.find_by(name:)\n return citation.id if citation\n\n puts 'Unable to find citation by name'\n\n end\n\n puts 'Creating citation from citation_name, authors, year'\n citation = _create_citation_from_citation_name__authors__year(name, authors, year)\n citation.id\n end", "def find_cuisine\n if params[:cuisine_id]\n @cuisine = Cuisine.find(params[:cuisine_id])\n end\n end", "def institution(id = nil)\n res = Connection.get('institutions', id)\n id.nil? ? Institution.all(res) : Institution.new(res)\n end", "def get(id)\n\t\t\t\turl = \"api/v2/interactions/#{id}\"\n\t\t\t\tget_object(:get, \"interaction\", url)\n\t\t\tend", "def invoice(id)\n self.invoices.detect { |i| i.id == id }\n end", "def set_incident_proof\n @incident_proof = IncidentProof.find(params[:id])\n end", "def find_contention_by_claim_id(claim_id)\n response = request(:find_contentions, \"claimId\": claim_id)\n response.body[:find_contentions_response][:benefit_claim]\n end", "def show\n # retrieve the invoice\n @invoice = Invoice.to_adapter.get(params.require(:id))\n # respond 404 when invoice was not found\n head(:not_found) unless @invoice\n end", "def get_instance(payload)\n ConferenceInstance.new(@version, payload)\n end", "def get_contest\n @contest = Contest.find_by_id(params[:id])\n return if check_nil_object(@contest)\n end", "def get_event(id)\n @event_svc.get(id)\n end", "def sic_code\n fetch('company.sic_code')\n end", "def get_i_cal\n raise \"missing ICS file\" if @ical_file.nil?\n begin\n file_content = open(@ical_file) { |f| f.read }\n icals = Icalendar.parse(file_content)\n puts \"Can't proccess ICS file with multiple calendars\" && exit(1) if icals.size > 1\n icals.first\n rescue StandardError\n raise ArgumentError.new(\"Cannot open #{@ical_file}\")\n end\n end", "def set_invoced_company\n @invoced_company = InvocedCompany.find(params[:id])\n end", "def show\n @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @counterparty }\n end\n end", "def incident_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'incidents/' + statuspage_id\n end", "def set_cov_died\n @cov_died = CovDied.friendly.find(params[:id])\n end", "def show\n @concerts = Concert.find(params[:id])\n end", "def id\n\t\t\t\treturn self.venue['id'].to_i\n\t\t\tend", "def clientid\n @obj['clientid']\n end", "def find_company\n Company.find(params[:company_id].to_i)\n end", "def get_organization_by_id(id)\n require_relative 'telerivet/organization'\n Organization.new(self, self.do_request(\"GET\", get_base_api_path() + \"/organizations/#{id}\"))\n end", "def show\n @object = Interest.find(params[:id])\n end", "def show\n @icd_code = IcdCode.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { render :xml => @icd_code }\n end\n end", "def set_incidence\n @incidence = Incidence.find(params[:id])\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 channel id = nil\n id ||= \"#{current_user.organisation_id}#{env[\"REQUEST_PATH\"].gsub(/\\/ws/,\"\")}\"\n Pubs.channels[id]\n end", "def get_copay_by_id(id)\n all_statements = get_copays\n\n # Return hash with error information if bad response\n return all_statements unless all_statements[:status] == 200\n\n statement = get_copays[:data].find { |copay| copay['id'] == id }\n\n raise StatementNotFound if statement.nil?\n\n { data: statement, status: 200 }\n end", "def find_encounter(program, patient, date)\n date = date.to_date\n\n encounter_type = EncounterType.find_by(name: 'DISPENSING').encounter_type_id\n Encounter.where(program_id: program.id,\n encounter_type: encounter_type,\n patient_id: patient.id,\n encounter_datetime: date...(date + 1.day))\n .order(date_created: :desc)\n .first\n end" ]
[ "0.6230577", "0.6167987", "0.56428635", "0.55607504", "0.55577266", "0.5505253", "0.54623157", "0.5422608", "0.5352587", "0.53493416", "0.53493416", "0.533292", "0.5316828", "0.52880484", "0.52880484", "0.52880484", "0.52880484", "0.52880484", "0.52880484", "0.52880484", "0.52880484", "0.52836853", "0.52677363", "0.52359074", "0.52244395", "0.51682407", "0.5158657", "0.5140429", "0.5127924", "0.5121891", "0.50879407", "0.5036175", "0.50304025", "0.4987849", "0.49718326", "0.4903973", "0.4903973", "0.48990256", "0.48708495", "0.48539427", "0.4852953", "0.48524362", "0.4832771", "0.4822757", "0.4822757", "0.4822757", "0.48204464", "0.4816011", "0.48017827", "0.47986814", "0.47955096", "0.47760436", "0.47697404", "0.47648054", "0.4756843", "0.4755313", "0.47502652", "0.47437102", "0.4742267", "0.4735099", "0.47245932", "0.47239363", "0.47233278", "0.47215942", "0.4704666", "0.4703582", "0.47018075", "0.47015485", "0.46975026", "0.46971288", "0.46970978", "0.4684848", "0.46835235", "0.46798763", "0.467372", "0.4668991", "0.46676463", "0.46657872", "0.46625757", "0.46621868", "0.4660661", "0.4660046", "0.46593434", "0.46531844", "0.46503675", "0.46476057", "0.46422637", "0.4641092", "0.4639726", "0.46382815", "0.46358216", "0.46344852", "0.46314457", "0.4629667", "0.46294823", "0.46252465", "0.462447", "0.46155006", "0.4609974", "0.46058488" ]
0.7662541
0
Get the Cherwell task with the given public ID, and return a Task object.
def task(id) task_xml = get_object_xml('Task', id) error = self.last_error if error raise Cherby::NotFound.new("Cannot find Task '#{id}': #{error}") else return Task.new(task_xml.to_s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task id\n Task.new(self, JSON.parse(request :get, \"tasks/#{id}\"))\n end", "def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end", "def task(task_id)\n task = self.class.get(\"/tasks/%s\" % task_id).parsed_response\n\n return Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end", "def task\n @task = MailTasks::Task.find( params[:id] )\n end", "def [](task_id)\n @tasks.select {|t| t.task_id == task_id}.first\n end", "def find_task\n @task = Task.find(params[:id])\n end", "def task(task_id, tasklist_id = '@default')\n get gtasks_task_url(task_id, tasklist_id)\n end", "def find_task\n @task = Task.find(params[:id])\n end", "def task\n Task.all.find {|task| task.id == self.task_id}\n end", "def get_task\n @task = @current_user.tasks.find(params[:id])\n head 404 and return unless @task\n end", "def load_task\n @task = Task.find(params[:id])\n end", "def get_task(options, task)\n options[:method] = 'Get'\n options[:endpoint] = '/kapacitor/v1/tasks/' + task[:id]\n\n task = _do_request(options)\n\n return if task['error'] == 'no task exists'\n task\n end", "def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end", "def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end", "def task\n Camunda::Task.find_by_business_key_and_task_definition_key! business_key, task_key\n end", "def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/tasks/#{id}\", options: options)).first, client: client)\n end", "def getTask(response)\r\n\t\t\t\ttasks_json = JSON.parse response\r\n\t\t\t\ttasks_array = tasks_json[\"tasks\"]\r\n\t\t\t\treturn jsonToTask(tasks_array[0])\r\n\t\t\tend", "def task_get(task_name)\n tasks.fetch prepare_key(task_name), nil\n end", "def next_task\n task = ::Client::Task.claim(owner: owner)\n task.id = task._id\n task\n rescue\n nil # indicates ._id wasn't found\n end", "def get_task_record(task)\n task = Task.find(task)\n end", "def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end", "def todo_object\n task = Todo.find_by_id(self.todo_id)\n return task\n end", "def set_simple_task\n @simple_task = SimpleTask.find(params[:id])\n end", "def _get_task_by_name(task_name)\n @tasks.each do |t|\n return t if t.name == task_name\n end\n raise \"Unknown Task!\" # couldn't find it. boo.\n end", "def get_instance(payload)\n TaskInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid])\n end", "def get_instance(payload)\n TaskInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], )\n end", "def task\n return @task\n end", "def show\n project = Project.where(id: params[:id]).first\n if project.present?\n @tasks = project.tasks\n end\n end", "def tasks(project_id, reload = false)\n self.cache(CostAgent::Task, project_id, reload) do\n (self.api(\"projects/#{project_id}/tasks\")/\"task\").collect do |task|\n # Find the project for this task\n project = self.project((task/\"project-id\").text.to_i)\n # Calculate rates\n billing_rate = (task/\"billing-rate\").text.to_f\n billing_period = (task/\"billing-period\").text\n hourly_rate = (billing_period == \"hour\" ? billing_rate : billing_rate / project.hours_per_day)\n daily_rate = (billing_period == \"hour\" ? billing_rate * project.hours_per_day : billing_rate)\n # Build the task out using the task data and the project it's tied to\n Task.new(\n :id => (task/\"id\").text.to_i,\n :name => (task/\"name\").text,\n :project_id => project.id,\n :project => project,\n :hourly_billing_rate => hourly_rate,\n :daily_billing_rate => daily_rate,\n :billable => (task/\"is-billable\").text == \"true\")\n end\n end\n end", "def set_task\n @task = @project.tasks.find(params[:id])\n end", "def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end", "def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end", "def show\n @task = Task.find(params[:id])\n end", "def show\n @task = Task.find(params[:id])\n end", "def show\n @task = Task.find(params[:id])\n end", "def get_project_by_id(id)\n require_relative 'telerivet/project'\n Project.new(self, self.do_request(\"GET\", get_base_api_path() + \"/projects/#{id}\"))\n end", "def set_task\n @task = Task.where(authorization_id: Authorization.current_id).find(params[:id])\n end", "def show\n @task = Task.find params[:id]\n end", "def set_task\n @task = @member.tasks.find(params[:id])\n end", "def [](taskPath, scopes=nil)\n task = getTaskAndProjectFile(taskPath, scopes)[0]\n return task\n end", "def show\n @task = Task.find params[:id]\n\n end", "def set_task\n @task = Task.friendly.find(params[:id])\n end", "def set_project_task\n @project_task = ProjectTask.cached_find(params[:id])\n end", "def get_task(task_name)\n if using_rake? and task_defined?(task_name)\n Rake::Task[task_name]\n end\n end", "def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end", "def find_task(name)\n name = name.to_sym unless name.nil?\n @tasks[name]\n end", "def set_api_task\n @api_task = Api::Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n@project = Project.where(id: params[:id]).first\n end", "def my_task\n @my_id = current_user.id # may be redundant4 but will head towards service objects\n @tasks = Task.where(user_id: @my_id)\n end", "def set_task\n @task = Task.find(params[:id]) # OG\n end", "def get_task\n @task = Task.find(params[:task_id])\n @group = Group.find(params[:group_id])\n @project = Project.find(params[:project_id])\n @parent = @task.comments\n end", "def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end", "def show\n @id = params[:id].to_i\n @task = Task.find_by(id: @id)\n #inherited from ApplicationController\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def get_tasks_in_project(project_id)\n body = get_json_data(\"https://app.asana.com/api/1.0/tasks?project=#{project_id}&assignee=me\")\n tasks = {}\n body[\"data\"].each do |element|\n tasks[element[\"id\"]] = element[\"name\"].gsub(\"'\", '').gsub(\"\\n\", '')\n end\n\n tasks\n end", "def find_by_task(task_id, options = {})\n options.merge!({task_id: task_id })\n Paymo::API.get :entries, :find_by_task, options\n end", "def getNext\n tasks = @db[:tasks]\n query_statuses = [\n Task.getStatusValue(:not_started),\n Task.getStatusValue(:restarted),\n Task.getStatusValue(:waiting),\n ]\n db_task = tasks.where(:status => query_statuses).order(:wake).order(:created).first\n if !db_task.nil?\n if self.lock db_task[:id]\n begin\n require db_task[:path]\n task = Marshal::load(db_task[:data])\n task.id = db_task[:id]\n status = Task.getStatusValue :running\n tasks.where(:id => task.id).update :status => status\n return task\n rescue\n self.unlock db_task[:id]\n end\n else\n @logger.warn \"lock contention for task #{db_task[:id]}\"\n return nil\n end\n end\n end", "def get_task\n @task = Task.find(params[:task_id])\n @assignment = Assignment.find(@task.assignment_id)\n end", "def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end", "def show\n @task = current_user.tasks.find params[:id] \n\n end", "def external_task\n output[:task]\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('exporttask', 'get', 'KalturaExportTask', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end", "def set_task\n @task = Task.find(params[:id])\n end" ]
[ "0.7402685", "0.69623286", "0.6862189", "0.6759626", "0.66513723", "0.6555171", "0.65374213", "0.64835805", "0.64676446", "0.64466", "0.638712", "0.6369276", "0.63113207", "0.63113207", "0.6270845", "0.6267655", "0.61952704", "0.61718273", "0.6155113", "0.6153831", "0.6107212", "0.60620266", "0.6042324", "0.60359186", "0.5949956", "0.5936521", "0.59312606", "0.589449", "0.5885755", "0.58545744", "0.5854179", "0.5843059", "0.5843059", "0.5838504", "0.5838504", "0.5838504", "0.58246714", "0.5779231", "0.57460696", "0.5739613", "0.5694405", "0.56823677", "0.5675427", "0.5674963", "0.5672947", "0.5653304", "0.5634879", "0.56177276", "0.56132776", "0.5612962", "0.56057024", "0.5597619", "0.5597531", "0.55946046", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5590817", "0.5587668", "0.5587127", "0.55848646", "0.55756754", "0.5569202", "0.5558478", "0.55555224", "0.5541425", "0.55307454", "0.55307454", "0.5527745", "0.5527745", "0.5527745", "0.5527745", "0.5527745", "0.5527745", "0.5527745", "0.5527745", "0.5527745", "0.5527745" ]
0.7864912
0
Get a BusinessObject instance
def get_business_object(object_type, id) xml = self.get_object_xml(object_type, id) return BusinessObject.new(xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def business\n @business ||= @session.business\n end", "def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end", "def get(obj)\n collection, query = get_type_info(obj)\n\n record = retrieve(collection, query, limit: 1).first\n return nil unless record\n\n obj.class.new(record)\n end", "def set_business\n @business = Business.find(params[:id])\n @current_obj = @business\n end", "def lookup_business_location\n BusinessLocator.new(self).lookup\n end", "def get\n\n BabboBackend.instance ||= BabboBackend.new\n end", "def get\n BabboShop.instance ||= BabboShop.new\n end", "def business(id, locale = {})\n Responses::Business.new(JSON.parse(business_request(id, locale).body))\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def set_business\n @business = Business.find(params[:id])\n end", "def new\n @business = Business.new\n end", "def business(id, locale = {})\n Response::Business.new(JSON.parse(business_request(id, locale).body))\n end", "def set_business\n\t\t@business = Business.find(params[:id])\n\tend", "def set_businessdocument\n # find any invoice.type by using Businessdocument as object class\n # so that search for STI object is NOT used\n @businessdocument = Billing::Businessdocument.find(params[:id])\n end", "def build_potential_business(yelp_result)\n if yelp_result.is_closed\n return nil\n end\n\n business_params = {\n yelp_id: yelp_result.id,\n display_name: yelp_result.name\n }\n\n Business.new(business_params)\n end", "def show\n @business = Business.find(params[:id])\n\n end", "def get_bean(bean_metadata)\n if bean = @beans[bean_metadata.name]\n bean\n else\n @bean_factory.create_bean_and_save(bean_metadata, @beans)\n end\n end", "def object\n @object ||= build_object\n end", "def get_instance(payload)\n BrandedCallInstance.new(@version, payload, )\n end", "def get_object_from_db_object(db_object)\n unless @objects.has_key?(db_object.id)\n @objects[db_object.id] = construct_new_object(db_object)\n end\n\n @objects[db_object.id]\n end", "def get_bean(bean_metadata)\n RequestStore.store[:_iocrb_beans] ||= {}\n if bean = RequestStore.store[:_iocrb_beans][bean_metadata.name]\n bean\n else\n @bean_factory.create_bean_and_save(bean_metadata, RequestStore.store[:_iocrb_beans])\n end\n end", "def new \n @business_user = BusinessUser.new \n @business = Business.new \n end", "def get_mobj(mname=nil) @model_class.instance; end", "def get_object\n class_name.create_from_database(id)\n end", "def return_boss_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/boss'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n BossCompany.from_hash(decoded)\n end", "def set_business\n @business = Business.find_by(id_string: params[:id])\n end", "def get_object_from_db_id(db_object_id)\n get_object_from_db_object(@db_class.find(db_object_id))\n end", "def business(business_id)\n url = \"#{API_HOST}#{BUSINESS_PATH}#{business_id}\"\n\n response = HTTP.auth(\"Bearer #{API_KEY}\").get(url)\n response.parse\n end", "def find_or_create_business_with_current_user(user)\n business = Business.find_or_create_by_employee_id_and_employer_id(self.id,user.id)\n #business.blank? ? Business.create(:employee_id => self.id, :employer_id =>user.id , :title => 'Test Business') : business\n end", "def new\n @business_object = BusinessObject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @business_object }\n end\n end", "def get_instance(payload)\n DomainInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def retrieve_business(opts = {})\n data, _status_code, _headers = retrieve_business_with_http_info(opts)\n return data\n end", "def show\n @business_object = BusinessObject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @business_object }\n format.xml { render :xml => @business_objects }\n end\n end", "def set_mybusiness\n @mybusiness = Mybusiness.find(params[:id])\n end", "def object(query, kwargs = {})\n objs = objects(query, kwargs)\n return objs.length == 1 ? objs[0] : nil\n end", "def get_instance(payload)\n CallInstance.new(@version, payload, account_sid: @solution[:account_sid],)\n end", "def business_type\n if self[:business_type] == nil\n return nil\n end\n return BusinessLicense.business_types[self[:business_type]]\n end", "def business\n self.select(&:business?)\n end", "def get_instance \n @instance = init_instance unless @instance\n return @instance\n end", "def get_instance(payload)\n CallInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def get_instance(payload)\n ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def show\n\t\t@business = business.find(params[:id, as: :business_line])\n\tend", "def get\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.get do |req|\n req.url resource_uri\n resource_params.each { |key, value|\n req.params[key] = value\n }\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end", "def retrieve_business\n warn 'Endpoint retrieve_business in V1LocationsApi is deprecated'\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def get_instance(payload)\n CampaignInstance.new(@version, payload, )\n end", "def get_object(obj_name)\n key = obj_name.to_s\n obj = @cache[key]\n unless obj\n if extra_inputs_has(key)\n obj = @extra_inputs[key]\n else\n case @defs[key]\n when MethodDef\n obj = construct_method(key)\n when FactoryDef\n obj = construct_factory(key)\n @cache[key] = obj\n else\n obj = construct_object(key)\n @cache[key] = obj if @defs[key].singleton?\n end\n end\n end\n obj\n end", "def get_instance(payload)\n ConferenceInstance.new(@version, payload)\n end", "def bot_instance\n @bot_instance ||= BotInstance.find_by(bot_id: bot.id)\n end", "def get_instance(payload)\n ChannelInstance.new(\n @version,\n payload,\n business_sid: @solution[:business_sid],\n brand_sid: @solution[:brand_sid],\n branded_channel_sid: @solution[:branded_channel_sid],\n )\n end", "def model\n __getobj__\n end", "def get_instance(payload)\n PhoneCallInstance.new(@version, payload, )\n end", "def get\n object\n end", "def object\n __getobj__\n end", "def object\n @obj\n end", "def get_instance(payload)\n ServiceInstance.new(@version, payload)\n end", "def get_instance(payload)\n ServiceInstance.new(@version, payload)\n end", "def sub_client(business)\n sid = business.sub_account.sid\n auth = business.sub_account.auth_token\n\n raise \"Unknown Accessor Business: #{business} - #{sid}/#{auth}\" unless sid and auth\n client(sid, auth)\n end", "def create\n @business_object = BusinessObject.new(params[:business_object])\n\n respond_to do |format|\n if @business_object.save\n format.html { redirect_to @business_object, :notice => 'Business object was successfully created.' }\n format.json { render :json => @business_object, :status => :created, :location => @business_object }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @business_object.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_instance(payload)\n CallInstance.new(@version, payload)\n end", "def show\n @business = @user.businesses.find(params[:id])\n \n end", "def get_object\n class_name = self.target_type.classify\n klass = Object.const_get(class_name)\n return klass.find(self.target_id)\n end", "def show\n @business_category = BusinessCategory.find(params[:id])\n end", "def get_instance(item)\n return InstanceManager.get_instance(item)\n end", "def get_object(query)\n aws_service_client.get_object(query)\n end", "def get_instance(payload)\n DomainConfigInstance.new(@version, payload, )\n end", "def instance\n @instance ||= new\n end", "def object\n @object ||= object!\n end", "def new\n BikeObject.new(self, 'Object', @type, @name)\n end", "def real_object\n result = self\n while result.respond_to?(:__getobj__)\n result = result.__getobj__\n end\n result\n end", "def set_business_unit\n @business_unit = BusinessUnit.find(params[:id])\n end", "def __getobj__\n @o\n end", "def get_job_by_object_path(path)\n obj = @service.object(path)\n .tap(&:introspect)\n Job.new(obj.Get(Job::INTERFACE, 'Id').first, self)\n end", "def set_business_process\n @business_process = BusinessProcess.find(params[:id])\n end", "def get_instance(payload)\n CountryInstance.new(@version, payload)\n end", "def get_by_objectpath objpath\n STDERR.puts \"#{self.class}.get_by_objectpath #{objpath}\" if Wbem.debug\n @client.get_instance(objpath)\n end", "def get_instance(payload)\n return RecordInstance.new(\n @version,\n payload,\n account_sid: @solution['account_sid'],\n )\n end", "def set_business_company\n @business_company = Business::Company.find(params[:id])\n end", "def get_instance(payload)\n return SandboxInstance.new(\n @version,\n payload,\n account_sid: @solution['account_sid'],\n )\n end", "def object\n @obj\n end", "def return_company_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/company'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Company.from_hash(decoded)\n end", "def construct_new_object(db_object)\n end", "def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Person.from_hash(decoded)\n end", "def get_instance(payload)\n PhoneNumberInstance.new(@version, payload)\n end", "def get_instance(payload)\n PhoneNumberInstance.new(@version, payload)\n end", "def set_business_owner\n @business_owner = BusinessOwner.find(params[:id])\n end", "def get(instance)\n get!(instance)\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {}, Mastodon::Instance)\n end", "def me\n @obj\n end", "def set_business_transaction\n @business_transaction = BusinessTransaction.find(params[:id])\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {},\n Mastodon::Instance)\n end", "def get_instance(payload)\n CompositionInstance.new(@version, payload, )\n end" ]
[ "0.64524025", "0.6060337", "0.5957739", "0.5940631", "0.59086174", "0.5883946", "0.58594644", "0.5848227", "0.5794602", "0.5794602", "0.5790286", "0.5790286", "0.5790286", "0.5790286", "0.5790286", "0.5790286", "0.5790286", "0.5790286", "0.5790286", "0.5772834", "0.57710195", "0.56780845", "0.56660074", "0.56280494", "0.5625528", "0.56156015", "0.5560495", "0.5530145", "0.54876083", "0.5477281", "0.54728264", "0.5456334", "0.54539555", "0.5445776", "0.5444293", "0.5436603", "0.5405947", "0.535403", "0.5338395", "0.53340584", "0.5333518", "0.5322315", "0.5321421", "0.5316105", "0.5271717", "0.5245507", "0.5229157", "0.52272075", "0.52212375", "0.5212961", "0.52109396", "0.5199058", "0.5196269", "0.5196134", "0.5182999", "0.5179419", "0.5126857", "0.5112157", "0.5110307", "0.51064885", "0.50944537", "0.50931907", "0.50926703", "0.50809187", "0.50809187", "0.5078025", "0.5071224", "0.5044528", "0.5044463", "0.5043251", "0.5036387", "0.503368", "0.50131285", "0.5005458", "0.49971008", "0.49875125", "0.49770838", "0.49665782", "0.4960229", "0.49567515", "0.49539074", "0.49536204", "0.49483693", "0.49392352", "0.49306545", "0.49226087", "0.49177563", "0.49131054", "0.4909378", "0.48993364", "0.48972425", "0.4883518", "0.4883518", "0.48774046", "0.486444", "0.4860711", "0.48605636", "0.48521104", "0.48498094", "0.48494455" ]
0.8126258
0
Update a given Cherwell object by submitting its XML to the SOAP interface.
def update_object_xml(object_type, id, xml) @client.update_business_object_by_public_id({ :busObNameOrId => object_type, :busObPublicId => id, :updateXml => xml }) return last_error end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n connection.put(element_path, to_xml)\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end", "def update(objecthash)\n\t\txml = build_xml(objecthash, 'update')\n\t\treturn execute(xml)\n\tend", "def update\n @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n flash[:notice] = 'Envelope was successfully updated.'\n format.html { redirect_to(@envelope) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end", "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end", "def update\n run_callbacks :update do\n connection.put(element_path(prefix_options), encode_changes, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end\n end", "def update\n @element.update_attributes(element_params)\n respond_with @element\n end", "def save\n update_attributes(WebPay.client.post(path, @updated_attributes))\n @updated_attributes = {}\n self\n end", "def update\n @support_contract = @object\n\n respond_to do |format|\n if @support_contract.update_attributes(params[:support_contract])\n flash[:notice] = 'SupportContract was successfully updated.'\n format.html { redirect_to support_contract_url(@support_contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @support_contract.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @soap.update(soap_params)\n format.html { redirect_to @soap, notice: 'Soap was successfully updated.' }\n format.json { render :show, status: :ok, location: @soap }\n else\n format.html { render :edit }\n format.json { render json: @soap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @draft_company = DraftCompany.find(params[:id])\n\n draft_review_info=@draft_company.draft_review\n email_tracker_info=draft_review_info.email_tracker\n CustomMessage.deliver_send_alert_mail_to_return_email(email_tracker_info.return_email)\n respond_to do |format|\n if @draft_company.update_attributes(params[:company])\n flash[:notice] = 'DraftCompany was successfully updated.'\n \n format.xml \n else\n \n format.xml { render :xml => @draft_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wklysum = Wklysum.find(params[:id])\n\n respond_to do |format|\n if @wklysum.update_attributes(params[:wklysum])\n flash[:notice] = 'Wklysum was successfully updated.'\n format.html { redirect_to(@wklysum) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wklysum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n run_callbacks :update do\n connection.patch(element_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end\n end", "def update(element)\n elementHash = element.to_hash\n parameter = { basic_auth: @auth,\n body: elementHash.to_json,\n headers: { 'Content-Type' => 'application/json; charset=utf-8
' } }\n save_response = self.class.put(\"/elements/#{element.key}\", parameter)\n if save_response.success?\n Element.new(save_response.parsed_response)\n else\n puts \"Could not save element: #{save_response.headers['x-errordescription']}\"\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update(xml)\n \t\tcheck_login\n \t\t\tresponse = @client.request :update do\n \t soap.header = { \"SessionHeader\" => { \"session\" => \"#{self.session}\" }}\n \t\t soap.body = xml\n \tend\n \t\tif response.success?\n \t\t \tif response.to_hash[:update_response][:result][:id] != nil\n return response.to_hash[:update_response][:result][:id]\n else\n return response.to_hash[:update_response]\n end\n \t \t\telse \n \t \t \t\treturn false\n \t \t\tend\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end", "def update\n @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n if @draft_partnership.update_attributes(params[:partnership])\n\n format.xml \n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @betpayee = Betpayee.find(params[:id])\n respond_to do |format|\n if @betpayee.update_attributes(params[:betpayee])\n flash[:notice] = 'Betpayee was successfully updated.'\n format.html { redirect_to(@betpayee) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @betpayee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @self_service_customer = SelfService::Customer.find(params[:id])\n\n respond_to do |format|\n if @self_service_customer.update_attributes(params[:self_service_customer])\n format.html { redirect_to(@self_service_customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @self_service_customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cabpedidoweb = Cabpedidoweb.find(params[:id])\n respond_to do |format|\n if @cabpedidoweb.update_attributes(params[:cabpedidoweb])\n flash[:notice] = 'El pedido a sido actualizado.'\n format.html { redirect_to(@cabpedidoweb) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cabpedidoweb.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @components_front_lever = Components::FrontLever.find(params[:id])\n\n respond_to do |format|\n if @components_front_lever.update_attributes(params[:components_front_lever])\n format.html { redirect_to(@components_front_lever, :notice => 'Front lever was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_front_lever.errors, :status => :unprocessable_entity }\n end\n end\n end", "def internal_object_update(params)\n end", "def internal_object_update(params)\n end", "def update\n respond_with @celeb.update(celeb_params)\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 process_request(legacy_xml_or_hash)\n c.soap(:ProcessRequest, { \n :ProcessRequest => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' },\n :sRequestXML => \n c.class.escape_html(\n \"<wapi clTRID='#{GoDaddyReseller::API.next_uid[0..50]}'\" + \n \" account='#{user_id}' pwd='#{password}'>\" +\n \"#{legacy_xml_or_hash.is_a?(Hash) ? c.class.xml_encode_hash(legacy_xml_or_hash) : legacy_xml_or_hash.to_s}\" +\n \"</wapi>\"\n )\n }\n }\n )\n end", "def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def 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 @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n if @counterparty.update_attributes(params[:counterparty])\n flash[:notice] = 'Counterparty was successfully updated.'\n format.html { redirect_to(@counterparty) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @counterparty.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n flash[:notice] = 'Contract was successfully updated.'\n format.html { redirect_to(@contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @flying_object = FlyingObject.find(params[:id])\n\n respond_to do |format|\n if @flying_object.update_attributes(params[:flying_object])\n format.html { redirect_to(@flying_object, :notice => 'Flying object was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @flying_object.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @call_box = CallBox.find(params[:id])\n\n respond_to do |format|\n if @call_box.update_attributes(params[:call_box])\n format.html { redirect_to([@layer, @call_box], :notice => 'Call Box was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @call_box.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cash_invoice.update cash_invoice_params\n render 'action'\n end", "def update\n @wro = Wro.find(params[:id])\n\n respond_to do |format|\n if @wro.update_attributes(params[:wro])\n flash[:notice] = 'Wro was successfully updated.'\n format.html { redirect_to(@wro) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end", "def update\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @envelope.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(params={})\n self.request(__method__, params)\n end", "def update\n @model_class.transaction do\n @object.update_attributes!(params[@object.class.name.tableize.singularize.to_sym])\n create_change_log_entry\n end\n respond_to do |format|\n flash[:notice] = @model_class.name + ' was successfully updated.'\n format.html { redirect_to(@object) }\n format.xml { head :ok }\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.timestamp = Time.now\n @invoice.update_totals\n\n\n# #if the invoice is paid, let's add them to the email marketing list\n# if @invoice.paid = true then\n# @cust = Customer.find_by_id(@invoice.customer_id)\n# url = \"http://allinnetworks.com/index.php?option=com_acymailing&gtask=sub&task=optin&hiddenlists=1,8&user[email]=\" + @cust.email + \"&user[name]=\" + @cust.firstname + \" \" + @cust.lastname\n# @doc = Nokogiri::XML(open(url))\n# end\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @caterogy = Caterogy.find(params[:id])\n\n respond_to do |format|\n if @caterogy.update_attributes(params[:caterogy])\n flash[:notice] = 'Caterogy was successfully updated.'\n format.html { redirect_to(@caterogy) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @caterogy.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(params)\n self.class.new reinit_endpoint(params).do_put\n end", "def update\n respond_to do |format|\n # Pretty sure Mongoid is smart enough to figure out I mean 'update' ... right?\n if @wreck.updat(wreck_params)\n format.html { redirect_to @wreck, notice: 'Wreck was successfully updated.' }\n format.json { render :show, status: :ok, location: @wreck }\n else\n format.html { render :edit }\n format.json { render json: @wreck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_cabinet.update_attributes(product_cabinet_params)\n format.html { redirect_to([:admin, @product_cabinet], notice: 'Product cabinet was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @product_cabinet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n if @currency.update_attributes(params[:currency])\n\n if send_to_web_service(format)\n format.html { redirect_to(@currency, :notice => 'Currency was successfully updated.') }\n format.xml { head :ok }\n end\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @currency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @quay = Quay.find(params[:id])\n\n respond_to do |format|\n if @quay.update_attributes(params[:quay])\n flash[:notice] = 'Quay was successfully updated.'\n format.html { redirect_to(@quay) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quay.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cash_transaction = CashTransaction.find(params[:id])\n\n respond_to do |format|\n if @cash_transaction.update_attributes(params[:cash_transaction])\n format.html { redirect_to(@cash_transaction, :notice => 'Cash transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cash_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @weather_box = WeatherBox.find(params[:id])\n\n respond_to do |format|\n if @weather_box.update_attributes(params[:weather_box])\n flash[:notice] = 'WeatherBox was successfully updated.'\n format.html { redirect_to(@weather_box) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @weather_box.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @business_partner = BusinessPartner.find(params[:id])\n\n respond_to do |format|\n if @business_partner.update_attributes(params[:business_partner])\n format.html { redirect_to(@business_partner, :notice => 'Business partner was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @business_partner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to(\"/contractview\", :notice => 'Contract was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @essay = Essay.find(params[:id])\n\n respond_to do |format|\n if @essay.update_attributes(params[:essay])\n format.html { redirect_to @essay, notice: 'Essay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cash_book = CashBook.find(params[:id])\n\n respond_to do |format|\n if @cash_book.update_attributes(params[:cash_book])\n flash[:notice] = 'CashBook was successfully updated.'\n format.html { redirect_to(cash_books_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cash_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def submit\n obj = ActiveSupport::Inflector.constantize(self.class.to_s.gsub(/Builder/, ''))\n obj.new(Client.post_xml_request(to_s))\n end", "def update\n @complex_service = ComplexService.find(params[:id])\n\n respond_to do |format|\n if @complex_service.update_attributes(params[:complex_service])\n format.html { redirect_to(@complex_service, :notice => 'ComplexService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @complex_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @fax_document = FaxDocument.find(params[:id])\n \n respond_to do |format|\n if @fax_document.update_attributes(params[:fax_document])\n format.html { redirect_to(@fax_document, :notice => t(:fax_document_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fax_document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @ph_electric_component = PhElectricComponent.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @ph_electric_component.update_attributes(params[:ph_electric_component])\r\n format.html { redirect_to(ph_maintenance_path(@ph_electric_component.ph_product)) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @ph_electric_component.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @envelope.update(envelope_params)\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { render :show, status: :ok, location: @envelope }\n else\n format.html { render :edit }\n format.json { render json: @envelope.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @warehouse.update(warehouse_params.keep_if{|p,q| q.class != ActionController::Parameters}) \n @warehouse.address.update(warehouse_params[:address_attributes])\n @warehouse.contact.update(warehouse_params[:contact_attributes])\n format.html { redirect_to @warehouse, warning: 'Warehouse was successfully updated.' }\n format.json { render :show, status: :ok, location: @warehouse }\n else\n format.html { render :edit }\n format.json { render json: @warehouse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end", "def send_raw(xml)\n open\n @soap_client.ProcessRequest(@ticket, xml)\n close \n end", "def update\n respond_to do |format|\n if @purchase_bill.update_attributes(params[:purchase_bill])\n flash[:notice] = 'PurchaseBill was successfully updated.'\n format.html { redirect_to(@purchase_bill) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purchase_bill.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @az_company = AzCompany.find(params[:id])\n\n respond_to do |format|\n if @az_company.update_attributes(params[:az_company]) #TODO Защитить баланс!!!\n flash[:notice] = 'AzCompany was successfully updated.'\n format.html { redirect_to(@az_company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exchange.update(exchange_params)\n format.html { redirect_to exchanges_path, notice: 'La cotizacion de elemento se modificó con exito.' }\n format.json { render :show, status: :ok, location: @exchange }\n else\n format.html { render :edit }\n format.json { render json: @exchange.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @element = Element.find(params[:id])\n\n respond_to do |format|\n if @element.update_attributes(params[:element])\n format.html { redirect_to(@element, :notice => 'Element was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @element.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end", "def update\n respond_to do |format|\n if @thuoc.update(thuoc_params)\n format.html { redirect_to @thuoc, notice: \"Thuoc was successfully updated.\" }\n format.json { render :show, status: :ok, location: @thuoc }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @thuoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(config=nil)\n @config = config if !config.nil?\n response = send_xml_post_request(@xml_api_config_path, @config)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def update\n wmi_object.put_\n end", "def update\n @components_saddle = Components::Saddle.find(params[:id])\n\n respond_to do |format|\n if @components_saddle.update_attributes(params[:components_saddle])\n format.html { redirect_to(@components_saddle, :notice => 'Saddle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_saddle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n end", "def update\n @kicad_component = KicadComponent.find( params[:id] )\n\n respond_to do |format|\n if @kicad_component.update_attributes(params[:kicad_component])\n flash[:notice] = 'KicadComponent was successfully updated.'\n format.html { redirect_to(kicad_components_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kicad_component.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @bogey = Bogey.find(params[:id])\n\n respond_to do |format|\n if @bogey.update_attributes(params[:bogey])\n flash[:notice] = 'Bogey was successfully updated.'\n format.html { redirect_to(@bogey) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bogey.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @coating.update_attributes(params[:coating])\n format.html { redirect_to(@coating, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @coating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cash_voucher.update cash_voucher_params\n render 'action'\n end", "def update\n @subcontractor = Subcontractor.find(params[:id])\n\n respond_to do |format|\n if @subcontractor.update_attributes(params[:subcontractor])\n flash[:notice] = 'Subcontractor was successfully updated.'\n format.html { redirect_to(@subcontractor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subcontractor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @centricsteel = Centricsteel.find(params[:id])\n\n respond_to do |format|\n if @centricsteel.update_attributes(params[:centricsteel])\n flash[:notice] = 'Centricsteel was successfully updated.'\n format.html { redirect_to(centricsteels_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @centricsteel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ins_co_office = InsCoOffice.find(params[:id])\n\n respond_to do |format|\n if @ins_co_office.update_attributes(params[:ins_co_office])\n format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @holding_company = HoldingCompany.find(params[:id])\n\n respond_to do |format|\n if @holding_company.update_attributes(params[:holding_company])\n flash.now[:notice] = 'Holding Company berhasil diubah !'\n format.html { redirect_to(holding_companies_path) }\n format.xml { head :ok }\n else\n flash.now[:notice] = 'Holding Company tidak berhasil diubah !'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @holding_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @officecar = Officecar.find(params[:id])\n\n respond_to do |format|\n if @officecar.update_attributes(params[:officecar])\n flash[:notice] = 'Officecar was successfully updated.'\n format.html { redirect_to(@officecar) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @officecar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wing = Wing.find(params[:id])\n\n respond_to do |format|\n if @wing.update_attributes(params[:wing])\n format.html { redirect_to(@wing, :notice => 'Wing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @centru = Centru.find(params[:id])\n\n respond_to do |format|\n if @centru.update_attributes(params[:centru])\n format.html { redirect_to(@centru, :notice => 'Centru was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @centru.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @centro = Centro.find(params[:id])\n\n respond_to do |format|\n if @centro.update_attributes(params[:centro])\n format.html { redirect_to(@centro, :notice => 'Centro atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @centro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(config=nil)\n @config = config if !config.nil?\n response = send_xml_post_request(@xml_api_config_path, @config)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def update\n save_doc\n end", "def update\n woof = Woof.find params[:id]\n woof.update woof_params\n redirect_to root_path\n end", "def update \n @stock_cargo = StockCargo.find(params[:id])\n respond_to do |format|\n if @stock_cargo.update_attributes(params[:stock_cargo])\n flash[:notice] = '货物更新成功.'\n format.html { redirect_to(@stock_cargo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock_cargo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n end", "def update\n fail ESP::NotImplementedError\n end", "def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n flash[:notice] = 'Cyberstock was successfully updated.'\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wig = Wig.find(params[:id])\n\n respond_to do |format|\n if @wig.update_attributes(params[:wig])\n format.html { redirect_to @wig, notice: 'Wig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!\n @service.update_message(self)\n end", "def update\n @warehouse = Warehouse.find(params[:id])\n respond_to do |format|\n if @warehouse.update_attributes(params[:warehouse])\n @warehouse.register_user_action(request.remote_ip, 'updated')\n format.html { redirect_to(settings_payroll_path, :notice => 'Warehouse was successfully updated.') }\n # format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @warehouse.errors, :status => :unprocessable_entity }\n format.json { respond_with_bip(@warehouse) }\n end\n end\n end", "def update\n @az_bill = AzBill.find(params[:id])\n\n respond_to do |format|\n if @az_bill.update_attributes(params[:az_bill])\n format.html { redirect_to(@az_bill, :notice => 'AzBill was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_bill.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n end" ]
[ "0.6479917", "0.63149154", "0.623946", "0.5823542", "0.58115184", "0.57926804", "0.57878566", "0.5706624", "0.5703181", "0.5698466", "0.56553006", "0.56543136", "0.5635792", "0.56115854", "0.55983585", "0.55750173", "0.55648303", "0.55632895", "0.5557411", "0.55290174", "0.5528833", "0.5519699", "0.5507741", "0.5483152", "0.5481931", "0.5479092", "0.5479092", "0.5461559", "0.54537046", "0.5452364", "0.5423247", "0.54225844", "0.54193515", "0.5409659", "0.5407893", "0.5403184", "0.5397301", "0.5391068", "0.53877425", "0.53841376", "0.5374031", "0.53665406", "0.53545797", "0.5351324", "0.5350398", "0.53440386", "0.5341446", "0.53380936", "0.53334224", "0.53270304", "0.5323093", "0.5321865", "0.5318548", "0.5310356", "0.53051597", "0.52857363", "0.5283967", "0.5275935", "0.52759206", "0.52709806", "0.5269883", "0.526761", "0.5264602", "0.526405", "0.5262465", "0.526236", "0.5262109", "0.5260396", "0.5259965", "0.5253147", "0.525064", "0.5249966", "0.5240042", "0.52367526", "0.5235875", "0.52348596", "0.5234188", "0.52319646", "0.5230479", "0.5229022", "0.52252233", "0.52246016", "0.5218947", "0.52157426", "0.52135086", "0.5212521", "0.5211918", "0.5211142", "0.52108794", "0.5201189", "0.5200808", "0.5196623", "0.51929176", "0.518868", "0.5188291", "0.51853645", "0.51814526", "0.51807874", "0.5179871", "0.51795536" ]
0.66331226
0
Save the given Cherwell incident
def save_incident(incident) update_object_xml('Incident', incident.id, incident.to_xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @incident = Incident.new(incident_params)\n @incident.happened_at = Time.now\n @incident.state = :open\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_params\n params.require(:incident).permit(:report_type, :your_name, :job_title, :injury_date, :injury_time, :witnesses, :location, :circumstances, :event_discription, :injuries_type, :ppe_used, :medical_assistance_provided, :project_id,:file)\n end", "def create\n @incident = Incident.new(params[:incident])\n\t@incident.project = session[:project]\n\n respond_to do |format|\n if @incident.save\n flash[:notice] = t 'flash.incident_create'\n format.html { redirect_to(@incident) }\n format.xml { render :xml => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if(params[:incId]).present?\n @incident = Incident.find(params[:incId])\n @incident.report_type = params[:incident][:report_type] \n @incident.your_name = params[:incident][:your_name]\n @incident.job_title = params[:incident][:job_title]\n @incident.injury_date = params[:incident][:injury_date]\n @incident.injury_time = params[:incident][:injury_time]\n @incident.witnesses = params[:incident][:witnesses]\n @incident.location =params[:incident][:location]\n @incident.circumstances = params[:incident][:circumstances]\n @incident.event_discription = params[:incident][:event_discription]\n @incident.injuries_type =params[:incident][:injuries_type]\n @incident.ppe_used =params[:incident][:ppe_used]\n @incident.medical_assistance_provided =params[:incident][:medical_assistance_provided]\n else\n @incident = @project.incidents.build(incident_params)\n end\n\n\n \n respond_to do |format|\n if @incident.save\n if params[:files]\n params[:files].each { |image|\n @incident.incidents_files.create(file: image, incident_id: @incident.id)\n }\n end\n @incident.cn = true\n @incident.save!\n incidents = @project.incidents.where(cn: false)\n incidents.destroy_all if incidents.present?\n format.html { redirect_to projects_path({inc: @incident.id}), notice: 'Incident was successfully created.' }\n format.json { render json: {incident_id: @incident.id} } \n # format.json { render action: 'show', status: :created, location: @incident }\n else\n format.html { render action: 'new' }\n format.json { render json: :true}\n # format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def save(connection, comment = nil)\n validate\n\n xml = connection.make_xml('VulnerabilityExceptionCreateRequest')\n xml.add_attributes({ 'vuln-id' => @vuln_id,\n 'scope' => @scope,\n 'reason' => @reason })\n case @scope\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id })\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id,\n 'port-no' => @port,\n 'vuln-key' => @vuln_key })\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n xml.add_attributes({ 'site-id ' => @site_id })\n end\n\n @submitter_comment = comment if comment\n if @submitter_comment\n comment_elem = REXML::Element.new('comment')\n comment_elem.add_text(@submitter_comment)\n xml.add_element(comment_elem)\n end\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['exception-id'].to_i if response.success\n end", "def save(connection, comment = nil)\n validate\n\n xml = connection.make_xml('VulnerabilityExceptionCreateRequest')\n xml.add_attributes({ 'vuln-id' => @vuln_id,\n 'scope' => @scope,\n 'reason' => @reason })\n case @scope\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id })\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n xml.add_attributes({ 'device-id' => @asset_id,\n 'port-no' => @port,\n 'vuln-key' => @vuln_key })\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n xml.add_attributes({ 'site-id ' => @site_id })\n end\n\n @submitter_comment = comment if comment\n if @submitter_comment\n comment_elem = REXML::Element.new('comment')\n comment_elem.add_text(@submitter_comment)\n xml.add_element(comment_elem)\n end\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['exception-id'].to_i if response.success\n end", "def incident_params\n params.require(:incident).permit(:incidentcategory_id, :date_time, :longtitude, :latitude, :address, :description, :status_id, :status, :activity, :injured_parts,:cause, :prevention)\n end", "def save\n intervention = Intervention.new\n puts params\n\n customer = params[\"intervention\"][\"customer_id\"]\n building = params[\"intervention\"][\"building_id\"]\n battery = params[\"intervention\"][\"battery_id\"]\n column = params[\"intervention\"][\"column_id\"]\n elevator = params[\"intervention\"][\"elevator_id\"]\n employee = params[\"intervention\"][\"employee_id\"]\n description = params[\"intervention\"][\"reports\"]\n\n p \"user information: \"\n p current_user\n\n intervention.author = current_user.id\n intervention.result = \"Incomplete\"\n intervention.reports = description\n intervention.status = \"Pending\"\n intervention.customer_id = customer\n intervention.building_id = building\n intervention.employee_id = employee\n if battery != \"-1\"\n intervention.battery_id = battery\n\n end\n\n \n \n #restricting the save of column data when battery selected\n if column != \"-1\"\n intervention.column_id = column\n intervention.battery_id = nil\n \n\n \n end \n #restricting the save of elevators data when column and battery selected selected\n if elevator != \"-1\"\n intervention.elevator_id = elevator\n intervention.column_id = nil\n intervention.battery_id = nil\n\n end \n\n \n \n \n customer_int = Customer.where(:id => intervention.customer_id)\n employee_int = Employee.where(:id => intervention.employee_id)\n \n \n\n\n p \"#####################################start#############################################\"\n p customer_int\n p \"#########################################middle############################################\"\n\n p employee_int\n p \"#########################################end############################################\"\n\n\n\n puts intervention.inspect\n #intervention.save!\n if intervention.save\n # fact_contacts()\n #sendMail()\n #dropbox()\n\n #call to send a zendesk ticket\n # client = ZendeskAPI::Client.new do |config|\n # config.url = ENV[\"ZENDESK_URL\"]\n # config.username = ENV[\"ZENDESK_EMAIL\"]\n # config.token = ENV[\"ZENDESK_TOKEN\"]\n # end\n \n # ZendeskAPI::Ticket.create!(client,\n # :subject => \"#{intervention.id} from #{intervention.id}\",\n # :comment => {\n # :value => \"An intervention form has been submitted by the employee having the following information: \n # The Requester: #{intervention.author} ftps://waws-prod-blu-207.ftp.azurewebsites.windows.net/site/wwwroot \n # Building ID: #{intervention.building_id}\n # The Battery ID: #{intervention.battery_id}\n # The Column ID : #{intervention.column_id}\n # Elevator ID if specified: #{intervention.elevator_id}\n # Description of the request for intervention: #{intervention.reports}\n\n # Thank you Rocket Elevator is there for your vertical transportation need.\n #\n \n \n # Attached Message: \n \n # The Contact uploaded an attachment\"\n # },\n # :priority => \"normal\",\n # :type => \"question\"\n # )\n\n #redirecting to success page after saving the form\n redirect_to success_url\n \n end\n \n \n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def create\n @incident = Incident.new(incident_params)\n @incident.status = \"abierto\"\n @incident.user ||= current_user\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incidencia registrada' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_incident\n @incident = @quote.incidents.find(params[:id])\n\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to root_url, notice: 'Incident was successfully created.' }\n format.json { render action: 'show', status: :created, location: @incident }\n else\n format.html { render action: 'new' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n\t@incident.project = session[:project]\n if @incident.update_attributes(params[:incident])\n flash[:notice] = t 'flash.incident_update'\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def 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 save_cobertura(e, op, c)\n cob = Cobertura.where(endereco: e).first\n v = (op == 'vivo') ? c : nil;\n o = (op == 'oi') ? c : nil;\n n = (op == 'net') ? c : nil;\n \n if cob == nil\n puts \"Criando nova Cobertura...\"\n \n cob = Cobertura.create!(endereco: e, vivo: v, net: n, oi: o)\n puts cob\n else\n puts \">>> Atualizando Cobertura cadastrada #{e}\"\n if (op == 'vivo') \n cob.vivo = c\n end\n if (op == 'oi') \n cob.oi = c\n end\n if (op == 'net') \n cob.net = c\n end\n cob.save\n end\n cob\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_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.\n if !result.nil?\n incident['IncidentID'] = result\n return incident\n else\n return nil\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n @catalogList = [['Tecnologia/Proyectores',1], ['Plomeria/Tuberias',2], ['Logistica/Bancos', 3], ['Tecnologia/IT',4]]\n\n begin\n id = ActiveRecord::Base.connection.execute(\"SELECT COUNT(*) FROM incidents;\")\n id.each do |row|\n id = row\n end\n id = id[0].to_i + 1\n sql = \"INSERT INTO incidents (incident_id, u_id, descripcion, prioridad, fecha_inicio, catalog) VALUES ('#{id}', '#{session[:user_id]}', '#{@incident.descripcion}', '#{@incident.prioridad}', #{Time.now.strftime(\"%Y%m%d\").to_i}, '#{@incident.catalog}');\"\n ActiveRecord::Base.connection.execute sql\n\n redirect_to incidents_url, notice: \"Gracias, el incidente será revisado\"\n rescue \n flash[:notice] = \"Error en la forma\"\n render :new\n end\n end", "def create\n @incident = Incident.new( incident_params )\n\n respond_to do |format|\n if @incident.save\n if params[ :incident_pictures ].present?\n params[ :incident_pictures ][ 'picture' ].each do | pic |\n @incident_picture = @incident.incident_pictures.create!( picture: pic )\n end\n end\n if params[:commit] == \"Submit & Next\"\n format.html { redirect_to new_incident_incident_detail_path(@incident), notice: 'Thank you! Incident was successfully created. Please submit incident details here' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { redirect_to @incident, notice: 'Thank you! Incident was successfully created. Please submit incident details to make it Live' }\n format.json { render :show, status: :created, location: @incident }\n end\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_params\n params.require(:incident).permit(:name, :number, :p_code, :user_id, :financial_code, :size,\n :incident_type, :complexity, :status, :cause, :fuel_type, \n :start_date, :containment_date, :control_date, :out_date, \n :percent_contained, :location, :ownership, :protection,\n :latitude, :longitude, :ic, :fire_behavior )\n end", "def create\n @incident = Incident.new(params[:incident])\n \n if signed_in?\n @incident.user_id = current_user.id \n else\n @incident.user_id = 1\n end\n \n @incident.reviewed = false\n \n respond_to do |format|\n if @incident.save\n format.html { redirect_to(@incident, :notice => 'Incident was successfully created.') }\n format.xml { render :xml => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n \n end", "def incidence_params\n params.require(:incidence).permit(:ticket, :type_id, :picture, :motive_id, :description,:ubigeo_id, :reference, :date, :latitud, :longitud)\n end", "def set_incident\n @incident = Incident.find_by_sql(\"SELECT * FROM incidents WHERE incident_id =#{params[:id]};\" )[0]\n end", "def save\n connection = Attendence.open_connection\n\n if (self.attendenceid)\n # update\n sql = \"UPDATE attendence SET dateofattendence='#{self.date}', status='#{self.status}', comment='#{self.comments}' WHERE attendenceid = #{self.attendenceid}\"\n else\n # add\n sql = \"INSERT INTO attendence (dateofattendence, studentid, status, comment) VALUES ('#{self.date}', '#{self.studentid}', '#{self.status}', '#{self.comments}') ;\"\n end\n\n connection.exec(sql)\n end", "def set_inciting_incident\n @inciting_incident = IncitingIncident.find(params[:id])\n end", "def update\n @incident = Incident.find(params[:id])\n \n respond_to do |format|\n if @incident.update_attributes(params[:incident]) \n format.html { redirect_to(@incident, :notice => 'Incident was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n \n #todo: may be required for events and sources as well...\n #todo: only create blogpost when reviewed == true, not just after any change\n if params[:incident][:create_blog] == \"1\"\n #if false\n # create blog entry\n b = Blogpost.new()\n id = @incident.id.to_s\n name = @incident.name\n b.header = \"New incident \" + \"<a href=\\\"http://www.osidb.org/incidents/\"+ id +\"\\\">\"+ \"OSIDB-ID: \" + id +\"</a> \" + name\n b.content = @incident.summary\n b.user_id = @incident.user_id\n b.save\n\n # create tweet\n @incident.tweet!\n end\n \n end", "def incident_params\n params.require(:incident).permit(:date_of_incident, :value, :type_of_incident, :description)\n end", "def set_incident\n @incident = current_user.incidents.find(params[:id])\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 create\n @incidence = Incidence.new(incidence_params)\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to @incidence, notice: 'Incidencia creada exitosamente.' }\n format.json { render :show, status: :created, location: @incidence }\n else\n format.html { render :new }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_params\n logger.info :customer_id\n params.permit(:date, :value, :type, :desc, :incident)\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 update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n now = Time.now\n\n data = {\n :id => @id,\n :desc => @desc,\n :ctime => Timestamp.dump(@ctime) || Timestamp.dump(now),\n :mtime => Timestamp.dump(now),\n :ppg_filename => @ppg_filename,\n }\n jobinfo.write(YAML.dump(data))\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 create\n @incident = current_user.incidents.new(params[:incident])\n\t@incident.status = \"Received\"\n\t\n respond_to do |format|\n if @incident.save\n\t @incident.create_timesheet()\n\t @incident.create_mat_list()\n\t\t \n\t @name = User.find(@incident.user_id).profile.name\n\t Notifier.send_notice(@name).deliver\n\t \t \n\t format.html { redirect_to edit_incident_timesheet_path(@incident), :notice => \"The Incident has been saved! Now please fill in the timesheet by adding personnel and materials below.\" }\n\t else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def incident_params\n params.require(:incident).permit(:address_1, :address_2, :city, :state, :zip, \n :country, :description, :incident_type, :occured_at, :neighborhood, :latitude, :longitude)\n end", "def incident_params\n params.require(:incident).permit(:incident_type, :contact_id, :notification_id, :location, :resolved, :false_flag, :viewed)\n end", "def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end", "def incident_params\n params.require(:incident).permit(:date_of_incident, :value, :type, :description)\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @inciting_incident.update(inciting_incident_params)\n render json: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end", "def save_observation(observation)\n success = true\n args = {}\n if observation.new_record?\n args[:method] = \"post\"\n args[:action] = \"observation\"\n args[:date] = observation.when\n if observation.location_id\n args[:location] = observation.location\n else\n args[:location] = observation.where\n end\n args[:notes] = observation.notes.to_s\n args[:specimen] = observation.specimen ? true : false\n args[:thumbnail] = observation.thumb_image_id.to_i\n args[:is_collection_location] = observation.is_collection_location\n else\n args[:method] = \"put\"\n args[:action] = \"observation\"\n args[:set_date] = observation.when if observation.when_changed?\n if observation.where_changed? || observation.location_id_changed?\n if observation.location_id\n args[:set_location] = observation.location\n else\n args[:set_location] = observation.where\n end\n end\n args[:set_notes] = observation.notes if observation.notes_changed?\n if observation.specimen_changed?\n args[:set_specimen] = observation.specimen\n end\n if observation.thumb_image_id_changed?\n args[:set_thumbnail] = observation.thumb_image_id.to_i\n end\n args[:set_is_collection_location] = observation.is_collection_location\n end\n if observation.save\n args[:id] = observation\n Transaction.create(args)\n else\n flash_error(:runtime_no_save_observation.t)\n flash_object_errors(observation)\n success = false\n end\n success\n end", "def save()\n sql = \"INSERT INTO tickets (customer_id,film_id,cinema,type) VALUES (#{@customer_id},#{@film_id},'#{@cinema}','#{@type}') RETURNING id;\"\n ticket_hash = SqlRunner.run(sql).first()\n @id = ticket_hash['id'].to_i\n end", "def create\n @incident = Incident.new(incident_params)\n @incident.user = current_user\n\n respond_to do |format|\n if @incident.save\n new_incident_email(@incident)\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def save!\n resource.save!\n end", "def save_character account, filename, data\n end", "def create\n return if auth2(\"website_administrator\", \"ims_servicedesk\")\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if current_user and current_user.roles.index(\"ims_servicedesk\")\n if @incident.save\n #@incident.ferret_update\n session[:current_incident] = @incident\n format.html { redirect_to ims_servicedesk_knowledgedatabasequery_path, :notice => 'Incident was successfully created.' }\n format.json { render :json => @incident, :status => :created, :location => @incident }\n else\n format.html { redirect_to ims_servicedesk_loggingandclassification_path }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n else\n if @incident.save\n format.html { redirect_to @incident, :notice => 'Incident was successfully created.' }\n format.json { render :json => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def incident_id\n @attrs['IncidentID']\n end", "def post_incident(payload)\n begin\n payload_json = JSON.dump(payload)\n resp = pagerduty.incidents_api.post(payload_json, :content_type => :json)\n answer = JSON.parse(resp, :symbolize_names => true)\n log.debug(\"POST to incidents, payload=#{payload.inspect}, response=#{answer}\")\n answer\n rescue Exception => e\n log.error(\"Failed to post to incident API: #{payload.inspect}.\"+\n \"\\nError: #{e.message}\")\n raise RuntimeError.new(\"Problem talking to PagerDuty incidents:\"+\n \" #{e.message}\\nRequest was #{payload.inspect}\")\n end\n end", "def save(attrs)\n if attrs[:id].present?\n data = @resource.update(attrs, @customer_id)\n else\n attrs.delete(:id) \n if resource_name == :customers\n data = @resource.create(attrs)\n else\n data = @resource.create(attrs, @customer_id)\n end\n end\n\n data.merge({\"open_pay_id\" => data[\"id\"]})\n end", "def create\n @incidentfile = Incidentfile.new(incidentfile_params)\n\n respond_to do |format|\n if @incidentfile.save\n format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully created.' }\n format.json { render :show, status: :created, location: @incidentfile }\n else\n format.html { render :new }\n format.json { render json: @incidentfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def save(code_and_response)\n color, icon = Formatter.handle_response(code_and_response)\n @config.ci.last_checked = Time.now.strftime('%s')\n @config.ci.response = code_and_response.to_json\n @config.ci.color = color\n @config.ci.status = icon\n nil\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 set_incidentfile\n @incidentfile = Incidentfile.find(params[:id])\n end", "def save_resource\n resource.save\n end", "def save_file(input_obj)\n\t$report_file.write(input_obj)\nend", "def incidente_params\n params.require(:incidente).permit(:descricao, :data_inicio, :data_fim, :previsao_fim, :status, :observacoes, :tipo_incidente_id)\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 incident_params\n params.require(:incident).permit(:title, :summary, :state, :happened_at, :resolved_at, :type_id, :level, :meta).tap do |h|\n h[:meta] = YAML.load(h[:meta]) if h[:meta]\n end\n end", "def close \n begin\n sql = \"UPDATE incidents SET estado = 'CERRADO', fecha_final = #{Time.now.strftime(\"%Y%m%d\").to_i} WHERE incident_id = #{@incident.incident_id};\"\n\n ActiveRecord::Base.connection.execute sql\n redirect_to incident_path(@incident), notice: \"El incidente ha sido modificado con exito.\"\n rescue\n flash[:notice] = \"Alguna alteracion no fue correctamente modificada\"\n render :edit\n end\n end", "def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_incidente\n @incidente = Incidente.accessible_by(current_ability).find(params[:id])\n end", "def incident_params\n params.require(:incident).permit(\n :id,\n :prisoner_id,\n :date_of_arrest,\n :prison_id,\n :date_of_release,\n *Incident.globalize_attribute_names,\n article_ids: [],\n tag_ids: []\n )\n end", "def save!\n status = orchio_put(to_json_direct) if valid?\n retval status\n end", "def incident_params\n # puts \"params.permitted?=#{params.permitted?}\"\n params.require(:incident).permit!\n # params.require(:incident).permit(\n # :user_id, :email, :name, :description, :events_in_email, :run_status,\n # :notify_criteria, :notify_criteria_as_string,\n # notification_signature_sections_attributes: [:id, :_destroy, :title, :description, :signature_ids => []]\n # )\n end", "def save_edited_ticket_entry\n @raw_date = params[:delivery_date]\n \n @day = @raw_date[3..4]\n @month = @raw_date[0..1]\n @year = @raw_date[6..9]\n \n @delivery_date = \"#{@year}-#{@month}-#{@day}\"\n \n @ticket = Ticket.find(params[:id])\n @ticket.number = params[:ticket_number]\n @ticket.delivery_date = @delivery_date\n @ticket.job_id = params[:job_id]\n @ticket.destination_id = params[:destination_id]\n @ticket.wood_type = params[:wood_type_id]\n \n #Because the tickets value (load pay) comes in as string in currency format\n # some parts have to be stripped off to be able to turn it into float correctly\n @value = params[:load_pay].to_s\n 3.times do\n @value.sub!(\",\", \"\")\n end\n @value = @value.to_f\n \n @ticket.value = @value\n \n @ticket.load_details.each_with_index do |i, x|\n i.species_id = params[:specieses][x]\n i.tonnage = params[:tonnages][x]\n i.mbfs = params[:mbfs][x]\n \n unless i.save\n render :status => 306, :nothing => true\n return\n end\n end\n \n unless @ticket.save\n render :status => 306, :nothing => true\n else\n render :status => 200, :nothing => true\n end\n end", "def incident(id)\n incident_xml = get_object_xml('Incident', id)\n error = self.last_error\n if error\n raise Cherby::NotFound.new(\"Cannot find Incident '#{id}': #{error}\")\n else\n return Incident.new(incident_xml.to_s)\n end\n end", "def create\n @timesheet = Incident.find(params[:incident_id]).timesheet\n\t@safety_officer = @timesheet.safety_officer.build(params[:safety_officer])\n\n respond_to do |format|\n if @safety_officer.save\n format.html { redirect_to(edit_incident_timesheet_path, :notice => 'Safety Officer was successfully created.') }\n else\n format.html { render :new }\n end\n end\n end", "def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end", "def icl_save( args )\n @foodDB.save( args )\n @log.save()\n end", "def set_incident\n @incident = Incident.includes(:images).find(params[:id])\n end", "def update_last_id_exercice id\n File.open(path_last_id_exercice,'wb'){ |f| f.write id.to_s }\n end", "def create\n @infected_machine = InfectedMachine.new(infected_machine_params)\n\n @incident = @infected_machine.incident\n\n if @infected_machine.save\n redirect_to @infected_machine.incident\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @infected_machine.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_incident_proof\n @incident_proof = IncidentProof.find(params[:id])\n end", "def create\n @incidente = Incidente.new(incidente_params)\n\n respond_to do |format|\n if @incidente.save\n flash[:success] = @@msgs\n format.html { redirect_to @incidente, notice: @@msgs }\n format.json { render :show, status: :created, location: @incidente }\n else\n flash[:danger] = @@msge\n format.html { render :new }\n format.json { render json: @incidente.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_params\n params.require(:incident).permit(:users_id, :latitude, :longitude, :fecha, :incidenttypes_id, :pmuerte, :nambulancia, :npolicia, :prioridad, :riesgo, :descripcion, :gnbtnpanico, :imagen)\n end", "def save()\n person_session = PersonSession.new({\n 'date_time_added' => @date_time_added,\n 'reserve' => @reserve.to_s,\n 'person_id' => @person.id,\n 'session_id' => @session.id\n })\n person_session.save()\n end", "def save\n SAVE\n end", "def save_assessment\n @assessment = Assessment.find(params[:id])\n @assessment.description = params[:assessment_description]\n @assessment.user_id = current_user.id\n @assessment.tenant_id = current_user.tenant_id\n @assessment.time_bound = \"time_bound\"\n @assessment.test_pattern_id = 1\n @assessment.save\n redirect_to(\"/structure_components/create_structure/#{@assessment.id}\")\n end", "def save( oid, metadata )\n\t\toid = normalize_oid( oid )\n\t\t@storage[ oid ] = metadata.dup\n\tend", "def save(object)\n full_name = extract_full_name object\n post 'api/save', :id => full_name\n end", "def save\n MoxiworksPlatform::Event.update(self.to_hash)\n end", "def save\n File.open(@file, 'w') do |file|\n file.write(Psych.dump(@params))\n end\n @saved = true\n end" ]
[ "0.6133752", "0.59281516", "0.58280176", "0.5819363", "0.58001083", "0.57861286", "0.57861286", "0.5772887", "0.5714373", "0.5701688", "0.5701688", "0.5682269", "0.5666079", "0.5666079", "0.5663588", "0.56451356", "0.56451356", "0.56451356", "0.56451356", "0.56451356", "0.56451356", "0.56451356", "0.56451356", "0.5612946", "0.55987084", "0.5564378", "0.5561616", "0.55592626", "0.55558205", "0.5545013", "0.5532867", "0.5528861", "0.5517746", "0.5517011", "0.55158156", "0.55050224", "0.5500151", "0.54384667", "0.54357076", "0.5400309", "0.53952926", "0.53892577", "0.5382681", "0.5375648", "0.53652513", "0.5364886", "0.5364886", "0.53643996", "0.5343999", "0.53415215", "0.53327996", "0.5324718", "0.53212464", "0.53168386", "0.53044486", "0.53044486", "0.53044486", "0.5301144", "0.5300545", "0.5299679", "0.5291897", "0.5284328", "0.52592707", "0.52543354", "0.52541715", "0.52524316", "0.52509695", "0.52374244", "0.52367693", "0.52320313", "0.52258205", "0.52154213", "0.5209655", "0.52077806", "0.5188452", "0.5186904", "0.51789635", "0.5176501", "0.5164685", "0.5164122", "0.5156266", "0.5148406", "0.5147076", "0.51445645", "0.5141913", "0.5140266", "0.51381725", "0.5133351", "0.51317036", "0.51225525", "0.5112175", "0.51093537", "0.51014656", "0.50922614", "0.50906426", "0.50876725", "0.50822234", "0.5080426", "0.5078102", "0.5073773" ]
0.7536809
0
Save the given Cherwell task
def save_task(task) update_object_xml('Task', task.id, task.to_xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(task)\n serialize Task.create(description: task.description, done: task.done)\n end", "def save\n MoxiworksPlatform::Task.update(self.to_hash)\n end", "def save(task)\n task.id = @redis.incr('id_counter') if task.id.nil?\n @redis.lpush('unstarted', Marshal.dump(task)) if task.state == 'unstarted'\n @redis.lpush(\"finished:#{task.id}\", Marshal.dump(task)) if task.state =='finished'\n task.id\n end", "def save(task)\n @store.transaction do\n @store[task.id] = task\n end\n end", "def save_task(task_type, target_user, work_object_id = 0, comments = \"\", subject = \"Other\")\n params =\n MagicParams.format(\n user_id: @allscripts_username,\n parameter1: task_type,\n parameter2: target_user,\n parameter3: work_object_id,\n parameter4: comments,\n parameter5: subject\n )\n results = magic(\"SaveTask\", magic_params: params)\n results[\"savetaskinfo\"]\n end", "def save_as_task!(task_name, options = {})\n default_action = new_record? ? \"create\" : \"update\"\n action_type = options.delete(:action_type) || default_action\n\n record_action(action_type, task_name:)\n save!(options)\n end", "def save(task, path, options = Hash.new)\n if options.respond_to?(:to_str) || !options # for backward compatibility\n options = Hash[:name => options]\n end\n options, find_options = Kernel.filter_options options,\n :name => nil,\n :model => task.model\n\n model_name = options[:model].name\n task_conf = find_task_configuration_object(task, find_options.merge(:model_name => model_name))\n if !task_conf\n task_conf = conf[model_name] = TaskConfigurations.new(options[:model])\n end\n name = options[:name] || task.name\n task_conf.extract(name, task)\n task_conf.save(name, path, task_model: task.model)\n end", "def save(task, path, options = Hash.new)\n if options.respond_to?(:to_str) || !options # for backward compatibility\n options = Hash[:name => options]\n end\n options, find_options = Kernel.filter_options options,\n :name => nil,\n :model => task.model\n\n model_name = options[:model].name\n task_conf = find_task_configuration_object(task, find_options.merge(:model_name => model_name))\n if !task_conf\n task_conf = conf[model_name] = TaskConfigurations.new(options[:model])\n end\n task_conf.save(task, path, options[:name])\n end", "def save\n now = Time.now\n\n data = {\n :id => @id,\n :desc => @desc,\n :ctime => Timestamp.dump(@ctime) || Timestamp.dump(now),\n :mtime => Timestamp.dump(now),\n :ppg_filename => @ppg_filename,\n }\n jobinfo.write(YAML.dump(data))\n end", "def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(task)\n file.puts(task)\n file.close\n\nend", "def save!\n ScriptoriaCore::Ruote.engine.storage_participant.do_update(_workitem)\n end", "def update_task\r\n\r\n t = BgWorker.task(:name => params[:task][:name]) # new task so we update data\r\n if t[:name].blank?\r\n flash[:error] = _('Invalid name!')\r\n redirect_to :action => :back\r\n end\r\n t[:filename]\t= Rails.root.join('lib', 'tasks', \"bg_worker_#{t[:name]}.rake\")\r\n id \t\t= params[:task][:id]\r\n t[:code]\t= params[:task][:code]\r\n t[:namespace] \t= params[:task][:namespace]\r\n t[:desc]\t= params[:task][:desc]\r\n t[:args]\t= params[:task][:args].blank? ? nil :\r\n params[:task][:args].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n arg_string\t= \", [#{t[:args]}]\" unless t[:args].blank?\r\n t[:dependencies]= params[:task][:dependencies].blank? ? nil :\r\n params[:task][:dependencies].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n dep_string\t= \" => [#{t[:dependencies]}]\" unless t[:dependencies].blank?\r\n t = BgWorker.task(t)\r\n file = %Q[# name: #{t[:name]}\r\n\r\n # args: #{t[:args]}\r\n # desc: #{t[:desc]}\r\n #{\"# namespace: #{t[:namespace]}\" unless t[:namespace].blank?}\r\n # dependencies: #{t[:dependencies] unless t[:dependencies].blank?}\r\n #{\"namespace :#{t[:namespace]} do\" unless t[:namespace].blank?}\r\n\r\n desc %q[#{t[:desc]}]\r\n task :#{t[:name]} #{arg_string} #{dep_string} do |task #{', args' if arg_string}|\r\n\r\n #{t[:code]}\r\n\r\n end\r\n\r\n #{'end' unless t[:namespace].blank?}]\r\n\r\n if !id.blank? && id != t[:name]\r\n begin\r\n File.rm(Rails.root.join('lib', 'tasks', \"#{id}.rake\"))\r\n rescue\r\n flash[:error] = _('Task %{obj} could not be erased!') % {:obj => id}\r\n end\r\n end\r\n begin\r\n File.open(t[:filename], 'w+') {|f| f.write file}\r\n flash[:notice] = _('%{obj} successfully modified') % {:obj => _('Task')}\r\n rescue\r\n flash[:error] ||= ''\r\n flash[:error] << _('%{obj} could not be modified!') % {:obj => _('Task')}\r\n end\r\n redirect_to :action => :list\r\n end", "def save(task, file, name)\n config_hash = self.class.save(task, file, name)\n in_context(\"while saving section #{name} in #{file} from task #{task.name}(#{task.model.name})\") do\n sections[name] = config_from_hash(config_hash)\n end\n end", "def judge_and_maybe_save(store, task)\n if task.ok == true # task is ok!\n task.message << \" \" + \"Task saved!\"\n session[:message] = task.message # use session[:message] for user messages\n task.message = \"\"\n store.save(task)\n session[:id_to_edit] = nil # exits from editing mode\n else\n task.message << \" \" + \"Not saved.\" # task not ok\n session[:message] = task.message # use session[:message] for user messages\n session[:overlong_description] = task.overlong_description if\n task.overlong_description\n session[:bad_categories] = task.bad_categories if\n task.bad_categories\n task.message = \"\"\n task.overlong_description = nil\n task.bad_categories = nil\n end\nend", "def judge_and_maybe_save(store, task)\r\n if task.ok == true # task is ok!\r\n task.message << \" \" + \"Task saved!\"\r\n session[:message] = task.message # use session[:message] for user messages\r\n task.message = \"\"\r\n store.save(task)\r\n session[:id_to_edit] = nil # exits from editing mode\r\n else\r\n task.message << \" \" + \"Not saved.\" # task not ok\r\n session[:message] = task.message # use session[:message] for user messages\r\n session[:overlong_description] = task.overlong_description if\r\n task.overlong_description\r\n session[:bad_categories] = task.bad_categories if\r\n task.bad_categories\r\n task.message = \"\"\r\n task.overlong_description = nil\r\n task.bad_categories = nil\r\n end\r\nend", "def save_to(path); end", "def save_tasks! \n @tasks_params.each do |i, task_params|\n # primary key, only one task expected\n task = Task.where(\"project_id=? and tag=?\", @project.id, i).first\n task.nil? ? @project.tasks.create!(task_params) : task.update_attributes!(task_params)\n end\n end", "def write_task(task_name, session, admin_auth=false, &block)\n task(task_name, session, :wt, admin_auth, &block)\n end", "def save(update_task: true)\n return false unless valid?\n\n # Save schedule\n config_was_changed = config_changed?\n redis.sadd(self.class.key, [id])\n redis.write(gid, to_h)\n\n # Stop there if backend does not need update\n return true unless update_task && (config_was_changed || !task_id || !CloudTask.find(task_id))\n\n # Update backend\n persist_cloud_task\n end", "def task=(value)\n @task = value\n end", "def save\n if @id\n # Update\n DB.execute(\"UPDATE tasks SET title = ?, description = ?, done = ? WHERE id = ?\", @title, @description, @done, @id)\n else\n # Insert\n DB.execute(\"INSERT INTO tasks (title, description, done) VALUES (?, ?, ?)\", @title, @description, @done)\n @id = DB.last_insert_row_id\n end\n end", "def persist_cloud_task\n # Delete previous instance\n CloudTask.delete(task_id) if task_id\n\n # Schedule worker\n Job.new(worker_instance).set(schedule_id: id).schedule!\n end", "def save_current_running_tasks! instances\n instances.each do |i_id, meta|\n current_task = AWS::CLI_Interface.ecs_current_running_task meta['ecs']['cluster']\n\n Logging.log \"Save running task (#{current_task}) for #{meta['name']}\".colorize(:yellow)\n @instances[i_id]['ecs']['task'] = current_task\n end\n\n File.write @source, @instances.to_json\n end", "def insert task\n now = Time.now.to_i\n tasks = @db[:tasks]\n tasks.insert :title => task.title,\n :status => task.getStatus,\n :created => now,\n :wake => now,\n :changed => 0,\n :path => task.getPath,\n :data => Marshal::dump(task)\n end", "def write_to_file(filename) # Take name and status of file, output and save it to a new file\n completed = @all_tasks.map(&:to_machine).join(\"\\n\")\n IO.write(filename, completed)\n end", "def save!; File.write @path, @data end", "def save\n perform_save\n end", "def complete_task(task)\n self.task_completion_status_cache ||= {}\n task = OfferingAdminPhaseTask.find(task) unless task.is_a?(OfferingAdminPhaseTask)\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = true\n tcs.complete = true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n tcs\n end", "def storeTask(param) \n @Handle.execute(\"INSERT INTO Task(OWNER_ID,askedbyID,estimated_time,actual_time,date_created)\" +\n \" values ('#{param.Owner.ID}','#{param.AskedBy.ID}','#{param.EstimatedTime.to_s}','#{param.ActualTime.to_s}','#{param.DateCreated.to_s}')\")\n end", "def save(obj)\n if obj.is_a? Wunderlist::List\n return save_list obj\n elsif obj.is_a? Wunderlist::Task\n return save_task obj\n end\n end", "def write_taskwarrior_file\n open(@task_file, 'w') do |f|\n local_tasks.each do |t|\n t[:tags] = t[:tags].join(\",\") if t[:tags]\n f.puts('[' + t.collect{|k, v| %Q{#{k}:\"#{v}\"} }.join(\" \") + ']')\n end\n end\n end", "def task\n end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def task_params\n params.require(:task).permit(:content, :finished)\n end", "def save_task\n @message = Message.related(current_user.id).find(params[:message_id])\n\n @task = Task.new\n @task.full_text = @message.full_text\n @task.user_id = current_user.id\n @task.agent_id = current_user.id\n\n render '/tasks/new'\n end", "def save!\n end", "def execute\n new_task = Task.new(new_task_attributes)\n assign_location(new_task)\n new_task\n end", "def external_task\n output[:task]\n end", "def save\n timeout_retry(3, 3){\n write \"SAVE\\r\\n\"\n status_code_reply\n }\n end", "def write_tasks\n io.open_file(session_file, \"w\") do |file|\n session_tasks.each do |task|\n file.write \"#{task}\\n\"\n end\n end\n end", "def create\n @task = Task.new(task_params)\n @task.save\n end", "def save(&block)\n returning = yield if block_given?\n Taco.storage.save\n returning\n end", "def task_saved(task)\n @task = task\n recipients = [task.author.email, task.owner.email, task.project.dev.email]\n mail(:to => recipients, :subject => \"[#{Conf.app['code']}] - #{task.created_at == task.updated_at ? 'Nueva' : 'Edición de'} #{Task.model_name.human}\")\n end", "def save_checkpoint\n @api.send(\"world.checkpoint.save()\")\n end", "def write_rake_step(default: false)\n prefix = @workflow_id + '_'\n prefix = prefix + 'task_' if not default\n if @rake_task == false\n @log.fatal { 'No Rake Task defined' }; exit\n else\n file_out = \"#{prefix}#{@task_name}.rb\"\n dest = File.open(file_out, 'w') # a = append\n dest.puts @rake_task\n dest.close\n @log.info \"Write Rake Step : [#{@task_name}] in [#{file_out}]\"\n return @project_path + '/' + file_out\n end\n end", "def write_to_file(filename = \"listsave\")\n\t\tIO.write(filename, @tasks.map(&:to_s).join(\"\\n\"))\n\t\tputs \"List has been successfully saved to #{filename}...\"\n\tend", "def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end", "def set_done(id)\n task = Task.find(id)\n task.done = true\n task.save\nend", "def create\n @task = Task.new(task_params)\n @task.save\n redirect_to task_path(@task)\n end", "def save\n if valid?\n task = Task.create!(title: title, body: body, difficulty: difficulty)\n create_association_for(task)\n TaskSerializer.new(task)\n else\n { errors: ErrorSerializer.serialize(self) }\n end\n end", "def create\n @taks = Task.new()\n @task.save\n redirect_to task_path(@task)\n end", "def create\n @task = Task.new(params[:task])\n if @task.save\n redirect_to wip_path\n else\n redirect_to wip_path\n end\n end", "def update_task(id, title, description)\n task = Task.find(id)\n task.title = title\n task.description = description\n task.save\nend", "def task_params\n params.require(:task).permit(:title, :content, :completed, :mark_done)\n end", "def sync_changes(task)\n tasks_in_sync = Task.all(:original => task.id)\n solutions_saved = ''\n \n if rebuild_cache(Kuni.find_by_id(task.kuni_id))\n if !tasks_in_sync.nil?\n tasks_in_sync.each do |task_sinc|\n task_sinc.is_done = task.in_sync ? Task.find_by_id(task.original).is_done : task.is_done\n kuni = Kuni.find_by_id(task_sinc.kuni_id)\n if task_sinc.save and rebuild_cache(kuni)\n logg(kuni,6)\n solutions_saved << ''\n else\n solutions_saved << 'f'\n end\n end\n end\n end\n solutions_saved\n end", "def cmd_save argv\n setup argv\n e = @hash['elements']\n filepath = @hash['filepath'] || \"config.json\"\n response = @api.save(e, filepath)\n msg response\n return response\n end", "def save\n todo = { 'content' => @content, 'id' => @id, 'is_completed' => @is_completed }\n found_todo = Todo.findTodo(@id)\n\n if found_todo.empty?\n @@allTodos.push(todo)\n return Todo.presist_data\n end\n Todo.edit(todo)\n Todo.presist_data\n end", "def save( defer=false )\n save_logic( defer ) \n end", "def save\n #code\n end", "def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end", "def save(prog, problem_id)\n FileUtils::mkdir_p get_workspace_for_problem(problem_id) # make the directory\n path = File.join(get_workspace_for_problem(problem_id), prog.original_filename) # create the file path\n File.open(path, \"wb\") { |f| f.write(prog.read) } # write the file\n end", "def save\n SAVE\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"./lib/save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n fail ESP::NotImplementedError\n end", "def save\n end", "def to_task; self end", "def save(how = :to_yaml)\n file = @tlog.repository.join('spool').join(filename)\n contents = send(how)\n Info << \"#{component.name}: write #{how}(#{contents.size}Bytes) to #{file}\"\n file.open('w+') do |file|\n file.write(contents)\n end\n contents.size\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def task_params\n params.require(:task).permit(:task_name, :priority, :completed, :project_id, :time_done)\n end", "def to_task(name, priority = 1)\r\n {\"name\" => name, \"priority\" => priority}\r\nend", "def finalized_task(task)\n\t\tsuper if defined? super\n\t\tPlanModificationHooks.finalized_object(self, task) \n\t end", "def begin_task_execution(task, step)\n params = Hash.new\n params[:current_task_id] = task.id\n params[:current_step] = step\n\n # if this is a multi-stage ds we don't bother to keep track of individual states\n if is_multiple_task? && get_plan_diario_post_task.nil?\n params[:ot_state_id] = OtState.find_by_ordinal(OtState::OT_STATE_EN_PROCESO).id\n else\n params[:ot_state_id] = task.decode_ot_state\n end\n update_attributes(params)\n end", "def create\n #@project = Project.where(_id: Moped::BSON::ObjectId(\"50cf8b9e4ba807e959000006\"))\n @project = Project.find(params[:task][:project])\n @task = Task.new(:title => params[:task][:title], :description => params[:task][:description], :time_value => params[:task][:time_value], :status => \"open\")\n @task.project = @project\n @project.update_attribute(\"time_budget\", @project.time_budget + @task.time_value )\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @project, notice: 'Task was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n save_timeline\n save_queue(id, @queue) #in waitlist module\n save_tweets(id, @tweets)\n save_watchlist(id, @watch_list)\n rules.each{|rule|rule.create}\n end", "def record_submission\n transaction do\n task.update_attributes(completed_at: DateTime.now)\n project.signal_or_raise!(:accept_proposal, nil, self)\n end\n end", "def task_params\n params.require(:task).permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end", "def save\n File.open(@file, 'w') do |file|\n file.write(Psych.dump(@params))\n end\n @saved = true\n end", "def save scrape_job, priority=nil, delay=nil\n body = scrape_job.to_flat.join(\"\\t\")\n delay ||= delay_to_next_scrape(scrape_job)\n priority ||= config[:priority]\n log scrape_job, priority, delay\n job_queue.put body, priority, delay, config[:time_to_run]\n end", "def dump_info_to\n \"to task #{ target_task_id } as '#{ status }'#{ ' >obsolete<' if obsolete }\"\n end", "def add_task\r\n\r\n task = task_info(params[:id], true)\r\n dup = BgWorker.first(:conditions => {:name => task[:fullname], :no_duplicate => true})\r\n res = BgWorker.run_task(task, 3) unless dup\r\n if res.nil?\r\n flash[:error] = _(\"Task could not be added to job list!\")\r\n else\r\n flash[:notice] = _(\"Task added to job list.\")\r\n end\r\n redirect_to(:action => :list) and return\r\n end", "def <<(scrape_job) save scrape_job end", "def _save_worker(id, worker, args)\n File.open(File.join(TEMP_W_DIR, \"#{id}.yml\"), 'w') do |f|\n f.write(YAML.dump({ worker => args }))\n end\n end", "def task_params\n params.require(:task).permit(:content, :complete)\n end", "def run_task\n begin\n run \n rescue Exception => e\n @task_run.add_error_text(e.class.name + \": \" + e.message)\n @task_run.add_error_text(e.backtrace.inspect)\n @task_run.success = false\n end \n\n finally\n\n @task_run.end_time = Time.now\n @task_run.save\n end", "def create\n @task = Task.new(params[:task])\n @task.autor = @staff_login.id\n @task.from_userid = @staff_login.id\n @task.current_staff = @staff_login\n @client = Client.find(params[:task][:cl_id])\n @task.name = @client.address if @task.name.empty?\n @task.status = \"new\" if @task.status.nil?\n @task.time_create = Time.now.getlocal\n @task.point_group = Task.maximum('point_group').to_i+1 if @task.point_group.nil? || @task.point_group.to_s.empty?\n @task.zapros_gid = Task.maximum('zapros_gid').to_i+1 if @task.zapros_gid.nil? || @task.zapros_gid.to_s.empty?\n @task.target = if @task.target.empty? || (@task.target=~/[\\d]+/).nil?\n \"0\"\n else\n /([\\d]+)/.match(@task.target)[1]\n end\n respond_to do |format|\n\t\tTask.transaction do\n\t\t\tbegin\n\t\t\t\t@task.save\n\t\t\t\tif @task.type_t == 'upgrade'\n\t\t\t\t\tif (shema = Task.where(point_group: @task.point_group, type_t: 'shem').first) != nil\n\t\t\t\t\t\tshema.update_attributes({status: 'run',target: @task.target})\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tformat.html { redirect_to \"/tasks/?cl_id=#{@client.id}\", notice: 'Task was successfully created.' }\n\t\t\t\tformat.json { render json: @task, status: :created, location: @task }\n\t\t\trescue\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend\n end", "def edit_task(hash_task, *args)\n edit_tasks([hash_task,], *args)\n end", "def save(*_)\n end" ]
[ "0.75393707", "0.750791", "0.7185318", "0.69940114", "0.67947197", "0.664525", "0.66307604", "0.6410636", "0.6298683", "0.6131508", "0.60617095", "0.60113007", "0.594752", "0.5937259", "0.59196144", "0.58929706", "0.58928627", "0.58301264", "0.5826117", "0.5778159", "0.57334834", "0.5723676", "0.5723023", "0.57226247", "0.57163084", "0.5687136", "0.56687105", "0.56616914", "0.565207", "0.56241935", "0.5604066", "0.5594418", "0.5589434", "0.5589434", "0.5589434", "0.5589434", "0.5589434", "0.5589434", "0.5589434", "0.5589434", "0.5571704", "0.5562855", "0.5560193", "0.5552984", "0.55392116", "0.5537161", "0.55362487", "0.5528824", "0.55251014", "0.5521443", "0.551116", "0.5505309", "0.5497526", "0.5496611", "0.54938525", "0.54594624", "0.54567975", "0.5455097", "0.54545444", "0.54451895", "0.5431879", "0.5430413", "0.54263484", "0.5415053", "0.5414527", "0.54087275", "0.5396246", "0.5384372", "0.5378697", "0.537771", "0.5367604", "0.5367604", "0.5367604", "0.5367604", "0.5367604", "0.5367604", "0.5367604", "0.5363223", "0.53603107", "0.5356213", "0.5346615", "0.5343856", "0.53364486", "0.5335576", "0.533357", "0.5331061", "0.53301376", "0.5327271", "0.5324819", "0.5323719", "0.53224087", "0.53223693", "0.53207886", "0.53181595", "0.5312996", "0.53091663", "0.53042746", "0.5302911", "0.5301344", "0.5300121" ]
0.71331966
3
Create a new Cherwell incident with the given data. If creation succeeds, return the Incident instance; otherwise, return `nil`.
def create_incident(data) incident = Incident.create(data) result = @client.create_business_object({ :busObNameOrId => 'Incident', :creationXml => incident.to_xml }) # Result contains the public ID of the new incident, or nil if the # incident-creation failed. if !result.nil? incident['IncidentID'] = result return incident else return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident(id)\n incident_xml = get_object_xml('Incident', id)\n error = self.last_error\n if error\n raise Cherby::NotFound.new(\"Cannot find Incident '#{id}': #{error}\")\n else\n return Incident.new(incident_xml.to_s)\n end\n end", "def create\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(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 @incident = Incident.new(params[:incident])\n\t@incident.project = session[:project]\n\n respond_to do |format|\n if @incident.save\n flash[:notice] = t 'flash.incident_create'\n format.html { redirect_to(@incident) }\n format.xml { render :xml => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n @incident.happened_at = Time.now\n @incident.state = :open\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to root_url, notice: 'Incident was successfully created.' }\n format.json { render action: 'show', status: :created, location: @incident }\n else\n format.html { render action: 'new' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @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 incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end", "def create\n @incident = Incident.new(incident_params)\n @incident.user = current_user\n\n respond_to do |format|\n if @incident.save\n new_incident_email(@incident)\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n @incident.status = \"abierto\"\n @incident.user ||= current_user\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incidencia registrada' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end", "def create_encounter(program, patient, date, provider = nil)\n Encounter.create(\n encounter_type: EncounterType.find_by(name: 'DISPENSING').encounter_type_id,\n patient_id: patient.patient_id,\n location_id: Location.current.location_id,\n encounter_datetime: date,\n program: program,\n provider: provider || User.current.person\n )\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(data = {})\n object = self.new(data)\n object.save\n object\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n respond_to do |format|\n if @incidentcategory.save\n format.html { redirect_to incidentcategories_path, notice: 'Incidentcategory was successfully created.' }\n format.json { render :show, status: :created, location: @incidentcategory }\n else\n format.html { render :new }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end", "def create\n return if auth2(\"website_administrator\", \"ims_servicedesk\")\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if current_user and current_user.roles.index(\"ims_servicedesk\")\n if @incident.save\n #@incident.ferret_update\n session[:current_incident] = @incident\n format.html { redirect_to ims_servicedesk_knowledgedatabasequery_path, :notice => 'Incident was successfully created.' }\n format.json { render :json => @incident, :status => :created, :location => @incident }\n else\n format.html { redirect_to ims_servicedesk_loggingandclassification_path }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n else\n if @incident.save\n format.html { redirect_to @incident, :notice => 'Incident was successfully created.' }\n format.json { render :json => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n @critical = Critical.new(critical_params)\n\n respond_to do |format|\n if @critical.save\n format.html { redirect_to @critical, notice: 'Critical was successfully created.' }\n format.json { render :show, status: :created, location: @critical }\n else\n format.html { render :new }\n format.json { render json: @critical.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(data)\n @create_resource_mixin.create(data)\n end", "def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end", "def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end", "def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end", "def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end", "def create(data={})\n object = self.new(data)\n object.save\n end", "def create\n @incident = Incident.new(params[:incident])\n \n if signed_in?\n @incident.user_id = current_user.id \n else\n @incident.user_id = 1\n end\n \n @incident.reviewed = false\n \n respond_to do |format|\n if @incident.save\n format.html { redirect_to(@incident, :notice => 'Incident was successfully created.') }\n format.xml { render :xml => @incident, :status => :created, :location => @incident }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n \n end", "def create\n @incident_type = IncidentType.new(params[:incident_type])\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully created.' }\n format.json { render json: @incident_type, status: :created, location: @incident_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n @concert.create_activity :create, owner: current_user\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_form = IncidentForm.new(incident_params)\n\n respond_to do |format|\n if @incident_form.save\n format.html { redirect_to incidents_url, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n @catalogList = [['Tecnologia/Proyectores',1], ['Plomeria/Tuberias',2], ['Logistica/Bancos', 3], ['Tecnologia/IT',4]]\n\n begin\n id = ActiveRecord::Base.connection.execute(\"SELECT COUNT(*) FROM incidents;\")\n id.each do |row|\n id = row\n end\n id = id[0].to_i + 1\n sql = \"INSERT INTO incidents (incident_id, u_id, descripcion, prioridad, fecha_inicio, catalog) VALUES ('#{id}', '#{session[:user_id]}', '#{@incident.descripcion}', '#{@incident.prioridad}', #{Time.now.strftime(\"%Y%m%d\").to_i}, '#{@incident.catalog}');\"\n ActiveRecord::Base.connection.execute sql\n\n redirect_to incidents_url, notice: \"Gracias, el incidente será revisado\"\n rescue \n flash[:notice] = \"Error en la forma\"\n render :new\n end\n end", "def create\n expose Challenge.create(@oauth_token, params[:data])\n end", "def create\n @timesheet = Incident.find(params[:incident_id]).timesheet\n\t@safety_officer = @timesheet.safety_officer.build(params[:safety_officer])\n\n respond_to do |format|\n if @safety_officer.save\n format.html { redirect_to(edit_incident_timesheet_path, :notice => 'Safety Officer was successfully created.') }\n else\n format.html { render :new }\n end\n end\n end", "def new\n return if auth(\"website_administrator\")\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @incident }\n end\n end", "def create\n @incident = current_user.incidents.new(params[:incident])\n\t@incident.status = \"Received\"\n\t\n respond_to do |format|\n if @incident.save\n\t @incident.create_timesheet()\n\t @incident.create_mat_list()\n\t\t \n\t @name = User.find(@incident.user_id).profile.name\n\t Notifier.send_notice(@name).deliver\n\t \t \n\t format.html { redirect_to edit_incident_timesheet_path(@incident), :notice => \"The Incident has been saved! Now please fill in the timesheet by adding personnel and materials below.\" }\n\t else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @infected_machine = InfectedMachine.new(infected_machine_params)\n\n @incident = @infected_machine.incident\n\n if @infected_machine.save\n redirect_to @infected_machine.incident\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @infected_machine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidence = Incidence.new(incidence_params)\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to @incidence, notice: 'Incidencia creada exitosamente.' }\n format.json { render :show, status: :created, location: @incidence }\n else\n format.html { render :new }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidenttype = Incidenttype.new(params[:incidenttype])\n\n respond_to do |format|\n if @incidenttype.save\n flash[:notice] = 'Incidenttype was successfully created.'\n format.html { redirect_to(@incidenttype) }\n format.xml { render :xml => @incidenttype, :status => :created, :location => @incidenttype }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incidenttype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @intervention = Intervention.new()\n \n @intervention.author_id = Employee.find_by(user_id: current_user.id).id\n @intervention.customer_id = intervention_params[:customer]\n @intervention.building_id = intervention_params[:building]\n @intervention.battery_id = intervention_params[:battery]\n @intervention.column_id = intervention_params[:column]\n @intervention.elevator_id = intervention_params[:elevator]\n @intervention.employee_id = intervention_params[:employee]\n @intervention.report = intervention_params[:report]\n\n @intervention.save!\n\n if @intervention.save\n redirect_back fallback_location: root_path, notice: \"Your Intervention was successfully created and sent!\"\n zendesk_intervention_ticket()\n end\n\n end", "def create\n @icd_code = IcdCode.new(params[:icd_code])\n\n respond_to do |format|\n if @icd_code.save\n format.html { redirect_to(@icd_code, :notice => 'Icd code was successfully created.') }\n format.xml { render :xml => @icd_code, :status => :created, :location => @icd_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @icd_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new( incident_params )\n\n respond_to do |format|\n if @incident.save\n if params[ :incident_pictures ].present?\n params[ :incident_pictures ][ 'picture' ].each do | pic |\n @incident_picture = @incident.incident_pictures.create!( picture: pic )\n end\n end\n if params[:commit] == \"Submit & Next\"\n format.html { redirect_to new_incident_incident_detail_path(@incident), notice: 'Thank you! Incident was successfully created. Please submit incident details here' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { redirect_to @incident, notice: 'Thank you! Incident was successfully created. Please submit incident details to make it Live' }\n format.json { render :show, status: :created, location: @incident }\n end\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if(params[:incId]).present?\n @incident = Incident.find(params[:incId])\n @incident.report_type = params[:incident][:report_type] \n @incident.your_name = params[:incident][:your_name]\n @incident.job_title = params[:incident][:job_title]\n @incident.injury_date = params[:incident][:injury_date]\n @incident.injury_time = params[:incident][:injury_time]\n @incident.witnesses = params[:incident][:witnesses]\n @incident.location =params[:incident][:location]\n @incident.circumstances = params[:incident][:circumstances]\n @incident.event_discription = params[:incident][:event_discription]\n @incident.injuries_type =params[:incident][:injuries_type]\n @incident.ppe_used =params[:incident][:ppe_used]\n @incident.medical_assistance_provided =params[:incident][:medical_assistance_provided]\n else\n @incident = @project.incidents.build(incident_params)\n end\n\n\n \n respond_to do |format|\n if @incident.save\n if params[:files]\n params[:files].each { |image|\n @incident.incidents_files.create(file: image, incident_id: @incident.id)\n }\n end\n @incident.cn = true\n @incident.save!\n incidents = @project.incidents.where(cn: false)\n incidents.destroy_all if incidents.present?\n format.html { redirect_to projects_path({inc: @incident.id}), notice: 'Incident was successfully created.' }\n format.json { render json: {incident_id: @incident.id} } \n # format.json { render action: 'show', status: :created, location: @incident }\n else\n format.html { render action: 'new' }\n format.json { render json: :true}\n # format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @encounter = Encounter.new(params[:encounter])\n\n respond_to do |format|\n if @encounter.save\n format.html { redirect_to @encounter, notice: 'Encounter was successfully created.' }\n format.json { render json: @encounter, status: :created, location: @encounter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @encounter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidente = Incidente.new(incidente_params)\n\n respond_to do |format|\n if @incidente.save\n flash[:success] = @@msgs\n format.html { redirect_to @incidente, notice: @@msgs }\n format.json { render :show, status: :created, location: @incidente }\n else\n flash[:danger] = @@msge\n format.html { render :new }\n format.json { render json: @incidente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n @incident.users << current_user\n format.html { redirect_to incident_path(@incident) }\n format.js { }\n format.json { render incident_path(@incident), status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clinical_icd = ClinicalIcd.new(clinical_icd_params)\n\n respond_to do |format|\n if @clinical_icd.save\n format.html { redirect_to @clinical_icd, notice: 'Clinical icd was successfully created.' }\n format.json { render :show, status: :created, location: @clinical_icd }\n else\n format.html { render :new }\n format.json { render json: @clinical_icd.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_id\n @incident_id || IncidentId.new(self)\n end", "def create\n interruption_type = -1\n if params[:interruption_type] == \"internal\"\n interruption_type = 1;\n elsif params[:interruption_type] == \"external\"\n interruption_type = 0;\n end\n \n @tomato = Tomato.find(params[:tomato_id])\n @interruption = @tomato.interruptions.create!(params[:interruption].merge(:interruption_type => interruption_type))\n @interruption.user_id = current_user.id\n \n respond_to do |format|\n if @interruption.save\n format.html { redirect_to @tomato, notice: 'Interruption was successfully created.' }\n format.json { render json: @tomato, status: :created, location: @tomato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tomato.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if concert_params[:origin] == \"manual\"\n c = Concert.find_or_create_by(concert_name: concert_params[:concert_name], local_date: concert_params[:local_date])\n c.update(concert_params)\n artist = Artist.find(performers_params[:artist_id])\n Performer.find_or_create_by(artist_id: artist.id, concert_id: c.id)\n elsif concert_params[:origin] == \"Ticket Master\"\n c = Concert.find_or_create_by(tm_id: concert_params[:tm_id])\n c.update(concert_params)\n # No Artist No Concert. There's No Exception.\n artist = Artist.find_by(artist_name: performers_params[:artist])\n elsif concert_params[:origin] == \"Songkick\"\n c = Concert.find_or_create_by(tm_id: concert_params[:tm_id], origin: 'Songkick')\n c.update(concert_params)\n artist = Artist.find_by(artist_name: performers_params[:artist])\n end\n\n if c.date.blank?\n c.date = \"TBC\"\n c.save\n end\n\n Performer.find_or_create_by(artist_id: artist.id, concert_id: c.id)\n\n venue = Venue.find_or_create_by(name: venue_params[:name])\n venue.update(venue_params)\n\n if venue.address.blank?\n geocoder = Geocoder.search(venue_params[:name])\n if geocoder.present?\n if geocoder.first.address.present?\n venue.address = geocoder.first.address\n end\n end\n venue.address = \"TBC\"\n end\n\n if venue.country.blank?\n geocoder = Geocoder.search(venue_params[:name])\n if geocoder.present?\n if geocoder.first.country.present?\n venue.country = geocoder.first.country\n end\n end\n venue.country = \"TBC\"\n end\n\n if venue.flag.blank? && venue.country.present?\n this = venue.country\n if this.casecmp(\"UK\") == 0 || this.include?(\"Great Britain\")\n this = \"GB\"\n end\n if (ISO3166::Country[this]) != nil\n venue.flag = (ISO3166::Country[this]).emoji_flag\n elsif (ISO3166::Country.find_country_by_alpha3(this)) != nil\n venue.flag = (ISO3166::Country.find_country_by_alpha3(this)).emoji_flag\n elsif (ISO3166::Country.find_country_by_name(this)) != nil\n venue.flag = (ISO3166::Country.find_country_by_name(this)).emoji_flag\n end\n end\n\n if venue.city.blank?\n geocoder = Geocoder.search(venue_params[:name])\n if geocoder.present? && geocoder.first.city.present?\n venue.city = geocoder.first.city\n else\n venue.city = \"TBC\"\n end\n end\n venue.save\n\n if c.venue_id.blank?\n c.venue_id = venue.id\n c.save\n end\n\n respond_to do |format|\n format.html { redirect_to concerts_url, notice: 'Concert was successfully saved.' }\n format.json { head :no_content }\n end\n end", "def create\n @citum = Citum.new(citum_params)\n\n respond_to do |format|\n if @citum.save\n format.html { redirect_to @citum, notice: 'Citum was successfully created.' }\n format.json { render :show, status: :created, location: @citum }\n else\n format.html { render :new }\n format.json { render json: @citum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(id, data, default_type, kind)\n entity_type = (TYPE_MAP[data[kind] || default_type] || raise)\n data.delete(kind)\n create_entity(entity_type, id, conv_params(data))\n end", "def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n \t\t\t\t@active = User.find(session[:user_id]).try :touch\n\t\t\t\t@encounter = Encounter.new(encounter_params)\n\t\t\t\t@encounter.date_created = Time.now\n\t\t\t\t@encounter.creator= session[:user_id]\n\t\t\t\t@encounter.save\n\t\t\t\t@encounter_type = EncountersType.all\n\t\t\t\t@people = Person.all\n\t\t\t\t@locations = Location.where(:retired => 0 )\n\t\t\t\t@patients = Patient.where(:voided => 0)\n respond_to do |format|\n if @encounter.save\n format.html { redirect_to @encounter, notice: 'Encounter was successfully created.' }\n format.json { render :show, status: :created, location: @encounter }\n else\n format.html { render :new }\n format.json { render json: @encounter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to(@concert, :notice => 'Concert was successfully created.') }\n format.xml { render :xml => @concert, :status => :created, :location => @concert }\n else\n format.html { render :action => 'new' }\n format.xml { render :xml => @concert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @incucai = Incucai.new(params[:incucai])\n\n respond_to do |format|\n if @incucai.save\n format.html { redirect_to @incucai, notice: 'Incucai was successfully created.' }\n format.json { render json: @incucai, status: :created, location: @incucai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = @theater.concerts.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n #TODO localise the previous string\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.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 create\n @cict = Cict.new(cict_params)\n\n respond_to do |format|\n if @cict.save\n format.html { redirect_to @cict, notice: 'Cict was successfully created.' }\n format.json { render :show, status: :created, location: @cict }\n else\n format.html { render :new }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # TODO 既存 team を含めて保存する場合は認証に対応させる\n @concert = Concert.new(concert_savable_params)\n\n if @concert.save\n render :show, status: :created\n else\n render json: @concert.errors, status: :unprocessable_entity\n end\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def post_incident(payload)\n begin\n payload_json = JSON.dump(payload)\n resp = pagerduty.incidents_api.post(payload_json, :content_type => :json)\n answer = JSON.parse(resp, :symbolize_names => true)\n log.debug(\"POST to incidents, payload=#{payload.inspect}, response=#{answer}\")\n answer\n rescue Exception => e\n log.error(\"Failed to post to incident API: #{payload.inspect}.\"+\n \"\\nError: #{e.message}\")\n raise RuntimeError.new(\"Problem talking to PagerDuty incidents:\"+\n \" #{e.message}\\nRequest was #{payload.inspect}\")\n end\n end", "def create\n @holiday = Holiday.find(params[:holiday_id])\n @occurrence = Occurrence.new(occurrence_params)\n\n respond_to do |format|\n if @occurrence.save\n format.html { redirect_to :back, notice: 'Occurrence was successfully created.' }\n format.json { render :show, status: :created, location: @occurrence }\n else\n format.html { render :new }\n format.json { render json: @occurrence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end", "def create\n @i_c = IC.new(params[:i_c])\n\n respond_to do |format|\n if @i_c.save\n format.html { redirect_to(@i_c, :notice => 'I c was successfully created.') }\n format.xml { render :xml => @i_c, :status => :created, :location => @i_c }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @i_c.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_inciting_incident\n @inciting_incident = IncitingIncident.find(params[:id])\n end", "def create\n @incarnation = Incarnation.new(incarnation_params)\n\n respond_to do |format|\n if @incarnation.save\n format.html { redirect_to @incarnation, notice: 'Incarnation was successfully created.' }\n format.json { render :show, status: :created, location: @incarnation }\n else\n format.html { render :new }\n format.json { render json: @incarnation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @co_independent_trait = CoIndependentTrait.new(co_independent_trait_params)\n\n respond_to do |format|\n if @co_independent_trait.save\n format.html { redirect_to @co_independent_trait, notice: 'Co independent trait was successfully created.' }\n format.json { render :show, status: :created, location: @co_independent_trait }\n else\n format.html { render :new }\n format.json { render json: @co_independent_trait.errors, status: :unprocessable_entity }\n end\n end\n end", "def instantiate\n resource.new(data)\n end", "def create\n @incidentfile = Incidentfile.new(incidentfile_params)\n\n respond_to do |format|\n if @incidentfile.save\n format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully created.' }\n format.json { render :show, status: :created, location: @incidentfile }\n else\n format.html { render :new }\n format.json { render json: @incidentfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create data\n data = validate_path validate_code(data)\n\n row = TABLE.\n returning.\n insert(data).\n first\n\n Computer.new(row)\n end", "def create\n @cuisine = Cuisine.new(spice_params)\n\n if @cuisine.save\n render json: @cuisine, status: :created\n else\n render json: @cuisine.errors, status: :unprocessable_entity\n end\n end", "def create\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 initialize # clinic\n # @company = clinic.company\n\n response = create\n end", "def create\n @invent = Invent.new(invent_params)\n\n respond_to do |format|\n if @invent.save\n format.html { redirect_to @invent, notice: 'Invent was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invent }\n else\n format.html { render action: 'new' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @corruption = current_citoyen.corruptions.build(corruption_params)\n\n respond_to do |format|\n if @corruption.save\n format.html { redirect_to @corruption, notice: 'Corruption was successfully created.' }\n format.json { render :show, status: :created, location: @corruption }\n else\n format.html { render :new }\n format.json { render json: @corruption.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n bike = !!bike_id ? Bike.where(user: current_user).find(bike_id) : nil\n @incident_form = IncidentForm.new(bike, current_user)\n\n if @incident_form.submit(incident_params)\n session[:user_id] = @incident_form.user.id unless current_user\n redirect_to bikes_path, notice: \"You incident has been reported\"\n else\n @last_seen = params[:incident][:last_seen]\n render \"new\"\n end\n end", "def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end", "def create\n @discipline = Discipline.new(params[:discipline])\n @discipline.discipline_id = UUIDTools::UUID.timestamp_create().to_s\n\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to @discipline, notice: t(:discipline_successfully_created) }\n format.json { render json: @discipline, status: :created, location: @discipline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interviewcategory = Interviewcategory.new(interviewcategory_params)\n\n respond_to do |format|\n if @interviewcategory.save\n format.html { redirect_to @interviewcategory, notice: \"Interviewcategory was successfully created.\" }\n format.json { render :show, status: :created, location: @interviewcategory }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @interviewcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_operation(data)\n puts \"Importing Operation #{data[:invoice_num]}\"\n Operation.find_or_create_by(company_id: find_company_id(data[:company]),\n invoice_num: data[:invoice_num],\n invoice_date: parse_date(data[:invoice_date]),\n operation_date: parse_date(data[:operation_date]),\n amount: data[:amount] || 1.0,\n reporter: data[:reporter],\n notes: data[:notes],\n status: data[:status],\n kind: data[:kind] \n )\n end", "def create\n @infractor = Infractor.new(infractor_params)\n\n respond_to do |format|\n if @infractor.save\n format.html { redirect_to @infractor, notice: 'Infractor was successfully created.' }\n format.json { render :show, status: :created, location: @infractor }\n else\n format.html { render :new }\n format.json { render json: @infractor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Integral::Category.new(resource_params)\n\n if @resource.save\n flash[:notice] = notification_message('creation_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('creation_failure') }, status: :unprocessable_entity\n end\n end", "def create(body = {})\n @client.identification.create(body)\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def set_incident\n @incident = Incident.find(params[:id])\n end", "def create\n @incidentmanagement = Incidentmanagement.new(incidentmanagement_params)\n\n respond_to do |format|\n if @incidentmanagement.save\n format.html { redirect_to @incidentmanagement, notice: 'Incidentmanagement was successfully created.' }\n format.json { render :show, status: :created, location: @incidentmanagement }\n else\n format.html { render :new }\n format.json { render json: @incidentmanagement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ice_observation = IceObservation.new(ice_observation_params)\n\n respond_to do |format|\n if @ice_observation.save\n format.html { redirect_to @ice_observation, notice: 'Ice observation was successfully created.' }\n format.json { render :show, status: :created, location: @ice_observation }\n else\n format.html { render :new }\n format.json { render json: @ice_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calevent = Calevent.new(params[:calevent])\n\n respond_to do |format|\n if @calevent.save\n format.html { redirect_to @calevent, notice: 'Calevent was successfully created.' }\n format.json { render json: @calevent, status: :created, location: @calevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calevent.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63564336", "0.6304077", "0.6295956", "0.6295956", "0.62588406", "0.62181264", "0.6210553", "0.61930954", "0.61212116", "0.6118432", "0.5821759", "0.57834375", "0.5702393", "0.5701018", "0.5651847", "0.56334335", "0.5605624", "0.55650544", "0.5534656", "0.55182076", "0.5491629", "0.54753023", "0.5474362", "0.5474362", "0.5474362", "0.5474062", "0.5467643", "0.54672503", "0.5465639", "0.5419426", "0.54112494", "0.5395699", "0.5358465", "0.53545415", "0.5325224", "0.53013027", "0.52608544", "0.5260593", "0.52418137", "0.523858", "0.51988524", "0.5152012", "0.51493084", "0.51301104", "0.5122734", "0.5122734", "0.5122042", "0.5096074", "0.5095833", "0.5090607", "0.50887614", "0.5079106", "0.50725853", "0.5056781", "0.5046332", "0.5033896", "0.50271094", "0.5020449", "0.5018079", "0.5012569", "0.5007837", "0.5001722", "0.49955443", "0.49941987", "0.49941987", "0.49815944", "0.49807325", "0.49690157", "0.49594352", "0.49478632", "0.49476868", "0.49468887", "0.49435204", "0.4934895", "0.49300256", "0.49258834", "0.49258026", "0.49133736", "0.49132085", "0.4900472", "0.48961818", "0.48954594", "0.48864272", "0.4883952", "0.48823497", "0.48757076", "0.48731685", "0.48685998", "0.48605746", "0.4859221", "0.4859221", "0.4859221", "0.4859221", "0.4859221", "0.4859221", "0.4859221", "0.4859221", "0.48569748", "0.48546797", "0.48472443" ]
0.839599
0
Get the last error reported by Cherwell.
def last_error return @client.get_last_error end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_error()\n return @last_error\n end", "def last_err\n api(\"LastErr\")\n end", "def last_error\n @error.respond_to?(:message) ? @error.message : @error\n end", "def get_last_error\r\n CALLS[\"kernel32!GetLastError:=L\"].call\r\n end", "def last_exception\n nil\n end", "def getError\n return @error\n end", "def get_last_error(err_num = GetLastError.call)\r\n buf = 0.chr * 260\r\n flags = FORMAT_MESSAGE_FROM_SYSTEM + FORMAT_MESSAGE_ARGUMENT_ARRAY \r\n FormatMessage.call(flags, 0, err_num, 0, buf, buf.size, 0) \r\n buf.split(0.chr).first.chomp \r\n end", "def previous_error\n error = command(:getpreverror => 1)\n error[\"err\"] ? error : nil\n end", "def error\n @last_error && @last_error.error\n end", "def error\n errors.full_messages.first\n end", "def lastvistaerror\n return @lastvistaerror\n end", "def error\n errors.first\n end", "def error\n errors.first\n end", "def error\n errors.first\n end", "def last_stderr\n @last_stdout.string if @last_stdout\n end", "def errno\n @last_error ? @last_error.errno : 0\n end", "def error\n @obj['error']\n end", "def last_error\n if current_status && current_status.error_class.present?\n {\n error_class: current_status.error_class,\n error_message: current_status.error_message,\n error_trace: current_status.error_backtrace\n }.with_indifferent_access\n else\n super\n end\n end", "def error\n return @error\n end", "def last_error\n less Email.find_with_deleted(:first, :conditions => \"subject like '[pam%'\", :order => \"id desc\").body\n end", "def geterrorcode()\r\n return getvalue(@@ERROR_CODE)\r\n end", "def first_error_message\n response_as_json[\"errors\"].first[\"message\"]\n end", "def error\n @error\n end", "def error\n @error ||= @response['reject_reason']\n end", "def get_redshift_error\n sql = <<-RE.squish\n SELECT filename, line_number, colname, type, raw_field_value, raw_line, err_reason\n FROM STL_LOAD_ERRORS\n WHERE filename like '%#{import_file}%'\n ORDER BY starttime desc\n LIMIT 1\n RE\n result = ::RailsRedshiftReplicator.connection.exec(sql).entries\n error = result.first.map{ |k, v| [k, v.strip].join('=>') }.join(\";\")\n replication.update_attribute :last_error, error\n end", "def error\n rrd_get_error\n end", "def errnum\r\n self.class.errnum\r\n end", "def get_error_code\n codes = get_error_codes\n return '' if codes.empty?\n codes[0]\n end", "def err\n @err\n end", "def first_error_message\n errors.messages.values.flatten.first if errors.any?\n end", "def error\n data['error']\n end", "def error_message\n return @error_message\n end", "def ftp_get_error\n code = @ftp.last_response_code\n code[0] == '2' ? nil : [code, @ftp.last_response]\n end", "def errored\n @errored ||= count('errored')\n end", "def raise_last_win_32_error\n errorCode = Win32API.new(\"kernel32\", \"GetLastError\", [], 'L').call\n if errorCode != ERROR_SUCCESS\n params = [\n 'L', # IN DWORD dwFlags,\n 'P', # IN LPCVOID lpSource,\n 'L', # IN DWORD dwMessageId,\n 'L', # IN DWORD dwLanguageId,\n 'P', # OUT LPSTR lpBuffer,\n 'L', # IN DWORD nSize,\n 'P', # IN va_list *Arguments\n ]\n\n formatMessage = Win32API.new(\"kernel32\", \"FormatMessage\", params, 'L')\n msg = ' ' * 255\n msgLength = formatMessage.call(FORMAT_MESSAGE_FROM_SYSTEM +\n FORMAT_MESSAGE_ARGUMENT_ARRAY, '', errorCode, 0, msg, 255, '')\n\n msg.gsub!(/\\000/, '')\n msg.strip!\n raise msg\n end\n end", "def error_number; end", "def error\n @data['error']\n end", "def error\n @data['error']\n end", "def error\n records\n @config[:error]\n end", "def error\n get_ingest_run.error\n end", "def error\n return unless error?\n err || GenericError.new(error_code, error_msg)\n end", "def error\n nil\n end", "def error\n nil\n end", "def get_errors\n return nil unless has_errors?\n return filter_low_priority_errors(@stderr)\n end", "def error\n @current_offset\n end", "def error_message\n error.message\n end", "def GetLastWarning\n @warning\n end", "def error_msg\n return nil if result\n\n if !github_user.last_sync_at\n \"GitHub has never been synchronized\"\n else\n \"Last GitHub synchronization is too old\"\n end\n end", "def GetLastError\n @error\n end", "def get_error\n error = nil\n begin\n yield\n rescue Exception, RuntimeError => e\n error = e\n end\n error\nend", "def error\r\n @error\r\n end", "def error_message\n @response.reason_phrase\n end", "def error_code\n raise BASICRuntimeError.new(:te_err_no_err) if @error_stack.empty?\n\n code = @error_stack[-1]\n NumericConstant.new(code)\n end", "def full_error\n @response_attributes['FullError'];\n end", "def get_error()\n error = session[:message]\n session.destroy \n return error\n end", "def error_code\n extract_raw_value __callee__\n end", "def cause # :nodoc:\n @last_cause\n end", "def last_http_response\n @http_response\n end", "def error\n return unless id.nil?\n @error ||= @response['message']\n end", "def error_details\n return @error_details\n end", "def error\n return if success? unless parse_error?\n @data['error'] || @data['message']\n end", "def message\n @error['message']\n end", "def error\n params[\"ErrDesc\"]\n end", "def error_reason\n @request['error']['reason']\n end", "def error\n return {error: \"\"}\n end", "def error(ex) [:error, ex]; end", "def error_msg\n IBM_DB.getErrormsg(@conn, IBM_DB::DB_CONN)\n end", "def error_message\n @data[\"message\"]\n end", "def error_name\n self.class.error_name\n end", "def error_name\n self.class.error_name\n end", "def error_message\n self[:error_message]\n end", "def last_correction()\n return nil if !defined?(@corrections) or @corrections.nil? or @corrections.empty?\n return @corrections[-1]\n end", "def error(rc)\n return rc[0].strip if rc[2].success?\n\n puts \"ERROR: #{rc[1]}\"\n\n exit(-1)\nend", "def stderr\n @result.stderr\n end", "def reset_last_error\n @last_error = nil\n @last_error_code = nil\n end", "def get_error_response()\n error_message = \"\"\n @errors.each do |k,v|\n error_message << v + \",\"\n end\n error_message\n end", "def operation_error\n (connection.get_operation_result.code == 0) ? nil : connection.get_operation_result\n end", "def error_message\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"]\n if code = details[\"code\"]\n \"failed with error #{code}: #{err.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n elsif code = details[\"assertionCode\"]\n assertion = details[\"assertion\"]\n \"failed with error #{code}: #{assertion.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n else\n \"failed with error #{err.inspect}\"\n end\n end", "def stderr\n @cmd_result.stderr\n end", "def original_error; end", "def original_error; end", "def lp_error ; @lp_error ; end", "def error\n @error_response\n end", "def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end", "def code\n @errorcode\n end", "def error\n response_json.fetch(\"error\", \"\")\n end", "def recover_from(_error); end", "def get_errors(response)\n errors = ''\n if response.respond_to?('errors')\n errors += last_response.errors\n end\n errors += '; ' unless errors.empty?\n begin\n errors += MultiJson.load(last_response.body)['errors'].to_s\n rescue\n # pass\n end\n return errors.strip\n end", "def results_errno()\n r = attr_get(\"status\")\n if(r.eql?(\"passed\"))\n 0\n end\n r = attr_get(\"errno\")\n unless r\n r = -1\n end\n r\n end", "def build_get_last_error_message(db_name, write_concern)\n gle = BSON::OrderedHash.new\n gle[:getlasterror] = 1\n if write_concern.is_a?(Hash)\n write_concern.assert_valid_keys(:w, :wtimeout, :fsync, :j)\n gle.merge!(write_concern)\n gle.delete(:w) if gle[:w] == 1\n end\n gle[:w] = gle[:w].to_s if gle[:w].is_a?(Symbol)\n build_command_message(db_name, gle)\n end", "def error\n []\n end", "def process_error(exp)\n return exp.shift\n end", "def error\n doc['error']\n end", "def error\n valid? ? nil : @error_message\n end", "def last_response\n @last_response\n end", "def error_message\n @@state[@server] ? @@state[@server][:message] : \"\"\n end", "def get_error_message\n error_msg = \"\"\n \n self.errors.full_messages.each do |msg|\n if error_msg != \"\"\n error_msg << \"<br>\"\n end\n error_msg << msg\n end\n\n error_msg\n end", "def code\n @error['code']\n end", "def error_msg\n name\n end", "def errors\n @error.fetch('errors', [])\n end" ]
[ "0.83008265", "0.8084219", "0.7802622", "0.73222286", "0.71150285", "0.70043015", "0.6963514", "0.6957523", "0.69565976", "0.67425543", "0.6698989", "0.66716313", "0.6657931", "0.6657931", "0.66383135", "0.6422763", "0.63544244", "0.63339853", "0.63336486", "0.63219017", "0.63218033", "0.63062215", "0.62859017", "0.6267631", "0.6262246", "0.6249809", "0.6227255", "0.6213141", "0.61416614", "0.60463834", "0.60432893", "0.602146", "0.6006461", "0.60017955", "0.5980321", "0.5978045", "0.596272", "0.596272", "0.59594417", "0.5958566", "0.59511745", "0.5943005", "0.5924459", "0.59226304", "0.59090054", "0.58977497", "0.5889343", "0.5880439", "0.5875747", "0.5872517", "0.58540934", "0.58464634", "0.5823705", "0.582087", "0.5816731", "0.58131003", "0.5809482", "0.58069247", "0.57711643", "0.5745054", "0.57374984", "0.5726831", "0.57137066", "0.57099336", "0.5707684", "0.56935734", "0.5680567", "0.5678708", "0.5671891", "0.5671891", "0.56585985", "0.5654723", "0.5651689", "0.5646448", "0.5644438", "0.56384915", "0.563433", "0.5634115", "0.56247455", "0.5616566", "0.5616566", "0.56064445", "0.56040627", "0.5603841", "0.5597516", "0.55945706", "0.5572841", "0.55614316", "0.55533546", "0.5545431", "0.5543749", "0.55428445", "0.5541351", "0.5539574", "0.55325973", "0.5515807", "0.5512494", "0.55119133", "0.54963607", "0.54724413" ]
0.79901206
2
Get a business object definition as a hash ex. get_object_definition('Incident') TODO: Use this as the basis for building templates?
def get_object_definition(object_type) result = {} definition = @client.get_business_object_definition(object_type) selector = 'BusinessObjectDef > FieldList > Field' Nokogiri::XML(definition).css(selector).map do |field| result[field['Name']] = field.css('Description').inner_html end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_definition\n\n end", "def hash\n [class_id, object_type, description, name, type, system].hash\n end", "def getEmploymentBusinessDetailObjName\r\n\t\t\treturn \"mfiforce__Employment_Business_Detail__c\"\r\n\t\tend", "def get_schema(object_name)\n s = @client.describe(object_name)\n object_schema = {}\n s[\"fields\"].each do |field|\n object_schema[field[\"name\"]]= {\n type: field[\"type\"],\n # http://salesforce.stackexchange.com/questions/25233/is-there-a-way-to-find-required-fields-on-an-objects\n required: field[\"createable\"] && !field[\"nillable\"] && !field[\"defaultedOnCreate\"]\n }\n end\n object_schema\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_hash\n object\n end", "def get_definition(cls, bld, fun)\r\n bld.add(\"///\")\r\n bld.add(\"/// Web API get single \" + cls.getUName())\r\n bld.add(\"///\")\r\n\r\n get_body(cls, bld, fun)\r\n\r\n bld.endFunction\r\n end", "def to_jaxb_json_hash\n _h = {}\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n _h['name'] = name.to_jaxb_json_hash unless name.nil?\n _h['layout'] = layout.to_jaxb_json_hash unless layout.nil?\n _h['indexDirectory'] = indexDirectory.to_jaxb_json_hash unless indexDirectory.nil?\n _h['description'] = description.to_jaxb_json_hash unless description.nil?\n return _h\n end", "def to_h\n obj = json_type == 'Schema' ? {'@context' => ShEx::CONTEXT} : {}\n obj['id'] = id.to_s if id\n obj['type'] = json_type\n operands.each do |op|\n case op\n when Array\n # First element should be a symbol\n case sym = op.first\n when :datatype then obj['datatype'] = op.last.to_s\n when :exclusions\n obj['exclusions'] = Array(op[1..-1]).map do |v|\n case v\n when Operator then v.to_h\n else v.to_s\n end\n end\n when :extra then (obj['extra'] ||= []).concat Array(op[1..-1]).map(&:to_s)\n when :pattern\n obj['pattern'] = op[1]\n obj['flags'] = op[2] if op[2]\n when :shapes then obj['shapes'] = Array(op[1..-1]).map {|v| v.to_h}\n when :minlength,\n :maxlength,\n :length,\n :mininclusive,\n :maxinclusive,\n :minexclusive,\n :maxexclusive,\n :totaldigits,\n :fractiondigits then obj[op.first.to_s] = op.last.object\n when :min, :max then obj[op.first.to_s] = op.last == '*' ? -1 : op.last\n when :predicate then obj[op.first.to_s] = op.last.to_s\n when :base, :prefix\n # Ignore base and prefix\n when Symbol then obj[sym.to_s] = Array(op[1..-1]).map(&:to_h)\n else\n raise \"Expected array to start with a symbol for #{self}\"\n end\n when :wildcard then obj['stem'] = {'type' => 'Wildcard'}\n when Annotation then (obj['annotations'] ||= []) << op.to_h\n when SemAct then (obj[is_a?(Schema) ? 'startActs' : 'semActs'] ||= []) << op.to_h\n when Start\n obj['start'] = case op.operands.first\n when RDF::Resource then op.operands.first.to_s\n else op.operands.first.to_h\n end\n when RDF::Value\n case self\n when Stem, StemRange\n obj['stem'] = case op\n when Operator then op.to_h\n else op.to_s\n end\n when SemAct then obj[op.is_a?(RDF::URI) ? 'name' : 'code'] = op.to_s\n when TripleConstraint then obj['valueExpr'] = op.to_s\n when Shape then obj['expression'] = op.to_s\n when EachOf, OneOf then (obj['expressions'] ||= []) << op.to_s\n when And, Or then (obj['shapeExprs'] ||= []) << op.to_s\n when Not then obj['shapeExpr'] = op.to_s\n when Language then obj['languageTag'] = op.to_s\n else\n raise \"How to serialize Value #{op.inspect} to json for #{self}\"\n end\n when Symbol\n case self\n when NodeConstraint then obj['nodeKind'] = op.to_s\n when Shape then obj['closed'] = true\n when TripleConstraint then obj['inverse'] = true\n else\n raise \"How to serialize Symbol #{op.inspect} to json for #{self}\"\n end\n when TripleConstraint, EachOf, OneOf\n case self\n when EachOf, OneOf\n (obj['expressions'] ||= []) << op.to_h\n else\n obj['expression'] = op.to_h\n end\n when NodeConstraint\n case self\n when And, Or\n (obj['shapeExprs'] ||= []) << op.to_h\n when Not\n obj['shapeExpr'] = op.to_h\n else\n obj['valueExpr'] = op.to_h\n end\n when And, Or, Shape, Not\n case self\n when And, Or\n (obj['shapeExprs'] ||= []) << op.to_h\n when TripleConstraint\n obj['valueExpr'] = op.to_h\n else\n obj['shapeExpr'] = op.to_h\n end\n when Value\n obj['values'] ||= []\n Array(op).map {|o| o.operands}.flatten.each do |oo|\n obj['values'] << serialize_value(oo)\n end\n else\n raise \"How to serialize #{op.inspect} to json for #{self}\"\n end\n end\n obj\n end", "def to_definition\n Definition.from(self)\n end", "def to_jaxb_json_hash\n _h = super\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n _h['version'] = version.to_jaxb_json_hash unless version.nil?\n _h['description'] = description.to_jaxb_json_hash unless description.nil?\n _h['url'] = url.to_jaxb_json_hash unless url.nil?\n _h['name'] = name.to_jaxb_json_hash unless name.nil?\n _h['organization'] = organization.to_jaxb_json_hash unless organization.nil?\n _h['issueManagement'] = issueManagement.to_jaxb_json_hash unless issueManagement.nil?\n _h['scm'] = scm.to_jaxb_json_hash unless scm.nil?\n _h['ciManagement'] = ciManagement.to_jaxb_json_hash unless ciManagement.nil?\n if !licenses.nil?\n _ha = Array.new\n licenses.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['licenses'] = _ha\n end\n if !mailingLists.nil?\n _ha = Array.new\n mailingLists.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['mailingLists'] = _ha\n end\n if !dependencies.nil?\n _ha = Array.new\n dependencies.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['dependencies'] = _ha\n end\n _h['incomplete'] = incomplete.to_jaxb_json_hash unless incomplete.nil?\n return _h\n end", "def object_definition_metadata\n version = @account.api_version.nil? ? 'latest' : @account.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end", "def object_definition_mappings\n parsed_json = object_definition_metadata\n\n object_names = []\n parsed_json.each do |object_definition|\n object_names << object_definition[\"name\"].downcase\n end\n object_names\n end", "def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end", "def to_h\n\n %w[\n expressions errors stored_workitems schedules trackers\n ].each_with_object({}) do |a, h|\n\n k = a == 'stored_workitems' ? 'workitems' : a\n\n v = self.send(a)\n v = v.collect { |e| e.respond_to?(:h) ? e.h : e }\n\n h[k] = v\n end\n end", "def hash\n [id, _info, actual_end, actual_hours, actual_start, agreement, bill_expenses, billing_amount, billing_attention, billing_method, billing_rate_type, billing_terms, bill_products, bill_project_after_closed_flag, bill_time, bill_to_company, bill_to_contact, bill_to_site, bill_unapproved_time_and_expense, board, budget_analysis, budget_flag, budget_hours, business_unit_id, company, contact, customer_po, description, downpayment, estimated_end, estimated_expense_revenue, estimated_hours, estimated_product_revenue, estimated_start, estimated_time_revenue, expense_approver, include_dependencies_flag, include_estimates_flag, location_id, manager, name, opportunity, project_template_id, restrict_down_payment_flag, scheduled_end, scheduled_hours, scheduled_start, ship_to_company, ship_to_contact, ship_to_site, site, status, time_approver, type].hash\n end", "def hash\n [id, invoice_number, type, status, company, bill_to_company, ship_to_company, apply_to_type, apply_to_id, attention, billing_site, shipping_site, billing_terms, reference, customer_po, template_setup_id, email_template_id, add_to_batch_email_list, date, restrict_downpayment_flag, location_id, department_id, territory_id, top_comment, bottom_comment, taxable_flag, tax_code, internal_notes, downpayment_previously_taxed_flag, service_total, due_date, expense_total, product_total, previous_progress_applied, service_adjustment_amount, agreement_amount, downpayment_applied, subtotal, total, remaining_downpayment, sales_tax, adjustment_reason, adjusted_by, payments, credits, balance, special_invoice_flag].hash\n end", "def to_h\n hash = {}\n self.class.field_definitions.each do |k, v|\n hash[k] = field_value k\n end\n hash\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 to_jaxb_json_hash\n _h = {}\n _h['beanId'] = beanId.to_jaxb_json_hash unless beanId.nil?\n _h['descriptionKey'] = descriptionKey.to_jaxb_json_hash unless descriptionKey.nil?\n _h['readOnly'] = readOnly.to_jaxb_json_hash unless readOnly.nil?\n return _h\n end", "def to_h\n h = {}\n if self.class.respond_to? :attributes\n attrs = self.class.attributes\n attrs.each{|att| h.store(att, self.send(att))}\n elsif self.respond_to?(:instance_variables) && !self.instance_variables.empty?\n attrs = self.instance_variables\n attrs.each{|att| h[att.to_s.delete(\"@\")] = instance_variable_get(att) }\n elsif self.class == Class\n h[:class] = self.inspect_without_obj_id\n elsif self.respond_to? :inspect\n # remove __id__ info, which is actually the C (void *) to the obj in memory... TMI\n h[:data] = self.inspect_without_obj_id\n else # ok this object is weird. Liquid::Strainer was one of these wiseguys.\n h[:data] = self.class.to_s\n end\n h.delete_if {|k,v| v.respond_to?(:nil?) ? v.nil? : false}\n h\n end", "def hash\n [id, name, type, company, contact, phone_number, email, status, opportunity, ticket, agreement, campaign, notes, date_start, date_end, assigned_by, assign_to, schedule_status, reminder, where, notify_flag, _info, custom_fields].hash\n end", "def hash\n [calendar_type, deleted_instance_dates, end_date, end_type, exceptions, frequency, modified_instance_dates, occurrence_count, pattern_type, period, sliding_flag, start_date, week_start_day, discriminator, day_of_week].hash\n end", "def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end", "def object_definition_mappings\n parsed_json = object_definition_metadata\n\n object_names = []\n parsed_json.each do |object_definition|\n object_names << object_definition[\"name\"].downcase\n end\n object_names\n end", "def object_hash(source, include_directives = {})\n obj_hash = {}\n\n if source.is_a?(JSONAPI::CachedResourceFragment)\n obj_hash['id'] = source.id\n obj_hash['type'] = source.type\n\n obj_hash['links'] = source.links_json if source.links_json\n obj_hash['attributes'] = source.attributes_json if source.attributes_json\n\n relationships = cached_relationships_hash(source, include_directives)\n obj_hash['relationships'] = relationships unless relationships.empty?\n\n obj_hash['meta'] = source.meta_json if source.meta_json\n else\n fetchable_fields = Set.new(source.fetchable_fields)\n\n # TODO Should this maybe be using @id_formatter instead, for consistency?\n id_format = source.class._attribute_options(:id)[:format]\n # protect against ids that were declared as an attribute, but did not have a format set.\n id_format = 'id' if id_format == :default\n obj_hash['id'] = format_value(source.id, id_format)\n\n obj_hash['type'] = format_key(source.class._type.to_s)\n\n links = links_hash(source)\n obj_hash['links'] = links unless links.empty?\n\n attributes = attributes_hash(source, fetchable_fields)\n obj_hash['attributes'] = attributes unless attributes.empty?\n\n relationships = relationships_hash(source, fetchable_fields, include_directives)\n obj_hash['relationships'] = relationships unless relationships.nil? || relationships.empty?\n\n meta = meta_hash(source)\n obj_hash['meta'] = meta unless meta.empty?\n end\n\n obj_hash\n end", "def get_definition(codeClass, bld)\n end", "def hash\n [id, name, type, sub_type, status, start_date, end_date, location_id, member, inactive, inactive_days_after_end, notes, default_group, marketing_manager_default_track_id, opportunity_default_track_id, impressions, budget_revenue, budget_cost, actual_cost, budget_gross_margin, budget_roi, actual_revenue, actual_gross_margin, actual_roi, emails_sent, _info].hash\n end", "def definition\n definition = self.class.definition_for(self.name)\n if definition.blank?\n log_warning \"Could not find cell definition for #{self.name}. Please check your cells.yml!\"\n return {}\n else\n definition\n end\n end", "def get_business_object(object_type, id)\n xml = self.get_object_xml(object_type, id)\n return BusinessObject.new(xml)\n end", "def getBusinessEventObjName\r\n\t\t\treturn \"mfiforce__Business_Event__c\"\r\n\t\tend", "def object_definition_metadata\n version = self.api_version.nil? ? 'latest' : self.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end", "def hash\n [objective, property_types, status, sale_mode, channel, address_parts, advertiser_identifiers, apm_identifiers, bathrooms, bedrooms, building_area, building_area_sqm, carspaces, date_available, date_created, date_updated, date_minor_updated, date_listed, date_purged, description, dev_project_id, energy_efficiency_rating, features, geo_location, headline, id, inspection_details, is_new_development, land_area, land_area_sqm, media, price_details, property_id, provider_details, rental_details, sale_details, is_withdrawn, seo_url, error_message, virtual_tour_url, homepass_enabled, statement_of_information, number_of_dwellings, highlights].hash\n end", "def hash\n [id, name, based_on, custom_calendar, default_flag, application_order, hi_impact_hi_urgency, hi_impact_med_urgency, hi_impact_low_urgency, med_impact_hi_urgency, med_impact_med_urgency, med_impact_low_urgency, low_impact_hi_urgency, low_impact_med_urgency, low_impact_low_urgency, respond_hours, respond_percent, plan_within, plan_within_percent, resolution_hours, resolution_percent, _info].hash\n end", "def attributes_hash(object); end", "def to_jaxb_json_hash\n _h = {}\n _h['description'] = description.to_jaxb_json_hash unless description.nil?\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n _h['enabled'] = enabled.to_jaxb_json_hash unless enabled.nil?\n return _h\n end", "def hash\n object_id\n end", "def to_jaxb_json_hash\n _h = {}\n _h['frequency'] = frequency.to_jaxb_json_hash unless frequency.nil?\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n _h['billingCycleDay'] = billingCycleDay.to_jaxb_json_hash unless billingCycleDay.nil?\n _h['billingPlanName'] = billingPlanName.to_jaxb_json_hash unless billingPlanName.nil?\n _h['cancellable'] = cancellable.to_jaxb_json_hash unless cancellable.nil?\n _h['vendorParameters'] = vendorParameters.to_jaxb_json_hash unless vendorParameters.nil?\n _h['billingFrequency'] = billingFrequency.to_jaxb_json_hash unless billingFrequency.nil?\n _h['name'] = name.to_jaxb_json_hash unless name.nil?\n _h['billingPlanId'] = billingPlanId.to_jaxb_json_hash unless billingPlanId.nil?\n _h['autoRenewal'] = autoRenewal.to_jaxb_json_hash unless autoRenewal.nil?\n _h['number'] = number.to_jaxb_json_hash unless number.nil?\n return _h\n end", "def hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\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 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 definition_cache\n @definition_cache ||= {}\n end", "def structure\n # create a hash and return it\n h = {\n name: @name,\n required: @required,\n expression: @expression,\n data_type: @data_type,\n field_type: @field_type\n }\n h[:properties] = @properties if @properties.keys.count > 0\n h\n end", "def hash\n [class_id, object_type, name, order, persistent_bindings, placement, static_wwpn_address, type, vif_id, wwpn, wwpn_address_type, fc_adapter_policy, fc_network_policy, fc_qos_policy, profile, san_connectivity_policy, scp_vhba, sp_vhbas, wwpn_lease, wwpn_pool].hash\n end", "def definition_name\n return @definition_name if defined?(@definition_name)\n\n if name\n @definition_name = name.gsub(\"::\", \"__\").freeze\n else\n \"#{self.class.name}_#{object_id}\".gsub(\"::\", \"__\").freeze\n end\n end", "def to_hash(embedded_contents = nil)\n if object.embedded?\n # select the relation for the parent object\n parent_relation = object.relations.select do |k,v|\n v.macro == :embedded_in && v.class_name == object._parent.class.name\n end.values.first\n # embed this in the parent's hash\n result = {\n association: parent_relation.inverse_of,\n id: object.id\n }\n result = result.merge(embedded: embedded_contents) if embedded_contents\n self.class.new(object._parent).to_hash(result)\n else # !embedded?\n result = { class_name: object.class.name, id: object.id }\n result[:embedded] = embedded_contents if embedded_contents\n result\n end\n end", "def to_hash\n {\n \"deployment_id\" => deployment_id, \"created_at\" => created_at, \"hot_deploy\" => hot_deploy,\n \"force_clean_build\" => force_clean_build, \"ref\" => ref, \"sha1\" => sha1, \"artifact_url\" => artifact_url, \"activations\" => activations\n }\n end", "def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end", "def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end", "def hash\n [class_id, object_type, contract, contract_status, contract_status_reason, contract_updated_time, covered_product_line_end_date, device_id, device_type, end_customer, end_user_global_ultimate, is_valid, item_type, maintenance_purchase_order_number, maintenance_sales_order_number, platform_type, product, purchase_order_number, reseller_global_ultimate, sales_order_number, service_description, service_end_date, service_level, service_sku, service_start_date, state_contract, warranty_end_date, warranty_type, registered_device, source].hash\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 get_definition(cls, bld, fun)\r\n get_body(cls, bld, fun)\r\n end", "def to_h\n { languages: languages.map(&:to_h), break_type: break_type,\n prefix_break: prefix_break?, bounds: bounds.map(&:to_h),\n symbols: symbols.map(&:to_h) }\n end", "def __getobj__\n @hashobj\n end", "def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end", "def parse_object_ref(ref)\n prefix = ref[1]\n ref = ref[0]\n # Let's make sure the value isn't nil. If it is, return the default Hash.\n return {} if ref.nil?\n class_name = underscore(ref.class)\n id = \"#{class_name}_#{ref.id || 'new'}\"\n\n if ref.respond_to?(:model_modifiers)\n class_name = model_classes(ref)\n elsif prefix\n class_name = \"#{prefix}_#{class_name}\"\n id = \"#{prefix}_#{id}\"\n end\n\n {'id' => id, 'class' => class_name}\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 to_h\n {\n id: id,\n uuid: uuid,\n aggregate_id: aggregate_id,\n type: type,\n body: body,\n version: version,\n created_at: created_at,\n correlation_id: correlation_id,\n causation_id: causation_id,\n }\n end", "def hash\n [id, name, prefix_suffix_option, default_flag, inactive_flag, pre_payment_flag, invoice_pre_suffix, location_id, business_unit_id, restrict_location_flag, restrict_department_flag, sla_id, application_units, application_limit, application_cycle, application_unlimited_flag, one_time_flag, cover_agreement_time_flag, cover_agreement_product_flag, cover_agreement_expense_flag, cover_sales_tax_flag, carry_over_unused_flag, allow_overruns_flag, expired_days, limit, expire_when_zero, charge_to_firm_flag, employee_comp_rate, employee_comp_not_exceed, comp_hourly_rate, comp_limit_amount, bill_cycle_id, bill_one_time_flag, bill_terms_id, invoicing_cycle, bill_amount, taxable_flag, restrict_down_payment_flag, invoice_description, top_comment_flag, bottom_comment_flag, work_role, work_type, project_type_id, invoice_template_setup_id, bill_time, bill_expenses, bill_products, billable_time_invoice_flag, billable_expense_invoice_flag, billable_product_invoice_flag, copy_work_roles_flag, copy_work_types_flag, _info].hash\n end", "def get_hash_by_object(object)\n json = {}\n\n object.instance_variables.each do |var|\n key = var.to_s.delete(\"@\")\n value = object.instance_variable_get(var)\n if value.is_a? Array\n values = []\n value.each do |v|\n new_value = get_hash_by_object(v)\n values.push((new_value.empty?) ? value : new_value)\n end\n json[key] = values\n else\n new_value = get_hash_by_object(value)\n json[key] = (new_value.empty?) ? value : new_value\n end\n end\n\n json\n end", "def to_h_k_s\n {\n slug: @slug, depends: @depends&.to_h_k_s, name: @name,\n version: @version, author: @author, description: @description\n }.map { |k, v| [k.to_s, v] }.to_h\n end", "def hash\n [id, project_id, description, board, status, agreement, opportunity, parent_phase, wbs_code, bill_time, bill_expenses, bill_products, mark_as_milestone_flag, notes, deadline_date, bill_separately_flag, billing_method, scheduled_hours, scheduled_start, scheduled_end, actual_hours, actual_start, actual_end, budget_hours, location_id, business_unit_id, hourly_rate, billing_start_date, bill_phase_closed_flag, bill_project_closed_flag, downpayment, po_number, po_amount, estimated_time_cost, estimated_expense_cost, estimated_product_cost, estimated_time_revenue, estimated_expense_revenue, estimated_product_revenue, currency, bill_to_company, bill_to_contact, bill_to_site, ship_to_company, ship_to_contact, ship_to_site, _info].hash\n end", "def hash\n [class_id, object_type, account_moid, create_time, domain_group_moid, mod_time, moid, owners, shared_scope, tags, version_context, ancestors, parent, permission_resources, display_names].hash\n end", "def get_definition(cls, bld, fun)\r\n bld.add(\"/*\")\r\n bld.add(\"* Web API get single \" + cls.getUName())\r\n bld.add(\"*/\")\r\n\r\n @dsClass = cls.model.findClassModelByPluginName(\"class_data_set\")\r\n\r\n if @dsClass != nil\r\n @returnType = Utils.instance.getStyledClassName(@dsClass.getUName())\r\n else\r\n @returnType = \"Page<\" + Utils.instance.getStyledClassName(cls.getUName()) + \">\"\r\n end\r\n\r\n get_body(cls, bld, fun)\r\n end", "def to_jaxb_json_hash\n _h = super\n _h['cronExpression'] = cronExpression.to_jaxb_json_hash unless cronExpression.nil?\n _h['location'] = location.to_jaxb_json_hash unless location.nil?\n _h['releases'] = releases.to_jaxb_json_hash unless releases.nil?\n _h['snapshots'] = snapshots.to_jaxb_json_hash unless snapshots.nil?\n _h['blockRedeployments'] = blockRedeployments.to_jaxb_json_hash unless blockRedeployments.nil?\n _h['stagingRepository'] = stagingRepository.to_jaxb_json_hash unless stagingRepository.nil?\n _h['scanned'] = scanned.to_jaxb_json_hash unless scanned.nil?\n _h['daysOlder'] = daysOlder.to_jaxb_json_hash unless daysOlder.nil?\n _h['retentionCount'] = retentionCount.to_jaxb_json_hash unless retentionCount.nil?\n _h['deleteReleasedSnapshots'] = deleteReleasedSnapshots.to_jaxb_json_hash unless deleteReleasedSnapshots.nil?\n _h['stageRepoNeeded'] = stageRepoNeeded.to_jaxb_json_hash unless stageRepoNeeded.nil?\n _h['resetStats'] = resetStats.to_jaxb_json_hash unless resetStats.nil?\n _h['skipPackedIndexCreation'] = skipPackedIndexCreation.to_jaxb_json_hash unless skipPackedIndexCreation.nil?\n return _h\n end", "def obj_to_hash( obj )\n hash = {}\n obj.instance_variables.each do |var|\n hash[var.to_s.gsub( /@/, '' )] = obj.instance_variable_get( var )\n end\n hash\n end", "def schema_definition\n of.schema_definition \n end", "def hash\n [schema, name].hash\n end", "def to_h\n {\n id: @id,\n word: @word,\n author: @author,\n permalink: @permalink,\n definition: @definition,\n example: @example,\n upvotes: @upvotes,\n downvotes: @downvotes\n }\n end", "def getHolidayObjName\r\n\t\t\treturn \"mfiforce__Holiday__c\"\r\n\t\tend", "def object_map\n @config.output.object_map\n end", "def to_h\n res = {\n email: email,\n api_key: api_key,\n org_id: org_id,\n mkp_name: mkp_name,\n version: version,\n assemblyname: assemblyname,\n componentname: componentname,\n domain: domain,\n region: region,\n resource: resource,\n storage_hddtype: storage_hddtype,\n oneclick: oneclick,\n ipv4private: ipv4private,\n ipv4public: ipv4public,\n ipv6private: ipv6private,\n ipv6public: ipv6public,\n sshkey: keypairname,\n keypairoption: keypairoption,\n cattype: cattype,\n cpu: @flavor.cpu,\n ram: @flavor.ram,\n hdd: @flavor.hdd,\n options: options,\n envs: envs,\n provider: provider\n }\n\n set_git(res)\n res\n end", "def to_srclib_defn(obj)\n {\n 'Path' => yard_object_path_to_srclib_path(obj['path']),\n 'TreePath' => yard_object_path_to_srclib_treepath(obj['path']),\n 'Name' => obj['name'],\n 'Kind' => RUBY_OBJECT_TYPE_MAP[obj['type']],\n 'Exported' => obj['exported'],\n 'File' => obj['file'],\n 'DefStart' => obj['def_start'],\n 'DefEnd' => obj['def_end'],\n 'Test' => !!(/(_test\\.rb|_spec\\.rb)$/.match(obj['file']) or /(specs?|tests?)\\//.match(obj['file'])),\n 'Data' => {\n # NOTE: This should be kept in sync with the def formatter in this\n # repository (which is written in Go).\n 'RubyKind' => obj['type'],\n 'TypeString' => obj['type_string'],\n 'Signature' => obj['signature'],\n 'Module' => obj['module'],\n 'RubyPath' => obj['path'],\n 'ReturnType' => obj['return_type'],\n },\n }\n end", "def to_h\n body\n end", "def hash\n [id, to, from, carrier, thumbnails, size, expected_delivery_date, date_created, date_modified, deleted, front_template_id, back_template_id, front_template_version_id, back_template_version_id, tracking_events, object, url, description, metadata, mail_type, merge_variables, send_date, use_type].hash\n end", "def factory_definitions\n @factory_definitions ||= {}\n end", "def to_definition\n DynamicModel::AttributeDefinition.new({\n :class_type => self.class_type,\n :name => self.name,\n :type => self.type,\n :length => self.length,\n :required => self.required,\n :default => self.default\n })\n end", "def to_jaxb_json_hash\n _h = {}\n _h['name'] = name.to_jaxb_json_hash unless name.nil?\n _h['with'] = with.to_jaxb_json_hash unless with.nil?\n _h['cover'] = cover.to_jaxb_json_hash unless cover.nil?\n _h['info'] = info.to_jaxb_json_hash unless info.nil?\n return _h\n end", "def hash\n [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].hash\n end", "def hash\n self.class.name.hash\n end", "def ref\n @definition_name\n end", "def to_hash\n index_hash = Hash.new\n self.each do |predef|\n index_hash[predef.name] = predef.to_s\n end\n index_hash\n end", "def to_h!\n h = {}\n @schema.keys.each do |k|\n v = self[k]\n h[k] = Configuration.config?(v) ? v.to_h! : v.inspect\n end\n h\n end", "def obj_to_hash\n hash = {}\n instance_variables.each do |var|\n hash[var.to_s.delete('@')] = instance_variable_get(var)\n end\n hash\n end", "def hash\n [id, identifier, name, status, type, address_line1, address_line2, city, state, zip, country, phone_number, fax_number, website, territory_id, market_id, account_number, default_contact, date_acquired, sic_code, parent_company, annual_revenue, number_of_employees, ownership_type, time_zone, lead_source, lead_flag, unsubscribe_flag, calendar_id, user_defined_field1, user_defined_field2, user_defined_field3, user_defined_field4, user_defined_field5, user_defined_field6, user_defined_field7, user_defined_field8, user_defined_field9, user_defined_field10, deleted_flag, date_deleted, deleted_by, mobile_guid, currency, _info, custom_fields].hash\n end", "def get_object(obj_name)\n key = obj_name.to_s\n obj = @cache[key]\n unless obj\n if extra_inputs_has(key)\n obj = @extra_inputs[key]\n else\n case @defs[key]\n when MethodDef\n obj = construct_method(key)\n when FactoryDef\n obj = construct_factory(key)\n @cache[key] = obj\n else\n obj = construct_object(key)\n @cache[key] = obj if @defs[key].singleton?\n end\n end\n end\n obj\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" ]
[ "0.5812334", "0.57990557", "0.5618393", "0.55305177", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.5494255", "0.54875606", "0.54716027", "0.5463971", "0.5436587", "0.54157746", "0.53965473", "0.5395415", "0.53908", "0.5384892", "0.5380636", "0.5372589", "0.5370987", "0.53660667", "0.53550553", "0.53494513", "0.5348787", "0.5345891", "0.53360206", "0.533373", "0.5332864", "0.53182405", "0.53134924", "0.5309162", "0.5299451", "0.5284096", "0.52578515", "0.5248397", "0.5224318", "0.5219281", "0.5215877", "0.5204184", "0.5202264", "0.51960295", "0.51929873", "0.51916146", "0.51907045", "0.515486", "0.51524144", "0.5144545", "0.5136359", "0.5134758", "0.5130735", "0.51191443", "0.51191443", "0.5115575", "0.51094437", "0.5100713", "0.5097671", "0.5092485", "0.509063", "0.5089112", "0.508421", "0.5081695", "0.50755763", "0.50716484", "0.50645226", "0.50632024", "0.5054918", "0.50516856", "0.50497395", "0.50425255", "0.50398123", "0.50352705", "0.5031126", "0.5027338", "0.5009986", "0.5004174", "0.5003016", "0.49964637", "0.49921477", "0.49919274", "0.4988642", "0.498476", "0.49838176", "0.49798068", "0.49759933", "0.49720678", "0.4970311", "0.49629062", "0.49613637", "0.49600542", "0.4953354" ]
0.7137704
0
Let's see how much you've got now...
def calculate_balance(month) plus = month[:income].sum minus = month[:expenses].sum plus - minus end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure; end", "def stats; end", "def stats; end", "def percent_passes; end", "def percent_passes; end", "def total; end", "def num_known\n @num_known ||= worth_counting { count_known }\nend", "def measure\n\t\t1\n\tend", "def total_time; end", "def counting\n puts \"hard to do right\"\n end", "def load_factor\n puts \"Load Factor: #{new_load_factor = @item_count / @size.to_f}\"\n return new_load_factor\n end", "def calc_stats\n #puts \"bad_biz = #{@bad_business_records.length}\"\n #puts \"bad_user = #{@bad_user_records.length}\"\n #puts \"good_biz = #{@good_business_records.length}\"\n #puts \"good_user = #{@good_user_records.length}\"\n \n @total_rec_cnt = @bad_business_records.length + @bad_user_records.length +\n\t @good_business_records.length + @good_user_records.length\n @well_formed_rec_cnt = @good_business_records.length + @good_user_records.length\n @malformed_rec_cnt = @bad_business_records.length + @bad_user_records.length\n @biz_rec_cnt = @businesses.length\n @user_rec_cnt = @users.length\n end", "def load_factor\n @item_count / @items.length\n end", "def who_often_takes\n\t \thash = Hash.new(0)\n\t\tres = @orders.each { |order| hash[order.name] += 1 } \n\t\thash.max{|a, b| a.length <=> b.length}\n\t end", "def hashrate\n 7158278.826666666 * shares.fresh.count\n end", "def total\n 2**64 - 1\n end", "def load_factor\n @item_count/ size\n end", "def calculated; end", "def print_statistics(bv)\n diff = bv.length- encode(bv).length\n percent_reduction = (1 - (bv.length - diff).to_f/bv.length) * 100\n puts \"Original Length: #{bv.length}\"\n puts \"Encoded Length: #{encode(bv).length}\"\n puts \"Characters saved: #{diff}\"\n puts \"Percent Reduction: #{percent_reduction}%\"\n diff\nend", "def eu1\n # .00028s | 1000 silent iterations\n total = 0\n (1..1000).each { |i| total += i if i % 3 == 0 or i % 5 == 0 }\n return total\nend", "def stats\n end", "def stats\n end", "def lots_count\t\t\n lots.count\n end", "def count; end", "def count; end", "def count; end", "def statistics; end", "def masterwork_prob_bonus; 0; end", "def backed_up()\n cnt = @queue.size() + (@current_req.nil? ? 0 : 1)\n return 0 if 0 == cnt\n if @max_queue_count.nil? || 0 == @max_queue_count\n cnt = 80 if 80 < cnt\n cnt\n else\n cnt * 100 / @max_queue_count\n end\n end", "def quick_stats\n\tend", "def percentage; end", "def cult_population\n my_followers.count\n end", "def remaining_total\n total\n end", "def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end", "def load_factor\n @item_count / size\n end", "def load_factor\n @item_count / size\n end", "def num_tankoubon; end", "def stats\n \n end", "def now_allocations\n 0\n end", "def total_query\n\t\t@total = 0\n\t\t@cards_held.times do |x|\n\t\t\t@total += hand_query(x,1,0)\n\t\tend\n\t\treturn @total\n\tend", "def load_factor\n @entry_count / @size\n end", "def stats\n ## TODO:\n end", "def load_factor\n return (@total_items.fdiv(size))\n end", "def test_total_weight\n assert_equal(0 , @wp00.total_weight)\n assert_equal(384, @wp01.total_weight)\n assert_equal(576, @wp02.total_weight)\n end", "def compute_fullcnpswage\n ( full_caissebase + full_process_bonuses ).ceil\n end", "def total_time=(_arg0); end", "def viralAdvertising(n)\n shared = 5\n cumulative = 0\n n.times do\n cumulative += (liked = shared / 2)\n shared = liked * 3\n end\n cumulative\nend", "def rate; end", "def rate; end", "def number_returned; 0; end", "def avarage_calories_burned\n total_workout_calories / set_sport_by_user.count\n rescue\n 0\n end", "def progress_stats\n word_count = Float(Word.all.length)\n quizzed_count = Float(Quiz.all.uniq { |noun| noun.word_id }.length)\n rate = quizzed_count / word_count\n rate.round(2) * 100\n end", "def total_bytes\n (wired + active + inactive + free) * pagesize\n end", "def load_factor\n @item_count / size.to_f\n end", "def totalamount\n\t\tcopies * 5\n\tend", "def get_progresses\n if @all_count > 0\n @progress_ch = 100 * @memorized_count_ch / @all_count\n @progress_ja = 100 * @memorized_count_ja / @all_count\n else\n @progress_ch = 0\n @progress_ja = 0\n end\n end", "def load_factor\n puts \"load_factor: #{@values} / #{@size}\"\n (@values + 0.0) / @size\n end", "def check_current_space\n if @parcels.empty?\n puts @volume.to_i\n else\n sum = 0\n @parcels.each do |parcel|\n sum += parcel.volume.to_i\n end\n puts @volume.to_i - sum\n end\n end", "def memsize\n end", "def calories_per_liter\n 672\n end", "def load_factor\n @count.to_f / size.to_f\n end", "def calculate_total\n total = 0\n cards.each {|a_card| total += a_card.value }\n #correct for Aces, if we have blown over 21\n cards.each do |a_card| \n if a_card.face == ACE \n total -= (ACE_VALUE - ACE_ALT_VALUE) if total > BLACKJACK\n end\n end\n total\n end", "def space_available\n used = 0\n if recordings.any?\n used = recordings.map(&:full_size).reduce(:+) \n end\n\n total_space - used\n end", "def test_total_codings\n assert_equal 25, @mk.codings.size\n # assert_equal 25, @mk.codings_old.size\n # assert_equal @mk.codings.size, @mk.codings_old.size\n end", "def tiles_remaining\n # still not sure why or how this is working. TODO: may take out later\n total_num_tiles = @default_set.inject(0) { |letter, letter_quantity| letter += letter_quantity[1] }\n p \"++++TEST++++\"\n p total_num_tiles\n return total_num_tiles\n end", "def tfullness\n ttaken.to_f/tlimit.to_f\n end", "def remaining\n max - used\n end", "def remaining; end", "def request_count; end", "def totalcount\n @totalcount\n end", "def total_life\n items.map(&:life).inject(0) { |sum, current| sum += current }\n end", "def count_sparsity\n (1 - count_edge.to_f/(count_user*count_item))*100\n end", "def memused\n @memtotal - @memfree\n end", "def bookings\n accumulator = 0.0\n cakes.all.each do |cake|\n accumulator += cake.production_quota_value\n end # of cake\n return accumulator\n end", "def split_total_amount\n total=0\n reim_split_details.each do |split|\n next if split.marked_for_destruction?\n total+=split.percent_amount if split.percent_amount\n end\n total\n end", "def increase_used\n self[:numUsed] += 1\n end", "def load_factor\n total = 0.0\n @items.each do |item|\n if item.is_a? Node\n total = total + 1\n elsif item.is_a? LinkedList\n total = total + item.length\n end\n end\n total.to_f / @size.to_f\n end", "def needed_amount_less_savings\n recommended_min_portfolio - portfolio_after_growth\n end", "def num_waiting\n end", "def num_waiting\n end", "def totalDistance\n\t\ti = 0\n\t\tsum = 0\n\t\twhile i < @@walks\n\t\t\tsum += @@distance[i].to_i\n\t\t\ti += 1\n\t\tend\n\t\tputs \"Bark\"\n\t\tif @@walks == 0\n\t\t\tputs \"#{@name}'s owners don't love them. They haven't been on a walk yet :(\"\n\t\telsif @@walks == 1\n\t\t\tputs \"#{@name} has walked #{sum}kms in a single walk\"\n\t\telse\n\t\t\tputs \"#{@name} has already walked #{sum}kms in #{@@walks} walks\"\n\t\tend\n\tend", "def completion_stats\n \n stats = { :self => \"0.0\", :peer => \"0.0\" }\n total_checks = self.check_count\n \n if total_checks[:designer] > 0\n stats[:self] = self.designer_completed_checks * 100.0 / total_checks[:designer]\n end\n if total_checks[:peer] > 0\n stats[:peer] = self.auditor_completed_checks * 100.0 / total_checks[:peer]\n end\n\n stats\n \n end", "def load_factor\n @items / self.get_size\n end", "def sfullness\n staken.to_f/slimit.to_f\n end", "def covered_percentages; end", "def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if tot2 > 17\n return tot2\n elsif tot2 == 17\n unless @hit_soft_17\n return tot2\n end\n end\n end\n return tot\n end", "def load_factor\n @item_count / self.size.to_f\n end", "def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end", "def return_quota\n returned_sheets / (course_profs.size * students).to_f\n end", "def precision; end", "def effective_rate; end", "def processor_count; end", "def processor_count; end", "def load_factor\n @count.fdiv(size)\n end", "def solve_math_attempt\n\n # 0 jolt charging outlet\n outlet = JoltageAdapter.new(0)\n @adapters.push(outlet)\n\n # final jump to device\n dev = Device.new(@adapters)\n @adapters.push(dev)\n\n @adapters.sort_by! {|adapter| adapter.joltage}\n\n\n # we only care about the joltages\n available_joltages = @adapters.map { |adapter| adapter.joltage }\n\n count = 0\n\n available_joltages.each do |joltage|\n\n # p joltage\n\n can_link_to = available_joltages.select do |node|\n diff = node - joltage\n diff <= 3 && diff > 0\n end\n\n is_linked_to = available_joltages.select do |node|\n diff = joltage - node\n diff <= 3 && diff > 0\n end\n\n # count += can_link_to.size\n # count *= is_linked_to.size\n\n impact = (can_link_to.size) * (is_linked_to.size) - 1\n\n puts \"Adapter #{joltage} impact: #{impact}\"\n\n count += impact unless impact <= 0\n\n\n\n\n # puts 2**(can_link_to.size-1) unless (can_link_to.size - 1 <= 0)\n\n # puts \"Joltage #{joltage} can link to #{can_link_to}, size #{can_link_to.size}\"\n\n # puts \"Increasing current count of #{count} by #{can_link_to.size}\"\n # count *= 2**(can_link_to.size-1) unless can_link_to.size <= 0\n\n\n end\n puts \"COUNT: #{count}\"\n # puts count.class\n # p count\n\nend", "def grows_fruits\n return @orange_count = @tree_years * 100\n end", "def collect_treasure\n @gold_coins = @gold_coins += 1\n if @gold_coins % 10 == 0\n level_up\n puts \"You got 11 gold coins! Now you have #{ @gold_coins }.\"\n puts \"Oh and you got an extra life, too! Now you have #{ @lives }.\"\n else\n puts \"You got a gold coin! Now you have #{ @gold_coins }.\"\n end #if\n end", "def amount; end", "def time_remaining\n end", "def percent_used\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\ttotal = memory[0].split[1].to_i\n\t\t\t\ttotal.-(memory[2].split[1].to_i).*(100).fdiv(total).round(2)\n\t\t\tend", "def how_many\n return @@total_samurais\n end" ]
[ "0.67176074", "0.67021394", "0.67021394", "0.6513376", "0.6513376", "0.6486386", "0.6422887", "0.6411202", "0.6350286", "0.62915546", "0.6273256", "0.62529564", "0.6210636", "0.6204597", "0.61850905", "0.6179464", "0.6156877", "0.6152296", "0.6144652", "0.6136861", "0.61329806", "0.61329806", "0.6131242", "0.61159474", "0.61159474", "0.61159474", "0.61118156", "0.61047375", "0.60787785", "0.60665715", "0.6065905", "0.6046951", "0.6038993", "0.60333383", "0.60305125", "0.60305125", "0.60161734", "0.60077083", "0.6007583", "0.6002684", "0.6002103", "0.6001727", "0.5996137", "0.59768134", "0.5975414", "0.5971842", "0.5969864", "0.595384", "0.595384", "0.59393966", "0.5935974", "0.5934562", "0.59051305", "0.5902639", "0.5901061", "0.5899203", "0.58949274", "0.5894278", "0.58908015", "0.58836335", "0.58768934", "0.58738846", "0.58717793", "0.58678913", "0.5866784", "0.58657056", "0.58644706", "0.5860009", "0.5859643", "0.58592755", "0.58582777", "0.58577245", "0.58548075", "0.5852928", "0.58464485", "0.5845997", "0.58448607", "0.5843409", "0.5840689", "0.5840689", "0.58401525", "0.583975", "0.5839385", "0.5837419", "0.58288515", "0.5821686", "0.58203286", "0.5820136", "0.582012", "0.581728", "0.5814423", "0.5812378", "0.5812378", "0.58086765", "0.58036184", "0.58034676", "0.5799955", "0.5799634", "0.57984614", "0.57977515", "0.5795872" ]
0.0
-1
Use this method to convert roman numbers to arabic Don't you dare cheat on spec!!!
def to_i value = 0 @roman.split(//).each.with_index do |char, i| char_val = INT_VAL[char] next_char = (i + 1 < @roman.length) ? @roman[i + 1] : false if next_char && INT_VAL[next_char] > char_val value -= char_val else value += char_val end end value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_arabic_numeral(roman)\n number = sum = 0\n roman.bytes do |char| \n sum += number - 2 * number % number = 10 ** (205558 % char % 7) % 9995\n end\n sum + number\n end", "def convert_roman_numerals_into_arabic string\n\n sumM = string.scan(/(?=M)/).length * 1000\n sumD = string.scan(/(?=D)/).length * 500\n sumC = string.scan(/(?=C)/).length * 100\n sumL = string.scan(/(?=L)/).length * 50\n sumX = string.scan(/(?=X)/).length * 10\n sumV = string.scan(/(?=V)/).length * 5\n sumI = string.scan(/(?=I)/).length * 1\n\n subM = string.scan(/(?=CM)/).length * -200\n subD = string.scan(/(?=CD)/).length * -200 \n subC = string.scan(/(?=XC)/).length * -20\n subL = string.scan(/(?=XL)/).length * -20\n subX = string.scan(/(?=IX)/).length * -2\n subV = string.scan(/(?=IV)/).length * -2\n\n sum = sumM + sumD + sumC + sumL + sumX + sumV + sumI + subM + subD + subC + subL + subX + subV\nend", "def test_convert_roman_one_to_arabic_one\n generic_fn_roman_numerals( 'I', '1' )\n end", "def to_roman(num)\nend", "def to_roman(num)\nend", "def to_roman(num)\n \n output = ''\n\n if num\n how_many_thousand = (num - num % 1000) / 1000\n num = num - (num - num % 1000)\n\n how_many_hundred = (num - num % 100) / 100\n num = num - (num - num % 100)\n\n how_many_tens = (num - num % 10) / 10\n num = num - (num - num % 10)\n\n how_many_ones = num - (num - num % 10)\n else\n \treturn nil\n end\n\n #adding thousands\n output << 'M' * how_many_thousand\n #adding hundreds\n if how_many_hundred == 9\n \t output << 'CM'\n \telsif how_many_hundred >= 5\n \t output << 'D' + 'C' * (how_many_hundred - 5)\n elsif how_many_hundred == 4\n output << 'CD'\n else\n output << \"C\" * how_many_hundred\n end\n #adding tens\n if how_many_tens == 9\n \t output << 'XC'\n \telsif how_many_tens >= 5 \n \t output << 'L' + 'X' * (how_many_tens - 5)\n elsif how_many_tens == 4\n output << 'XL'\n else\n output << \"X\" * how_many_tens\n end\n #adding ones\n if how_many_ones == 9\n \t output << 'IX'\n \telsif how_many_ones >= 5 \n \t output << 'V' + 'I' * (how_many_ones - 5)\n elsif how_many_ones == 4\n output << 'IV'\n else\n output << \"I\" * how_many_ones\n end\n\n output\n\nend", "def to_roman\n\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman = roman + 'V' * (self % 10 / 5)\n roman = roman + 'I' * (self % 5 / 1)\n\n roman\n end", "def to_roman1(num)\n # Your code here\n ans = \"\"\n\n while (num / 1000 > 0)\n ans << 'M'\n num -= 1000\n end\n\n while (num / 500 > 0)\n ans << 'D'\n num -= 500\n end\n\n while (num / 100 > 0)\n ans << 'C'\n num -= 100\n end\n\n while (num / 50 > 0)\n ans << 'L'\n num -= 50\n end\n\n while (num / 10 > 0)\n ans << 'X'\n num -= 10\n end\n\n while (num / 5 > 0)\n ans << 'V'\n num -= 5\n end\n\n while (num > 0)\n ans << 'I'\n num -= 1\n end\n\n ans.gsub!(/DCCCC/, 'CM')\n ans.gsub!(/CCCC/, 'CD')\n ans.gsub!(/LXXXX/, 'XC')\n ans.gsub!(/XXXX/, 'XL')\n ans.gsub!(/VIIII/, 'IX')\n ans.gsub!(/IIII/, 'IV')\n\n ans\nend", "def to_roman\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman = roman + 'V' * (self % 10 / 5)\n roman = roman + 'I' * (self % 5 / 1)\n\n roman\n\n end", "def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result\n end", "def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result \n end", "def to_roman\n n = self\n roman = ''\n ROMAN_NUMBERS.each do |value, letter|\n roman << letter * (n / value)\n n = n % value\n end\n roman\n end", "def to_arabic num\n arabic = 0\n ROMAN_NUMBERS.each do |key, value|\n while num.start_with? value\n arabic += key\n num = num.slice(value.size, num.size)\n end\n end\n arabic\nend", "def to_roman(num)\n place_value_digits = num.to_s.split('').map { |digit| digit.to_i}\n\n if place_value_digits.length == 0 \n return \"\"\n end \n\n if place_value_digits[0] == 0 \n place_value_digits.shift \n return \"\" + to_roman(place_value_digits) if place_value_digits.empty? == false\n return \"\"\n end \n\n if place_value_digits.length == 1 \n digit = place_value_digits.shift\n if digit <= 3\n return \"I\" * digit\n elsif digit == 4\n return \"IV\" \n elsif digit == 5 \n return \"V\" \n elsif digit > 5 && digit < 9\n return \"V\" + (\"I\" * (digit - 5))\n else \n return \"IX\"\n end \n\n elsif place_value_digits.length == 2 \n digit = place_value_digits.shift\n if digit <= 3\n return \"X\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"XL\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"L\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"L\" + (\"X\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"XC\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 3\n digit = place_value_digits.shift\n if digit <= 3\n return \"C\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"CD\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"D\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"D\" + (\"C\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"CM\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 4 \n digit = place_value_digits.shift\n return \"M\" * digit + to_roman(place_value_digits.join.to_i)\n end \n end", "def num_to_roman_numeral num\n \n orig_num = num\n \n # Clear values for all characters before starting\n m = ''\n d = ''\n c = ''\n l = ''\n x = ''\n v = ''\n i = ''\n \n # Get 1000s\n if num/1000 >= 1\n m = 'M'*(num/1000)\n num = num%1000\n end\n \n # Get 500s\n if num/500 >= 1\n if num/100 == 9\n d = ''\n c = 'CM'\n num = num%100\n else\n d = 'D'*(num/500)\n num = num%500\n end\n end\n \n # Get 100s\n if num/100 >= 1\n c = 'C'*(num/100)\n num = num%100\n end\n \n # Get 50s\n if num/50 >= 1\n if num/10 == 9\n l = ''\n x = 'XC'\n num = num%10\n else\n l = 'L'*(num/50)\n num = num%50\n end\n end\n \n # Get 10s\n if num/10 >= 1\n if num/10 == 4\n x = 'XL'\n else\n x = 'X'*(num/10)\n end\n num = num%10\n end\n \n # Get 5s\n if num/5 >= 1\n if num == 9\n v = ''\n i = 'IX'\n num = 0\n else\n v = 'V'*(num/5)\n num = num%5\n end\n end\n \n # Get 1s\n if num >= 1\n if num == 4\n i = 'IV'\n num = 0\n else\n i = 'I'*num\n end\n end\n \n roman_numeral = m + d + c + l + x + v + i\n \n puts orig_num.to_s + ' in old roman numerals is ' + roman_numeral\nend", "def roman_numeral num_to_convert\n\t\n\tnum_converted = ''\n\n\tthousands = num_to_convert / 1000\n\tnum_converted = 'M'*thousands\n\tremainder = num_to_convert % 1000\n\n\tfivehundreds = remainder / 500\n\tif remainder >= 900\n\t\tnum_converted += 'CM'\n\t\tremainder = remainder % 900\n\telse\n\t\tnum_converted += 'D'*fivehundreds\n\t\tremainder = remainder % 500\n\tend\n\n\tonehundreds = remainder / 100\n\tif onehundreds == 4\n\t\tnum_converted += 'CD'\n\t\tremainder = remainder % 400\n\telse\n\t\tnum_converted += 'C'*onehundreds\n\t\tremainder = remainder % 100\n\tend\n\t\n\n\tfifties = remainder / 50\n\tif remainder >= 90\n\t\tnum_converted += 'XC'\n\t\tremainder = remainder % 90\n\telse\n\t\tnum_converted += 'L'*fifties\n\t\tremainder = remainder % 50\t\n\tend\n\t\n\ttens = remainder / 10\n\tif tens == 4\n\t\tnum_converted += 'XL'\n\t\tremainder = remainder % 40\n\telse\n\t\tnum_converted += 'X'*tens\n\t\tremainder = remainder % 10\n\tend\n\t\n\tfives = remainder / 5\n\tif remainder >= 9\n\t\tnum_converted += 'IX'\n\t\tremainder = remainder % 9\n\telse\n\t\tnum_converted += 'V'*fives\n\t\tremainder = remainder % 5\n\tend\n\n\tones = remainder\n\tif ones == 4\n\t\tnum_converted += 'IV'\n\telse \n\t\tnum_converted += 'I'*ones\n\tend\n\n\tputs num_converted\n\treturn num_converted\nend", "def modernize\n\t\troman = self\n\t\troman.gsub(\"DCCCC\", \"CM\")\n\t\troman.gsub(\"CCCC\", \"CD\")\n\t\troman.gsub(\"LXXXX\", \"XC\")\n\t\troman.gsub(\"XXXX\", \"XL\")\n\t\troman.gsub(\"VIIII\", \"IX\")\n\t\troman.gsub(\"IIII\", \"IV\")\n\tend", "def to_roman2 number\t\r\n\t@roman = ''\r\n\tmarker = ['I','V','X','L','C','D','M']\r\n\t(0..Math.log10(number).to_i).each do |i|\r\n\t\tputs i\r\n\t\t@unit_number = (number % (10^(i+1)))/10^i\r\n\t\tputs @unit_number\t\r\n\t\t@roman = @roman + show_power_of_ten(@unit_number,marker[2*i+2],marker[2*i+1],marker[2*i])\t\r\n\tend\r\n\t@roman.reverse\r\nend", "def convert_to_roman(i)\n\troman_numeral = \"\"\n\ti = i\n\t(i/1000).times {print \"M\"}\t\t\t\t# 3 * M\n\ti = i % 1000\t\t\t\t\t\t\t# i = 780\n\t\n\t(i/500).times {print \"D\"}\t\t\t\t# 1 * C\n\ti = i % 500\t\t\t\t\t\t\t\t# i = 280\n\n\t(i/100).times {print \"C\"}\t\t\t\t# 2 * C\n\ti = i % 100\t\t\t\t\t\t\t\t# i = 80\n\n\t(i/50).times {print \"L\"}\t\t\t\t# 1 * L\n\ti = i % 50\t\t\t\t\t\t\t\t# i = 30\n\n\t(i/10).times {print \"X\"}\t\t\t\t# 3 * X\n\ti = i % 10\t\t\t\t\t\t\t\t# i = 0\n\n\t(i/1).times {print \"I\"}\t\t\t\t\t# 0 * I\nend", "def old_r_conv nums\n\troman = ''\n\troman = roman + 'M' * (nums/1000)\n\troman = roman + 'D' * ((nums%1000)/500)\n\troman = roman + 'C' * ((nums%500)/100)\n\troman = roman + 'L' * ((nums%100)/50)\n\troman = roman + 'X' * ((nums%50)/10)\n\troman = roman + 'V' * ((nums%10)/5)\n\troman = roman + 'I' * ((nums%5)/1)\n\n\tputs roman\nend", "def roman_numeral(arabic_numeral)\n arabic_array = arabic_numeral.to_s.split(//)\n arabic_array_int = arabic_array.map { |int| int.to_i }\n if arabic_array.length >= 8\n puts \">> This feature only supports numbers up to 9,999,999, as the unicode for Roman numerals above 1,000 is not universally displayable. Please enter a positive whole number less than 10,000,000:\"\n arabic_numeral = gets.to_i\n roman_numeral(arabic_numeral)\n loop do\n break if arabic_numeral > 0\n if arabic_numeral <= 0\n puts \">> Make sure that the number you enter is greater than 0:\"\n end\n arabic_numeral = gets.to_i\n end\n end\n# begin millions place\n if arabic_array_int[-7] != nil\n millions = arabic_array_int[-7] * 1000\n millions.times { |mmmmm| print \"M\" }\n end\n# begin hundred thousands place\n if arabic_array_int[-6] != nil\n hundred_thousands = arabic_array_int[-6] * 100\n hundred_thousands.times { |mmm| print \"M\" }\n end\n# begin ten thousands place\n if arabic_array_int[-5] != nil\n ten_thousands = arabic_array_int[-5] * 10\n ten_thousands.times { |mm| print \"M\" }\n end\n# begin thousands place\n if arabic_array_int[-4] != nil\n m = arabic_array_int[-4]\n m.times { |m| print \"M\" }\n end\n# begin hundreds place\n unless arabic_array_int[-3] != true || arabic_array_int[-3] == 9 || arabic_array_int[-3] == 4 || arabic_array_int[-3] >= 5 && arabic_array_int[-3] <= 8\n arabic_array_int[-3].times { |c| print \"C\" }\n end\n if arabic_array_int[-3] == 1\n print \"C\"\n end\n if arabic_array_int[-3] == 2\n print \"CC\"\n end\n if arabic_array_int[-3] == 3\n print \"CCC\"\n end\n if arabic_array_int[-3] == 4\n print \"CD\"\n end\n if arabic_array_int[-3] == 5\n print \"D\"\n elsif arabic_array_int[-3] == 6 \n print \"DC\"\n elsif arabic_array_int[-3] == 7\n print \"DCC\"\n elsif arabic_array_int[-3] == 8\n print \"DCCC\"\n end \n if arabic_array_int[-3] == 9\n print \"CM\"\n end\n \n# begin tens place\n unless arabic_array_int[-2] != true || arabic_array_int[-2] == 9 || arabic_array_int[-2] == 4 || arabic_array_int[-2] >= 5 && arabic_array_int[-2] <= 8\n arabic_array_int[-2].times { |x| print \"X\" }\n end\n if arabic_array_int[-2] == 1\n print \"X\" \n elsif arabic_array_int[-2] == 2\n print \"XX\"\n elsif arabic_array_int[-2] == 3\n print \"XXX\"\n elsif arabic_array_int[-2] == 4\n print \"XL\"\n elsif arabic_array_int[-2] == 5\n print \"L\"\n elsif arabic_array_int[-2] == 6 \n print \"LX\"\n elsif arabic_array_int[-2] == 7\n print \"LXX\"\n elsif arabic_array_int[-2] == 8\n print \"LXXX\"\n elsif arabic_array_int[-2] == 9\n print \"XC\"\n end\n \n# begin ones place\n unless arabic_array_int[-1] == 9 || arabic_array_int[-1] == 4 || arabic_array_int[-1] >= 5 && arabic_array_int[-1] <= 8\n arabic_array_int[-1].times { |ones| print \"I\" }\n end\n if arabic_array_int[-1] == 5\n print \"V\"\n elsif arabic_array_int[-1] == 6 \n print \"VI\"\n elsif arabic_array_int[-1] == 7\n print \"VII\"\n elsif arabic_array_int[-1] == 8\n print \"VIII\"\n end \n if arabic_array_int[-1] == 9\n print \"IX\"\n end\n if arabic_array_int[-1] == 4\n print \"IV\"\n end\n# end line for readability\nprint \"\\n\"\nend", "def to_roman\n old_roman_num = ''\n\n old_roman_num << 'M' * (self / 1000)\n\n old_roman_num << 'D' * (self % 1000 / 500)\n\n old_roman_num << 'C' * (self % 500 / 100)\n\n old_roman_num << 'L' * (self % 100 / 50)\n\n old_roman_num << 'X' * (self % 50 / 10)\n\n old_roman_num << 'V' * (self % 10 / 5)\n\n old_roman_num << 'I' * (self % 5 / 1)\n\n return old_roman_num\n end", "def arabic\n return 1 if self =~ /^I$/;\n return 2 if self =~ /^II$/;\n return 3 if self =~ /^III$/;\n return 4 if self =~ /^IV$/;\n return 5 if self =~ /^V$/;\n return 10 if self =~ /^X$/;\n\n return nil\n end", "def to_roman(num)\n\n result = \"\"\n\n roman_mappings.each do |arabic, roman|\n #if 2000 appended to result then repeat\n while num >= arabic\n result << roman\n num -= arabic\n end\n end\n puts result\nend", "def modern_roman (z)\n\tfirst = (z / 1000)\n\tsecond = (z % 1000 / 100)\n\tthird = (z % 100 / 10)\n\tlast = (z % 10 )\n\n\troman = \"\"\n\troman << \"M\" * first\n\n\tif second == 9\n\t\troman << \"CM\"\n\telsif second == 4\n\t\troman << \"CD\"\n\telse\n\t\troman << \"D\" * (z % 1000 / 500)\n\t\troman << \"C\" * (z % 500 / 100)\n\tend\n\n\tif third == 9\n\t\troman << \"XC\"\n\telsif third == 4\n\t\troman << \"XL\"\n\telse\n\t\troman << \"L\" * (z % 100 / 50)\n\t\troman << \"X\" * (z % 50 / 10)\n\tend\n\n\tif last == 9\n\t\troman << \"IX\"\n\telsif last == 4\n\t\troman << \"IV\"\n\telse\n\t\troman << \"V\" * (z % 10 / 5)\n\t\troman << \"I\" * (z % 5 / 1)\n\tend\nend", "def roman_to_integer roman\r\n digit_vals = {'i' => 1,\r\n 'v' => 5,\r\n 'x' => 10,\r\n 'l' => 50,\r\n 'c' => 100,\r\n 'd' => 500,\r\n 'm' => 1000}\r\n total = 0\r\n prev = 0\r\n roman.reverse.each_char do |c_or_C|\r\n c = c_or_C.downcase\r\n val = digit_vals[c]\r\n if !val\r\n puts 'this is not a valid roman numeral!'\r\n return\r\n end\r\n if val < prev\r\n val *= -1\r\n else\r\n prev = val\r\n end\r\n\r\n total += val\r\n end\r\n\r\n total\r\nend", "def converter(x)\n i=x\n roman_num=[]\n while i!=0\n if i/1000>0\n roman_num.push('M'*(i/1000))\n i-=i-i%1000\n elsif i/100>0\n if i/100<4\n roman_num.push('C'*(i/100))\n i-=i-i%100\n elsif i/100==4\n roman_num.push('CD')\n i-=400\n elsif i/100==5\n roman_num.push('D')\n i-=500\n elsif ((i/100)>5 && (i/100)<9)\n roman_num.push('D')\n i-=500\n roman_num.push('C'*(i/100))\n i-=i-i%100\n elsif i/100==9\n roman_num.push('CM')\n i-=900\n end\n elsif i/10>0\n if i/10<4\n roman_num.push('X'*(i/10))\n i-=i-i%10\n elsif i/10==4\n roman_num.push('XL')\n i-=40\n elsif i/10==5\n roman_num.push('L')\n i-=50\n elsif ((i/10)>5 && (i/10)<9)\n roman_num.push('L')\n i-=50\n roman_num.push('X'*(i/10))\n i-=i-i%10\n elsif i/10==9\n roman_num.push('XC')\n i-=90\n end\n else \n if (i>=1 && i<4)\n roman_num.push('I'*i)\n i=0\n elsif i==4\n roman_num.push('IV')\n i=0\n elsif i==5\n roman_num.push('V')\n i=0\n elsif (i>5 && i<9)\n roman_num.push('V')\n i-=5\n roman_num.push('I'*i)\n i=0\n else\n roman_num.push('IX')\n i=0\n end\n end\n end\n return roman_num.join('')\nend", "def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num.downcase\n\nend", "def toRoman(arabicNumber)\n if arabicNumber > 3999 || arabicNumber < 1\n raise RangeError\n end\n #Should recursively subtract from arabicNumber and build up a Roman Numeral\n #Once the base case == 0 it would return the final Roman Numeral. I cant figure out how to do that without ruining the Range Error\nend", "def galactic_words_to_roman # returns roman representaion \n\t\t@pattern.split.map{ |e| @@galactic_words_roman_symbol_assignments[e] }.join\n\tend", "def galactic_words_to_roman # returns roman representaion \n\t\t@pattern.split.map{ |e| @@galactic_words_roman_symbol_assignments[e] }.join\n\tend", "def old_roman_numeral num\n\t\n\tif num >= 1000\n\t\tthousands = 'M' * (num / 1000)\n\tend\n\n\tif num >= 100\n\t\ttemp_hundreds = (num % 1000) / 100\n\t\tif temp_hundreds > 5\n\t\t\thundreds = 'D' + 'C' * (temp_hundreds - 5)\n\t\telsif temp_hundreds == 5\n\t\t\thundreds = 'D'\n\t\telse\n\t\t\thundreds = 'C' * temp_hundreds\n\t\tend\n\tend\n\t\n\tif num >= 10\n\t\ttemp_tens = (num % 100) / 10\n\t\tif temp_tens > 5\n\t\t\ttens = 'L' + 'X' * (temp_tens - 5)\n\t\telsif temp_tens == 5\n\t\t\ttens = 'L'\n\t\telse\n\t\t\ttens = 'X' * temp_tens\n\t\tend\n\tend\n\t\n\tif num > 0\n\t\ttemp_ones = num % 10\n\t\tif temp_ones > 5\n\t\t\tones = 'V' + 'I' * (temp_ones - 5)\n\t\telsif temp_ones == 5\n\t\t\tones = 'V'\n\t\telse\n\t\t\tones = 'I' * temp_ones\n\t\tend\n\tend\n\t\n\tputs \"#{num} in Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend", "def roman_numeral(num)\n digits = [[1000, 500, 100, 50, 10, 5, 1], [0, 0, 0, 0, 0, 0, 0], ['M','D','C','L','X','V','I']]\n answer = ' '\n h = 0\n \n digits[0].each do |z|\n if num / z > 0\n digits[1][h] = (num / z) #Counting the number of 10s, 50s, 100s, etc in num\n num = num % z #Using the remainder as the next value of num\n end\n h += 1\n end\n \n for a in 0..digits[1].size - 1 do #Iterate through array to calculate roman numerals old school style\n answer << digits[2][a] * digits[1][a]\n answer = answer.gsub(\"DCCCC\",\"CM\").gsub(\"CCCC\",\"CD\").gsub(\"LXXXX\",\"XC\").gsub(\"XXXX\",\"XL\").gsub(\"VIIII\",\"IX\").gsub(\"IIII\",\"IV\") #Catching edge cases to update old school roman numeral\n end\n\n answer.strip\nend", "def convert(c)\n out = []\n if c == 100\n out << \"C\"\n c -= 100\n end\n if c >= 90\n out << \"XC\"\n c -= 90\n end\n if c >= 50\n out << \"L\"\n c -= 50\n end\n if c >= 40\n out << \"XL\"\n c -= 40\n end\n while c >= 10\n out << \"X\"\n c -= 10\n end\n if c == 9\n out << \"IX\"\n c -= 9\n end\n if c >= 5\n out << \"V\"\n c -= 5\n end\n if c == 4\n out << \"IV\"\n c -= 4\n end\n while c > 0\n out << \"I\"\n c -= 1\n end\n puts \"Your number in Roman Numeral is:\"\n puts out.join\nend", "def new_roman_numeral(number)\n \n roman = \"\"\n\n thousands_place = number/1000\n hundreds_place = (number%1000)/100\n tens_place = (number%100)/10\n ones_place = (number%10)\n\n roman << \"M\"*thousands_place\n\n if hundreds_place == 9\n roman << \"CM\"\n elsif hundreds_place == 4\n roman << \"CD\"\n else\n roman = roman << 'D' * (number%1000 /500)\n roman = roman << 'C' * (number%500 /100)\n end\n\n if tens_place == 9\n roman << \"XC\"\n elsif tens_place == 4\n roman << \"XL\"\n else\n roman = roman << 'L' * (number%100 /50)\n roman = roman << 'X' * (number%50 /10)\n end\n\n\n if ones_place == 9\n roman << \"IX\"\n elsif ones_place == 4\n roman << \"IV\"\n else\n roman = roman << 'V' * (number%10 /5)\n roman = roman << 'I' * (number%5)\n end\n \n\n\nend", "def to_r(decimal)\n roman_form = ''\n\n decimal = decimal.round if decimal.is_a? Float\n\n @@roman_numerals.reverse_each do |letter, number|\n while decimal / number > 0\n roman_form = roman_form + letter.to_s\n decimal = decimal - number\n end\n end\n if subtractive_notation?\n roman_form.gsub! 'VIIII', 'IX'\n roman_form.gsub! 'IIII', 'IV'\n roman_form.gsub! 'LXXXX', 'XC'\n roman_form.gsub! 'XXXX', 'XL'\n roman_form.gsub! 'DCCCC', 'CM'\n roman_form.gsub! 'CCCC', 'CD'\n end\n roman_form\n end", "def to_roman\n result = ''\n number = self\n ROMAN_NUMERALS.each do |key, value|\n numeral, remainder = number.divmod(value)\n if numeral > 0 \n result += (key * numeral)\n end\n number = remainder\n end\n result\n end", "def to_roman2(num)\n result = \"\"\n \n @roman_mapping.each do |pair|\n value = pair[0]\n roman = pair[1]\n division_result = num / value\n result += roman * division_result\n num = num - (value * division_result)\n end\n return result\nend", "def int_to_roman_2(num)\n result = \"\"\n while num > 0\n if num >= 1000\n num -= 1000\n result += \"M\"\n elsif num >= 900\n num -= 900\n result += \"CM\"\n elsif num >= 500\n num -= 500\n result += \"D\"\n elsif num >= 400\n num -= 400\n result += \"CD\"\n elsif num >= 100\n num -= 100\n result += \"C\"\n elsif num >= 90\n num -= 90\n result += \"XC\"\n elsif num >= 50\n num -= 50\n result += \"L\"\n elsif num >= 40\n num -= 40\n result += \"XL\"\n elsif num >= 10\n num -= 10\n result += \"X\"\n elsif num >= 9\n num -= 9\n result += \"IX\"\n elsif num >= 5\n num -= 5\n result += \"V\"\n elsif num >= 4\n num -= 4\n result += \"IV\"\n else\n num -= 1\n result += \"I\"\n end\n end\n\n return result\nend", "def ancientify\n\t\troman = self\n\t\troman.gsub(\"CM\", \"DCCCC\")\n\t\troman.gsub(\"CD\", \"CCCC\")\n\t\troman.gsub(\"XC\", \"LXXXX\")\n\t\troman.gsub(\"XL\", \"XXXX\")\n\t\troman.gsub(\"IX\", \"VIIII\")\n\t\troman.gsub(\"IV\", \"IIII\")\n\tend", "def to_roman\n result = \"\"\n number = self\n roman_mapping.keys.each do |divisor|\n quotient, modulus = number.divmod(divisor)\n result << roman_mapping[divisor] * quotient\n number = modulus\n end\n result\n end", "def roman_mappings\n {\n 1000 => 'M',\n 900 => 'CM',\n 500 => 'D',\n 400 => 'CD',\n 100 => 'C',\n 90 => 'XC',\n 50 => 'L',\n 40 => 'XL',\n 10 => 'X',\n 9 => 'IX',\n 5 => 'V',\n 4 => 'IV',\n 1 => 'I',\n }\n end", "def old_roman_numeral(num)\n\t@romanNumeral = \"\"\t\n\n\twhile num > 0\n\t\tquotient, modulus = num.divmod(1000)\n\t\t\tif quotient > 0 \t\t\t\t\t\t\t\t\t\t#using a divisor \n\t\t\t@romanNumeral << (\"M\" * quotient) #using divisor again\n\t\t\tnum = modulus\t\t\t\t\t\t\t\t\t\t\t\t#using modulus\n\t\telsif\n\t\t\tnum / 500 > 0\n\t\t\t@romanNumeral << (\"D\" * (num/500))\n\t\t\tnum %= 500\n\t\telsif\n\t\t\tif num / 100 > 0\n\t\t\t\t@romanNumeral << (\"C\" * (num/100))\n\t\t\t\tnum %= 100\n\t\t\telsif \n\t\t\t\tnum / 90 > 0 \n\t\t\t\t@romanNumeral << (\"XC\" * (num/90))\n\t\t\t\tnum %= 90\n\t\t\tend\n\t\telsif\n\t\t\tif num / 50 > 0\n\t\t\t@romanNumeral << (\"L\" * (num/50))\n\t\t\tnum %= 50\n\t\t\telsif \n\t\t\t\tnum / 40 > 0\n\t\t\t\t@romanNumeral << (\"XL\" * (num/40))\n\t\t\t\tnum %= 40 \t\t\t\n\t\t\tend\n\t\telsif\n\t\t\tif num / 10 > 0\n\t\t\t\t@romanNumeral << (\"X\" * (num/10))\n\t\t\t\tnum %= 10\n\t\t\telsif\n\t\t\t\tnum / 9 > 0\n\t\t\t\t@romanNumeral << (\"IX\" * (num/9))\n\t\t\t\tnum %= 9 \n\t\t\tend\n\t\telsif\n\t\t\tnum / 5 > 0\n\t\t\t@romanNumeral << (\"V\" * (num/5))\n\t\t\tnum %= 5\n\t\telse\n\t\t\tif\n\t\t\t\tnum / 4 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/4))\n\t\t\t\tnum %= 4\n\t\t\telse\n\t\t\t\tnum / 1 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/1))\n\t\t\t\tnum %= 1\n\t\t\tend\t\n\t\tend\n\tend\n\n\t@romanNumeral\n\nend", "def get_roman()\n num = @number\n answer = \"\"\n# you can also use: If num >= 10 \n\n while num >= 10\n answer += \"X\"\n num -= 10\n end\n if num == 9\n answer += \"IX\"\n num -= 9\n end\n if num >= 5\n answer += \"V\"\n num -= 5\n end\n if num == 4\n answer += \"IV\"\n num -= 4\n end\n answer += \"I\" * num # * @number\n return answer\n end", "def roman_convert(input)\n numerals_string = []\n input_array = input.split('')\n\n until input_array.empty?\n case input_array.length\n when 4\n puts \"#{input_array.first}000 = #{@thousands[input_array.first.to_i]}\"\n numerals_string.push(@thousands[input_array.shift.to_i])\n when 3\n puts \" #{input_array.first}00 = #{@hundreds[input_array.first.to_i]}\"\n numerals_string.push(@hundreds[input_array.shift.to_i])\n when 2\n puts \" #{input_array.first}0 = #{@tens[input_array.first.to_i]}\"\n numerals_string.push(@tens[input_array.shift.to_i])\n when 1\n puts \" #{input_array.first} = #{@units[input_array.first.to_i]}\"\n numerals_string.push(@units[input_array.shift.to_i])\n else\n break\n end\n end\n\n puts ''\n puts 'Your number converted to Roman Numerals is: '\n puts \"#{numerals_string.join}\"\n puts ''\n end", "def old_roman_numeral num\nnumerals = \"\"\nnumerals << \"M\" * (num / 1000)\nnumerals << \"D\" * (num % 1000 /500)\nnumerals << \"C\" * (num % 500 / 100)\nnumerals << \"L\" * (num % 100 / 50)\nnumerals << \"X\" * (num % 50 / 10)\nnumerals << \"V\" * (num % 10 / 5)\nnumerals << \"I\" * (num % 5 / 1)\nnumerals\nend", "def int_to_roman val\n ROMAN_NUMERALS.map do |l, i|\n repeat, val = val.divmod i\n l * repeat\n end.join\n end", "def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num\n\nend", "def to_roman3(num)\n result = \"\"\n @roman_mapping.each do |pair|\n value = pair[0]\n binding.pry\n roman = pair[1]\n level_occurance = num / value\n level_occurance.times do |x|\n result << roman\n end\n num = num - value * level_occurance\n end\n return result\nend", "def to_roman(num)\n roman_sym=[\"M\",\"CM\",\"D\",\"CD\",\"C\",\"XC\",\"L\",\"XL\",\"X\",\"IX\",\"V\",\"IV\",\"I\"]\n roman_val=[1000,900,500,400,100,90,50,40,10,9,5,4,1]\n roman = \"\"\n roman_sym.each_index do |i|\n roman += roman_sym[i] * (num/roman_val[i])\n num = num%roman_val[i]\n end\n return roman\nend", "def to_arabic(string_with_kansuji, type = nil)\n Parser.to_arabic(string_with_kansuji, type)\n end", "def to_roman(n)\n resto = []\n num = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]\n num.each do |element|\n resto.push(n / element)\n n = n % element\n end\n chars = %w[M CM D CD C XC L XL X IX V IV I]\n resto.each_with_index.map do |element, index|\n chars[index] * element\n end.join\nend", "def roman\n return \"-#{(-self).roman}\" if self < 0\n return \"\" if self == 0\n @@roman_values_assoc.each do | (i, v) | return(i+(self-v).roman) if v <= self end\n end", "def old_school_roman (y)\n\troman = \"\"\n\troman << \"M\" * (y / 1000)\n\troman << \"D\" * (y % 1000 / 500)\n\troman << \"C\" * (y % 500 / 100)\n\troman << \"L\" * (y % 100 / 50)\n\troman << \"X\" * (y % 50 / 10)\n\troman << \"V\" * (y % 10 / 5)\n\troman << \"I\" * (y % 5 / 1)\n\troman\nend", "def modern_roman_numeral number\n numeral = \"\"\n\n numeral_1 = (number / 1000)\n numeral_2 = (number % 1000/100)\n numeral_3 = (number % 100/ 10) \n numeral_4 = (number % 10) \n \n roman = \"M\" * numeral_1\n\nif numeral_2 == 9\n roman = roman + \"CM\"\nelsif numeral_2 == 4\n roman = roman + \"CD\"\nelse\n roman = roman + \"D\" * (number % 1000 / 500)\n roman = roman + \"C\" *(number % 500/100) \n end\nif numeral_3 == 9\n roman = roman + \"XC\"\nelsif numeral_3 == 4\n roman = roman + \"XL\"\nelse\n roman=roman +\"L\" *(number % 100/ 50)\n roman=roman + \"X\"*(number % 50/ 10) \n end\nif numeral_4 == 9\n roman = roman + \"IX\"\nelsif numeral_4 == 4\n roman = roman + \"IV\"\nelse\n roman = roman + \"V\" * (number % 10/ 5)\n roman = roman + \"I\" * (number % 5/ 1) \nend\n\nroman\n\nend", "def old_roman number\n\tnumerals = []\n\twhile number < 0\n\t\tputs 'please use a whole number => 1 and <= 3000'\n\tend\n\tif number % 1000 > 0\n\t\tthousands = number / 1000\n\t\tm_numerals = 'M' * thousands\n\t\tnumerals.push m_numerals\n\t\tnumber = number - (thousands * 1000)\n\tend\n\tif number % 500 > 0\n\t\tnumerals.push 'D'\n\t\tnumber = number - 500\n\tend\n\tif number % 100 > 0\n\t\thundreds = number / 100\n\t\tc_numerals = 'C' * hundreds\n\t\tnumerals.push c_numerals\n\t\tnumber = number - (hundreds * 100)\n\tend\n\tif number % 50 > 0\n\t\tnumerals.push 'L'\n\t\tnumber = number - 50\n\tend\n\tif number % 10 > 0\n\t\ttens = number / 10\n\t\tx_numerals = 'X' * tens\n\t\tnumerals.push x_numerals\n\t\tnumber = number - (tens * 10)\n\tend\n\tif number % 5 > 0\n\t\tnumerals.push 'V'\n\t\tnumber = number - 5\n\tend\n\n\tones = number\n\ti_numerals = 'I' * ones\n\tnumerals.push i_numerals\n\n\tputs numerals\nend", "def old_roman_numeral number\n\n if number >= 1000\n thousands = 'M' * (number / 1000)\n end\n\n if number >= 100\n hundreds = (number % 1000) / 100\n if hundreds >= 5\n hundreds = 'D' + 'C' * (hundreds - 5)\n else\n hundreds = 'C' * ((number % 1000) / 100)\n end\n end\n\n if number >= 10\n tens = (number % 100) / 10\n if tens >= 5\n tens = 'L' + 'X' * (tens - 5)\n else\n tens = 'X' * ((number % 100) / 10)\n end\n end\n\n if number >= 1\n ones = (number % 10) / 1\n if ones >= 5\n ones = 'V' + 'I' * (ones - 5)\n else\n ones = 'I' * ((number % 10) / 1)\n end\n end\n\n puts \"#{number} in old-school Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend", "def old_roman_numeral num\n orn = ''\n \torn += 'M' * (num/1000)\n \tnum = num % 1000\n \torn += 'D' * (num/500)\n \tnum = num % 500\n \torn += 'C' * (num/100)\n \tnum = num % 100\n \torn += 'L' * (num/50)\n \tnum = num % 50\n \torn += 'X' * (num/10)\n \tnum = num % 10\n \torn += 'V' * (num/5)\n \tnum = num % 5\n \torn += 'I' * (num)\n \treturn orn\nend", "def roman_numeral num\n roman_to_arabic = {\n M: 1_000, CM: 900, D: 500, CD: 400,\n C: 100, XC: 90, L: 50, XL: 40,\n X: 10, IX: 9, V: 5, IV: 4,\n I: 1\n }\n\n return '' if num <= 0\n roman_to_arabic.each { |key, val| return key.to_s + roman_numeral(num - val) if num >= val }\nend", "def old_roman_numeral(num)\n return \"Please use a positive integer.\" if num <= 0\n \n roman = \"\"\n \n roman << \"M\" * (num / 1000)\n roman << \"D\" * (num % 1000 / 500)\n roman << \"C\" * (num % 500 / 100)\n roman << \"L\" * (num % 100 / 50)\n roman << \"X\" * (num % 50 / 10)\n roman << \"V\" * (num % 10 / 5)\n roman << \"I\" * (num % 5 / 1)\n \n roman\nend", "def old_roman_numeral num\n\troman = ''\n\n\troman = roman + 'M' * (num / 1000)\n\troman = roman + 'D' * (num % 1000 / 500)\n\troman = roman + 'C' * (num % 500 / 100)\n\troman = roman + 'L' * (num % 100 / 50)\n\troman = roman + 'X' * (num % 50 / 10)\n\troman = roman + 'V' * (num % 10 / 5)\n\troman = roman + 'I' * (num % 5 / 1)\n\n\troman\nend", "def roman\n\t\treturn \"-#{(-self).roman}\" if self < 0\n\t\treturn \"\" if self == 0\n\t\t@@roman_values_assoc.each do | (i, v) |\treturn(i+(self-v).roman) if v <= self\tend\n\tend", "def new_roman_numeral num\n roman = ''\n\n roman << 'M' * (num / 1000)\n\n digit_hundred = num % 1000 / 100\n if digit_hundred >= 5\n if digit_hundred == 9\n roman << 'CM'\n else\n roman << 'D'\n roman << 'C' * (digit_hundred % 5)\n end\n else\n if digit_hundred == 4\n roman << 'CD'\n else\n roman << 'C' * digit_hundred\n end\n end\n\n digit_ten = num % 100 / 10\n if digit_ten >= 5\n if digit_ten == 9\n roman << 'XC'\n else\n roman << 'L'\n roman << 'X' * (digit_ten % 5)\n end\n else\n if digit_ten == 4\n roman << 'XL'\n else\n roman << 'X' * digit_ten\n end\n end\n\n digit_one = num % 10\n if digit_one >= 5\n if digit_one == 9\n roman << 'IX'\n else\n roman << 'V'\n roman << 'I' * (digit_one % 5)\n end\n else\n if digit_one == 4\n roman << 'IV'\n else\n roman << 'I' * digit_one\n end\n end\n\n roman\nend", "def to_modern_roman(number)\n\n\twhile number.to_i <= 3000\n\t\t# split number into an array\n\t\tarray = number.split(//).map { |x| x.to_i }\n\t\tresult =[]\n\t\t# array has length of 4\n\t\tuntil array.length == 4\n\t\tarray.unshift(0)\n\t\tend\n\t\t# 1000s of number\n\t\tif array[-4] < 4 \n\t\t\t\tnum = array[-4]\n\t\t\t\tnum.times { result << \"M\" }\n\t\tend\n\t\t# 100s of number\n\t\tif array[-3] < 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tnum.times { result << \"C\" }\n\t\telsif array[-3] == 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CD\"\n\t\telsif array[-3] == 6\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"DC\"\n\t\telsif array[-3] == 9\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CM\"\n\t\telse\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"D\" \n\t\t\t\t(num-5).times { result << \"C\" }\n\t\tend\n\t\t# 10s of number\n\t\tif array[-2] < 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tnum.times { result << \"X\" }\n\t\telsif array[-2] == 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XL\"\n\t\telsif array[-2] == 6\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"LX\"\n\t\telsif array[-2] == 9\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XC\"\n\t\telse\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"L\" \n\t\t\t\t(num-5).times { result << \"X\" }\n\t\tend\n\t\t# single digits of number\n\t\tif array[-1] < 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tnum.times { result << \"I\" }\n\t\telsif array[-1] == 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IV\"\n\t\telsif array[-1] == 6\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"VI\"\n\t\telsif array[-1] == 9\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IX\"\n\t\telse\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"V\" \n\t\t\t\t(num-5).times { result << \"I\" }\t\n\t\tend\n\t\t# return number in roman numerals\n\t\tputs \"#{number} in New Style Roman Numerals is #{result.join(\"\")}.\"\n\t\texit\n\tend\n\tputs \"Number must be greater than 3000.\"\n\texit\nend", "def to_arabic(string_with_kansuji, type = nil)\n string_with_kansuji.gsub(kansuji_regxep) do |matched|\n case type\n when :mixed_arabic\n Kansuji.to_kansuji(to_i(matched), :mixed_arabic)\n else\n to_i(matched).to_s\n end\n end\n end", "def arabic_to_eng\n\t\tvalidate_input\n\n\t\tcase @num\n\t\twhen \"NAN\"\n\t\t\tputs \"not valid, expected input: positive interger\"\n\t\t\treturn false\n\n\t\twhen 0\n\t\t\tputs \"zero\"\n\t\t\treturn \"zero\"\n\n\t\twhen 1..999\n\t\t\tconvert_smaller_than_thousand(@num)\n\n\t\telse\n\t\t\tconvert_larger_than_thousand(@num)\n\n\t\tend\n\t\tfinal_result\n\n\tend", "def old_roman_string num\n raise \"Use positive integer\" if num <= 0\n roman_str = ''\nroman_str << 'M' * (num /1000)\nroman_str << 'D' * (num % 1000 / 500)\nroman_str << 'C' * (num % 500 / 100)\nroman_str << 'L' * (num % 100 / 50)\nroman_str << 'X' * (num % 50 / 10)\nroman_str << 'V' * (num % 10 / 5)\nroman_str << 'I' * (num % 5 / 1)\n\n#build up the strings by * H,T,U\nend", "def roman_numeral(num)\n thousands = (num / 1000)\n hundreds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10)\n\n roman = 'M' * thousands\n\n if hundreds == 9\n roman = roman + 'CM'\n elsif hundreds == 4\n roman = roman + 'CD'\n else\n roman = roman + 'D' * (num % 1000 / 500)\n roman = roman + 'C' * (num % 500 / 100)\n end\n\n if tens == 9\n roman = roman + 'XC'\n elsif tens == 4\n roman = romann + 'XL'\n else\n roman = roman + 'L' * (num % 100 / 50)\n roman = roman + 'X' * (num % 50 / 10)\n end\n\n if ones == 9\n roman = roman + 'IX'\n elsif ones == 4\n roman = roman + 'IV'\n else\n roman = roman + 'V' * (num % 10 / 5)\n roman = roman + 'I' * (num % 5 / 1)\n end\n roman\nend", "def test_can_convert_numbers\n\t\tassert_equal(11, arabic_converter(\"XI\"))\n\t\tassert_equal(14, arabic_converter(\"XIV\"))\n\t\tassert_equal(19, arabic_converter(\"XIX\"))\n\t\tassert_equal(16, arabic_converter(\"XVI\"))\n\t\tassert_equal(18, arabic_converter(\"XVIII\"))\n\tend", "def roman_numeral num\n\n number1000s = (num / 1000)\n number100s = (num % 1000) / 100\n number10s = (num % 100) / 10\n number1s = (num % 10) / 1\n\n numberDs = (num % 1000) / 500\n numberCs = (num % 500) / 100\n numberLs = (num % 100) / 50\n numberXs = (num % 50) / 10\n numberVs = (num % 10) / 5\n numberIs = (num % 5) / 1\n\n result = \"M\" * number1000s\n\n if number100s == 9\n result = result + \"CM\"\n elsif number100s == 4\n result = result + \"CD\"\n else\n result = result + \"D\" * numberDs\n result = result + \"C\" * numberCs\n end\n\n if number10s == 9\n result = result + \"XC\"\n elsif number10s == 4\n result = result + \"XL\"\n else\n result = result + \"L\" * numberLs\n result = result + \"X\" * numberXs\n end\n\n if number1s == 9\n result = result + \"IX\"\n elsif number1s == 4\n result = result + \"IV\"\n else\n result = result + \"V\" * numberVs\n result = result + \"I\" * numberIs\n end\n\n result\n\nend", "def to_roman(num, way = \"new\")\n \n\troman_string = \"\"\n\n\tif way == \"new\"\n\t\tNEW_WAY.each do |number, roman| \n\t\t\troman_string += roman * (num/number)\t\n\t\t\tnum %= number \n\t\tend\n\telsif way == \"old\"\n\t\tOLD_WAY.each do |number, roman| \n\t\t\troman_string += roman * (num/number)\t\n\t\t\tnum %= number \n\t\tend\n\telse\n\t\traise \"We don't know how to convert that way\"\n\tend\n \n\troman_string\nend", "def old_roman_numeral number\n numeral = \"\"\n\n numeral = numeral + \"M\" * (number / 1000)\n numeral = numeral + \"D\" * (number % 1000/500)\n numeral = numeral + \"C\" * (number % 500/ 100) \n numeral = numeral + \"L\" * (number % 100/ 50) \n numeral = numeral + \"X\" * (number % 50/ 10) \n numeral = numeral + \"V\" * (number % 10/ 5) \n numeral = numeral + \"I\" *(number % 5/ 1) \n numeral\nend", "def romanize(input)\n\n raise ArgumentError, 'can not encode negative number' if input < 0\n raise ArgumentError, 'can not encode zero' if input == 0\n\n #Creating a Hash that pointing different numbers to different characters.\n romkeys = {1000 => 'M', 900 => 'CM', 500 => 'D', 400 => 'CD', 100 => 'C', 90 => 'XC', 50 => 'L', 40 => 'XL', 10 => 'X', 9 => 'IX', 5 => 'V', 4 => 'IV' ,1 => 'I'}\n\n #Creating a variable that have the format string, for storing the different characters.\n output = ' '\n\n #Looping until the input is zero.\n until input == 0\n\n #Looping thro the different keys and values of the hash.\n romkeys.each do |key, value|\n if input >= key\n\n #If the input was 5 this will result as 'V' after that the output will save the V and loop thro until it's nothing left.\n output += value\n\n #This subtract the key value to make the loop end.\n input -= key\n\n #This just ending the loop.\n break\n end\n end\n end\n\n #Returning the output string.\n return output\nend", "def roman number\n\t\nm_length = 0\nd_length = 0\nc_length = 0\nl_length = 0\nx_length = 0\nv_length = 0\ni_length = 0\n\nif number >= 1000\n\tm_length = number/1000\n\tnumber = number%1000\nend\nif number >= 500\n\td_length = number/500\n\tnumber = number%500\nend\nif number >= 100\n\tc_length = number/100\n\tnumber = number%100\nend\nif number >= 50\n\tl_length = number/50\n\tnumber = number%50\nend\nif number >= 10\n\tx_length = number/10\n\tnumber = number%10\nend\nif number >= 5\n\tv_length = number/5\n\tnumber = number%5\nend\nif number < 5\n\ti_length = number/1\n\tnumber = number%10\nend\n\nputs 'M'*m_length + 'D'*d_length + 'C'*c_length + 'L'*l_length + \"X\"*x_length + \"V\"*v_length + \"I\"*i_length\n\nend", "def new_roman_numeral number\n digits = []\n i = 4\n while i>0\n digits.push (number%10)\n number = (number/10).to_i\n i -= 1\n end\n thousandth = 'M'*digits[3]\n hundredth = 'D'*(digits[2]/5).to_i+'C'*(digits[2]%5)\n tenth = 'L'*(digits[1]/5).to_i+'X'*(digits[1]%5)\n unit = 'V'*(digits[0]/5).to_i+'I'*(digits[0]%5)\n hundredth = 'CD' if hundredth == 'C'*4\n hundredth = 'CM' if hundredth == 'D'+'C'*4\n tenth = 'XL' if tenth == 'X'*4\n tenth = 'XC' if tenth == 'L'+'X'*4\n unit = 'IV' if unit == 'I'*4\n unit = 'IX' if unit == 'V'+'I'*4\n puts thousandth+hundredth+tenth+unit\nend", "def roman_to_integer roman \n digit_vals = {'i' => 1,\n 'v' => 5,\n 'x' => 10,\n 'l' => 50,\n 'c' => 100,\n 'd' => 500,\n 'm' => 1000}\n total = 0 \n prev = 0 \n index = roman.length - 1 \n while index >= 0 \n c = roman[index].downcase \n index = index - 1 \n val = digit_vals[c]\n if !val \n puts \"This is not a valud roman numeral\"\n return \n end \n if val < prev\n val = val * -1\n else \n prev = val \n end \n total = total + val \n end \n total \nend", "def to_roman(num)\n\toutput = \"\"\n\t@roman_num.each do |key, val|\n\t\tremainder = num%key.to_i\n\t\twhile remainder < num\n\t\t\toutput << val\n\t\t\tnum = num - key.to_i\n\t\tend\n\tend\n\toutput\nend", "def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\tif(aux >= 900)\r\n\t\t\t\troman_num = roman_num + 'CM'\r\n\t\t\t\taux = aux - 900\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'D'\r\n\t\t\t\taux = aux - 500\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\tif(aux >= 400)\r\n\t\t\t\troman_num = roman_num + 'CD'\r\n\t\t\t\taux = aux - 400\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'C'\r\n\t\t\t\taux = aux - 100\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\tif(aux >= 90)\r\n\t\t\t\troman_num = roman_num + 'XC'\r\n\t\t\t\taux = aux - 90\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'L'\r\n\t\t\t\taux = aux - 50\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\tif(aux >= 40)\r\n\t\t\t\troman_num = roman_num + 'XL'\r\n\t\t\t\taux = aux - 40\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'X'\r\n\t\t\t\taux = aux - 10\t\t\r\n\t\t\tend\r\n\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\tif(aux >= 9)\r\n\t\t\t\troman_num = roman_num + 'IX'\r\n\t\t\t\taux = aux - 9\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'V'\r\n\t\t\t\taux = aux - 5\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\tif(aux >= 4)\r\n\t\t\t\troman_num = roman_num + 'IV'\r\n\t\t\t\taux = aux - 4\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'I'\r\n\t\t\t\taux = aux - 1\t\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend", "def old_roman_numeral number\n digits = []\n i = 4\n while i>0\n digits.push (number%10)\n number = (number/10).to_i\n i -= 1\n end\n thousandth = 'M'*digits[3]\n hundredth = 'D'*(digits[2]/5).to_i+'C'*(digits[2]%5)\n tenth = 'L'*(digits[1]/5).to_i+'X'*(digits[1]%5)\n unit = 'V'*(digits[0]/5).to_i+'I'*(digits[0]%5)\n puts thousandth+hundredth+tenth+unit\nend", "def roman_numeral num\n \n if num >= 1000\n thousands = 'M' * (num / 1000)\n end\n\n # We now account for cases of 400 and 900 (CD, CM, respectively)\n # CCC=300, CD=400, D=500, DCCC=800, CM=900\n if num >= 100\n temp_hundreds = (num % 1000) / 100\n if temp_hundreds == 9\n hundreds = 'CM'\n elsif (temp_hundreds < 9 && temp_hundreds > 5)\n hundreds = 'D' + 'C' * (temp_hundreds - 5)\n elsif temp_hundreds == 5\n hundreds = 'D'\n elsif temp_hundreds == 4\n hundreds = 'CD'\n else\n hundreds = 'C' * temp_hundreds\n end\n end\n \n # We now account for cases of 40 and 90 (XL, XC, respectively)\n # XXX=30, XL=40, L=50, LXXX=80, XC=90\n if num >= 10\n temp_tens = (num % 100) / 10\n if temp_tens == 9\n tens = 'XC'\n elsif (temp_tens < 9 && temp_tens > 5)\n tens = 'L' + 'X' * (temp_tens - 5)\n elsif temp_tens == 5\n tens = 'L'\n elsif temp_tens == 4\n tens = 'XL'\n else\n tens = 'X' * temp_tens\n end\n end\n \n # We now account for cases of 4 and 9 (IV, IX, respectively)\n # III=3, IV=4, V=5, XIII=8, IX=9\n if num > 0\n temp_ones = num % 10\n if temp_ones == 9\n ones = 'IX'\n elsif (temp_ones < 9 && temp_ones > 5)\n ones = 'V' + 'I' * (temp_ones - 5)\n elsif temp_ones == 5\n ones = 'V'\n elsif temp_ones == 4\n ones = 'IV'\n else\n ones = 'I' * temp_ones\n end\n end\n \n puts \"#{num} in \\\"Modern\\\" Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend", "def to_roman(integer)\n integer = integer.to_i\n if integer < 1 or integer > 3999\n raise RangeError, \"Integer must be between 1 and 3999\"\n end\n\n roman = \"\"\n integer, roman = prepare_group(integer, roman, 1000, \"M\", 900, \"CM\")\n integer, roman = prepare_group(integer, roman, 500, \"D\", 400, \"CD\")\n integer, roman = prepare_group(integer, roman, 100, \"C\", 90, \"XC\")\n integer, roman = prepare_group(integer, roman, 50, \"L\", 40, \"XL\")\n integer, roman = prepare_group(integer, roman, 10, \"X\", 9, \"IX\")\n integer, roman = prepare_group(integer, roman, 5, \"V\", 4, \"IV\")\n integer, roman = prepare_group(integer, roman, 1, \"I\", nil, nil)\n\n roman\nend", "def to_roman(value)\n return \"zero\" if value == 0\n roman_numeral = value < 0 ? \"-\" : \"\"\n value = value.abs\n \n while value >= 1\n NUMERALS.each_with_index do |number, index|\n if value >= number\n roman_numeral += ROMANS[index]\n value -= number\n break\n end\n end\n end\n return roman_numeral\n end", "def roman_numerals number\n roman_numerals = ''\n\n roman_numerals += 'M' * (number / 1000)\n number %= 1000\n\n roman_numerals += 'D' * (number / 500)\n number %= 500\n\n roman_numerals += 'C' * (number / 100)\n number %= 100\n\n roman_numerals += 'L' * (number / 50)\n number %= 50\n\n roman_numerals += 'X' * (number / 10)\n number %= 10\n\n roman_numerals += 'V' * (number / 5)\n number %= 5\n\n roman_numerals += 'I' * (number / 1)\n number %= 1\n\n roman_numerals\nend", "def test_covert_one_to_roman\n generic_fn_roman_numerals( '1', 'I' )\n end", "def roman_numeral num\n thous = (num / 1000)\n hunds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10 )\n\n roman = \"M\" * thous\n if hunds == 9\n roman = roman + \"CM\" \n elsif hunds == 4\n roman = roman + \"CD\"\n else\n roman = roman + \"D\" * (num % 1000 / 500)\n roman = roman + \"C\" * (num % 500 / 100)\n end\n\n if tens == 9 \n roman = roman + \"XC\"\n elsif tens == 4\n roman = roman + \"XL\"\n else\n roman = roman + \"L\" * (num % 100 / 50) \n roman = roman + \"X\" * (num % 50 / 10)\n end\n\n if ones == 9 \n roman = roman + \"IX\"\n elsif ones == 4\n roman = roman + \"IV\"\n else\n roman = roman + \"V\" * (num % 10/ 5)\n roman = roman + \"I\" * (num % 5 / 1)\n end\n roman\n end", "def from_roman(roman)\n roman = roman.strip.upcase\n roman_a = roman.chars\n integer = 0\n roman_a.zip(roman_a[1..-1]).each do |ch, nch|\n if CHAR_PRECEDENCE.has_key?(ch) and CHAR_PRECEDENCE[ch].include?(nch)\n integer -= CHAR_VALUES[ch]\n else\n integer += CHAR_VALUES[ch]\n end\n end\n integer\nend", "def old_school_roman_numeral(num)\n arabs_to_romans = [\n ['M', 1000],\n ['D', 500],\n ['C', 100],\n ['L', 50],\n ['X', 10],\n ['V', 5],\n ['I', 1]\n ]\n\n result = ''\n\n arabs_to_romans.each do |arab_to_roman|\n arab = arab_to_roman[1]\n roman = arab_to_roman[0]\n\n if num / arab != 0\n result += roman * (num / arab)\n num = num % arab\n end\n end\n result\nend", "def roman?\r\n # Liberal definition: all Roman numeral letters\r\n self.upcase =~ ROMAN_REGEXP\r\n # ALT: Stolen from O'Reilly's Perl Cookbook 6.23. Regular Expression Grabbag\r\n #self =~ /^M*(D?C{0,3}|C[DM])(L?X{0,3}|X[LC])(V?I{0,3}|I[VX])$/i\r\n # ALT: Catch all non-arabic numbers\r\n # not self.arabic?\r\n end", "def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\t\tputs aux\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\troman_num = roman_num + 'D'\r\n\t\t\taux = aux - 500\t\t\r\n\t\t\tputs aux\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\troman_num = roman_num + 'C'\r\n\t\t\taux = aux - 100\r\n\t\t\tputs aux\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\troman_num = roman_num + 'L'\r\n\t\t\taux = aux - 50\r\n\t\t\tputs aux\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\troman_num = roman_num + 'X'\r\n\t\t\taux = aux - 10\r\n\t\t\tputs aux\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\troman_num = roman_num + 'V'\r\n\t\t\taux = aux - 5\r\n\t\t\tputs aux\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\troman_num = roman_num + 'I'\r\n\t\t\taux = aux - 1\r\n\t\t\tputs aux\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend", "def decimal_to_roman decimal\n roman = \"\"\n i = 0\n\n # Greedily append the highest roman numeral that fits\n while i < ROMANS.size\n numeral = ROMANS[i]\n if VALUE[numeral] <= decimal\n roman += numeral\n decimal -= VALUE[numeral]\n else\n i += 1\n end\n end\n\n # Find groups of unnecessary repeated numerals, replace with subtractive \n # pairs.\n for repeat in REPEATS do\n roman = roman.sub(repeat, SUB_PAIRS[repeat])\n end\n\n return roman\nend", "def old_roman_numberals num\n roman = \"\"\n roman += \"M\" * (num/1000)\n roman += \"D\" * ((num%1000)/500)\n roman += \"C\" * ((num%500)/100)\n roman += \"L\" * ((num%100)/50)\n roman += \"X\" * ((num%50)/10)\n roman += \"V\" * ((num%10)/5)\n roman += \"I\" * ((num%5)/1)\nputs roman\nend", "def modern_roman_numeral(num)\n arabs_to_romans = [\n ['M', 1000],\n ['CM', 900],\n ['D', 500],\n ['CD', 400],\n ['C', 100],\n ['XC', 90],\n ['L', 50],\n ['XL', 40],\n ['X', 10],\n ['IX', 9],\n ['V', 5],\n ['IV', 4],\n ['I', 1]\n ]\n\n result = ''\n\n arabs_to_romans.each do |arab_to_roman|\n arab = arab_to_roman[1]\n roman = arab_to_roman[0]\n\n if num / arab != 0\n result += roman * (num / arab)\n num = num % arab\n end\n end\n result\nend", "def old_roman_numeral num\r\n\traise 'must use + integer' if num <= 0\r\n\troman = ''\r\n\r\n\troman << 'M' * (num / 1000)\r\n\t\t# -> 1.925 -> 1 (floor)\r\n\troman << 'D' * (num % 1000 / 500)\r\n\t\t# -> 925/500 -> 1.85 -> 1 (floor)\r\n\troman << 'C' * (num % 500 / 100)\r\n\t\t# -> 425/100 -> 4.25 -> 4 (floor)\r\n\troman << 'L' * (num % 100 / 50)\r\n\t\t# -> 25/50 -> 0.5 -> 0 (floor)\r\n\troman << 'X' * (num % 50 / 10)\r\n\t\t# -> 25/10 -> 2.5 -> 2 (floor)\r\n\troman << 'V' * (num % 10 / 5)\r\n\t\t# -> 5/5 -> 1 -> 1\r\n\troman << 'I' * (num % 5 / 1)\r\n\t\t# -> 0/10 -> 0 -> 0\r\n\r\n\troman\r\nend", "def new_roman_numeral num\n number = \"\"\n if (num / 1000) > 0\n number = \"M\" * (num / 1000)\n end\n if (num % 1000) >= 900 \n number += \"CM\"\n end\n if (num % 1000) >= 500 && (num % 1000) < 900\n number += \"D\"\n end\n if (num % 1000) >= 400 && (num % 1000) < 500\n number += \"CD\"\n end\n if ((num % 1000) % 500) >= 100 && ((num % 1000) % 500) < 400\n number += \"C\" * (((num % 1000) % 500) / 100)\n end\n if (((num % 1000) % 500) % 100) >= 90\n number += \"XC\"\n end\n if (((num % 1000) % 500) % 100) >= 50 && (((num % 1000) % 500) % 100) < 90\n number += \"L\"\n end\n if (((num % 1000) % 500) % 100) >= 40 && (((num % 1000) % 500) % 100) < 50\n number += \"XL\"\n end\n if (((num % 1000) % 500) % 50) >= 10 && (((num % 1000) % 500) % 50) < 40\n number += \"X\" * ((((num % 1000) % 500) % 50) / 10)\n end\n if ((((num % 1000) % 500) % 50) % 10) == 9\n number += \"IX\"\n end\n if ((((num % 1000) % 500) % 50) % 10) >= 5 && ((((num % 1000) % 500) % 50) % 10) < 9\n number += \"V\" + \"I\" * (((((num % 1000) % 500) % 50) % 10) % 5)\n end\n if ((((num % 1000) % 500) % 50) % 10) == 4\n number += \"IV\"\n end\n if ((((num % 1000) % 500) % 50) % 10) < 4\n number += \"I\" * (((((num % 1000) % 500) % 50) % 10) % 5)\n end\n puts number\nend", "def test_to_roman\n assert_equal(\"X\", RomanMathmaticalOperation.new.send(:to_roman,10))\n assert_not_equal(\"X\", RomanMathmaticalOperation.new.send(:to_roman,11))\n assert_equal(\"\", RomanMathmaticalOperation.new.send(:to_roman,0))\n end", "def arabic_to_english(arabic);\n Linguistics::EN.numwords(arabic)\nend", "def roman_numeral num\r\n\r\n\tthous = (num \t\t\t/ 1000)\r\n\thunds = (num \t% 1000 \t/ 100)\r\n\ttens = (num \t% 100 \t/ 10)\r\n\tones = (num \t% \t\t\t10)\r\n\r\n\troman = 'M' * thous\r\n\r\nend", "def old_school(num) \n roman = ''\n roman = roman + 'M' * (num / 1000)\n roman = roman + 'D' * (num % 1000/ 500)\n roman = roman + 'C' * (num % 500/ 100)\n roman = roman + 'L' * (num % 100/ 50)\n roman = roman + 'X' * (num % 50/ 10)\n roman = roman + 'V' * (num % 10/ 5)\n roman = roman + 'I' * (num % 5/ 1)\n roman \nend", "def old_school_roman_numerial number\n roman = ''\n\n # 1000\n roman << \"M\" * (number / 1000)\n # 500\n roman << \"D\" * (number % 1000 / 500)\n # 100\n roman << \"C\" * (number % 1000 % 500 / 100)\n # 50\n roman << \"L\" * (number % 1000 % 500 % 100 / 50)\n # 10\n roman << \"X\" * (number % 1000 % 500 % 100 % 50 / 10)\n # 5\n roman << \"V\" * (number % 1000 % 500 % 100 % 50 % 10 / 5)\n # 1\n roman << \"I\" * (number % 1000 % 500 % 100 % 50 % 10 % 5 / 1)\n\n puts roman\nend", "def roman_numeral number\n\nend", "def roman(decimal)\n bases = ROMANS.keys\n roman = \"\"\n base = bases.pop\n while base > 1 and decimal > 0 do\n y = Math.log(decimal, base).floor \n if y > 0\n roman << ROMANS[base] * y\n decimal -= base ** y\n else\n base = bases.pop\n end\n end\n roman << ROMANS[base] * decimal\n end" ]
[ "0.80962443", "0.79989904", "0.7661343", "0.7517114", "0.7517114", "0.73418474", "0.7328175", "0.73075575", "0.73014975", "0.7181064", "0.7180057", "0.7153044", "0.71414876", "0.71105665", "0.7097231", "0.70902216", "0.70646083", "0.7039619", "0.701626", "0.701268", "0.69935286", "0.6970273", "0.69586223", "0.69128716", "0.68856317", "0.6875184", "0.68744135", "0.68700343", "0.6866247", "0.68602353", "0.68602353", "0.684958", "0.6840398", "0.6838958", "0.68284625", "0.68251824", "0.6822314", "0.6818031", "0.6815991", "0.6814654", "0.68093276", "0.6800597", "0.6761519", "0.6749507", "0.67370725", "0.67291355", "0.67044497", "0.67032593", "0.6702304", "0.67018527", "0.670135", "0.6697791", "0.6688029", "0.66765153", "0.6658023", "0.66555816", "0.662983", "0.66291785", "0.66289186", "0.6628257", "0.66231555", "0.66199845", "0.6618006", "0.66105163", "0.6598254", "0.6592668", "0.6591001", "0.65846443", "0.6579563", "0.6578147", "0.6567304", "0.6565888", "0.65392107", "0.6535068", "0.6529942", "0.65194625", "0.6514197", "0.6508634", "0.6504205", "0.6500378", "0.64800155", "0.6475384", "0.64733547", "0.64575756", "0.64489555", "0.6442472", "0.644018", "0.6439707", "0.64225996", "0.6417637", "0.6410789", "0.63793874", "0.6346553", "0.6337787", "0.6271372", "0.62713504", "0.6251105", "0.6248435", "0.62460583", "0.6237227", "0.62340677" ]
0.0
-1
Renders a single constituency given a constituency id.
def show @postcode = flash[:postcode] @constituency, @seat_incumbencies, @party = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup', 'SeatIncumbency', 'Party') # Instance variable for single MP pages @single_mp = true @constituency = @constituency.first @seat_incumbencies = @seat_incumbencies.reverse_sort_by(:start_date) @current_incumbency = @seat_incumbencies.shift if !@seat_incumbencies.empty? && @seat_incumbencies.first.current? @json_location = constituency_map_path(@constituency.graph_id, format: 'json') @current_party = @current_incumbency.member.current_party if @current_incumbency @party = @current_party ? @current_party : @party.first return if @postcode.nil? begin response = Parliament::Utils::Helpers::PostcodeHelper.lookup(@postcode) @postcode_constituency = response.filter(Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')).first postcode_correct = @postcode_constituency.graph_id == @constituency.graph_id @postcode_constituency.correct = postcode_correct rescue Parliament::Utils::Helpers::PostcodeHelper::PostcodeError => error flash[:error] = error.message @postcode = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency.update_attributes(params[:constituency])\n flash[:notice] = 'Constituency was successfully updated.'\n format.html { redirect_to(@constituency) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\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 create\n @constituency = Constituency.new(params[:constituency])\n\n respond_to do |format|\n if @constituency.save\n flash[:notice] = 'Constituency was successfully created.'\n format.html { redirect_to(@constituency) }\n format.xml { render :xml => @constituency, :status => :created, :location => @constituency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def lookup\n @constituency = @request.get.first\n\n redirect_to constituency_path(@constituency.graph_id)\n end", "def set_constat\n @constat = Constat.find(params[:id])\n end", "def destroy\n @constituency = Constituency.find(params[:id])\n @constituency.destroy\n\n respond_to do |format|\n format.html { redirect_to(constituencies_url) }\n format.xml { head :ok }\n end\n end", "def show\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite_constitucional }\n end\n end", "def update\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n if @constitution.update_attributes(params[:constitution])\n format.html { redirect_to @constitution, notice: 'Constitution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_factor }\n end\n end", "def constituency\n constituencies.first\n end", "def set_constituency_duplicate\n @constituency_duplicate = ConstituencyDuplicate.find(params[:id])\n end", "def set_constituency\n @constituency = Constituency.find_by_id(current_user.constituency_id)\n# @constituency = Constituency.find_by_user_id(current_user.id)\n end", "def find_category_from_id\n @category = GlossaryCategory.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end", "def show\n id = params[\"id\"]\n type = ModelUtils.type_for_id(id)\n case type\n when nil\n render_not_found(id)\n when \"PEOPLE\"\n render_faculty(id)\n when \"ORGANIZATION\"\n render_org(id)\n when \"TEAM\"\n render_org(id)\n else\n # Render the JSON-LD representation in case somebody relies on the\n # original `/display/id` URL for other VIVO types that are neither\n # PEOPLE nor ORGANIZATION.\n render_vitro_data(id, type)\n end\n rescue => ex\n backtrace = ex.backtrace.join(\"\\r\\n\")\n Rails.logger.error(\"Could not render record #{id}, type #{type}. Exception: #{ex} \\r\\n #{backtrace}\")\n render \"error\", status: 500\n end", "def show\n @charity = Charity.find(params[:id])\n end", "def show\n @charity = Charity.find(params[:id])\n end", "def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "def show\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @benefit_category }\n end\n end", "def show\n @covariate = Covariate.find(params[:id])\n\n if @covariate.trait.nil?\n flash[:error] = 'This covariate is not associated with a trait! Consider removing it.'\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @covariate }\n format.csv { render :csv => @covariate }\n format.json { render :json => @covariate }\n end\n end", "def show\n @title_view = 'Estados de Conservación'\n @cultural_heritage_conservational_state = CulturalHeritage::ConservationalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_conservational_state }\n end\n end", "def show\n @course_proficiency = CourseProficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_proficiency }\n end\n end", "def show\n @critical_success_factor_type = CriticalSuccessFactorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_success_factor_type }\n end\n end", "def render\n @case = Case.find(self.case_id)\n end", "def index\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n end", "def show\n @lbl_colour = LblColour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbl_colour }\n end\n end", "def show\n @certificate_type = CertificateType.find(params[:id])\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\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 @competency = @resource.competency\n breadcrumb\n end", "def show_complaint_by_id\n complaint = Complaint.find(params[:id])\n if complaint\n render json: complaint, methods: [:status]\n else\n render json: {status: \"error\", error_message: \"complaint not found\"}\n end\n end", "def show\n @critical_success_factor = CriticalSuccessFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_success_factor }\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 show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def html(contact_id, configuration = {})\n m_configuration = Faces::Common.merge_configurations([Faces::Configuration::HIGHRISE, configuration])\n Faces::Public.generate_html(url(contact_id, configuration), m_configuration)\n end", "def update\n respond_to do |format|\n if @constat.update(constat_params)\n format.html { redirect_to @constat, notice: 'Constat was successfully updated.' }\n format.json { render :show, status: :ok, location: @constat }\n else\n format.html { render :edit }\n format.json { render json: @constat.errors, status: :unprocessable_entity }\n end\n end\n end", "def constituency_loc(constituency)\n Cachy.cache(\"const\" + constituency, hash_key: true) {constituency_loc_real constituency }\nend", "def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end", "def show\n @proficiency = Proficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proficiency }\n end\n end", "def show\n @concour = Concour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concour }\n end\n end", "def show\n @disc_color = DiscColor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disc_color }\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 new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end", "def show\n @id = params[:id] #this is the id of the course, used in template to create a link to show the studetns of a course\n @course = Course.find_by_id(params[:id])\n end", "def show\n @college_benefit = CollegeBenefit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @college_benefit }\n end\n end", "def showCourseInfo\n cid = params[:cid]\n @course = Course.find_by_id(cid)\n @course\n end", "def display_resource(coin)\n \"#{coin.name} (#{coin.symbol})\"\n end", "def get_category id\n\t\traw_output = @fred.category( nil, category_id: id.to_s )\n\n\t\traw_output.categories.category\n\tend", "def show\n parameters = params[:id]\n new_params = CGI.parse(parameters)\n country_id = new_params[\"country_id\"][0].to_i\n cod_id = new_params[\"cod_id\"][0].to_i\n @country = Country.find(country_id)\n @cod = Cod.find(cod_id)\n @charities = Charity.where(:cod_id => cod_id, :country_id => country_id)\n end", "def show\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @congressional_district }\n end\n end", "def show\n @concerts = Concert.find(params[:id])\n end", "def show\n @court_type = CourtType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court_type }\n end\n end", "def show\n if !params[:id].to_s.match(/^\\d+$/)\n @charity = Charity.find_by_seo_name_and_enabled(params[:id], true)\n else\n @charity = Charity.find_by_id_and_enabled(params[:id], true)\n end\n if !@charity.nil? then\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charity }\n end\n else\n flash[:error_message] = \"This charity is not active.\"\n respond_to do |format|\n format.html { render \"errors/index\" }\n format.xml { render :xml => flash[:error_message] }\n end\n end\n end", "def show\n if !params[:id].to_s.match(/^\\d+$/)\n @charity = Charity.find_by_seo_name(params[:id])\n else\n @charity = Charity.find(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charity }\n end\n end", "def show\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_compliance }\n end\n end", "def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end", "def show\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citizenship_class }\n end\n end", "def show\n @charge = Charge.find(params[:id])\n @competences = @charge.competences\n @title = \"Cargo\"\n \n end", "def show\n @lifestyle_cue_inference_clarification_connector = LifestyleCueInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_cue_inference_clarification_connector }\n end\n end", "def show\n @cultural_heritage_type_cultural_institution = CulturalHeritage::TypeCulturalInstitution.find(params[:id])\n @title_view = 'Tipos de Institución Cultural'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_type_cultural_institution }\n end\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def show\n @comdty = Comdty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def update\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n\n respond_to do |format|\n if @tramite_constitucional.update_attributes(params[:tramite_constitucional])\n format.html { redirect_to @tramite_constitucional, notice: 'Tramite constitucional was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tramite_constitucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @costtype = Costtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @costtype }\n end\n end", "def show\n @race_discipline = RaceDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @race_discipline }\n end\n end", "def create\n @constitution = Constitution.new(params[:constitution])\n\n respond_to do |format|\n if @constitution.save\n format.html { redirect_to @constitution, notice: 'Constitution was successfully created.' }\n format.json { render json: @constitution, status: :created, location: @constitution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_type }\n end\n end", "def show\n id = params[:session][:id] \n @food_court = FoodCourt.find(id) \n #puts \"printing food courts\", @food_court.id\n end", "def set_severity\n @severity = Severity.find(params[:id])\n end", "def show\n flash[:commissioning_id] = params[:id]\n super( @commissioning.label )\n end", "def create\n @constat = Constat.new(constat_params)\n\n respond_to do |format|\n if @constat.save\n format.html { redirect_to @constat, notice: 'Constat was successfully created.' }\n format.json { render :show, status: :created, location: @constat }\n else\n format.html { render :new }\n format.json { render json: @constat.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n begin\n @incident = Incident.find(params[:id])\n rescue\n logger.error \"Attempt to access unknown incident report #{params[:id]}\"\n redirect_to incidents_url, notice: 'Sorry, invalid Incident ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end\n end", "def show\n\t\trender plain: params[:id]\n\tend", "def display_resource(ticket_sla)\n \"TicketSla ##{ticket_sla.id}\"\n end", "def destroy\n @constituency_duplicate.destroy\n respond_to do |format|\n format.html { redirect_to constituencies_url, notice: \"Constituency was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def show\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_type }\n end\n end", "def show\n @encounter_reason = EncounterReason.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_reason }\n end\n end", "def show\n @course = Course.find(params[:id])\n render :show\n end", "def show\n @course = Course.find(params[:id])\n render 'show'\n end", "def show\n @crate_priority = CratePriority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate_priority }\n end\n end", "def show\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus_characteristic }\n end\n end", "def display_resource(findingaid)\n \"#{findingaid.name}\"\n end", "def edit_score\n @owned_certification = OwnedCertification.find(params[:id])\n end", "def show\n @crit_requirement = CritRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crit_requirement }\n end\n end", "def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end", "def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end", "def show\n @mathematical_model_constant = MathematicalModelConstant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mathematical_model_constant }\n end\n end", "def set_certification\n @certification = Certification.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def show\n @conclusion = Conclusion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conclusion }\n end\n end", "def show\n @curriculum_comment_type = CurriculumCommentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @curriculum_comment_type }\n end\n end", "def show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end", "def show\n @incidenttype = Incidenttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end", "def show\n @course_category = CourseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_category }\n end\n end", "def show\n @speciality = Speciality.find(params[:id])\n render :layout => false\n end", "def show\n @criterion = Criterion.find(params[:id])\n end", "def show\n @cost_type = CostType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cost_type }\n end\n end", "def set_competency\n @competency = Competency.find(params[:id])\n end", "def show\n @incomeclassification = Incomeclassification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline }\n end\n end", "def show\n @achievement_category = AchievementCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievement_category }\n end\n end" ]
[ "0.6452249", "0.59990525", "0.5967143", "0.5638046", "0.5525501", "0.5417787", "0.53766227", "0.53503054", "0.5349137", "0.53155196", "0.53111017", "0.52863073", "0.52705383", "0.5250323", "0.52046597", "0.5200666", "0.51653415", "0.51653415", "0.516513", "0.5141347", "0.5125898", "0.50903", "0.5059731", "0.50436443", "0.5032675", "0.5031373", "0.5016873", "0.5006078", "0.49970552", "0.4981689", "0.4979783", "0.49765584", "0.4966051", "0.49449456", "0.49043348", "0.4903224", "0.4898786", "0.48947257", "0.48855755", "0.48772088", "0.48762682", "0.4873804", "0.48633817", "0.4861369", "0.48577946", "0.48496595", "0.48476812", "0.48412097", "0.48390114", "0.48370588", "0.48336765", "0.48327625", "0.48252347", "0.48203847", "0.48133463", "0.48094168", "0.48091334", "0.48079583", "0.48030287", "0.4800824", "0.47942713", "0.4793938", "0.47934192", "0.47930473", "0.4784894", "0.47732502", "0.4772472", "0.47678354", "0.4761612", "0.4759436", "0.4757335", "0.4747004", "0.47380552", "0.47361815", "0.4731931", "0.4730927", "0.4730086", "0.4730033", "0.47290722", "0.4728662", "0.4728419", "0.47150397", "0.47123566", "0.47101924", "0.4702397", "0.47009003", "0.46999505", "0.4697188", "0.46968624", "0.4696546", "0.4695221", "0.46914846", "0.46892932", "0.46865845", "0.46811542", "0.4680142", "0.46783504", "0.4677055", "0.4676331", "0.46755698", "0.46728155" ]
0.0
-1
Redirects to a single constituency given an external source and an id that identifies this constituency in that source.
def lookup @constituency = @request.get.first redirect_to constituency_path(@constituency.graph_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirected\n @url = Url.where(short_url: params[:id]).first\n if @url.present?\n @url.increase_hit\n redirect_to \"#{'http://' unless @url.url.include?('http://') || @url.url.include?('https://')}#{@url.url}\"\n else\n redirect_to urls_path, alert: \"URL not present. Please create new URL\" \n end\n end", "def fwd\n\n url_id = params[:id]\n \n if !url_id.nil? && !url_id.empty?\n link_id = Base32::Crockford.decode(url_id)\n else\n # It will be catched by the next block now\n link_id = -1\n end\n \n begin\n link = Link.find(link_id)\n redirect_to_full_url(link.url, 301)\n rescue ActiveRecord::RecordNotFound\n redirect_to :controller => \"links\", :action => \"new\"\n end\n\n end", "def redirect\n if (url = ShortUrl.decode_short_url(params[:id]))\n url.increment_click_count\n return redirect_to url.full_url\n end\n\n render json: {\n status: 404, errors: 'Not Found'\n }, status: :not_found\n end", "def link\n id = session[:id].to_s\n url =\"http://ourco2.org/dopplr/?userid=\"+id\n redirect_to \"https://www.dopplr.com/api/AuthSubRequest?scope=http://www.dopplr.com&next=\"+url+\"&session=1\"\n end", "def redirect\n dsid = \"DS1\"\n dsid = params[:download_id] if params[:download_id]\n redirect_to \"#{Fedora::Repository.instance.base_url}/get/#{params[:pid]}/#{dsid}\"\n end", "def redirect\n @url = Url.where(:hash_code => params[:hash_code]).first\n ### That line above obviously has some problems.\n redirect_to @url.long_link \n\nend", "def redirect\n # Does it exist?\n if url = Redirect.find_by_short_url(params[:id])\n # # Increment count\n # url.update_attributes(count: url.count + 1)\n # Add redirect to history\n RedirectHistory.create(redirect_id: url.id, notes: \"params: #{params}\")\n # Redirect\n redirect_to url.full_url\n else\n redirect_to redirects_path\n end\n end", "def redirect\n @item = Item.find_by_id(Base58.decode(params[:id]))\n redirect_to @item[:location]\n end", "def redirect(url); end", "def redirect_to_original_link\n if params[:unique_code].present?\n id = UniqueCodeMethods.decode_unique_code(params[:unique_code])\n link = Link.find_record(id)\n if link.present?\n link.increase_visit_count\n redirect_to link.original_link\n end\n else\n render nothing: true\n end\n end", "def redirect\n @url = Url.find_by_short_code params[:short_code]\n @url.update_attribute(:counter, @url.counter + 1)\n redirect_to @url.url\n end", "def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end", "def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end", "def redirect \n url = Url.find_by(url_short: params[:path])\n if !url.present?\n flash[:ERROR] = \"Shorten Url doesn't exist: #{@url_host}#{params[:path]}\"\n redirect_to action: \"index\"\n else\n url.update(hit_count: url.hit_count + 1)\n redirect_to url[\"url_long\"]\n end\n end", "def product_revenue\n p '#{request.referer}'\n redirect_to \"http://www.google.com\" ,status: 301\n end", "def ciao\n redirect_to '/' && return if params[:url].blank?\n @ua = {:action => UserAction.id_for('external_url'), :data => {:source => params[:source]}}\n url = Base64.decode64(params[:url])\n url = \"http://#{url}\" unless url.match(/https?:\\/\\//) != nil\n redirect_to url\n end", "def redirect_to(shortcode)\n url = ''\n url += if shortcode.ssl?\n 'https://'\n else\n 'http://'\n end\n url += shortcode.destination\n shortcode.hit\n redirect url, 301\n end", "def getit\n @record = Record.find(params[:id])\n head :bad_request and return if @record.nil?\n @record.rebuild_openurl!(current_primary_institution.code) if @record.expired?\n # If external system is primo and we have a primo_id, link to primo\n if has_primo_as_external_system? && @record.external_id && ENV['PERSISTENT_LINKER_URL']\n redirect_to \"#{ENV['PERSISTENT_LINKER_URL']}#{@record.external_id}?institution=#{current_primary_institution.code.upcase}\"\n else\n # Otherwise use getit\n redirect_to getit_url + strip_getit_prefix(@record.url)\n end\n end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def external_link\n\n url = params[:url]\n if url.nil?\n render :nothing => true\n return\n end\n\n ExternalLinkLog.log url, request, current_user\n\n redirect_to url\n\n end", "def redirect_handler\n id = params['id']\n result = ChargeBee::HostedPage.retrieve(id)\n if result.hosted_page.state == \"succeeded\"\n redirect_to \"/ssp/subscription\"\n else \n redirect_to \"/400\"\n end\n end", "def redirect(url)\n raise \"To be implemented by client application\"\n end", "def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end", "def redirect_to(url)\n raise DoubleRenderError if already_built_response?\n res.header['location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end", "def redirect_to(url)\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res.status = 302 \n # @res.set_header('Content-Type', content_type)\n @res.set_header('location', url)\n # @res.write(content) \n session.store_session(res)\n # debugger\n @already_built_response = true \n # debugger\n end \n end", "def redirect_clickthroughs\n if (params[:ct])\n params.delete :ct\n headers[\"Status\"] = \"301 Moved Permanently\"\n redirect_to params, :status => 301\n end\n return true\n end", "def key_redirect\n share_link = Sharelink.find_by_short_key!(params[:short_code])\n cookies.signed[:referrer_id] = {\n :value => share_link.referrer_id,\n :expires => 1.day.from_now,\n }\n redirect_to campaign_path(share_link.campaign)\n end", "def redirection\n short = params[\"short\"]\n\n if short.nil?\n redirect_to root_url\n else\n link = Link.find_by(shortened: short)\n\n if link.nil?\n redirect_to root_url\n else\n redirect_to link.destination\n end\n end\n end", "def translate\n # pull the link out of the Database\n @url = Url.where(:unique_key => params[:unique_key]).first\n\n if @url\n @url.hit_count_increament\n # do a 301 redirect to the destination url\n head :moved_permanently, :location => @url.url\n else\n # if shortened link is not found, redirect to the root\n # make this configurable in future versions\n head :moved_permanently, :location => root_url\n end\n end", "def gringotts_redirect_to(url)\n # save url for redirecting back after we verify\n flash[:gringotts_next_url] = request.original_url\n \n # keep other flash items (e.g., success messages)\n flash.keep\n \n # last but not least ... redirect\n redirect_to url\n end", "def redirect_to(url)\n if self.already_built_response?\n raise \"Double render error!\"\n else\n @res.status = 302\n @res.location = url\n @already_built_response = true\n end\n end", "def redirect\n redirect_to @goto_url\n end", "def redirect_to(url)\n if already_built_response?\n raise\n else\n res.status = 302\n res.header[\"location\"] = url\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end", "def redirect_to(url)\n raise \"double render error\" if @already_built_response\n # Issuing a redirect consists of two parts, setting the 'Location'\n # field of the response header to the redirect url and setting the\n # response status code to 302\n @already_built_response = true\n res.location = url\n res.status = 302\n @session.store_session(res)\n end", "def redirect_url(immediate = false)\n moje_id_request.redirect_url(realm, return_to, immediate)\n end", "def show\n\n @long = params[:id].to_i(36)\n\n if Url.exists?(@long)\n\n @url = Url.find(@long).url\n\n redirect_to @url\n\n else\n redirect_to root_path\n end\n\n end", "def redirect_to(url)\n self.res.status = 302\n #how would I know about location\n self.res.header[\"location\"] = url\n session.store_session(self.res)\n\n #self.res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, url)\n if already_rendered?\n raise \"Can't render/redirect twice\"\n end\n\n #following might be wrong b/c of no setter\n @already_built_response = true\n nil\n end", "def redirect_to_url(callback_url)\n client_details = \"client_id=#{self.client_id}\"\n return callback_url + \"?#{client_details}\"\n end", "def r_to code\n redirect_to site_url, :status => code\n end", "def correct_user\n @source = current_user.sources.find_by(id: params[:id])\n redirect_to root_url if @source.nil?\n end", "def redirect_external() redirect_to \"http://www.rubyonrails.org\"; end", "def redirect_to(url)\n raise 'Already responded' if already_built_response?\n flash.store_flash(res)\n res['Location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirect_to(url)\n unless already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n fail\n end\n session.store_session(res)\n end", "def redirect_to(url)\n if !already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n raise \"exception\"\n end\n session.store_session(res)\n # storing the flash will fail the last spec\n flash.store_flash(res)\n end", "def redirect_to(url)\n raise \"Double Render Error\" if already_built_response?\n\n # equiv to @res.redirect\n @res.status = 302\n @res.location = url\n\n @already_built_response = true\n\n session.store_session(@res)\n end", "def redirect_to(url)\n raise \"Already delivered response\" if self.already_built_response?\n res.status = 302\n res['Location'] = url\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end", "def set_redirect\n @redirect = Redirect.find(params[:id])\n end", "def redirect_to(url)\n raise \"already built response\" if already_built_response?\n @res.status = 302\n @res[\"Location\"] = url\n @already_built_response = true\n self.session.store_session(@res)\n self.flash.store_flash(@res)\n end", "def authorized_user\n @source = current_user.sources.find_by_id(params[:id])\n redirect_to root_path if @source.nil?\n end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res[\"Location\"] = url\n @res.status = 302\n @already_built_response = true\n session.store_session(@res)\n flash.store_flash(@res)\n end", "def chase_redirect(url)\n u = URI.parse(url)\n (0..9).each do\n opts = { use_ssl: u.scheme == 'https',\n ca_file: Chef::Config[:ssl_ca_file] }\n resp = Net::HTTP.start(u.host, u.port, opts) { |h| h.head(u.to_s) }\n return u.to_s unless resp.is_a?(Net::HTTPRedirection)\n u = URI.parse(resp['location'])\n end\n nil\n end", "def redirect_to(url)\n raise \"double render error\" if constructed_response?\n\n @response.status = 302\n @response[\"Location\"] = url\n\n @constructed_response = true\n\n session.store_session(@response)\n\n nil\n end", "def set_redirect\n @redirect = Redirect.find(params[:id])\n end", "def redirect\n if @short.nil?\n redirect_to \"/\"\n else\n # raise\n @plain_url = Short.decrypt(@short)\n redirect_to @plain_url\n end\n end", "def identifier_keyword_redirect\n opt = request_parameters\n search_query_keys(**opt).find do |q_param|\n next if (q_param == :identifier) || (query = opt[q_param]).blank?\n next unless (identifier = PublicationIdentifier.cast(query))\n opt[:identifier] = identifier.to_s\n redirect_to opt.except!(q_param)\n end\n end", "def redirect(url)\n headers['Location'] = url\n self.status = 302\n raise FinishRequest\n end", "def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end", "def legacy_redirect\n raise \"Legacy without auth\" unless params[:auth]\n customer = Customer.find_by_uuid(params[:auth])\n if params[:order_id]\n @order = customer.orders.find_by_id(params[:order_id])\n raise \"Can't find order for customer\" unless @order\n else\n @order = customer.orders.first\n end\n session[:order_id] = @order.id\n url = { :controller => '/orders', :action => params[:name], :id => @order.id }\n logger.info(\"Redirect URL: #{url.inspect}\")\n redirect_to url\n end", "def redirect\n \n if \"succeeded\" == params[\"state\"]\n # Acknowledge the update payment method hosted page id passed in return URL. \n # The response will have customer and their masked payment details.\n result = ChargeBee::HostedPage.acknowledge(params[\"id\"])\n hosted_page = result.hosted_page\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_payment_method/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end", "def redirect_to(url)\n check_already_rendered\n session.store_session(response)\n response.status = 302\n response['Location'] = url\n @already_rendered = true\n end", "def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end", "def direct_link\n link = params[:link];\n if ( link.blank? )\n add_error(\"EMPTY DIRECT LINK\");\n redirect_to :controller=>\"general\";\n return;\n end\n begin\n as = ApplicationState.unmarshal(link.strip);\n logger.info \"******* as=#{as.to_hash().to_s}\"\n logger.info \"******* as=#{as.redirect_to_hash().to_s}\"\n # TODO see that as.user equals the current user, and hadle in-equality.\n redirect_to :controller=>\"mt_company\", :action=>\"mt_req_show\", :id=>\"330\" #as.redirect_to_hash();\n return;\n rescue Exception => e\n add_error( e.message );\n add_error( \"<pre>#{params[:link]}</pre>\")\n add_error(\"BAD DIRECT LINK\");\n redirect_to :controller=>\"general\";\n end\n end", "def redirect_to(url_options = {}, response_options = {})\n response_options[:status] ||= :see_other unless request.get?\n super url_options, response_options\n end", "def redirect\n # Request the ChargeBee server about the Update Card Hosted Page status \n # and provides details about the subscripton and customer.\n \n if \"succeeded\" == params[\"state\"]\n result = ChargeBee::HostedPage.retrieve(params[\"id\"])\n hosted_page = result.hosted_page\n if hosted_page.state != \"succeeded\"\n redirect_to \"/400\"\n return\n end\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_card/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end", "def get\n url = Url.find_by!(shortened_url: params[:code])\n url.count += 1\n url.save!\n redirect_to url.original_url\n rescue StandardError\n flash[:error] = \"That's not right. Did you mistype the url?\"\n redirect_to root_path\n end", "def legacy_show\n # grab the id from slugged urls like \"3818-cops-bust-frat-boys-for\"\n # skip the account part of the URL - this only runs on deployed Hot Ink\n redirect_to \"/articles/#{params[:id].split(\"-\")[0]}\", :status=>:moved_permanently\n end", "def redirects; end", "def prev_location # :nologin: :norobots:\n redirect_to_next_object(:prev, Location, params[:id].to_s)\n end", "def redirect_to_good_slug(object)\n redirect_to controller: controller_name, action: params[:action], id: object.to_param, status: 301\n end", "def redirect_to_good_slug(object)\n redirect_to controller: controller_name, action: params[:action], id: object.to_param, status: 301\n end", "def abrir_nueva_factura_individual\n redirect_to :action => 'nueva_orden', :id => params[:id_factura], :oid=> params[:oid],:una=>\"1\"\nend", "def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend", "def redirect_old\n issue = @project.issues.find_by(id: params[:id])\n\n if issue\n redirect_to issue_path(issue)\n return\n else\n raise ActiveRecord::RecordNotFound.new\n end\n end", "def send_to_redirect\n redirect_to @short_url.redirect\n end", "def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend", "def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end", "def redirect_to(uri_fragment)\n @headers['Status'] = '302 Moved'\n @headers['Location'] = @cgi.full_uri_for uri_fragment\n output\n end", "def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"adjudicators\"\n return (tournament_path(params[:id]) + '/control/adjudicators');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end", "def track\n search_session['counter'] = params[:counter]\n search_session['id'] = params[:search_id]\n search_session['per_page'] = params[:per_page]\n search_session['document_id'] = params[:document_id]\n\n if params[:redirect] && (params[:redirect].starts_with?('/') || params[:redirect] =~ URI::DEFAULT_PARSER.make_regexp)\n uri = URI.parse(params[:redirect])\n path = uri.query ? \"#{uri.path}?#{uri.query}\" : uri.path\n redirect_to path, status: :see_other\n else\n redirect_to({ action: :show, id: params[:id] }, status: :see_other)\n end\n end", "def redirect(uri, verb = T.unsafe(nil)); end", "def permanent_redirect_to(options={})\r\n redirect_to options, :status => 301\r\n end", "def record\n new_id = params[:id]\n if new_id\n if new_id.start_with?('FRANKLIN') && /^FRANKLIN_99\\d+03681$/.match(new_id).nil?\n new_id = new_id.sub(/(\\d+)/, \"#{ALMA_MMS_ID_PREFIX}\\\\1#{ALMA_MMS_ID_SUFFIX}\")\n end\n redirect_to \"https://franklin.library.upenn.edu/catalog/#{new_id}\"\n else\n redirect_to 'https://franklin.library.upenn.edu/'\n end\n end", "def next_location # :nologin: :norobots:\n redirect_to_next_object(:next, Location, params[:id].to_s)\n end", "def my_redirect url \r\n session[:plugin_redirection] = true if is_request_from_plugin?()\r\n redirect_to(url)\r\n end", "def follow_redirect\n get extract_redirection_url\n end", "def redirect_path\r\n if !(@target =~ /invoice/i).nil?\r\n redirect_to new_invoice_path\r\n else\r\n redirect_to @account\r\n end\r\n end", "def redirect_to(url, options={})\n full_url = absolute_url(url, options)\n response[LOCATION] = full_url\n respond_with 302\n full_url\n end", "def permanent_redirect_to(location)\n \"<?php\\nheader(\\\"HTTP/1.1 301 Moved Permanently\\\");\\nheader(\\\"Location: #{NEW_DOMAIN}/#{location}\\\");\\necho \\\"redirecting...\\\"\\n ?>\"\nend", "def prev_location_description # :nologin: :norobots:\n redirect_to_next_object(:prev, LocationDescription, params[:id].to_s)\n end", "def redirect\n name = params[:link]\n if params[:extension] != nil\n name += '.' + params[:extension]\n end\n link = Link.find_by_name(name)\n url = link.url\n redirect_to url\n end", "def show\n @short_url = ShortUrl.where(:shortcode => params[:id]).first\n @link = Link.find(@short_url.link_id)\n @click = Click.new(:ip => request.remote_ip, :referer => request.referer, :clickdate => Time.now).save!\n redirect_to @link.fullurl, :status => 301\n end", "def redirect(options = {})\r\n end", "def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend", "def redirect(location, as: 302, **params)\n @connection.status = Rack::Utils.status_code(as)\n @connection.set_response_header(\"Location\", location.is_a?(Symbol) ? app.endpoints.path(location, **params) : location)\n halt\n end", "def redirect_to!(occurrence)\n update_column :redirect_target_id, occurrence.id\n truncate!\n\n # if all occurrences for this bug redirect, mark the bug as unimportant\n if bug.occurrences.where(redirect_target_id: nil).none?\n bug.update_attribute :irrelevant, true\n end\n end", "def redirect_to_training_object\n if general_ledger_params.key? :training_session_id\n redirect_to training_session_path(\n general_ledger_params[:training_session_id]\n ), notice: 'General ledger was successfully linked.'\n elsif general_ledger_params.key? :training_request_id\n redirect_to training_request_path(\n general_ledger_params[:training_request_id]\n ), notice: 'General ledger was successfully linked.'\n end\n end", "def redirect_to url, options = {}\n\t\t\t\treturn super() if defined? super\n\t\t\t\turl = full_url_for(url, params) unless url.is_a?(String) || url.nil?\n\t\t\t\t# redirect\n\t\t\t\tresponse.redirect_to url, options\n\t\t\tend", "def redirect_to_origin(opts = {})\n if params[:ret].present?\n redirect_to params[:ret], opts\n else\n redirect_to opts.merge!(action: :index)\n end\n end", "def redirect_target\n if defined?(@redirect_target)\n @redirect_target\n else\n results = Article.find_by_sql([\"select articles.* from articles, redirects where redirects.redirect_source_repository_id = ? and redirects.redirect_source_local_id = ? and BINARY redirects.redirect_target_title = articles.title and redirects.redirect_source_repository_id = articles.repository_id\", repository_id, local_id])\n raise \"Can't happen case #{repository_id.to_s + \" \" + local_id.to_s} #{results.inject(\"\"){|str, result| str + result.title + \" \" + result.repository_id.to_s} }\" if results.size > 1\n @redirect_target = results.first\n end\n end" ]
[ "0.6356379", "0.6323642", "0.6301863", "0.62697154", "0.62367415", "0.6148157", "0.6147223", "0.6096034", "0.60953665", "0.6094001", "0.60492134", "0.60352594", "0.5989146", "0.595721", "0.5942591", "0.59392685", "0.582971", "0.5796933", "0.5782548", "0.5750796", "0.5746887", "0.5739201", "0.572541", "0.5721194", "0.5706191", "0.5702467", "0.56901324", "0.5677418", "0.56695604", "0.5667977", "0.56537", "0.56515974", "0.5647436", "0.5646752", "0.56409836", "0.562994", "0.5620864", "0.5607064", "0.5598458", "0.55815065", "0.5580246", "0.55539054", "0.5542095", "0.5539292", "0.55046934", "0.5498706", "0.5495006", "0.5484267", "0.54446805", "0.5440506", "0.54371697", "0.54313564", "0.5425763", "0.5423878", "0.5421762", "0.5412629", "0.53751576", "0.53729343", "0.5371315", "0.5370361", "0.5368931", "0.53632736", "0.5362571", "0.5352737", "0.5346466", "0.5341603", "0.533721", "0.53305155", "0.5327288", "0.5326972", "0.5326972", "0.5325872", "0.53250057", "0.53225994", "0.5320123", "0.5319962", "0.5319314", "0.53102547", "0.53060323", "0.5292269", "0.5291571", "0.52816325", "0.52773434", "0.5267514", "0.52669954", "0.52570134", "0.5244292", "0.52429986", "0.52414256", "0.52374667", "0.52335244", "0.5231171", "0.52289885", "0.52223444", "0.52173746", "0.521268", "0.52081674", "0.52039164", "0.5197534", "0.5195305" ]
0.63747656
0