query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This sweeper is going to keep an eye on the UniqueShapeName model If our sweeper detects that a UniqueShapeName was created call this
def after_create(unique_shape_name) expire_cache_for(unique_shape_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shape\n id = rand 7\n @cur_y = 0\n @cur_x = 5\n @shape = SHAPES[id].dup\n end", "def remove_shape\n\t\[email protected]_at(0)\n\tend", "def initialize_ISG_shape(shape_uid)\n\t\t\t# create dictionary if it doesn't exist\n\t\t\t@dict = self.attribute_dictionary 'IterativeSG', true\n\t\t\t@rules_applied = Array.new\n\t\t\t\n\t\t\t# define rule that generated this shape\n\t\t\t@applied_by_rule = @dict.get_attribute 'IterativeSG', 'applied_by_rule'\n\t\t\t\n\t\t\t# UIDs are a bit different - when shape is copied, they should\n\t\t\t# not remain the same. So make sure to change them even if they exist.\n\t\t\tcurrent_uid = @dict.get_attribute 'IterativeSG', 'UID'\n\t\t\tif current_uid == nil\n\t\t\t\t@UID = shape_uid\n\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', shape_uid\n\t\t\telse\n\t\t\t\tif Controller.UIDs.include? current_uid\n\t\t\t\t\t@UID = shape_uid\n\t\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', shape_uid\n\t\t\t\telse\n\t\t\t\t\t@UID = current_uid\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@component_name = self.definition.name\n\t\t\t# define current position for faster access\n\t\t\tself.update_shape\n\t\t\t\n\t\t\treturn @UID\n\t\tend", "def remove shape\n @remove_shapes << shape\n end", "def after_destroy(unique_shape_name)\n expire_cache_for(unique_shape_name)\n end", "def after_update(unique_shape_name)\n expire_cache_for(unique_shape_name)\n end", "def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end", "def test_duplicate_name_allowed\n type = Type.new(:name => \"Personification\")\n type.metaphor_id = types(:metaphor_9682_type).metaphor_id\n assert type.save\n end", "def genShapeJson()\n shape = [] ;\n @shape.pointList.each{|point|\n pos = [point.x, point.y] ;\n shape.push(pos) ;\n }\n return shape ;\n end", "def after_create(shape_type)\n expire_cache_for(shape_type)\n end", "def throw_shape(shape, color)\n add_shape(shape, color, rand(width - shape.width), rand(height - shape.height))\n end", "def __object_unique_id__\n name\n end", "def __object_unique_id__\n name\n end", "def after_create(shape)\n# expire_cache_for(shape)\n end", "def unique_name\n entity = Entity.where(\n :name => self.name,\n :parent_id => self.parent_id\n )\n if entity.blank?\n return true\n else\n errors.add( :base, \"Entity already exist...\" )\n end\n end", "def name_uniqueness\n other_sprint = Sprint.where(board_id: self.board_id, name: self.name).where.not(id: self.id).count\n if other_sprint > 0\n errors.add(:name, 'must be uniq.')\n end\n end", "def create\n @shape_type = ShapeType.new(params[:shape_type])\n\n\t\t# get the parent shape type\n\t\tparent = ShapeType.find(params[:parent_shape])\n\n respond_to do |format|\n\t\t\tif parent.nil?\n format.html { render action: \"new\" }\n format.json { render json: @shape_type.errors, status: :unprocessable_entity }\n\t\t\telse\n\t\t\t\t# add the new shape type to the parent\n\t\t if parent.children.create(params[:shape_type])\n\t\t\t\t\tmsg = I18n.t('app.msgs.success_created', :obj => I18n.t('app.common.shape_type'))\n\t\t\t\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n\t\t format.html { redirect_to admin_shape_type_path(@shape_type), notice: msg }\n\t\t format.json { render json: @shape_type, status: :created, location: @shape_type }\n\t\t else\n\t\t format.html { render action: \"new\" }\n\t\t format.json { render json: @shape_type.errors, status: :unprocessable_entity }\n\t\t end\n\t end\n end\n end", "def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end", "def empty_shapes\n\t\t\t\tshapes.clear\n\t\t\tend", "def container?\n @name == 'shape'\n end", "def validate_name_kinds_are_unique\n # do not validate on global since we hope to be on namespace soon\n return if !@project || [email protected]_resource_names?\n\n # ignore services where we generate their names\n elements = @elements.reject { |e| !e[:kind] || (e[:kind] == \"Service\" && !self.class.keep_name?(e)) }\n\n # group by kind+name and to sure we have no duplicates\n groups = elements.group_by do |e|\n user_supplied = (ALLOWED_DUPLICATE_KINDS.include?(e.fetch(:kind)) || self.class.keep_name?(e))\n [e.fetch(:kind), e.dig(:metadata, :namespace), user_supplied ? e.dig(:metadata, :name) : \"hardcoded\"]\n end.values\n bad = groups.select { |group| group.size > 1 }\n return if bad.empty?\n\n bad_kinds = bad.map { |g| g.first[:kind] }\n @errors <<\n \"Only use 1 per kind #{bad_kinds.join(\", \")} in a role\\n\" \\\n \"To bypass: assign a namespace to the project, or set metadata.annotations.samson/keep_name=\\\"true\\\"\"\n end", "def ensure_unique_in_chain\n self.entity.spots.each { |s| remove_duplicate_blueprint(s) }\n self.entity.apply_to_children do |entity|\n remove_duplicate_blueprint(entity)\n entity.spots.each { |s| remove_duplicate_blueprint(s) }\n end\n end", "def add_shape(shape, color, cell_x, cell_y)\n for shape_x in 0...shape.width\n for shape_y in 0...shape.height\n x_offset = shape_x + cell_x\n y_offset = shape_y + cell_y\n if shape.pattern[shape_y][shape_x] == 1\n grid[y_offset][x_offset] = color\n end\n end\n end\n\n updated\n end", "def display_shape_name(shapeType)\n\tcase shapeType\n\twhen :square then puts \"I am a square\"\n\twhen :circle then puts \"I am a circle\"\n\twhen :rectangle then puts \"I am a rectangle\"\n\tend\nend", "def create_matching_taxon_name\n return true if @skip_new_taxon_name\n return true if scientific_name\n\n taxon_attributes = attributes\n taxon_attributes.delete( \"id\" )\n tn = TaxonName.new\n taxon_attributes.each do | k, v |\n tn[k] = v if TaxonName.column_names.include?( k )\n end\n tn.lexicon = TaxonName::LEXICONS[:SCIENTIFIC_NAMES]\n tn.is_valid = true\n\n if !tn.valid? && !tn.errors[:source_identifier].blank?\n tn.source_identifier = nil\n end\n\n taxon_names << tn\n true\n end", "def add_shape shape\n\t\tif shape.class == Rectangle or shape.class == Triangle or shape.class == Circle\n\t\t\[email protected] shape\n\t\telse\n\t\t\tputs \"Not a shape\"\n\t\tend\n\tend", "def ensure_unique_tasks_names! \n for i in 0..(@tasks_params.count-2)\n for j in (i+1)..(@tasks_params.count-1)\n raise RuntimeError, 'Duplicated tasks names' if @tasks_params[i.to_s][:name] == @tasks_params[j.to_s][:name]\n end\n end\n end", "def assign_until_unique(piece)\n x = Random.new.rand(1..@size)\n y = Random.new.rand(1..@size)\n unless coordinates.include? [x, y]\n piece.coordinates = [x, y]\n return piece\n end\n assign_until_unique(piece)\n end", "def after_save\n validate_uniqueness_as_run(:name)\n end", "def unique?(name)\n tgts = resolve_mapping(name)\n targets = tgts.is_a?(Array) ? tgts : find(tgts)\n targets.size == 1\n end", "def toggle_pods\n @pods = (@pods + 1) % 2\n if @pods == 1\n @shapes_pods.each do |shape|\n @window.space.add_shape(shape)\n end\n else\n @shapes_pods.each do |shape|\n @window.space.remove_shape(shape)\n end \n end\n end", "def unique_name\n return nil if ignoring_request?\n\n @unique_name ||= begin\n scope_layer = LayerConverters::FindLayerByType.new(self).scope\n if scope_layer\n scope_layer.legacy_metric_name\n else\n :unknown\n end\n end\n end", "def has_unique_name\n invalid = false\n if template\n invalid ||= template.common_fields.any? {|field| field.name.downcase == self.name.downcase && field != self }\n invalid ||= template.default_fields.any? {|field| field.name.downcase == self.name.downcase && field != self }\n else\n scope = self.class.common.where(\"LOWER(name) = LOWER(?)\", self.name)\n scope = scope.where(\"id != ?\", self.id) if persisted?\n invalid ||= scope.exists?\n end\n\n errors.add(:name, \"has already been taken\") if invalid\n end", "def __object_unique_id__\n return @args[:data][:Key_name]\n end", "def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end", "def unique_identifiers\n [:name, :path]\n end", "def get_random_shape\n shapes = [@t, @h_line, @v_line, @l, @square]\n shapes.sample\n end", "def unique_info\n person = Person.first_by_info(name, email, home_phone)\n errors.add(\"existing person with name '#{name}'\") if person && person != self\n end", "def unique_name(name)\n \"pedant_#{name}_#{pedant_suffix}\"\n end", "def render\n update\n @batch.begin\n case @shape_type\n when :filled\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Filled)\n when :point\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Point)\n when :line\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Line)\n else\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Filled)\n end\n display\n @shape.end unless @shape.nil?\n @batch.end\n end", "def shape_count\n\t\treturn @shapes.length\n\tend", "def equal_to?(shape)\n return false if shape.type != @type\n shape.squares.each do |square|\n found = false\n #Shapes don't have to have the same order of squares\n @squares.each do |sq|\n found = true if square.x == sq.x and square.y == sq.y\n end\n return false if !found\n end\n return true\n end", "def test_uniqueness_of_name\n client = Client.new(:name => \"XXX\", :tat => 14,\n :partener_bank_group_code => 'KK', :internal_tat => 90, :group_code => 'JO',\n :max_jobs_per_user_payer_wise => 5, :max_jobs_per_user_client_wise => 5,\n :max_eobs_per_job => 5)\n assert_equal(false,client.save)\n end", "def must_be_unique\n errors.add(:failed, I18n.t('room_type_master_rate_mappings.create.message.already_exist')) if\n !RoomTypeMasterRateMapping.find_by_pool_id_and_room_type_id(self.pool_id, self.room_type_id).blank?\n end", "def add_shape(shape)\n @shapes.add(shape)\n self\n end", "def unique_name(name)\n if @commands_by_name.include?(name)\n count = 2\n name2 = nil\n while (name2 = name + count.to_s) && @commands_by_name.include?(name2)\n count += 1\n end\n name2\n else\n name\n end\n end", "def reuseIdentifier\n self.class.name\n end", "def pass\n Shape.send_message(\"shape #{name} #{xpos} #{ypos} #{size}\")\n update_attribute :passed, true\n end", "def name_is_unique\n return if self.name.nil?\n errors.add(:name, 'has already been taken') if Institution.where(name: self.name).reject{|r| r == self}.any?\n end", "def unique?\n false\n end", "def add_shape(attribute_hash)\n return false if attribute_hash[:is_internal_node]\n raise if attribute_hash[:source_table].blank? || attribute_hash[:source_table_gid].blank?\n @shapes.push [attribute_hash[:source_table], attribute_hash[:source_table_gid], attribute_hash[:date_valid_from], attribute_hash[:date_valid_to]]\n end", "def geoObject()\n return @shape ;\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def load_shapefile(shp_name)\n Rails.logger.info \"Reading Shapes into #{@model.to_s} Table...\"\n # Execute read Shapefile\n begin\n RGeo::Shapefile::Reader.open(shp_name,\n assume_inner_follows_outer: true,\n factory: RGeo::ActiveRecord::SpatialFactoryStore.instance.default) do |shapefile|\n\n fail_count = 0\n if @model.name == CustomGeography.name && Config.dashboard_mode == 'travel_patterns'\n attrs = {}\n if shapefile.num_records > 1\n @errors << 'Found multiple features while creating a custom geography. Uploader only accepts one feature'\n else\n first_shape = shapefile.get(0)\n attrs[:name] = first_shape.attributes[@column_mappings[:name]] if @column_mappings[:name]\n attrs[:state] = StateCodeDictionary.code(42) if @column_mappings[:state]\n #attrs[:state] = StateCodeDictionary.code(first_shape.attributes[@column_mappings[:state]]) if @column_mappings[:state]\n geom = first_shape.geometry\n Rails.logger.info \"Loading #{attrs.values.join(\",\")}...\"\n record = ActiveRecord::Base.logger.silence do\n @custom_geo = @model.create({ name: @name, agency: @agency })\n @custom_geo.update_attributes(geom:geom)\n # generally, the only error we're going to get are either the shapefile is invalid\n # or the name was taken already\n if @custom_geo.errors.present?\n @errors << \"#{@custom_geo.errors.full_messages.to_sentence} for #{@custom_geo.name}.\"\n else\n @custom_geo\n end\n end\n end\n if record\n Rails.logger.info \" SUCCESS!\"\n else\n Rails.logger.info \" FAILED.\"\n fail_count += 1\n end\n else\n shapefile.each do |shape|\n attrs = {}\n attrs[:name] = shape.attributes[@column_mappings[:name]] if @column_mappings[:name]\n attrs[:state] = StateCodeDictionary.code(42) if @column_mappings[:state]\n #attrs[:state] = StateCodeDictionary.code(shape.attributes[@column_mappings[:state]]) if @column_mappings[:state]\n geom = shape.geometry\n Rails.logger.info \"Loading #{attrs.values.join(\",\")}...\"\n\n # NOTE: the below probably needs an update since it's pretty old\n # if the record fails to create, then we can just check for record errors and push those in\n # instead of doing a weird thing with active record logger\n record = ActiveRecord::Base.logger.silence do\n # The below is overly verbose for debugging purposes\n geo = @model.find_or_create_by!(attrs)\n geo.update_attributes!(geom:geom)\n geo\n end\n if record\n Rails.logger.info \" SUCCESS!\"\n else\n Rails.logger.info \" FAILED.\"\n fail_count += 1\n end\n end\n end\n @errors << \"#{fail_count} record(s) failed to load.\" if fail_count > 0\n end\n rescue StandardError => ex\n puts ex.message\n @errors << \"An error occurred while unpacking the uploaded Shapefile. Please double check your shapefile and try again\"\n end\n end", "def place_scenario\n associate TweetPong::Stage::Wall.new(:x => 0, :y => 0, :width => width, :height => 0)\n associate TweetPong::Stage::Wall.new(:x => width, :y => 0, :width => 0, :height => height)\n associate TweetPong::Stage::Wall.new(:x => 0, :y => height, :width => width, :height => 0)\n associate TweetPong::Stage::Wall.new(:x => 0, :y => 0, :width => 0, :height => height)\n\n end", "def show_shape(type, options={})\n add_actor Gamework::Shape.new(type, options)\n end", "def ensure_unique_node(path, name)\n name = SecureRandom.hex(8) while File.exist? File.join(path, name)\n Folder.new File.join(path, name)\n end", "def identify\n self.dup.identify!\n end", "def object_name; end", "def object_name; end", "def object_name; end", "def index\n @shape_text = UniqueShapeName.for_profiles\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_text }\n end\n end", "def generate_unique_name\n SecureRandom.uuid\n end", "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "def check_for_collision\n canonical_id = name.identify\n polls = Poll.all(:conditions => {:id => canonical_id})\n if polls.count > 0\n errors.add(:base, \"Name too similar to that of an existing poll\")\n end\n end", "def unique_name_already_claimed_by\n @node[:crowbar_wall] ||= Mash.new\n claimed_disks = @node[:crowbar_wall][:claimed_disks] || []\n cm = claimed_disks.find do |claimed_name, v|\n begin\n self.link_to_name?(claimed_name)\n rescue Errno::ENOENT\n # FIXME: Decide what to do with missing links in the long term\n #\n # Stoney had a bug that caused disks to be claimed twice for the \n # same owner (especially of the \"LVM_DRBD\" owner) but under two\n # differnt names. One of those names doesn't persist reboots and\n # to workaround that bug we just ignore missing links here in the\n # hope that the same disk is also claimed under a more stable name.\n false\n end\n end || []\n cm.first\n end", "def composite?\n !shapes.empty?\n end", "def set_name_as_untitled\n if name.blank?\n untitled_count = attachable ? attachable.photo_albums.untitled.size : self.class.without_attachable.untitled.size\n self.name = \"#{UNTITLED_NAME} #{untitled_count + 1}\"\n end\n true\n end", "def name\n @name ? @name.to_s : unique_id\n end", "def generate_name_if_empty\n if name.nil?\n #Check to make sure that the \"random name\" has not already been \n #taken.\n while true\n rname = App.random_name\n break unless App.exists? name: rname\n end\n self.name = rname\n end\n end", "def readShapesFromFile(filename)\n\nss = Shapeset.new\ninputFile = File.new(filename, \"r\")\n\nfor line in inputFile\n if line.split(/, */)[0].strip == 'circle'\n ss.addShape(Circle.new(line.split(/, */)[1].strip))\n elsif line.split(/, */)[0].strip == 'square'\n ss.addShape(Square.new(line.split(/, */)[1].strip))\n else\n ss.addShape(Triangle.new(line.split(/, */)[1].strip,line.split(/, */)[2].strip))\n end \nend\n\nreturn ss\n\nend", "def new_name; end", "def name!( ɴ )\n old_ɴ = namespace.__instances__[ self ] # previous name\n if ɴ then # puts \"NameMagic: Rudely naming with #{ɴ}.\" if DEBUG\n ɴ = namespace.send( :validate_name, # honor the hook\n namespace.name_set_hook.( ɴ, self, old_ɴ ) ).to_sym\n # puts \"NameMagic: Name adjusted to #{ɴ}.\" if DEBUG\n return false if old_ɴ == ɴ # already named as required\n pair = namespace.__instances__.rassoc( ɴ )\n namespace.__forget__( pair[0] ) if pair # rudely forget the collider\n namespace.const_set ɴ, self # write a constant\n namespace.__instances__[ self ] = ɴ # write to @instances\n namespace.__forget__ old_ɴ # forget the old name of self\n else\n self.name = nil # unnaming, no collider issues\n end\n end", "def ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\n end", "def marker_unique_by\n nil\n end", "def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{sanitized_title.downcase}_#{salt}\"\n end\n end", "def processShapefile()\n\t#Create a new file object\n\t$shapefile = File.new($filePath,\"rb\")\n\t#Create a SketchUp model object\n\tmodel = Sketchup.active_model\n\n\t#Process Shapefile header information\n\t#Verify the file type\n\tfileCode = $shapefile.read(4).unpack(\"l>\")\n\t#Shapefile code is 9994. Checking for the match\n\tif fileCode[0]!=9994 then\n\t\tabort(\"The specified file is not a Shapefile.\")\n\tend\n\t#Ignore the next 20 bytes they are unused\n\t$shapefile.read(20)\n\t#Get the file length. Important for record processing.\n\tfileLength = $shapefile.read(4).unpack(\"l>\")\n\t#Next four bytes are the version. We won't be using this.\n\t$shapefile.read(4)\n\t#The next four bytes are the shape type. Important for record processing.\n\tshapeType = $shapefile.read(4).unpack(\"l<\")\n\t#Rule out certain shape types. More types will be added as time goes on.\n\tif shapeType[0]!=1 and shapeType[0]!=3 then\n\t\tabort(\"This type of shapefile is not supported.\")\n\tend\n\t#Read the next 64 bytes. They won't be used in our program for now.\n\t$shapefile.read(64)\n\t\n\t\n\t#Begin record procesing\n\t#Option for point shapefile\n\tif shapeType[0]==1 then\n\t\t#Try grabbing the first record\n\t\tbegin\n\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\trescue #Exit if the shapefile is empty\n\t\t\tabort(\"There are no records in this shapefile.\")\n\t\tend\n\t\t#Let the user know the process has begun\n\t\tputs(\"Processing shapefile...\")\n\t\t#Process all records until the end\n\t\twhile recordNumber!=nil\n\t\t\trecordLength = $shapefile.read(4).unpack(\"l>\")\n\t\t\trecordType = $shapefile.read(4).unpack(\"l<\")\n\t\t\t#If it is a null shape, we will ignore it\n\t\t\t#Process remaining record contents\n\t\t\tif recordType[0]==1\n\t\t\t\t#Read the coordinates\n\t\t\t\tpointX = $shapefile.read(8).unpack(\"E\")\n\t\t\t\tpointY = $shapefile.read(8).unpack(\"E\")\n\t\t\t\t#Add the point to the model\n\t\t\t\tmodel.entities.add_cpoint model.latlong_to_point([pointX[0],pointY[0]])\n\t\t\tend\n\t\t\t#Try reading the next record. Prepare for possible error.\n\t\t\tbegin\n\t\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\t\trescue #If we need to rescue, we are at the end of the shapefile.\n\t\t\t\tputs(\"Shapefile has been processed.\")\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t#Option for polyline shapefile\n\telsif shapeType[0]==3\n\t\t#Try grabbing the first record\n\t\tbegin\n\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\trescue\n\t\t\tabort(\"There are no records in the shapefile.\")\n\t\tend\n\t\tputs(\"Processing Shapefile...\")\n\t\t#Process each record\n\t\twhile recordNumber!=nil\n\t\t\trecordLength = $shapefile.read(4).unpack(\"l>\")\n\t\t\trecordType = $shapefile.read(4).unpack(\"l<\")\n\t\t\t#Process polyline shape types\n\t\t\tif recordType[0]==3\n\t\t\t\trecordBox = $shapefile.read(32) #We will read this, but we don't need it\n\t\t\t\t#Get part and point counts\n\t\t\t\trecordPartCount = $shapefile.read(4).unpack(\"l<\")\n\t\t\t\trecordPointCount = $shapefile.read(4).unpack(\"l<\")\n\t\t\t\t#Create an index array\n\t\t\t\tindex = []\n\t\t\t\t#Populate the index array\n\t\t\t\tfor recordPoint in (0..recordPartCount[0]-1) do\n\t\t\t\t\tindex.push($shapefile.read(4).unpack(\"l<\"))\n\t\t\t\tend\n\t\t\t\t#Loop through all parts for this record\n\t\t\t\tfor partNum in (0..recordPartCount[0]-1) do\n\t\t\t\t\t#Generate the loop count\n\t\t\t\t\tloopCount = nil\n\t\t\t\t\tif index[partNum+1]==nil #Figure out how many point to count\n\t\t\t\t\t\tloopCount = recordPointCount[0] - index[partNum][0]\n\t\t\t\t\telse\n\t\t\t\t\t\tloopCount = index[partNum+1][0]-index[partNum][0]\n\t\t\t\t\tend\n\t\t\t\t\t#Loop through all lat,long values for this part.\n\t\t\t\t\tpointsArray = []\n\t\t\t\t\t#Generate array of points\n\t\t\t\t\tfor i in (1..loopCount) do\n\t\t\t\t\t\tpointX = $shapefile.read(8).unpack(\"E\")\n\t\t\t\t\t\tpointY = $shapefile.read(8).unpack(\"E\")\n\t\t\t\t\t\tpointsArray.push(model.latlong_to_point([pointX[0],pointY[0]])) #Convert lon/lat to x,y and add to array\n\t\t\t\t\tend\n\t\t\t\t\t#Add line to the model\n\t\t\t\t\tmodel.entities.add_edges pointsArray\n\t\t\t\tend\n\t\t\t\t#Try and process next record. Prepare for possible error.\n\t\t\t\tbegin\n\t\t\t\t\trecordNumber = $shapefile.read(4).unpack(\"l>\")\n\t\t\t\trescue\n\t\t\t\t\tputs(\"Shapefile has been processed.\")\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\t\n\telse #Condition for shape types that are not able to be processed.\n\t\tputs(\"Shapefile type is currently not supported.\")\n\tend\nend", "def find_named_objects(canvas)\n # Each object looks something like this\n # {\n # \"Bounds\": \"{{416, 66}, {320, 50}}\",\n # \"Class\": \"ShapedGraphic\",\n # \"ID\": 191531,\n # \"Layer\": 0,\n # \"Name\": \"ad1\",\n # },\n #\n # Groups have a \"Graphics\" sub-key.\n # Some objects have a GraphicsList subkey (Canvases do; not sure if others do).\n named_shapes = []\n to_visit = canvas[\"ExportShapes\"]\n to_visit = canvas[\"GraphicsList\"]\n until to_visit.empty? do\n current = to_visit.pop\n named_shapes << current if current[\"Name\"]\n to_visit.concat(current[\"Graphics\"]) if current[\"Graphics\"]\n to_visit.concat(current[\"GraphicsList\"]) if current[\"GraphicsList\"]\n end\n named_shapes\nend", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def uniqify_fields\n begin\n self.uniq_title = self.title.to_uniq\n self.uniq_position = self.position.to_uniq\n self.uniq_playbacks_count = self.playbacks_count.to_uniq\n self.uniq_likes_count = self.likes_count.to_uniq\n self.uuid = UUIDTools::UUID.timestamp_create().to_s if self.uuid.nil?\n rescue\n end\n end", "def duplicate_component()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.LayoutEditor_duplicate_component(@handle.ptr)\n end", "def name_unique_in_clinic\n errors.add(:name, \"Name: #{name} already in use\") unless\n name_unique_in_clinic?\n end", "def is_unique\n return true if fact_type.is_a?(LinkFactType) or # Handle objectification roles\n fact_type.all_role.size == 1 # and unary roles\n\n uniqueness_constraint ? true : false\n end", "def duplicate!(**args)\n self.dont_create_legend_item = true\n duplicate = super(args)\n return duplicate if duplicate.new_record? || duplicate.errors.present?\n\n duplicate\n end", "def object_name=(_arg0); end", "def initialize_ISG_marker(uid)\n\t\t\t# create dictionary\n\t\t\t@dict = self.attribute_dictionary 'IterativeSG', true\n\t\t\t\n\t\t\t# UIDs are a bit different - when shape is copied, they should\n\t\t\t# not remain the same. So make sure to change them even if they exist.\n\t\t\tcurrent_uid = @dict.get_attribute 'IterativeSG', 'UID'\n\t\t\tif current_uid == nil\n\t\t\t\t@UID = uid\n\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', uid\n\t\t\telse\n\t\t\t\tif Controller.UIDs.include? current_uid\n\t\t\t\t\t@UID = uid\n\t\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', uid\n\t\t\t\telse\n\t\t\t\t\t@UID = current_uid\n\t\t\t\tend\n\t\t\tend\n\t\t\t# define current position for faster access\n\t\t\tself.update_shape\n\t\t\t\n\t\t\treturn @UID\n\t\tend", "def ensure_unique_athlete_per_prediction\n \terrors.add(:athlete_id, \"Already chosen\") if @duplicate_athlete_ids.present? and @duplicate_athlete_ids.include?(athlete_id)\n\tend", "def render\n draw\n (@shape.size).times {|c| puts @shape[c]}\n end", "def unique? name\n\t\trobots = ObjectSpace.each_object(Robot).to_a\n\t\traise \"There are 17,676 robots, we've run out of names\" if robots.length > 17676\n\t\trobots.each { |r| return false if r.name == name }\n\t\treturn true\n\tend", "def clone_sku!(order_item)\n SkuCloner.new(order_item, sku, :singular).process\n order_item.reload # thanks mongo\n end", "def allows_unique?\n true\n end", "def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{self.title.gsub(/[^\\w\\.\\-]/,'_').downcase}_#{salt}\"\n end\n end", "def identify(_collection)\n raise NotImplementedError\n end", "def generate_identity\n handle_name ||= username if respond_to?(:username)\n handle_name ||= short_name if respond_to?(:short_name)\n handle_name ||= name.parameterize(\"_\").gsub(\"-\",\"_\") if respond_to?(:name)\n\n self.handle = Handle.build_unique(self, handle_name)\n self.handle.identifiable = self\n\n self[identity_field] = handle.name\n instance_variable_set(:\"@#{identity_field}\", handle.name)\n end", "def identify_name\n @identify_name ||= begin\n if self.respond_to?(:name)\n self.try(:name)\n elsif self.respond_to?(:title)\n self.try(:title)\n else\n 'NONE'\n end\n end\n end", "def duplicate?\n @duplicate == true\n end", "def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end" ]
[ "0.65151423", "0.58718973", "0.5719948", "0.5717422", "0.56124854", "0.5588835", "0.5378931", "0.52917635", "0.52866364", "0.527403", "0.5267726", "0.5264684", "0.5264684", "0.5220904", "0.51848567", "0.5181494", "0.5163503", "0.5147804", "0.5133412", "0.5107059", "0.50914145", "0.50835794", "0.5073621", "0.5056639", "0.5040125", "0.5015005", "0.50141734", "0.49906558", "0.49893713", "0.49556115", "0.49376512", "0.49059963", "0.49043944", "0.4900863", "0.4898984", "0.4895828", "0.4881869", "0.48675853", "0.48640993", "0.48517752", "0.48481575", "0.48479", "0.48435178", "0.48412994", "0.48265025", "0.48234993", "0.48206353", "0.48205122", "0.4819653", "0.48165625", "0.48080605", "0.4791392", "0.47865993", "0.47865993", "0.47864905", "0.4785556", "0.4779686", "0.47796485", "0.4777415", "0.47769544", "0.47769544", "0.47769544", "0.47763616", "0.47729316", "0.47642672", "0.47599658", "0.475711", "0.47561237", "0.47509715", "0.4747879", "0.47476512", "0.47460872", "0.47457942", "0.47408003", "0.47352028", "0.47300786", "0.47253102", "0.472165", "0.47190037", "0.4713693", "0.4713693", "0.4713693", "0.47136432", "0.47134426", "0.4699795", "0.46956587", "0.46807986", "0.46789044", "0.46784794", "0.46737766", "0.46734965", "0.4672718", "0.46708757", "0.46683154", "0.4665704", "0.466486", "0.46565446", "0.46545306", "0.4647643", "0.46360016" ]
0.6410919
1
If our sweeper detects that a UniqueShapeName was updated call this
def after_update(unique_shape_name) expire_cache_for(unique_shape_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_create(unique_shape_name)\n expire_cache_for(unique_shape_name)\n end", "def after_destroy(unique_shape_name)\n expire_cache_for(unique_shape_name)\n end", "def after_update(shape_type)\n expire_cache_for(shape_type)\n end", "def after_update(shape)\n expire_cache_for(shape)\n end", "def create_shape\n id = rand 7\n @cur_y = 0\n @cur_x = 5\n @shape = SHAPES[id].dup\n end", "def name!( ɴ )\n old_ɴ = namespace.__instances__[ self ] # previous name\n if ɴ then # puts \"NameMagic: Rudely naming with #{ɴ}.\" if DEBUG\n ɴ = namespace.send( :validate_name, # honor the hook\n namespace.name_set_hook.( ɴ, self, old_ɴ ) ).to_sym\n # puts \"NameMagic: Name adjusted to #{ɴ}.\" if DEBUG\n return false if old_ɴ == ɴ # already named as required\n pair = namespace.__instances__.rassoc( ɴ )\n namespace.__forget__( pair[0] ) if pair # rudely forget the collider\n namespace.const_set ɴ, self # write a constant\n namespace.__instances__[ self ] = ɴ # write to @instances\n namespace.__forget__ old_ɴ # forget the old name of self\n else\n self.name = nil # unnaming, no collider issues\n end\n end", "def pass\n Shape.send_message(\"shape #{name} #{xpos} #{ypos} #{size}\")\n update_attribute :passed, true\n end", "def remove_shape\n\t\[email protected]_at(0)\n\tend", "def after_create(shape)\n# expire_cache_for(shape)\n end", "def after_create(shape_type)\n expire_cache_for(shape_type)\n end", "def is_name_update?\n return false if @chunks.size < 10\n [-10, -7, -6, -5, -4, -2, -1].map {|i| @chunks[i] } ==\n [83, OP_2DROP, OP_DROP, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG]\n end", "def update(visualizer)\r\n #check for spontaneous splits\r\n for _, value in $CRN.reactions.select { |key, val| key == [self] }\r\n if rand($MIN_TICS / visualizer.minFramesValue * value[0]).round == 0\r\n visualizer.split([self], value[1])\r\n end\r\n end\r\n self.x += self.v[:x]\r\n self.y += self.v[:y]\r\n end", "def initialize_ISG_shape(shape_uid)\n\t\t\t# create dictionary if it doesn't exist\n\t\t\t@dict = self.attribute_dictionary 'IterativeSG', true\n\t\t\t@rules_applied = Array.new\n\t\t\t\n\t\t\t# define rule that generated this shape\n\t\t\t@applied_by_rule = @dict.get_attribute 'IterativeSG', 'applied_by_rule'\n\t\t\t\n\t\t\t# UIDs are a bit different - when shape is copied, they should\n\t\t\t# not remain the same. So make sure to change them even if they exist.\n\t\t\tcurrent_uid = @dict.get_attribute 'IterativeSG', 'UID'\n\t\t\tif current_uid == nil\n\t\t\t\t@UID = shape_uid\n\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', shape_uid\n\t\t\telse\n\t\t\t\tif Controller.UIDs.include? current_uid\n\t\t\t\t\t@UID = shape_uid\n\t\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', shape_uid\n\t\t\t\telse\n\t\t\t\t\t@UID = current_uid\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@component_name = self.definition.name\n\t\t\t# define current position for faster access\n\t\t\tself.update_shape\n\t\t\t\n\t\t\treturn @UID\n\t\tend", "def update_object(new_name, log)\n self.name = new_name\n save\n observation.log(:log_naming_updated,\n name: format_name, touch: log)\n true\n end", "def after_save\n validate_uniqueness_as_run(:name)\n end", "def remove shape\n @remove_shapes << shape\n end", "def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end", "def assign_until_unique(piece)\n x = Random.new.rand(1..@size)\n y = Random.new.rand(1..@size)\n unless coordinates.include? [x, y]\n piece.coordinates = [x, y]\n return piece\n end\n assign_until_unique(piece)\n end", "def check_for_collision\n canonical_id = name.identify\n polls = Poll.all(:conditions => {:id => canonical_id})\n if polls.count > 0\n errors.add(:base, \"Name too similar to that of an existing poll\")\n end\n end", "def unique_name\n return nil if ignoring_request?\n\n @unique_name ||= begin\n scope_layer = LayerConverters::FindLayerByType.new(self).scope\n if scope_layer\n scope_layer.legacy_metric_name\n else\n :unknown\n end\n end\n end", "def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end", "def name_uniqueness\n other_sprint = Sprint.where(board_id: self.board_id, name: self.name).where.not(id: self.id).count\n if other_sprint > 0\n errors.add(:name, 'must be uniq.')\n end\n end", "def did_name_change?\n @name_changed = name_id_changed?\n true\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @scaled_shape = args[:scaled_shape] if args.key?(:scaled_shape)\n @scaling_function = args[:scaling_function] if args.key?(:scaling_function)\n end", "def _structure_changed tf=true\n @_structure_changed = tf\n @repaint_required = true\n fire_dimension_changed\n #@list = nil\n end", "def update_bitmap\n @effectus_old_name = @picture.name\n if @effectus_old_name.empty?\n self.bitmap = nil\n else\n self.bitmap = Cache.picture(@effectus_old_name)\n @effectus_center_x = bitmap.width / 2\n @effectus_center_y = bitmap.height / 2\n end\n end", "def render\n update\n @batch.begin\n case @shape_type\n when :filled\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Filled)\n when :point\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Point)\n when :line\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Line)\n else\n @shape.begin(com.badlogic.gdx.graphics.glutils.ShapeRenderer::ShapeType::Filled)\n end\n display\n @shape.end unless @shape.nil?\n @batch.end\n end", "def is_name_firstupdate?\n return false if @chunks.size < 11\n [-11, -7, -6, -5, -4, -2, -1].map {|i| @chunks[i] } ==\n [82, OP_2DROP, OP_2DROP, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG]\n end", "def update\n # The update occurs only if the shape is falling. If it lays on other shapes\n # nothing happen\n if ( @falling ) \n # After a movement or gravity update, we check if the moved shape collides with the world.\n # If it does, we restore its position to the last known good position.\n # This is the reason why the old position is kept.\n old_x = @x\n old_y = @y\n \n # Check if it is passed enough time to let the shape falls.\n # In this case @y is increased by 32 pixels.\n if needs_fall_update?\n @y = (@y + @game.block_height)\n end\n \n # We let the shape falls but if it collides the following occurs:\n # 1. the shape returns to the old position\n # 2. the falling process completes\n # 3. the game engine let a new shape to fall\n # 4. a check is done to verify if a line has been completed and then can be removed.\n if ( collide )\n @y = (old_y)\n @falling = false\n @game.spawn_next_shape\n @game.delete_lines_of(self)\n else \n # If enough time is passed for an horizontal movement do the following:\n # 1. if user pressed left key update the x position moving the shape on the left.\n # 2. if user pressed right key update the x position moving the shape on the right.\n #\n # After the movement check if the shape collide with something else. If so,\n # recover its old x position.\n if needs_move_update?\n if (@game.button_down?(Gosu::KbLeft))\n @x = (@x - @game.block_width)\n end\n if (@game.button_down?(Gosu::KbRight))\n @x = ( @x + @game.block_width)\n end\n \n if ( collide )\n @x = (old_x)\n end \n end \n end\n end\n end", "def unique?(name)\n tgts = resolve_mapping(name)\n targets = tgts.is_a?(Array) ? tgts : find(tgts)\n targets.size == 1\n end", "def unique_name(name)\n if @commands_by_name.include?(name)\n count = 2\n name2 = nil\n while (name2 = name + count.to_s) && @commands_by_name.include?(name2)\n count += 1\n end\n name2\n else\n name\n end\n end", "def update_shape()\n\t\t\t# define current position for faster access\n\t\t\t@position = self.bounds.center\n\t\t\tedges = self.definition.entities.to_a { |ent| ent.class == Sketchup::Edge }\n\t\t\t\n\t\t\t# set vertices array\n\t\t\tvertices = Array.new\n\t\t\tedges.each do |edge|\n\t\t\t\tvertices << edge.vertices\n\t\t\tend\n\t\t\tvertices.flatten!\n\t\t\tvertices.uniq!\n\t\t\t\n\t\t\t# now calculate each vertex global position\n\t\t\t@points = Array.new\n\t\t\ttransformation = self.transformation\n\t\t\tvertices.each do |vertex|\n\t\t\t\t@points << (vertex.position.transform! transformation)\n\t\t\tend\n\t\t\t\n\t\t\t@trans_array = transformation.to_a\n\t\t\treturn nil\n\t\tend", "def should_generate_new_friendly_id?\n name_changed? || super\n end", "def add_shape(shape, color, cell_x, cell_y)\n for shape_x in 0...shape.width\n for shape_y in 0...shape.height\n x_offset = shape_x + cell_x\n y_offset = shape_y + cell_y\n if shape.pattern[shape_y][shape_x] == 1\n grid[y_offset][x_offset] = color\n end\n end\n end\n\n updated\n end", "def update_name_windowskin\n windowskin_name = current_name_windowskin\n return if @name_windowskin_name == windowskin_name\n\n wb = @name_window.window_builder = current_name_window_builder\n @name_window.windowskin = RPG::Cache.windowskin(@name_windowskin_name = windowskin_name)\n @name_window.x = x\n if current_position != :top\n @name_window.y = y - wb[5] - wb[-1] - default_line_height - default_vertical_margin\n else\n @name_window.y = y + height + default_vertical_margin\n end\n @name_window.height = wb[5] + wb[-1] + default_line_height\n end", "def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end", "def _update!\n self.class.repository_or_fail.createPolygon self\n end", "def process_names(total)\n names = self.feature.names\n prioritized_names = self.feature.prioritized_names\n delete_feature_names = self.fields.delete('feature_names.delete')\n association_notes = self.feature.association_notes\n name_added = false\n name_changed = false\n if !delete_feature_names.blank? && delete_feature_names.downcase == 'yes'\n names.clear\n association_notes.delete(association_notes.where(:association_type => 'FeatureName'))\n end\n replace_feature_names = self.fields.delete('feature_names.replace')\n if !replace_feature_names.blank?\n name = names.find_by(name: replace_feature_names)\n if name.nil?\n self.say \"Feature name to be replaced #{replace_feature_names} does not exist for feature #{self.feature.pid}\"\n else\n name_str = self.fields.delete('feature_names.name')\n if name_str.blank?\n self.say \"No name specified to replace #{replace_feature_names} for feature #{self.feature.pid}.\"\n else\n name.update_attributes(name: name_str, skip_update: true)\n name_changed = true\n end\n end\n end\n name_positions_with_changed_relations = Array.new\n relations_pending_save = Array.new\n delete_is_primary = self.fields.delete('feature_names.is_primary.delete')\n if !delete_is_primary.blank? && delete_is_primary.downcase == 'yes'\n names.where(:is_primary_for_romanization => true).each do |name|\n name_changed = true if !name_changed\n name.update_attributes(:is_primary_for_romanization => false, :skip_update => true)\n end\n end \n # feature_names.note can be used to add general notes to all names of a feature\n 0.upto(3) do |i|\n feature_names_note = self.fields.delete(i==0 ? 'feature_names.note' : \"feature_names.#{i}.note\")\n if !feature_names_note.blank?\n note = association_notes.find_by(association_type: 'FeatureName', content: feature_names_note)\n if note.nil?\n note = association_notes.create(:association_type => 'FeatureName', :content => feature_names_note)\n self.spreadsheet.imports.create(:item => note) if note.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end\n self.say \"Feature name note #{feature_names_note} could not be saved for feature #{self.feature.pid}\" if note.nil?\n end\n end\n name = Array.new(total)\n 1.upto(total) do |i|\n n = i-1\n name_tag = \"#{i}.feature_names\"\n name_str = self.fields.delete(\"#{name_tag}.name\")\n if name_str.blank?\n name_str = self.fields.delete(\"#{name_tag}.existing_name\")\n next if name_str.blank?\n name[n] = names.find_by(name: name_str)\n existing = true\n else\n existing = false\n end\n relationship_system_code = self.fields.delete(\"#{i}.feature_name_relations.relationship.code\")\n if !relationship_system_code.blank?\n relationship_system = SimpleProp.get_by_code(relationship_system_code)\n if relationship_system.nil?\n self.say \"Phonetic or orthographic system with code #{relationship_system_code} was not found for feature #{self.feature.pid}.\"\n else\n if relationship_system.instance_of? OrthographicSystem\n orthographic_system = relationship_system\n elsif relationship_system.instance_of? PhoneticSystem\n phonetic_system = relationship_system\n elsif relationship_system.instance_of? AltSpellingSystem\n alt_spelling_system = relationship_system\n else\n self.say \"Relationship #{relationship_system_code} has to be either phonetic or orthographic for feature #{self.feature.pid}.\"\n end\n end\n else\n begin\n orthographic_system = OrthographicSystem.get_by_code_or_name(self.fields.delete(\"#{i}.orthographic_systems.code\"), self.fields.delete(\"#{i}.orthographic_systems.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n begin\n phonetic_system = PhoneticSystem.get_by_code_or_name(self.fields.delete(\"#{i}.phonetic_systems.code\"), self.fields.delete(\"#{i}.phonetic_systems.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n end\n if !existing\n conditions = {:name => name_str}\n begin\n language = Language.get_by_code_or_name(self.fields.delete(\"#{i}.languages.code\"), self.fields.delete(\"#{i}.languages.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n begin\n writing_system = WritingSystem.get_by_code_or_name(self.fields.delete(\"#{i}.writing_systems.code\"), self.fields.delete(\"#{i}.writing_systems.name\"))\n conditions[:writing_system_id] = writing_system.id if !writing_system.nil?\n rescue Exception => e\n self.say e.to_s\n end\n begin\n alt_spelling_system = AltSpellingSystem.get_by_code_or_name(self.fields.delete(\"#{i}.alt_spelling_systems.code\"), self.fields.delete(\"#{i}.alt_spelling_systems.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n # if language is not specified it may be inferred.\n if language.nil?\n if phonetic_system.nil?\n language = Language.get_by_code('zho') if !writing_system.nil? && (writing_system.code == 'hant' || writing_system.code == 'hans')\n else\n language = Language.get_by_code('bod') if phonetic_system.code=='ethnic.pinyin.tib.transcrip' || phonetic_system.code=='tib.to.chi.transcrip'\n end\n end\n etymology = self.fields.delete(\"#{name_tag}.etymology\")\n conditions[:language_id] = language.id if !language.nil?\n name[n] = names.find_by(conditions)\n is_primary = self.fields.delete(\"#{i}.feature_names.is_primary\")\n conditions[:is_primary_for_romanization] = is_primary.downcase=='yes' ? 1 : 0 if !is_primary.blank?\n conditions[:etymology] = etymology if !etymology.blank?\n \n # now deal with relationships\n relation_conditions = Hash.new\n relation_conditions[:orthographic_system_id] = orthographic_system.id if !orthographic_system.nil?\n relation_conditions[:phonetic_system_id] = phonetic_system.id if !phonetic_system.nil?\n relation_conditions[:alt_spelling_system_id] = alt_spelling_system.id if !alt_spelling_system.nil?\n position = self.fields.delete(\"#{i}.feature_names.position\")\n if name[n].nil? || !relation_conditions.empty? && name[n].parent_relations.find_by(relation_conditions).nil?\n conditions[:position] = position if !position.blank?\n name[n] = names.create(conditions.merge({:skip_update => true}))\n if !name[n].id.nil?\n self.spreadsheet.imports.create(:item => name[n]) if name[n].imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n name_added = true if !name_added\n end\n else\n name[n].position = position if !position.blank?\n name[n].etymology = etymology if !etymology.blank?\n if name[n].changed?\n name[n].save!\n self.spreadsheet.imports.create(:item => name[n]) if name[n].imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n name_changed = true\n end\n end\n if name[n].id.nil?\n self.say \"Name #{name_str} could not be added to feature #{self.feature.pid}. #{name[n].errors.messages.to_s}\"\n next\n end\n end\n 0.upto(4) do |j|\n prefix = j==0 ? \"#{i}.feature_names\" : \"#{i}.feature_names.#{j}\"\n self.add_date(prefix, name[n])\n self.add_info_source(prefix, name[n])\n self.add_note(prefix, name[n])\n end\n is_translation_str = self.fields.delete(\"#{i}.feature_name_relations.is_translation\")\n is_translation = is_translation_str.downcase=='yes' ? 1: 0 if !is_translation_str.blank?\n parent_node_str = self.fields.delete(\"#{i}.feature_name_relations.parent_node\")\n parent_name_str = self.fields.delete(\"#{i}.feature_name_relations.parent_node.name\") if parent_node_str.blank?\n # for now is_translation is the only feature_name_relation that can be specified for a present or missing (inferred) parent.\n # if no parent is specified, it is possible to infer the parent based on the relationship to an already existing name.\n if parent_node_str.blank? && parent_name_str.blank?\n # tibetan must be parent\n if !phonetic_system.nil? && (phonetic_system.code=='ethnic.pinyin.tib.transcrip' || phonetic_system.code=='tib.to.chi.transcrip')\n parent_name = FeatureExtensionForNamePositioning::HelperMethods.find_name_for_writing_system(prioritized_names, WritingSystem.get_by_code('tibt').id)\n if parent_name.nil?\n self.say \"No tibetan name was found to associate #{phonetic_system.code} to #{name_str} for feature #{self.feature.pid}.\"\n else\n name_relation = name[n].parent_relations.find_by(parent_node_id: parent_name.id)\n if name_relation.nil?\n name_relation = name[n].parent_relations.create(:skip_update => true, :parent_node_id => parent_name.id, :phonetic_system_id => phonetic_system.nil? ? nil : phonetic_system.id, :is_phonetic => 1, :is_translation => is_translation)\n if name_relation.nil?\n self.say \"Could not associate #{name_str} to Tibetan name for feature #{self.feature.pid}.\"\n else\n parent_name.update_hierarchy\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n end\n else\n name_relation.update_attributes(:phonetic_system_id => phonetic_system.nil? ? nil : phonetic_system.id, :is_phonetic => 1, :orthographic_system_id => nil, :is_orthographic => 0, :is_translation => is_translation)\n end\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end \n end\n # now check if there is simplified chinese and make it a child of trad chinese\n writing_system = name[n].writing_system\n if !writing_system.nil? && writing_system.code=='hant'\n simp_chi_name = FeatureExtensionForNamePositioning::HelperMethods.find_name_for_writing_system(prioritized_names, WritingSystem.get_by_code('hans').id)\n if !simp_chi_name.nil?\n name_relation = simp_chi_name.parent_relations.first\n if name_relation.nil?\n name_relation = name[n].child_relations.create(:skip_update => true, :is_orthographic => 1, :orthographic_system_id => OrthographicSystem.get_by_code('trad.to.simp.ch.translit').id, :is_translation => is_translation, :child_node_id => simp_chi_name.id)\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n if name_relation.nil?\n self.say \"Could not make #{name_str} a parent of simplified chinese name for feature #{self.feature.pid}\"\n else\n simp_chi_name.update_hierarchy\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n end\n elsif !phonetic_system.nil? && phonetic_system.code=='tib.to.chi.transcrip'\n # only update if its tibetan\n name_relation.update_attributes(:phonetic_system_id => nil, :is_phonetic => 0, :orthographic_system_id => OrthographicSystem.get_by_code('trad.to.simp.ch.translit').id, :is_orthographic => 1, :is_translation => is_translation, :parent_node_id => name[n].id)\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end\n # pinyin should be a child of the traditional and not the simplified chinese\n name_relation = simp_chi_name.child_relations.find_by(phonetic_system_id: PhoneticSystem.get_by_code('pinyin.transcrip').id)\n if !name_relation.nil?\n name_relation.update_attribute(:parent_node_id, name[n].id)\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end\n end\n end\n else\n conditions = {:skip_update => true, :phonetic_system_id => phonetic_system.nil? ? nil : phonetic_system.id, :orthographic_system_id => orthographic_system.nil? ? nil : orthographic_system.id, :is_translation => is_translation, :alt_spelling_system_id => alt_spelling_system.nil? ? nil : alt_spelling_system.id}\n is_phonetic = self.fields.delete(\"#{i}.feature_name_relations.is_phonetic\")\n if is_phonetic.blank?\n conditions[:is_phonetic] = phonetic_system.nil? ? 0 : 1\n else\n conditions[:is_phonetic] = is_phonetic.downcase=='yes' ? 1 : 0\n end\n is_orthographic = self.fields.delete(\"#{i}.feature_name_relations.is_orthographic\")\n if is_orthographic.blank?\n conditions[:is_orthographic] = orthographic_system.nil? ? 0 : 1\n else\n conditions[:is_orthographic] = is_orthographic.downcase=='yes' ? 1: 0\n end\n is_alt_spelling = self.fields.delete(\"#{i}.feature_name_relations.is_alt_spelling\")\n if is_alt_spelling.blank?\n conditions[:is_alt_spelling] = is_alt_spelling.nil? ? 0 : 1\n else\n conditions[:is_alt_spelling] = is_alt_spelling.downcase=='yes' ? 1: 0\n end\n if parent_node_str.blank?\n if !parent_name_str.blank?\n parent_name = prioritized_names.detect{|fn| fn.name==parent_name_str}\n if parent_name.nil?\n self.say \"Parent name #{parent_name_str} of #{name[n].name} for feature #{self.feature.pid} not found.\"\n else\n name << parent_name\n parent_position = name.size - 1\n end\n end\n else\n parent_position = parent_node_str.to_i-1\n end \n relations_pending_save << { :relation => name[n].parent_relations.build(conditions), :parent_position => parent_position }\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n name_positions_with_changed_relations << parent_position if !name_positions_with_changed_relations.include? parent_position\n end\n end\n relations_pending_save.each do |item|\n pending_relation = item[:relation]\n parent_node = name[item[:parent_position]]\n if parent_node.nil?\n self.say \"Parent name #{item[:parent_position]} of #{pending_relation.child_node.id} for feature #{self.feature.pid} not found.\"\n else\n relation = pending_relation.child_node.parent_relations.find_by(parent_node_id: parent_node.id)\n if relation.nil?\n pending_relation.parent_node = parent_node\n relation = pending_relation.save\n self.say \"Relation between names #{relation.child_note.name} and #{relation.parent_node.name} for feature #{self.feature.pid} could not be saved.\" if relation.nil? \n end \n end\n end\n\n # running triggers for feature_name\n if name_added\n views = self.feature.update_name_positions\n views = self.feature.update_cached_feature_names if views.blank? && name_changed\n end\n\n # running triggers for feature_name_relation\n name_positions_with_changed_relations.each{|pos| name[pos].update_hierarchy if !name[pos].nil?}\n return name_changed || name_added\n end", "def container?\n @name == 'shape'\n end", "def toggle_pods\n @pods = (@pods + 1) % 2\n if @pods == 1\n @shapes_pods.each do |shape|\n @window.space.add_shape(shape)\n end\n else\n @shapes_pods.each do |shape|\n @window.space.remove_shape(shape)\n end \n end\n end", "def duplicate_component()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.LayoutEditor_duplicate_component(@handle.ptr)\n end", "def set_name_as_untitled\n if name.blank?\n untitled_count = attachable ? attachable.photo_albums.untitled.size : self.class.without_attachable.untitled.size\n self.name = \"#{UNTITLED_NAME} #{untitled_count + 1}\"\n end\n true\n end", "def should_generate_new_friendly_id?\r\n name_changed? || super\r\n end", "def should_generate_new_friendly_id?\n name_changed?\n end", "def should_generate_new_friendly_id?\n name_changed?\n end", "def should_generate_new_friendly_id?\n name_changed?\n end", "def should_generate_new_friendly_id?\n name_changed?\n end", "def should_generate_new_friendly_id?\n name_changed?\n end", "def notify_species_lists\n # Tell all the species lists it belonged to.\n species_lists.each do |spl|\n spl.log(:log_observation_destroyed2, name: unique_format_name,\n touch: false)\n end\n\n # Save namings so we can delete them after it's dead.\n @old_namings = namings\n end", "def validate_unique_name(name)\n if @@events.reduce(true) {|outcome, event| outcome && (event.name != name)}\n # Event name is unique.\n return name\n else\n handle_validation_fail \"That event name already exists!\"\n return false\n end\n end", "def after_destroy(shape_type)\n expire_cache_for(shape_type)\n end", "def update(visualization)\n NamedMap.stats_aggregator.timing('named-map.update') do\n @template = NamedMap.get_template_data( visualization, @parent )\n\n retries = 0\n success = true\n begin\n response = self.class.http_client.put( url + '?api_key=' + @parent.api_key, {\n headers: @parent.headers,\n body: ::JSON.dump( @template ),\n ssl_verifypeer: @parent.verify_cert,\n ssl_verifyhost: @parent.verify_host,\n followlocation: true,\n connecttimeout: HTTP_CONNECT_TIMEOUT,\n timeout: HTTP_REQUEST_TIMEOUT\n } )\n\n if response.code == 200\n success = true\n elsif response.code == 400 && response.body =~ /is locked/i && retries < 3\n sleep(2**retries)\n ## We hit a Tiler lock, wait and retry\n retries += 1\n else\n raise HTTPResponseError.new(\"PUT:#{response.code} #{response.request.url} #{response.body}\", @template)\n end\n end until success\n @template\n end\n end", "def new_name; end", "def dup_pixi tmpFlg, repost=false\r\n ListingDataProcessor.new(self).dup_pixi tmpFlg, repost\r\n end", "def identify\n self.dup.identify!\n end", "def object_name_changed\n logger.debug(\"kpi_id = #{session[:kpi_id].size}\") unless session[:kpi_id].nil?\n # Select left box\n unless params[:can_select_object_name].nil?\n @already_select_object_names = (session[:object_names].nil?)? Array.new : session[:object_names]\n unless session[:kpi_id].nil?\n # One more kpi can only select one object\n if session[:kpi_id].size > 1\n @already_select_object_names = Array.new\n session[:object_names] = nil\n end\n end\n params[:can_select_object_name].each{|object_name|@already_select_object_names.push(object_name)}\n @can_select_object_names = @all_object_names - @already_select_object_names\n session[:object_names] = @already_select_object_names\n end\n # Select right box\n unless params[:already_select_object_name].nil?\n @already_select_object_names = (session[:object_names].nil?)? Array.new : session[:object_names]\n params[:already_select_object_name].each{|object_name|@already_select_object_names.delete(object_name)}\n @can_select_object_names = @all_object_names - @already_select_object_names\n session[:object_names] = @already_select_object_names\n end\n # Set chart number\n set_chart_number\n end", "def original_name; end", "def ensure_unique_in_chain\n self.entity.spots.each { |s| remove_duplicate_blueprint(s) }\n self.entity.apply_to_children do |entity|\n remove_duplicate_blueprint(entity)\n entity.spots.each { |s| remove_duplicate_blueprint(s) }\n end\n end", "def process_collection!(name, key, value, remote)\n if collection.key?(name)\n existing_remote = collection[name.to_s][:remote]\n # skip if the existing item is local and the new item is remote\n return if remote && !existing_remote\n raise \"Duplicate item with name '#{name}' was detected.\" unless existing_remote && !remote\n\n # override if the existing item is remote and the new is local\n logger.info \"Duplicate item with name '#{name}' was detected from the remote folder.\"\n end\n collection[name.to_s] = { name: name.to_s, type: key, value: value, remote: remote }\n end", "def duplicate?\n @duplicate == true\n end", "def _unique(name)\n seen = (@_seen ||= Set.new)\n if seen.include?(name)\n raise ArgumentError, \"duplicate field: #{name.inspect}\"\n else\n seen << name\n end\n end", "def not_duplicate_route\n return unless waypoints.length != 0 && self.name_changed? && self.name != \"Trip route\"\n Route.find_by_radius(waypoints.first.latitude,waypoints.first.longitude, 20).each do |route|\n next if self.id == route.id #Prevents self testing on update\n if route.name == name\n\tputs \"There is already another #{type.titleize.tableize.singularize} in this area with that name. This #{type.titleize.tableize.singularize} might have already been submitted.\"\n errors.add(:route, \"There is already another #{type.titleize.tableize.singularize} in this area with that name. This #{type.titleize.tableize.singularize} might have already been submitted.\")\n end\n end\n end", "def unique_name?(full_name)\n # Initialize a cache that will return false if a name is not\n # recognized, but will remember the name for next time\n $name_cache ||= Hash.new do |hash, key|\n hash[key] = \"recognized\"\n false\n end\n $name_cache[full_name]\nend", "def update name,params=nil\n\n # Skip hook calls made by update\n # (separate to options[:skiphook]):\n skiphook = (params && params[:skiphook])\n\n options = {\n :resize => true, # Force resize even if it exists\n :skiphook => true # Don't run hooks\n }\n\n # Update all sized instances of an original:\n if params.nil?\n r = self.image(name)\n return if r.nil?\n original = resolve(r[:original])\n others = r[:widths].collect{|w|\n self.fetch(name,options.merge(:width => w))}\n others += r[:heights].collect{|h|\n self.fetch(name,options.merge(:height => h))}\n @hooks.create(:original => original,\n :sized => others,\n :update => true) if @hooks && !skiphook\n return original\n\n # Update single sized image:\n else\n nm = fetch(name,params.merge(options))\n @hooks.create(:sized => nm,\n :update => true) if @hooks && !skiphook\n return nm\n end\n end", "def validates_duplicity_of(attr_name, scope: nil)\n set_callback :save, :before, Callback.new(attr_name, scope)\n end", "def update_name\n # update the name so it includes the standard_template string\n name_array = [@standard_template]\n name_array << get_building_type\n @building_sections.each do |bld_tp|\n name_array << bld_tp.standards_building_type\n end\n name_array << @name if [email protected]? && !@name == ''\n @name = name_array.join('|').to_s\n end", "def unique_name\n entity = Entity.where(\n :name => self.name,\n :parent_id => self.parent_id\n )\n if entity.blank?\n return true\n else\n errors.add( :base, \"Entity already exist...\" )\n end\n end", "def update\n @shape_type = ShapeType.find(params[:id])\n\n\t\t# get the parent shape type\n\t\tparent = ShapeType.find(params[:parent_shape])\n\n respond_to do |format|\n\t\t\tif parent.nil?\n\t format.html { render action: \"edit\" }\n\t format.json { render json: @shape_type.errors, status: :unprocessable_entity }\n\t\t\telse\n\t\t\t\t# see if the parent shape changed\n\t\t\t\tanc_ary = @shape_type.ancestry.split(\"/\")\n\t\t\t\tif (anc_ary.length == 1 && parent.id.to_s == anc_ary[0]) || parent.id.to_s == anc_ary[anc_ary.length-1]\n\t\t\t\t\t# parent shape did not change, do nothing\n\t\t\t\telse\n\t\t\t\t\t# parent shape did change. update the ancestry value\n\t\t\t\t\tnew_anc = parent.ancestor_ids.join(\"/\")\n\t\t\t\t\tnew_anc += \"/\" + parent.id.to_s\n\t\t\t\t\tparams[:shape_type][:ancestry] = new_anc\n\t\t\t\tend\n\n\t\t if @shape_type.update_attributes(params[:shape_type])\n\t\t\t\t\tmsg = I18n.t('app.msgs.success_updated', :obj => I18n.t('app.common.shape_type'))\n\t\t\t\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n\t\t format.html { redirect_to admin_shape_type_path(@shape_type), notice: msg }\n\t\t format.json { head :ok }\n\t\t else\n\t\t format.html { render action: \"edit\" }\n\t\t format.json { render json: @shape_type.errors, status: :unprocessable_entity }\n\t\t end\n\t end\n end\n end", "def test_duplicate_name_allowed\n type = Type.new(:name => \"Personification\")\n type.metaphor_id = types(:metaphor_9682_type).metaphor_id\n assert type.save\n end", "def equal_to?(shape)\n return false if shape.type != @type\n shape.squares.each do |square|\n found = false\n #Shapes don't have to have the same order of squares\n @squares.each do |sq|\n found = true if square.x == sq.x and square.y == sq.y\n end\n return false if !found\n end\n return true\n end", "def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end", "def ensure_unique_tasks_names! \n for i in 0..(@tasks_params.count-2)\n for j in (i+1)..(@tasks_params.count-1)\n raise RuntimeError, 'Duplicated tasks names' if @tasks_params[i.to_s][:name] == @tasks_params[j.to_s][:name]\n end\n end\n end", "def avoid_duplicate_image_names(content)\n nodes = content.xpath(\"//draw:frame[@draw:name]\")\n nodes.each_with_index do |node, i|\n node.attribute('name').value = \"pic_#{i}\"\n node.xpath(\".//draw:image\").each do |draw_image|\n if !draw_image.attribute('href').nil?\n href = draw_image.attribute('href').value\n end\n unless href.to_s.empty?\n @global_image_paths_set.add(href) \n end\n end\n end\n end", "def should_generate_new_friendly_id?\n\t name_changed?||self.slug.nil?\n\tend", "def name=( ɴ )\n old_ɴ = namespace.__instances__[ self ] # previous name\n if ɴ then # puts \"NameMagic: Naming with argument #{ɴ}.\" if DEBUG\n ɴ = namespace.send( :validate_name, # honor the hook\n namespace.name_set_hook.( ɴ, self, old_ɴ ) ).to_sym\n # puts \"NameMagic: Name adjusted to #{ɴ}.\" if DEBUG\n return if old_ɴ == ɴ # already named as required\n fail NameError, \"Name '#{ɴ}' already exists in #{namespace} namespace!\" if\n self.class.__instances__.rassoc( ɴ )\n namespace.const_set ɴ, self # write a constant\n namespace.__instances__[ self ] = ɴ # write to @instances\n namespace.__forget__ old_ɴ # forget the old name of self\n else # puts \"NameMagic: Unnaming #{old_ɴ || self}\" if DEBUG\n namespace.__instances__.update( self => nil ) # unname in @instances\n namespace.send :remove_const, old_ɴ if old_ɴ # remove namespace const.\n end\n end", "def unique? name\n\t\trobots = ObjectSpace.each_object(Robot).to_a\n\t\traise \"There are 17,676 robots, we've run out of names\" if robots.length > 17676\n\t\trobots.each { |r| return false if r.name == name }\n\t\treturn true\n\tend", "def reload_name!\n clear_name_cache\n end", "def should_generate_new_friendly_id?\n name_changed? || super\n end", "def fire_duplicate_id(old_entity, new_entity); end", "def set_partial_name_match\n return if waypoints.length == 0\n #Only need to compute partial name match if new or a name has changed.\n return unless self.id.nil? || self.name_changed? || self.alternate_names_changed?\n #For each place look for trimmed name inside the places full names\n Place.find_by_radius(averageLatitude, averageLongitude, 70).each do |place|\n next if place == self\n trimmed_names.each do |trimmed| #Look for trimmed names in neighbour places names\n\tplace.raw_names.each do |name|\n\t if name.match(trimmed)\n\t self.partial_name_match = false\n\t return\n\t end\n\tend\n end\n end\n self.partial_name_match = true\n end", "def marker_unique_by\n nil\n end", "def update\n @ship.update\n @needs_redraw ||= @ship.needs_redraw?\n end", "def no_duplicate_places\n\n return if (self.latitude.nil? || self.longitude.nil?) && border_points.length < 3\n return unless name_changed? || self.id.nil? || self.latitude_changed? || self.longitude_changed?\n places = Place.find_by_radius(centerLatitude,centerLongitude,0.02,0)\n if(places.length > 1 || (places.length == 1 && places.first != self))\n errors.add(:latitude, \"Must be at least 20 meters from other places\")\n end\n\n Place.find_by_radius(centerLatitude, centerLongitude, 10, 0).each do |place|\n if place.id != self.id && place.name == self.name\n errors.add(:name, \"There is already a #{self.class.to_s} with that name in this area\")\n end\n end\n end", "def update_ships\n # A data structure to store the ships in\n\n ships = [\n [\"Brittana\", [\"Brittany P.\", \"Santana L.\"]],\n [\"Faberry\", [\"Quinn F.\", \"Rachel B.\"]],\n [\"Flanamotta\", [\"Rory F.\", \"Sugar\"]],\n [\"Sory\", [\"Rory F.\", \"Sam E.\"]],\n [\"Seblaine\", [\"Sebastian S.\", \"Blaine A.\"]],\n [\"Santofsky\", [\"D. Karofsky\", \"Santana L.\"]],\n [\"Bartie\", [\"Brittany P.\", \"Artie A.\"]],\n [\"Tike\", [\"Mike C.\", \"Tina C.\"]],\n [\"Pezberry\", [\"Santana L.\", \"Rachel B.\"]],\n [\"Pizes\", [\"Lauren Z.\", \"Puck\"]],\n [\"St. Berry\", [\"Jesse sJ.\", \"Rachel B.\"]],\n [\"Kill\", [\"Kurt H.\", \"Will S.\"]],\n [\"Puckurt\", [\"Kurt H.\", \"Puck\"]],\n [\"Artina\", [\"Tina C.\", \"Artie A.\"]],\n [\"Partie\", [\"Puck\", \"Artie A.\"]],\n [\"Blainofskyve\", [\"Blaine A.\", \"D. Karofsky\"]],\n [\"Klaine\", [\"Kurt H.\", \"Blaine A.\"]],\n [\"Hummelberry\", [\"Kurt H.\", \"Rachel B.\"]],\n [\"Furt\", [\"Kurt H.\", \"Finn H.\"]],\n [\"Pinn\", [\"Puck\", \"Finn H.\"]],\n [\"Samcedes\", [\"Sam E.\", \"Mercedes J.\"]],\n [\"Artcedes\", [\"Artie A.\", \"Mercedes J.\"]],\n [\"Finchel\", [\"Finn H.\", \"Rachel B.\"]],\n [\"Puckleberry\", [\"Puck\", \"Rachel B.\"]],\n [\"Wemma\", [\"Will S.\", \"Emma P.\"]]\n ]\n\n ships.each do |ship_data|\n ship = Ship.find_by_name(ship_data[0])\n\n # Make sure the ship doesn't already exist\n if !ship\n\n # create a new ship\n ship = Ship.new()\n ship.name = ship_data[0]\n ship.save\n\n # For each character in the ship\n ship_characters = ship_data[1]\n generate_log(\"Generating New Ship: #{ship_data[0]} between #{ship_data[1]}\")\n ship_characters.each do |ship_character|\n character = generate_character(ship_character)\n # Save the relationship\n relationship = Relationship.new()\n relationship.ship = ship\n relationship.character = character\n relationship.save\n\n end\n else\n ship.update_attributes(:name => ship_data[0])\n ship.save\n generate_log(\"Updating: #{ship_data[0]} between #{ship_data[1]}\")\n\n\n end\n end\nend", "def markOrigin(ox, oy, oz)\n t = df.map_tile_at(ox, oy, oz)\n if t then\n s = t.shape_basic\n #TODO: preseve designation:\n #$originTile = t.designation # a global to store the original origin state\n #puts \"origin: #{$originTile}\"\n t.dig(:Default) if s == :Wall\n end\nend", "def post(original_name)\n img = Magick::ImageList.new(original_name)\n if check? img\n element_name = ELEMENTS_PATH + File.basename(original_name)\n export(img, element_name)\n else\n File.delete original_name\n end\n img.destroy!\n end", "def update\r\n super\r\n # Try to load the new file if the name is different\r\n if @picture_name != @picture.name\r\n @picture_name = @picture.name\r\n load_bitmap\r\n end\r\n # Don't update if the name is empty\r\n if @picture_name.empty?\r\n self.visible = false\r\n return\r\n end\r\n self.visible = true\r\n\r\n update_properties\r\n update_gif if @gif_handle\r\n end", "def update_bubbles\n @bubbles.each do |bubble|\n if bubble.position.y >= BubbleHeight or rand<BubbleDissapearChance\n @bubbles.delete(bubble)\n @bubbles.compact!\n else\n bubble.move\n end\n end\n add_bubble if rand <= Bubble_Spawn_Chance\n end", "def more_uniq\n self.uniq_level += 1\n self.rename\n self\n end", "def primary_square\n new_placements.squares.first\n end", "def must_be_unique\n errors.add(:failed, I18n.t('room_type_master_rate_mappings.create.message.already_exist')) if\n !RoomTypeMasterRateMapping.find_by_pool_id_and_room_type_id(self.pool_id, self.room_type_id).blank?\n end", "def process_names(total)\n names = self.feature.names\n prioritized_names = self.feature.prioritized_names\n # If feature_names.delete is \"yes\", all names and relations will be deleted.\n delete_feature_names = self.fields.delete('feature_names.delete')\n association_notes = self.feature.association_notes\n if !delete_feature_names.blank? && delete_feature_names.downcase == 'yes'\n names.clear\n association_notes.delete(association_notes.where(:association_type => 'FeatureName'))\n end\n name_added = false\n name_positions_with_changed_relations = Array.new\n relations_pending_save = Array.new\n name_changed = false\n\n delete_is_primary = self.fields.delete('feature_names.is_primary.delete')\n if !delete_is_primary.blank? && delete_is_primary.downcase == 'yes'\n names.where(:is_primary_for_romanization => true).each do |name|\n name_changed = true if !name_changed\n name.update_attributes(:is_primary_for_romanization => false, :skip_update => true)\n end\n end \n # feature_names.note can be used to add general notes to all names of a feature\n 0.upto(3) do |i|\n feature_names_note = self.fields.delete(i==0 ? 'feature_names.note' : \"feature_names.#{i}.note\")\n if !feature_names_note.blank?\n note = association_notes.where(:association_type => 'FeatureName', :content => feature_names_note).first\n note = association_notes.create(:association_type => 'FeatureName', :content => feature_names_note) if note.nil?\n puts \"Feature name note #{feature_names_note} could not be saved for feature #{self.feature.pid}\" if note.nil?\n end\n end\n name = Array.new(total)\n 1.upto(total) do |i|\n n = i-1\n name_str = self.fields.delete(\"#{i}.feature_names.name\")\n next if name_str.blank?\n conditions = {:name => name_str} \n begin\n language = Language.get_by_code_or_name(self.fields.delete(\"#{i}.languages.code\"), self.fields.delete(\"#{i}.languages.name\"))\n rescue Exception => e\n puts e.to_s\n end\n begin\n writing_system = WritingSystem.get_by_code_or_name(self.fields.delete(\"#{i}.writing_systems.code\"), self.fields.delete(\"#{i}.writing_systems.name\"))\n conditions[:writing_system_id] = writing_system.id if !writing_system.nil?\n rescue Exception => e\n puts e.to_s\n end\n begin\n alt_spelling_system = AltSpellingSystem.get_by_code_or_name(self.fields.delete(\"#{i}.alt_spelling_systems.code\"), self.fields.delete(\"#{i}.alt_spelling_systems.name\"))\n rescue Exception => e\n puts e.to_s\n end\n relationship_system_code = self.fields.delete(\"#{i}.feature_name_relations.relationship.code\")\n if !relationship_system_code.blank?\n relationship_system = SimpleProp.get_by_code(relationship_system_code)\n if relationship_system.nil?\n puts \"Phonetic or orthographic system with code #{relationship_system_code} was not found for feature #{self.feature.pid}.\"\n else\n if relationship_system.instance_of? OrthographicSystem\n orthographic_system = relationship_system\n elsif relationship_system.instance_of? PhoneticSystem\n phonetic_system = relationship_system\n else\n puts \"Relationship #{relationship_system_code} has to be either phonetic or orthographic for feature #{self.feature.pid}.\"\n end\n end\n else\n begin\n orthographic_system = OrthographicSystem.get_by_code_or_name(self.fields.delete(\"#{i}.orthographic_systems.code\"), self.fields.delete(\"#{i}.orthographic_systems.name\"))\n rescue Exception => e\n puts e.to_s\n end\n begin\n phonetic_system = PhoneticSystem.get_by_code_or_name(self.fields.delete(\"#{i}.phonetic_systems.code\"), self.fields.delete(\"#{i}.phonetic_systems.name\"))\n rescue Exception => e\n puts e.to_s\n end\n end\n # if language is not specified it may be inferred.\n if language.nil?\n if phonetic_system.nil?\n language = Language.get_by_code('chi') if !writing_system.nil? && (writing_system.code == 'hant' || writing_system.code == 'hans')\n else\n language = Language.get_by_code('tib') if phonetic_system.code=='ethnic.pinyin.tib.transcrip' || phonetic_system.code=='tib.to.chi.transcrip'\n end\n end\n conditions[:language_id] = language.id if !language.nil? \n name[n] = names.where(conditions).first\n is_primary = self.fields.delete(\"#{i}.feature_names.is_primary\")\n conditions[:is_primary_for_romanization] = is_primary.downcase=='yes' ? 1 : 0 if !is_primary.blank?\n relation_conditions = Hash.new\n relation_conditions[:orthographic_system_id] = orthographic_system.id if !orthographic_system.nil?\n relation_conditions[:phonetic_system_id] = phonetic_system.id if !phonetic_system.nil?\n relation_conditions[:alt_spelling_system_id] = alt_spelling_system.id if !alt_spelling_system.nil?\n position = self.fields.delete(\"#{i}.feature_names.position\")\n if name[n].nil? || !relation_conditions.empty? && name[n].parent_relations.where(relation_conditions).first.nil?\n conditions[:position] = position if !position.blank?\n name[n] = names.create(conditions.merge({:skip_update => true}))\n name_added = true if !name_added && !name[n].id.nil?\n elsif !position.blank?\n name[n].update_attribute(:position, position)\n name_changed = true\n end\n if name[n].id.nil?\n puts \"Name #{name_str} could not be added to feature #{self.feature.pid}.\"\n next\n end\n 0.upto(4) do |j|\n prefix = j==0 ? \"#{i}.feature_names\" : \"#{i}.feature_names.#{j}\"\n self.add_date(prefix, name[n])\n self.add_info_source(prefix, name[n])\n self.add_note(prefix, name[n])\n end\n is_translation_str = self.fields.delete(\"#{i}.feature_name_relations.is_translation\")\n is_translation = is_translation_str.downcase=='yes' ? 1: 0 if !is_translation_str.blank?\n parent_node_str = self.fields.delete(\"#{i}.feature_name_relations.parent_node\")\n parent_name_str = self.fields.delete(\"#{i}.feature_name_relations.parent_node.name\") if parent_node_str.blank?\n # for now is_translation is the only feature_name_relation that can be specified for a present or missing (inferred) parent.\n # if no parent is specified, it is possible to infer the parent based on the relationship to an already existing name.\n if parent_node_str.blank? && parent_name_str.blank?\n # tibetan must be parent\n if !phonetic_system.nil? && (phonetic_system.code=='ethnic.pinyin.tib.transcrip' || phonetic_system.code=='tib.to.chi.transcrip')\n parent_name = FeatureExtensionForNamePositioning::HelperMethods.find_name_for_writing_system(prioritized_names, WritingSystem.get_by_code('tibt').id)\n if parent_name.nil?\n puts \"No tibetan name was found to associate #{phonetic_system.code} to #{name_str} for feature #{self.feature.pid}.\"\n else\n name_relation = name[n].parent_relations.where(:parent_node_id => parent_name.id).first\n if name_relation.nil?\n name_relation = name[n].parent_relations.create(:skip_update => true, :parent_node => parent_name, :phonetic_system => phonetic_system, :is_phonetic => 1, :is_translation => is_translation)\n if name_relation.nil?\n puts \"Could not associate #{name_str} to Tibetan name for feature #{self.feature.pid}.\"\n else\n parent_name.update_hierarchy\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n end\n else\n name_relation.update_attributes(:phonetic_system => phonetic_system, :is_phonetic => 1, :orthographic_system => nil, :is_orthographic => 0, :is_translation => is_translation)\n end\n end \n end\n # now check if there is simplified chinese and make it a child of trad chinese\n writing_system = name[n].writing_system\n if !writing_system.nil? && writing_system.code=='hant'\n simp_chi_name = FeatureExtensionForNamePositioning::HelperMethods.find_name_for_writing_system(prioritized_names, WritingSystem.get_by_code('hans').id)\n if !simp_chi_name.nil?\n name_relation = simp_chi_name.parent_relations.first\n if name_relation.nil?\n name_relation = name[n].child_relations.create(:skip_update => true, :is_orthographic => 1, :orthographic_system => OrthographicSystem.get_by_code('trad.to.simp.ch.translit'), :is_translation => is_translation, :child_node => simp_chi_name)\n if name_relation.nil?\n puts \"Could not make #{name_str} a parent of simplified chinese name for feature #{self.feature.pid}\"\n else\n simp_chi_name.update_hierarchy\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n end\n elsif !phonetic_system.nil? && phonetic_system.code=='tib.to.chi.transcrip'\n # only update if its tibetan\n name_relation.update_attributes(:phonetic_system => nil, :is_phonetic => 0, :orthographic_system => OrthographicSystem.get_by_code('trad.to.simp.ch.translit'), :is_orthographic => 1, :is_translation => is_translation, :parent_node => name[n])\n end\n # pinyin should be a child of the traditional and not the simplified chinese\n name_relation = simp_chi_name.child_relations.where(:phonetic_system_id => PhoneticSystem.get_by_code('pinyin.transcrip')).first\n name_relation.update_attribute(:parent_node, name[n]) if !name_relation.nil?\n end\n end\n else \n conditions = {:skip_update => true, :phonetic_system => phonetic_system, :orthographic_system => orthographic_system, :is_translation => is_translation, :alt_spelling_system => alt_spelling_system}\n is_phonetic = self.fields.delete(\"#{i}.feature_name_relations.is_phonetic\")\n if is_phonetic.blank?\n conditions[:is_phonetic] = phonetic_system.nil? ? 0 : 1\n else\n conditions[:is_phonetic] = is_phonetic.downcase=='yes' ? 1 : 0\n end\n is_orthographic = self.fields.delete(\"#{i}.feature_name_relations.is_orthographic\")\n if is_orthographic.blank?\n conditions[:is_orthographic] = orthographic_system.nil? ? 0 : 1\n else\n conditions[:is_orthographic] = is_orthographic.downcase=='yes' ? 1: 0\n end\n is_alt_spelling = self.fields.delete(\"#{i}.feature_name_relations.is_alt_spelling\")\n if is_alt_spelling.blank?\n conditions[:is_alt_spelling] = is_alt_spelling.nil? ? 0 : 1\n else\n conditions[:is_alt_spelling] = is_alt_spelling.downcase=='yes' ? 1: 0\n end\n if parent_node_str.blank?\n if !parent_name_str.blank?\n parent_name = prioritized_names.detect{|fn| fn.name==parent_name_str}\n if parent_name.nil?\n puts \"Parent name #{parent_name_str} of #{name[n].name} for feature #{self.feature.pid} not found.\"\n else\n name << parent_name\n parent_position = name.size - 1\n end\n end\n else\n parent_position = parent_node_str.to_i-1\n end \n relations_pending_save << { :relation => name[n].parent_relations.build(conditions), :parent_position => parent_position }\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n name_positions_with_changed_relations << parent_position if !name_positions_with_changed_relations.include? parent_position\n end\n end\n relations_pending_save.each do |item|\n pending_relation = item[:relation]\n parent_node = name[item[:parent_position]]\n if parent_node.nil?\n puts \"Parent name #{item[:parent_position]} of #{pending_relation.child_node.id} for feature #{self.feature.pid} not found.\"\n else\n relation = pending_relation.child_node.parent_relations.where(:parent_node_id => parent_node.id).first\n if relation.nil?\n pending_relation.parent_node = parent_node\n relation = pending_relation.save\n puts \"Relation between names #{relation.child_note.name} and #{relation.parent_node.name} for feature #{self.feature.pid} could not be saved.\" if relation.nil? \n end \n end\n end\n\n # running triggers for feature_name\n self.feature.update_name_positions if name_added\n if name_added || name_changed\n self.feature.update_cached_feature_names\n self.feature.expire_tree_cache\n end\n\n # running triggers for feature_name_relation\n name_positions_with_changed_relations.each{|pos| name[pos].update_hierarchy if !name[pos].nil?}\n end", "def update\n\n # Iterate over every sprite we handle, updating their positions\n @sprites.each { |sp|\n\n # extract the sprite meta data fmor the @params hash\n params = @params[sp.name]\n\n # update the sprites position\n sp.x += params[:dx]\n sp.y += params[:dy]\n\n # Check the sprite is staying within its defined bounds\n check_bounds(sp,params)\n\n # does the sprite need to decelerate?\n if params[:decelerate]\n params[:dx] *= params[:decelerate]\n params[:dy] *= params[:decelerate]\n end\n\n # does this sprite need to be destroyed\n if sp.off_screen?\n @sprites.delete(sp)\n params[:num] -= 1\n puts \"Deleting spite: #{sp.name}\"\n end\n }\n\n # Check to see if we need to create new sprites\n @params.values.each do |p|\n # Only add a new instance of this sprite if we need too\n if p[:num] < p[:max_num]\n # use rand to randomly generate a sprite \n if rand(1000) < p[:rarity]\n if sp = create_sprite(p)\n @sprites << sp\n p[:num] += 1\n end\n end\n end\n end \n end", "def check_source_cluster_annotations\n existing_annotations = self.cluster_group.cell_annotations.map {|a| a['name']}\n if existing_annotations.include?(self.name) && !self.queued_for_deletion\n errors.add(:name, \"- '#{self.name}' already exists as an annotation in the selected cluster. Please choose a different name.\")\n end\n end", "def is_name_new?\n return false if @chunks.size < 8\n [-8, -6, -5, -4, -2, -1].map {|i| @chunks[i] } ==\n [OP_1, OP_2DROP, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG]\n end", "def update_bitmap\n if graphic_changed?\n @tile_id = @character.tile_id\n @character_name = @character.character_name\n @character_index = @character.character_index\n if @tile_id > 0\n set_tile_bitmap\n else\n set_character_bitmap\n end\n end\n end", "def uuid_overwrite?\n @uuid_overwrite\n end", "def update_bitmap\n if @picture.name.empty?\n self.bitmap = nil\n else\n self.bitmap = swap_cache(@picture.name)\n end\n end", "def on_update(new_point)\n end", "def device_block_name_modification\n return @device_block_name_modification\n end" ]
[ "0.6507056", "0.60477304", "0.56410486", "0.5639614", "0.55599785", "0.5416625", "0.5255165", "0.5229306", "0.5210432", "0.51466656", "0.51098204", "0.5103404", "0.5073991", "0.50669867", "0.5055709", "0.50451624", "0.50352347", "0.5023767", "0.5012722", "0.500739", "0.49794924", "0.49751693", "0.49695635", "0.496419", "0.4958196", "0.49108154", "0.4905616", "0.48831692", "0.48774508", "0.4876201", "0.48534754", "0.4849663", "0.48352787", "0.48215947", "0.48061696", "0.4803391", "0.48013765", "0.47951108", "0.4793705", "0.4787509", "0.47791898", "0.47731996", "0.47731394", "0.47693944", "0.47693944", "0.47693944", "0.47693944", "0.47693944", "0.4746954", "0.47369653", "0.47313187", "0.47230107", "0.47229144", "0.4721092", "0.47208494", "0.4717775", "0.4711687", "0.47006667", "0.4696974", "0.46911976", "0.4687524", "0.46814537", "0.46781868", "0.46775514", "0.4677037", "0.46677", "0.46599218", "0.4658174", "0.4654035", "0.4651391", "0.46494627", "0.4646683", "0.46414477", "0.4641198", "0.46366924", "0.46328205", "0.46307337", "0.46292543", "0.46288258", "0.4627915", "0.4627022", "0.46249014", "0.4623758", "0.46189135", "0.46186996", "0.46183947", "0.46183786", "0.4611159", "0.46027622", "0.45982862", "0.45939004", "0.45931083", "0.459138", "0.45823872", "0.4578586", "0.45781082", "0.457754", "0.45770547", "0.45743424", "0.45740816" ]
0.70050925
0
If our sweeper detects that a UniqueShapeName was deleted call this
def after_destroy(unique_shape_name) expire_cache_for(unique_shape_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_shape\n\t\[email protected]_at(0)\n\tend", "def after_create(unique_shape_name)\n expire_cache_for(unique_shape_name)\n end", "def remove shape\n @remove_shapes << shape\n end", "def after_update(unique_shape_name)\n expire_cache_for(unique_shape_name)\n end", "def after_destroy(shape_type)\n expire_cache_for(shape_type)\n end", "def after_destroy(shape)\n expire_cache_for(shape)\n end", "def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end", "def delete(name); end", "def delete(name); end", "def empty_shapes\n\t\t\t\tshapes.clear\n\t\t\tend", "def after_create(shape)\n# expire_cache_for(shape)\n end", "def destroy\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_shape = CulturalHeritage::Shape.find(params[:id])\n mensaje = @cultural_heritage_shape.erasable\n if mensaje.blank?\n @cultural_heritage_shape.deleted = 1\n @cultural_heritage_shape.save\n end\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_shapes_url, :notice => mensaje) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end", "def cleanup_old_person\n\t\tself.person_was.destroy if self.person_was && self.person_was.show_positions.count == 0 && self.person_was.netid.blank?\n\tend", "def after_create(shape_type)\n expire_cache_for(shape_type)\n end", "def before_destroy\n \n begin\n del_html = \"#{SHIP_LABELS_STORE}/#{File.basename(self.label)}\"\n del_graphic = \"#{SHIP_LABELS_STORE}/label#{File.basename(self.label).gsub(\".html\", \".gif\")}\"\n FileUtils.rm del_html, :force => true\n FileUtils.rm del_graphic, :force => true\n rescue\n return true\n end\n\n end", "def destroy\n @mouth_shape.destroy\n respond_to do |format|\n format.html { redirect_to mouth_shapes_url, notice: 'La Forma de Boca ha sido eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def after_update(shape_type)\n expire_cache_for(shape_type)\n end", "def remove plataform\n end", "def remove!; end", "def after_update(shape)\n expire_cache_for(shape)\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def create_shape\n id = rand 7\n @cur_y = 0\n @cur_x = 5\n @shape = SHAPES[id].dup\n end", "def drop(name)\n tuples = primary.lookup_vals(name)\n return delete(tuples).size > 0\n end", "def destroy\n @shade.destroy\n end", "def delete_item(name)\n previous = items.size\n items.reject! { |item| item.name == name}\n previous != items.size\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def _delete\n marked_for_destruction?\n end", "def delete(name)\n\n end", "def deleted?(name, options = T.unsafe(nil)); end", "def delete_obj\r\n # display confirmation dialog\r\n result = UI.messagebox(\"Delete this #{@objtype}?\" , MB_YESNO, \"Confirm Delete\")\r\n \r\n # delete if yes\r\n if (result == 6)\r\n @wall.objects.delete(@selected_obj)\r\n draw_obj\r\n end\r\n Sketchup.active_model.select_tool(nil)\r\nend", "def remove!\n zombie_check\n self.class.remove(@name)\n end", "def _destroy(*)\n fail NotImplementedError\n end", "def delete_category\n if self.shoes.empty?\n self.delete\n else\n return false\n end\n end", "def remove *k\n\t\t\t# todo combine queries in a transaction\n\t\t\tActiveOrient::Base.logger.debug { \"delete: #{@name} --< #{k.map(&:to_or).join( ' :: ' )}\"}\n\t\t k.map{|l|\[email protected]( {remove: { @name => l} } ) }\n\t#\t\[email protected]!\n\t#\t\[email protected] @name \n\t\tend", "def remove_gladiator(name)\n if gladiators.empty? #TODO: Could be cleaner\n return false\n end\n if gladiators[0].name != name\n if gladiators[1].name != name\n return false\n else\n mercy?\n return gladiators.pop\n end\n else\n if is_able?\n swap_gladiators\n end\n mercy?\n return gladiators.pop\n end\n end", "def delete_object(x, y)\n @generator_flag = false if @grid[y][x].object.class == MapAbxn::Generator\n @grid[y][x] = nil\n end", "def destroy_item(klass, name, type_name)\n begin\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end\n end", "def destroy_item(klass, name, type_name)\n begin\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end\n end", "def destroy_item(klass, name, type_name)\n begin\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end\n end", "def _drop\n true\n end", "def remove_vertex(id)\n # YOUR WORK HERE\n end", "def remove name\n delete(name)\n end", "def destroy?\n name == :destroy\n end", "def before_destroy\n\t\tresult, message = self.delete_image\n\n\t\tif result != true\n\t\t\traise message\n\t\tend\n\n\t\treturn result\n\tend", "def remove(category, shape)\n @rows.delete_if { |row| row.id == shape.id }\n @by_id.delete_if { |id, row| id == shape.id }\n @by_category[category].delete_if { |sh| sh.id == shape.id }\n if shape.label\n key = \"#{category}_#{RGeom::Util.sort_symbol(shape.label)}\"\n @by_label.delete_if { |k,v| k == key }\n end\n end", "def remove!\n update_attributes(x_position: nil, y_position: nil)\n end", "def destroy_image?\n self.image.clear if @image_delete == \"1\"\n end", "def destroy\n @cow_shade.destroy\n end", "def delete_front()\n \n end", "def did_destroy\n @destroyed = true\n self.class.identity_map.delete self.id\n self.class.all.delete self\n\n trigger_events(:destroy)\n end", "def remove_previously_stored_preview\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n @previous_model_for_avatar = nil\n end\n end", "def delete\n NamedMap.stats_aggregator.timing('named-map.delete') do\n response = self.class.http_client.delete( url + '?api_key=' + @parent.api_key,\n {\n headers: @parent.headers,\n ssl_verifypeer: @parent.verify_cert,\n ssl_verifyhost: @parent.verify_host,\n followlocation: true,\n connecttimeout: HTTP_CONNECT_TIMEOUT,\n timeout: HTTP_REQUEST_TIMEOUT\n } )\n raise HTTPResponseError, \"DELETE:#{response.code} #{response.request.url} #{response.body}\" unless response.code == 204\n end\n end", "def post(original_name)\n img = Magick::ImageList.new(original_name)\n if check? img\n element_name = ELEMENTS_PATH + File.basename(original_name)\n export(img, element_name)\n else\n File.delete original_name\n end\n img.destroy!\n end", "def _destroy\n !!@destroy\n end", "def destroy\n @graphic.destroy\n end", "def ensure_unique_in_chain\n self.entity.spots.each { |s| remove_duplicate_blueprint(s) }\n self.entity.apply_to_children do |entity|\n remove_duplicate_blueprint(entity)\n entity.spots.each { |s| remove_duplicate_blueprint(s) }\n end\n end", "def _destroy\n marked_for_destruction?\n end", "def remove_before_destroy?\n true\n end", "def delete(name)\n return super(name) if name.is_a?(Fixnum)\n remove(name)\n end", "def destroy_item(klass, name, type_name)\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end", "def delete_operations; end", "def remove_previously_stored_image\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n @previous_model_for_image = nil\n end\n end", "def delete\n Phidgets::FFI::Common.delete(@handle)\n true\n end", "def run_on_deletion(paths)\n end", "def run_on_deletion(paths)\n end", "def remove_tower\n end", "def delete name,params=nil\n\n # Skip hook calls made by update\n skiphook = (params && params[:skiphook])\n\n images = self.image(name)\n return nil if images.nil?\n o = absolute(images[:original])\n\n if params.nil? || (!params[:width] && !params[:height])\n File.delete(o) if File.exists?(o)\n [:widths,:heights].each do |w|\n images[w].each do |i|\n File.delete(absolute(name,\n (w==:widths ? :width : :height) => i))\n end\n end\n @hooks.delete(:original => images[:original],\n :sized => images[:widths]+images[:heights]) if @hooks && !skiphook\n return o\n\n else\n w,h = params[:width],params[:height]\n n = nil\n if w\n n = absolute(name,:width => w)\n File.delete(n)\n @hooks.delete(:sized => [n]) if @hooks && !skiphook\n elsif h\n n = absolute(name,:height => h)\n File.delete(n)\n @hooks.delete(:sized => [n]) if @hooks && !skiphook\n else\n raise 'Error #2 '+@@errors[2]\n end\n return n\n\n end\n end", "def del(name)\n data.delete(name)\n end", "def delete_matched\n raise NotImplementedError, \"#{self.class} does not support delete_matched\"\n end", "def remove_should_check_existing?\n true\n end", "def container?\n @name == 'shape'\n end", "def erase\r\n @name = nil.to_s\r\n end", "def destroy\n @circle.destroy\n head :no_content \n end", "def before_destroy\n if supplier_pos.count != 0\n return false\n else\n return true\n end\n end", "def delete_orphans\n count = 0\n mapper.dataset.each do |content|\n unless valid_path?(content)\n content.destroy\n count += 1\n end\n end\n @dirty ||= (count > 0)\n count\n end", "def handle_destroy\n if !self.is_straightforward\n\n\n self.to_remove_array = []\n user = self.collection.user\n # user.default_collections = user.collections.includes(:games).limit(3)\n #Check if the target collection is in the user's defaults\n if user.default_collections.include?(self.collection)\n user.collections.each do |collection|\n if collection.id != self.collection_id &&\n collection.games.include?(self.game)\n CollectionGame.find_by(\n collection_id: collection.id,\n game_id: self.game.id).destroy\n collection.save\n self.to_remove_array.push(collection.id)\n break\n end\n end\n review = Review.find_by(user_id: user.id, game_id: self.game.id)\n if review\n review.destroy\n self.removeReviewId = review.id\n end\n end\n end\n end", "def destroy\n @size_group.destroy\n\n render :nothing => true\n end", "def delete_component(name)\n components.delete_if { |c| c.name == name.to_sym }\n end", "def delete(name)\n @by_name.delete(name)\n true\n end", "def toggle_pods\n @pods = (@pods + 1) % 2\n if @pods == 1\n @shapes_pods.each do |shape|\n @window.space.add_shape(shape)\n end\n else\n @shapes_pods.each do |shape|\n @window.space.remove_shape(shape)\n end \n end\n end", "def _remove_method\n :\"_remove_#{singularize(self[:name])}\"\n end", "def destroy\n common_name = @taxon.common_name\n @taxon.destroy\n respond_to do |format|\n format.html { redirect_to taxons_path, notice: \"Species: '#{common_name}' was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n @array_roses.pop\nend", "def delete_unknown\n Jhead.call(\"-du\", @match, @pattern)\n end", "def shape_count\n\t\treturn @shapes.length\n\tend", "def delete_validator\n if is_used?\n self.errors.add \"This event is used on participant records. You must remove all participant events before deleteing this event type\"\n false\n end\n end", "def delete_command\n name = get_param(\"name=\", \"([a-zA-Z]+)\")\n\n deleted = false\n\n if name\n @app.delete_animal(name)\n else\n puts \"Error!: A name is required to delete an animal\"\n delete_command_help()\n end\n end", "def destroy \n\t\traise 'This feature is not supported'\n\tend", "def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end", "def delete_location\n if MusicCollection.find_rows(\"location_id\", @id) == []\n self.delete\n else\n false\n end\n end", "def destroy_item(klass, name, type_name)\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException => e\n error_message = \"#{e.message}. Could not find a #{type_name} named #{name} to delete!\"\n ui.warn(error_message)\n raise CloudExceptions::ServerDeleteError, error_message\n end", "def delete_local\n super\n end", "def delete_layer(layer_name)\n @cascade.delete(layer_name)\n end", "def destroyed(item)\n bowline.destroyed(\n name, \n item.id\n ).call\n end", "def remove(name)\n @collection.delete_if { |f| f.name == name }\n end", "def remove(name)\n @j_map.remove(name)\n self\n end", "def being_removed?(item)\n state_group(item) == :remove\n end" ]
[ "0.6897539", "0.68258774", "0.6726054", "0.6667117", "0.61867195", "0.6176698", "0.6073247", "0.5678825", "0.5678825", "0.5655568", "0.5644912", "0.5583315", "0.55753475", "0.5567295", "0.55632305", "0.5528086", "0.5423195", "0.5402216", "0.5401047", "0.5361197", "0.53326184", "0.53326184", "0.53326184", "0.53326184", "0.5326362", "0.5312642", "0.5293956", "0.52846795", "0.52787066", "0.5260438", "0.52537334", "0.5224262", "0.5219339", "0.521282", "0.52005905", "0.5188555", "0.5188098", "0.5178908", "0.51770455", "0.51618606", "0.51618606", "0.51618606", "0.5149315", "0.51471186", "0.5145714", "0.51437527", "0.5142899", "0.51380837", "0.512534", "0.5112634", "0.51115054", "0.50935143", "0.5079487", "0.50770545", "0.50763303", "0.50656635", "0.50622153", "0.5055899", "0.503206", "0.502958", "0.5012215", "0.5007361", "0.5006923", "0.50007266", "0.4991734", "0.49913764", "0.49874544", "0.49874544", "0.49807703", "0.49806723", "0.4974839", "0.49657494", "0.49646553", "0.49560001", "0.49522784", "0.4948629", "0.49485406", "0.49465975", "0.49463344", "0.49284256", "0.49266887", "0.49224716", "0.49222997", "0.4920421", "0.49189058", "0.4904032", "0.49033856", "0.49032173", "0.49023667", "0.48986822", "0.48962232", "0.48946282", "0.48936915", "0.48905867", "0.48861822", "0.4884499", "0.4884156", "0.4879306", "0.48779574", "0.487707" ]
0.7283331
0
method to get location
def get_zip print "What is you location? (zip code): " zipcode = gets.chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location\n\n end", "def location\n fetch('hey_arnold.locations')\n end", "def getLocation\r\n\t\t\t\t\treturn @location\r\n\t\t\t\tend", "def location\n @location\n end", "def location\n return @location\n end", "def location\n @location\n end", "def location\n @location\n end", "def location\n\t\t@location\n\tend", "def location\n @location\n end", "def location\n # TODO Check this\n # return poi.location unless poi.nil?\n # return place.location unless place.nil?\n return get_location\n end", "def location\n fetch('rick_and_morty.locations')\n end", "def location\n @client.get(\"#{path}/location\")\n end", "def location\n fetch('doraemon.locations')\n end", "def location\n fetch('harry_potter.locations')\n end", "def location\n ensure_full_data!\n @gapi[\"location\"]\n end", "def location\n @gapi[\"location\"]\n end", "def full_location; end", "def location\n self.well_info.location\n end", "def get_current_loc\r\n\t\treturn driver.location\r\n\tend", "def location\n response[\"location\"]\n end", "def location\n @ole.Location\n end", "def location\n fetch('simpsons.locations')\n end", "def location\n peer.get_location\n end", "def location\n result_hash['loc']\n end", "def location\r\n infoxml = get_info\r\n return infoxml.at('location').inner_text\r\n end", "def location\n fetch('how_to_train_your_dragon.locations')\n end", "def location\n fetch('sword_art_online.location')\n end", "def location\n @location ||= Station.get(@attrs['LocationCode'])\n end", "def location\n fetch('games.super_mario.locations')\n end", "def location\n self\n end", "def location\n Location.get(@entity['location_id'], client: @client)\n end", "def location_s\n self.location.to_s\n end", "def location\n ans = location_answers.first\n ans ? ans.location : nil\n end", "def location\n return nil if reference?\n ensure_full_data!\n @gapi_json[:location]\n end", "def get_location(io, context)\n generate_location(io, context)\n end", "def getCurrentLocation\n nil\n end", "def location\n attributes.fetch(:location)\n end", "def get_current_location\n\t \tif Rails.env.test? || Rails.env.development?\n\t \t\t[43.648209, -79.397865] # Hello HackerYou!\n\t \telse\n\t \t\trequest.location\n\t \tend\n\t end", "def current_location\n object.location\n end", "def location\n fetch('books.the_kingkiller_chronicle.locations')\n end", "def location\n @location_cache || self.locations[0]\n end", "def location\n @location ||= locations.hq.first\n end", "def location_info(location = locations.first)\n if location\n location.full_location\n else\n []\n end\n end", "def location\n fetch('games.league_of_legends.location')\n end", "def location\n\t\tfireeagle_user.best_guess.name\n\tend", "def location\n return Location.find_by_LOCATION_PROFILE_ID(self.LOCATION_PROFILE_ID)\n end", "def get_location\n @street = request.location.street\n @city = request.location.city\n @state = request.location.state\n @country = request.location.country\n end", "def locate_by_ip\n request.location\n end", "def location\n raise NotImplementedError, 'Abstract method, please define `location` in subclass.'\n end", "def current_location\n ip = request.remote_ip\n results = Geocoder.search(ip)\n results.first.address\n end", "def location\n # and call a private getter method within\n puts \"I live on #{address.split[1]} street.\"\n end", "def location\n wrap.location\n end", "def to_s\n location\n end", "def show_location\n\n end", "def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end", "def locate(place)\n locations, = get :q => place\n return locations.first\n end", "def getlocation\r\n @myip = remote_ip()\r\n # based off freegeoip.net is really terrible\r\n result = Geocoder.search(@myip)\r\n @mylat = result.latitude\r\n @mylong = result.longitude\r\n @mycity = result.address\r\n #51.243048, -0.588458\r\n end", "def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend", "def location\n ln = location_name\n return nil if ln == \"\" || ln == nil\n @engine.item_by_name(location_name)\n end", "def get_location\n\n if (cookies[:location] != nil)\n @location = Location.from_cookie(cookies[:location])\n elsif (logged_in? == true)\n @location = current_user.location\n else\n @location = nil\n end\n\n return @location\n end", "def path\n @location.path\n end", "def location\n vm.location\n end", "def final_location\n\t\[email protected]\n\tend", "def location\n @gapi.job_reference.location\n end", "def located_at\n return @located_at if @located_at\n \n # return outside location if set\n unless self.outside_location.blank?\n @located_at = self.outside_location\n return @located_at\n end\n \n # return location if applicable\n if self.location\n @located_at = self.location.name\n return @located_at\n end\n \n @located_at = \"Anywhere\"\n return @located_at\n end", "def office_location\n return @office_location\n end", "def locate(location)\n get :q => location.is_a?(String) ? location : location_from_params(location).to_s, :output => 'locations'\n end", "def get_location(ip)\n\t\t\tresponse_data = LocationApi.new.call(ip)\n\t\t\tLocationJsonParser.new.parse(response_data)\n\t\tend", "def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def location\n recommendations 'location'\n end", "def locate(address)\n get :location => address\n end", "def get_location\n @lat, @lng = request.location.try(:latitude), request.location.try(:longitude) \n end", "def location\n @fog_wrapper.location\n end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end" ]
[ "0.90447307", "0.83649945", "0.83343536", "0.83129394", "0.83128643", "0.8299312", "0.8299312", "0.8198253", "0.81554526", "0.8142865", "0.80478805", "0.8023135", "0.7997128", "0.7991822", "0.79700375", "0.79527926", "0.7949214", "0.7903897", "0.7882957", "0.78698426", "0.78276503", "0.78265136", "0.7825893", "0.7813416", "0.78006953", "0.77837044", "0.7779678", "0.7771017", "0.763688", "0.7628073", "0.76060325", "0.7600267", "0.75585496", "0.7531798", "0.7519241", "0.7510796", "0.74894077", "0.74818355", "0.74775517", "0.74627566", "0.74282986", "0.7416089", "0.74159384", "0.739641", "0.73465985", "0.7322124", "0.73112345", "0.7306438", "0.73011893", "0.7272125", "0.72496974", "0.72289145", "0.7222529", "0.71895546", "0.7187093", "0.7170658", "0.7164704", "0.7135704", "0.7129781", "0.7125012", "0.71091396", "0.70811015", "0.7066956", "0.7043688", "0.70137215", "0.7005584", "0.7004754", "0.69859517", "0.6978077", "0.6971959", "0.6968631", "0.6964035", "0.6941886", "0.69362396", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119", "0.6929119" ]
0.0
-1
method to draw separator line
def hor_line for i in 1..40 print "-" end puts '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line\n print H_SEP * columns\n end", "def draw_separation(x_start, y_start, y_min, y_max, x)\n @canvas.g.translate(x_start, y_start) do |lines|\n lines.styles(:stroke=>'#CCCCCC', :stroke_width=>1, :opacity=>0.05)\n lines.line(x, y_min, x, y_max)\n end\n end", "def line_divider \n puts @header.light_blue\n end", "def divider_line\n lines - 2\n end", "def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end", "def print_separator_line\nline = \"\"\n3.times do\n3.times { line << SEPARATOR[:horizontal] }\nline << SEPARATOR[:cross]\nend\nputs line[0...line.length - 1]\nprint \"\\t\"\nend", "def draw_dashed(x_start, y_start, x_end, value, stat_max, stat_min, rotated=false)\n y_interval = @box_size*9\n x_begin = @box_size * 0.7\n stat_interval = stat_max - stat_min\n dash1 = @box_size/5+1\n dash2 = @box_size/2\n dash_array = Array.new\n dash_array << dash1\n dash_array << dash2\n y = ((stat_max-value) / stat_interval) * y_interval\n\t\ty = y_interval - y if rotated\n @canvas.g.translate(x_start, y_start) do |l|\n l.styles(:fill=>'none', :stroke_width=>1, :stroke=>'gray', :fill_opacity=>0.0, :stroke_dasharray=>dash_array)\n l.line(x_begin, y, x_end-x_start, y)\n end\n end", "def horizontal_seperator y, x, x2\n [x, y, x2, y, 150, 150, 150]\n end", "def drawDashedLine(x0,y0,x1,y1,thickness=1,color=\"grey\")\n @gc.set_foreground(getColor(color)) ;\n @gc.set_line_attributes(thickness, Gdk::LINE_ON_OFF_DASH,\n\t\t\t Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER) \n\n @buffer.draw_line(@gc,valX(x0),valY(y0),valX(x1),valY(y1)) ;\n end", "def find_separator(pb, x)\n sep_color = Color.new(113, 76, 47)\n (125 - pb.rect.y).upto(pb.rect.height - 1) do |y|\n return y if ImageUtils.color_diff(sep_color, pb.get_color(x, y)) < 2\n # return y if sep_color == pb.get_pixel(x, y)\n end\n puts \"Acro: No separator found.\"\n return -1\n end", "def separator; end", "def line_stroke(left_border, junc_border, right_border, &block)\n stroke = ''\n stroke += left_border if settings.border.left?\n dimensions.num_cols.times do |col_num|\n stroke += junc_border if col_num > 0 && settings.border.inner_vert?\n stroke += yield\n end\n stroke += right_border if settings.border.right?\n stroke\n end", "def drawDashedLine(x0,y0,x1,y1,thickness=1,color=\"grey\") ;\n @device.drawDashedLine(x0,y0,x1,y1,thickness,color) ;\n end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n puts \" \"\n end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n puts \" \"\n end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n puts \" \"\n end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def draw_eol\n print \"\\r\\e[#{columns - 1}C#{V_SEP}\\n\"\n end", "def vertical_seperator x, y, y2\n [x, y, x, y2, 150, 150, 150]\n end", "def separator\n self.horizontal_bar * @width\n end", "def middle_line\n border_options.separator ? \"\" : super\n end", "def draw_line_markers\n return if @hide_line_markers\n\n\n # have to do this here (AGAIN)... see draw() in this class\n # because this funtion is called before the @radius, @center_x and @center_y are set\n @radius = @graph_height / 2.0\n @center_x = @graph_left + (@graph_width / 2.0)\n @center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit\n\n\n # Draw horizontal line markers and annotate with numbers\n @d = @d.stroke(@marker_color)\n @d = @d.stroke_width 1\n\n\n (0..@column_count-1).each do |index|\n rad_pos = index * Math::PI * 2 / @column_count\n\n @d = @d.line(@center_x, @center_y, @center_x + Math::sin(rad_pos) * @radius, @center_y - Math::cos(rad_pos) * @radius)\n\n\n marker_label = labels[index] ? labels[index].to_s : '000'\n\n draw_label(@center_x, @center_y, rad_pos * 360 / (2 * Math::PI), @radius, marker_label)\n end\n end", "def draw_line(number)\n @dim.times do |i|\n if i+1 == number || @dim-i == number\n print draw_x\n else\n print draw_dot\n end\n end\n end", "def separator = '********************' * 8", "def render_seperators\n outputs.lines << horizontal_seperator(505, grid.left, 445)\n outputs.lines << horizontal_seperator(353, grid.left, 445)\n outputs.lines << horizontal_seperator(264, grid.left, 445)\n outputs.lines << horizontal_seperator(174, grid.left, 445)\n\n outputs.lines << vertical_seperator(445, grid.top, grid.bottom)\n\n outputs.lines << horizontal_seperator(690, 445, 820)\n outputs.lines << horizontal_seperator(426, 445, 820)\n\n outputs.lines << vertical_seperator(820, grid.top, grid.bottom)\n end", "def display_bottom_separator(width = HOLE_SIZE, new_line = true, tab = true)\n\t\tdisplay_separator_row(SEPARATOR[:sw_corner], SEPARATOR[:s_divide], \n\t\t\t SEPARATOR[:se_corner], width, new_line, tab)\n\tend", "def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend", "def separator\n nil\n end", "def draw_line(x1,y1,x2,y2,r,g,b,graph_function=false)\r\n if ( @line_dot_size > 1 )\n self.draw_dotted_line(x1,y1,x2,y2,@line_dot_size,r,g,b,graph_function)\n else\n r = 0 if ( r < 0 ) \n r = 255 if ( r > 255 ) \r\n g = 0 if ( g < 0 ) \n g = 255 if ( g > 255 ) \r\n b = 0 if ( b < 0 ) \n b = 255 if ( b > 255 ) \r\n distance = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) \r\n if ( distance == 0 )\r\n #return -1\n else \r\n xstep = (x2-x1) / distance\r\n ystep = (y2-y1) / distance\r\n i =0\n while i<=distance \r\n x = i * xstep + x1\r\n y = i * ystep + y1\r\n if((x >= @garea_x1 && x <= @garea_x2&& y >= @garea_y1 && y <= @garea_y2) || !graph_function )\r\n if ( @line_width == 1 )\r\n self.draw_antialias_pixel(x,y,r,g,b)\n else\r\n start_offset = -(@line_width/2) \n end_offset = (@line_width/2)\n j = start_offset\n while j<=end_offset\n self.draw_antialias_pixel(x+j,y+j,r,g,b)\n end \r\n end\r\n end\n i =i+1\r\n end\n end \n end \r\n end", "def draw_line_markers\n return if @hide_line_markers\n\n @d = @d.stroke_antialias false\n\n if @y_axis_increment.nil?\n # Try to use a number of horizontal lines that will come out even.\n #\n # TODO Do the same for larger numbers...100, 75, 50, 25\n if @marker_count.nil?\n (3..7).each do |lines|\n if @spread % lines == 0.0\n @marker_count = lines\n break\n end\n end\n @marker_count ||= 4\n end\n @increment = (@spread > 0) ? significant(@spread / @marker_count) : 1\n else\n # TODO Make this work for negative values\n @maximum_value = [@maximum_value.ceil, @y_axis_increment].max\n @minimum_value = @minimum_value.floor\n calculate_spread\n\n normalize() # default to false to fix y_axis_increment assignment on line chart\n\n @marker_count = (@spread / @y_axis_increment).to_i\n @increment = @y_axis_increment\n end\n\n (0..@marker_count).each do |index|\n line_diff = (@graph_right - @graph_left) / @marker_count\n x = @graph_right - (line_diff * index) - 1\n @d = @d.fill(@marker_color)\n @d = @d.line(x, @graph_bottom, x, @graph_top)\n diff = index - @marker_count\n marker_label = diff.abs * @increment + @minimum_value\n\n unless @hide_line_numbers\n @d.fill = @font_color\n @d.font = @font if @font\n @d.stroke = 'transparent'\n @d.pointsize = scale_fontsize(@marker_font_size)\n @d.gravity = CenterGravity\n # TODO Center text over line\n @d = @d.annotate_scaled(@base_image,\n 0, 0, # Width of box to draw text in\n x, @graph_bottom + (LABEL_MARGIN * 2.0), # Coordinates of text\n marker_label.to_s, @scale)\n end # unless\n @d = @d.stroke_antialias true\n end\n end", "def separator\n '+' + @widths.map { |w| '-' * (w+2) }.join('+') + '+' \n end", "def draw_line(x1,y1,x2,y2,r,g,b,graph_function=false)\n if ( @line_dot_size > 1 )\n self.draw_dotted_line(x1,y1,x2,y2,@line_dot_size,r,g,b,graph_function)\n else\n r = 0 if ( r < 0 )\n r = 255 if ( r > 255 )\n g = 0 if ( g < 0 )\n g = 255 if ( g > 255 )\n b = 0 if ( b < 0 )\n b = 255 if ( b > 255 )\n distance = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))\n if ( distance == 0 )\n #return -1\n else\n xstep = (x2-x1) / distance\n ystep = (y2-y1) / distance\n i =0\n while i<=distance\n x = i * xstep + x1\n y = i * ystep + y1\n if((x >= @g_area_x1 && x <= @g_area_x2&& y >= @g_area_y1 && y <= @g_area_y2) || !graph_function )\n if ( @line_width == 1 )\n self.draw_antialias_pixel(x,y,r,g,b)\n else\n start_offset = -(@line_width/2)\n end_offset = (@line_width/2)\n j = start_offset\n while j<=end_offset\n self.draw_antialias_pixel(x+j,y+j,r,g,b)\n end\n end\n end\n i =i+1\n end\n end\n end\n end", "def draw_horizontal(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = PATH_CHAR } \n end", "def draw_vertical(start_line, end_line, start_char)\n start_line.upto(end_line) do |line_idx| \n @lines[line_idx][start_char] = PATH_CHAR \n end\n end", "def separator\n return @separ if @separ\n str = \"\"\n if @numbering\n str = \"-\"*(rows+1)+@x\n end\n each_column { | c, ix|\n v = c.width\n next if v == 0 ## hidden column\n str << \"-\" * (v+1) + @x \n }\n @separ = str.chop\n end", "def draw_line_markers\n return if @hide_line_markers\n\n (0..marker_count).each do |index|\n marker_label = (BigDecimal(index.to_s) * BigDecimal(@increment.to_s)) + BigDecimal(minimum_value.to_s)\n x = @graph_left + ((marker_label - minimum_value) * @graph_width / @spread)\n draw_marker_vertical_line(x, tick_mark_mode: true)\n\n unless @hide_line_numbers\n label = y_axis_label(marker_label, @increment)\n y = @graph_bottom + @label_margin + (labels_caps_height / 2.0) + 5 # 5px offset for tick_mark_mode\n text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)\n text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)\n end\n end\n end", "def draw_alt_line\n @dim.times do |i|\n if i.even?\n print draw_x\n else\n if @type == \"allx\"\n print draw_x\n elsif @type == \"alt\"\n print draw_dot\n end\n end\n end\n end", "def draw\n lines = []\n\n indent = @height - 1\n draw_braches(lines, indent)\n\n lines\n end", "def print_divider\n\t\tputs \"------------------------------------------------------------\"\n\tend", "def draw_line_markers\n return if @hide_line_markers\n\n # Draw horizontal line markers and annotate with numbers\n number_of_lines = marker_count\n number_of_lines = 1 if number_of_lines == 0\n\n # TODO: Round maximum marker value to a round number like 100, 0.1, 0.5, etc.\n increment = significant(@spread / number_of_lines)\n (0..number_of_lines).each do |index|\n line_diff = (@graph_right - @graph_left) / number_of_lines\n x = @graph_right - (line_diff * index) - 1\n draw_marker_vertical_line(x)\n\n unless @hide_line_numbers\n diff = index - number_of_lines\n marker_label = (BigDecimal(diff.abs.to_s) * BigDecimal(increment.to_s)) + BigDecimal(minimum_value.to_s)\n label = x_axis_label(marker_label, @increment)\n y = @graph_bottom + @label_margin + (labels_caps_height / 2.0)\n text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)\n text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)\n end\n end\n end", "def separator\n return [] if border_options.separator # == EACH_ROW #TODO ask about this looks broken.\n # how could border_options ever be nil, if we just did border_options.separator\n border_options ? super : nil\n end", "def separator(type); end", "def draw_horizontal_line(y, h = 2)\n contents.fill_rect(0, y, contents_width, h, text_color(QuestData::COLOURS[:line]))\n contents.fill_rect(0, y + h, contents_width, [h / 2, 1].max, text_color(QuestData::COLOURS[:line_shadow]))\n end", "def draw_line_markers\n return if @hide_line_markers\n\n @d = @d.stroke_antialias false\n\n if @left_axis_increment.nil? || @right_axis_increment.nil?\n # Try to use a number of horizontal lines that will come out even.\n #\n # TODO Do the same for larger numbers...100, 75, 50, 25\n if @marker_count.nil?\n marker_count\n normalize(true)\n end\n @left_increment = @left_spread / @marker_count if !@left_spread.nil?\n @right_increment = @right_spread / @marker_count if !@right_spread.nil?\n end\n \n if @has_left_data\n @increment_scaled = @graph_height.to_f / (@left_spread / @left_increment)\n elsif @has_right_data\n @increment_scaled = @graph_height.to_f / (@right_spread / @right_increment)\n end\n\n increment_scale = @increment_scaled\n @increment_scaled = @increment_scaled.ceil\n\n @scale_percentage = increment_scale/@increment_scaled\n \n# y = @graph_top + @graph_height - @marker_count * @increment_scaled\n# @d.fill 'white'\n# @d.rectangle( @graph_left, y, @graph_right, @graph_bottom)\n\n # Draw horizontal line markers and annotate with numbers\n (0..@marker_count).each do |index|\n y = @graph_top + @graph_height - index.to_f * @increment_scaled\n\n @d.fill(@marker_color)\n @d.line(@graph_left, y.to_i, @graph_right, y.to_i)\n\n# @d.fill('black')\n# @d.line(@graph_left, y, @graph_left+3, y) if !(@left_increment.nil? && @left_minimum_value.nil?)\n# @d.line(@graph_right-3, y, @graph_right, y) if !(@right_increment.nil? && @right_minimum_value.nil?)\n\n marker_label = index * @left_increment + @left_minimum_value.to_f if !(@left_increment.nil? && @left_minimum_value.nil?)\n right_marker_label = index * @right_increment + @right_minimum_value.to_f if !(@right_increment.nil? && @right_minimum_value.nil?)\n\n unless @hide_line_numbers\n @d.fill = @font_color\n @d.font = @font if @font\n @d.stroke('transparent')\n @d.pointsize = scale_fontsize(@marker_font_size)\n @d.gravity = EastGravity if !(@left_increment.nil? && @left_minimum_value.nil?)\n\n # Vertically center with 1.0 for the height\n @d = @d.annotate_scaled( @base_image,\n @graph_left - LABEL_MARGIN, 1.0,\n 0.0, y,\n label(marker_label), @scale) if !(@left_increment.nil? && @left_minimum_value.nil?)\n\n @d.gravity = WestGravity if !(@right_increment.nil? && @right_minimum_value.nil?)\n @d = @d.annotate_scaled( @base_image,\n 0.0, 1.0,\n @graph_right + LABEL_MARGIN, y,\n label(right_marker_label, :right), @scale) if !(@right_increment.nil? && @right_minimum_value.nil?)\n end\n end\n\n # # Submitted by a contibutor...the utility escapes me\n # i = 0\n # @additional_line_values.each do |value|\n # @increment_scaled = @graph_height.to_f / (@maximum_value.to_f / value)\n #\n # y = @graph_top + @graph_height - @increment_scaled\n #\n # @d = @d.stroke(@additional_line_colors[i])\n # @d = @d.line(@graph_left, y, @graph_right, y)\n #\n #\n # @d.fill = @additional_line_colors[i]\n # @d.font = @font if @font\n # @d.stroke('transparent')\n # @d.pointsize = scale_fontsize(@marker_font_size)\n # @d.gravity = EastGravity\n # @d = @d.annotate_scaled( @base_image,\n # 100, 20,\n # -10, y - (@marker_font_size/2.0),\n # '', @scale)\n # i += 1\n # end\n\n @d = @d.stroke_antialias true\n end", "def separator\n return @separator\n end", "def draw_edge\n print \"|\"\n end", "def GenSilkLine(x1, y1, x2, y2)\n thickness = GetDim('silkwidth')\n PcbElementLine(x1, y1, x2, y2, thickness)\nend", "def draw_red_line(x_start, y_start, x_end, stat_max, stat_min, p_thresh, rotate)\n x = @box_size\n xmin = x\n\n ymin = 0\n ymax = @box_size*9\n y_interval = ymax-ymin\n\n # set stat_min to be zero\n stat_min = 0\n stat_max = @functional_max\n\n stat_interval = stat_max - stat_min\n\n p_thresh = get_neg_log(p_thresh)\n y=((stat_max-p_thresh) / stat_interval) * y_interval\n if rotate\n y = y_interval - y\n end\n\n x_begin = @box_size * 0.7\n\n @canvas.g.translate(x_start, y_start) do |l|\n l.styles(:fill=>'none', :stroke_width=>1, :stroke=>'red', :fill_opacity=>0.1, :stroke_opacity=>0.5)\n l.line(x_begin, y, x_end-x_start, y)\n end\n\n end", "def line(*font)\n @io.puts(tag(:hr))\n end", "def divider(text, color: nil)\n raise NotImplementedError\n end", "def draw_line_markers\n return if @hide_line_markers\n\n increment_scaled = @graph_height.to_f / (@spread / @increment)\n\n # Draw horizontal line markers and annotate with numbers\n (0..marker_count).each do |index|\n y = @graph_top + @graph_height - index.to_f * increment_scaled\n\n line_renderer = Gruff::Renderer::Line.new(renderer, color: @marker_color, shadow_color: @marker_shadow_color)\n line_renderer.render(@graph_left, y, @graph_right, y)\n\n unless @hide_line_numbers\n marker_label = BigDecimal(index.to_s) * BigDecimal(@increment.to_s) + BigDecimal(minimum_value.to_s)\n label = y_axis_label(marker_label, @increment)\n text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)\n text_renderer.add_to_render_queue(@graph_left - LABEL_MARGIN, 1.0, 0.0, y, Magick::EastGravity)\n end\n end\n end", "def separator(text)\n puts '--%s' % text\nend", "def draw_line(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x += 4\n rect.y += index * WLH\n rect.width = contents.width - 8\n rect.height = WLH\n self.contents.clear_rect(rect)\n self.contents.font.color = normal_color\n self.contents.draw_text(rect, @lines[index])\n end", "def line_color\n :white_on_black\n end", "def bottom_line\n border_options ? super : nil\n end", "def draw_line(grids, length)\n grid(grids[0], grids[1]).bounding_box() do\n stroke_horizontal_line 0, 470*length, at: 5\n end\n end", "def bottom_border_stroke\n line_stroke(\n settings.border.style.bottom_left,\n settings.border.style.bottom_junc,\n settings.border.style.bottom_right\n ) do\n settings.border.style.bottom_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def separator(type = 'middle')\n if unicode?\n case type\n when 'first' then left, center, right = \"\\u250F\", \"\\u2533\", \"\\u2513\"\n when 'middle' then left, center, right = \"\\u2523\", \"\\u254A\", \"\\u252B\"\n when 'last' then left, center, right = \"\\u2517\", \"\\u253B\", \"\\u251B\"\n end\n else\n left = right = center = '+'\n end\n left + @cols.map { |c| horizontal_bar * (c.width + 2) }.join(center) + right\n end", "def display_boards_separators separator_display_method\n\t\tseparator_display_method.call(HOLE_SIZE, false)\n\t\tprint \" \"\n\t\tseparator_display_method.call(RATING_SIZE, true, false)\n\tend", "def drawSolidLine(x0,y0,x1,y1,thickness=1,color=\"black\") ;\n @device.drawSolidLine(x0,y0,x1,y1,thickness,color) ;\n end", "def default_line_separator\n @def_line_sep ||= infer_line_separator\n end", "def separator\n @parts.push(separator: true)\n end", "def print_separator\n str = \"+\" + \"-\" * (title_width + 2)\n \n column_order.length.times do\n str += \"+\" + \"-\" * (column_width + 2)\n end\n \n puts str + '+'\n end", "def draw_horizontal_stars(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = STAR_CHAR }\n end", "def draw_paths; end", "def create_pathdrawelement(line_width: 16.0, stroke_color: nil)\n strokeColor = stroke_color unless stroke_color.nil?\n strokeColor = MIColor.make_rgbacolor(0.2, 0.2, 0.2) if stroke_color.nil?\n arcBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n startX = $theWidth * 0.5 + $radius * Math.sin(-0.75 * Math::PI)\n startY = $theHeight * 0.5 + $radius * Math.cos(-0.75 * Math::PI)\n startPoint = MIShapes.make_point(startX, startY)\n arcBBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n thePath = make_arcpath(inBox: arcBBox, radius: $radius)\n pathDrawElement = MIDrawElement.new(:strokepath)\n pathDrawElement.arrayofpathelements = thePath\n pathDrawElement.startpoint = startPoint\n pathDrawElement.linewidth = line_width\n pathDrawElement.linecap = :kCGLineCapRound\n pathDrawElement.strokecolor = strokeColor\n pathDrawElement\nend", "def lines(points)\n CGContextAddLines(@ctx, points, points.size)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n end", "def lineBreak \n \"lineBreak\" \n end", "def drawLine _obj, _args\n \"_obj drawLine _args;\" \n end", "def add_divider_row_to_table\n table << \" -\"\n size.times { table << '-----' }\n table << \"\\n\"\n end", "def drawarc(*)\n super\n end", "def build_separator(year, month)\n separator = Array.new\n # cycle through days in month\n for d in (1..self.days_in_month(year, month))\n # does this match today?\n if year == Time.now.year && month == Time.now.month && d == Time.now.day then\n separator[d.to_i] = @options[:indicator]\n else\n # append separator to the array\n separator[d.to_i] = Line_Calendar::SEPARATOR_STRING_B\n end\n end\n # trim 0 key and move everything up one\n separator.shift\n return separator\n end", "def draw_segment(character, offset)\n puts \"#{' ' * offset}#{character}\"\nend", "def draw_line(x1, y1, x2, y2)\n if (x2-x1).abs > 0.95 * @max_width || (y2-y1).abs > 0.95 * @max_height\n return\n end\n\n\n x1 = scale(x1)\n y1 = scale(y1)\n x2 = scale(x2)\n y2 = scale(y2)\n\n strokeWeight(1)\n\n stroke(255)\n line(x1, y1, x2, y2)\n #stroke(0xff, 0xff, 0xff)\n #ellipse(x2, y2, 2, 2)\n end", "def line(x1, y1, x2, y2)\n CGContextAddLines(@ctx, [NSPoint.new(x1, y1), NSPoint.new(x2, y2)], 2)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n\n end", "def display_top_separator(width = HOLE_SIZE, new_line = true, tab = true)\n\t\tdisplay_separator_row(SEPARATOR[:nw_corner], SEPARATOR[:n_divide], \n\t\t\t SEPARATOR[:ne_corner], width, new_line, tab)\n\tend", "def line_separator(args = {})\n count = args[:count].nil? ? 20 : args[:count]\n separator = args[:separator].nil? ? '-' : args[:separator]\n\n # Concatenate and output.\n puts separator * count\n end", "def default_separator; end", "def sep; end", "def sep; end", "def draw_horizontal_segment\n @pixel_y = @cmd_options[@cmd_options.length-2]-1\n @color = @cmd_options.last\n\n @pixel_xs = (@cmd_options[0]..@cmd_options[1]).to_a\n\n @pixel_xs.each do |pixel_x|\n pixel_x -=1\n @matrix[@pixel_y][pixel_x] = @color\n end\n end", "def set_line_dash a, _b\n @dash = a.empty? ? nil : a\n end", "def how_to_render_lines args\n # Render a horizontal line at the bottom\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 0 }\n\n # Render a vertical line at the left\n args.nokia.lines << { x: 0, y: 0, x2: 0, y2: 47 }\n\n # Render a diagonal line starting from the bottom left and going to the top right\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 47 }\nend", "def lsep\n \"==================================================================================\"\n end", "def separator\n \":\"\n end", "def print_line\n @pdf.stroke_horizontal_line @pdf.bounds.left, @pdf.bounds.right\n end", "def drawarrow(*)\n super\n end", "def draw_lines\n @dim.times do |i|\n if @type.nil?\n draw_line(i+1)\n draw_edge\n puts\n elsif @type == \"allx\" || @type == \"alt\"\n draw_alt_line\n draw_edge\n puts\n end\n end\n end", "def draw(graphics)\n graphics.set_color @color.native_color\n graphics.draw @line\n end", "def draw_text_indent(line, string, additional=0)\n return if line <= 0\n y = 32 * line - 32\n self.contents.draw_text(35+additional, y, @width, 32, string)\n end", "def draw_line(y)\n width = @options[:page_layout] == :portrait ? 530 : 770\n @pdf.stroke { @pdf.horizontal_line 0, width, :at => y }\n end", "def line_style(data_set_index, options={})\n @line_styles[data_set_index] = \"#{options[:line_thickness]}\"\n @line_styles[data_set_index] += \",#{options[:length_segment]},#{options[:length_blank]}\" if options[:length_segment]\n end", "def draw_line(label=nil)\n unless label.nil? then\n bold_print(label) \n puts\n end\n end", "def setlinecolorind(*)\n super\n end", "def display_separator_row(left, middle, right, width, new_line, tab)\n\t\tprint \"\\t\" if tab\n\t\tto_display = left\n\t\tMastermind::BOARD_WIDTH.times do\n\t\t\twidth.times { to_display += SEPARATOR[:horizontal] }\n\t\t\tto_display += middle\n\t end\n\t to_display[to_display.length - 1] = right\n\n\t print to_display\n\t puts if new_line\n\tend", "def top_border_stroke\n line_stroke(\n settings.border.style.top_left,\n settings.border.style.top_junc,\n settings.border.style.top_right\n ) do\n settings.border.style.top_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def draw_horz_line(y)\n contents.fill_rect(0, y, contents_width, 2, system_color)\n end", "def line_items\n move_down 20\n data = line_item_data\n options = { width: bounds.width }\n header_styles = {\n border_width: 2,\n border_color: \"333333\"\n }\n table data, options do |table|\n table.rows(0).style(table_style.merge(header_styles))\n table.rows(1).style(table_style.merge(padding_top: 30))\n table.rows(2..data.length-1).style(table_style)\n end\n move_down 10\n stroke_color \"999999\"\n stroke_horizontal_rule\n end", "def separator\n columns_dashes = @widths.map { |w| '-' * (w + 2) }\n \"+#{columns_dashes.join('+')}+\"\n end", "def hr\n \"<hr />\"\n end" ]
[ "0.7522219", "0.73153824", "0.69710934", "0.6936839", "0.689818", "0.6823194", "0.66816515", "0.66569805", "0.65903026", "0.6587138", "0.657772", "0.6540361", "0.6522437", "0.65151834", "0.65151834", "0.65151834", "0.6491642", "0.6491642", "0.646288", "0.64345604", "0.64183277", "0.6390089", "0.6343549", "0.62794256", "0.6261186", "0.6233624", "0.62324", "0.62268674", "0.6182157", "0.6144453", "0.6091635", "0.6071706", "0.60699856", "0.6060894", "0.6021947", "0.60143435", "0.5988827", "0.596416", "0.5962074", "0.59564424", "0.5947138", "0.5942868", "0.5942228", "0.59250605", "0.5922487", "0.59016395", "0.58959967", "0.5892552", "0.5890145", "0.5878299", "0.5853565", "0.5837677", "0.58182544", "0.5807921", "0.5795507", "0.57854337", "0.5783592", "0.5780605", "0.57534677", "0.5734101", "0.57292825", "0.5728704", "0.5727403", "0.5717943", "0.57176846", "0.57135487", "0.57109416", "0.57072735", "0.5706532", "0.5705859", "0.570391", "0.5689746", "0.56889707", "0.56881887", "0.56561184", "0.56478345", "0.5646119", "0.5630513", "0.5627504", "0.5617658", "0.5617658", "0.5614536", "0.5614095", "0.5610313", "0.5600393", "0.5600005", "0.5598485", "0.55894876", "0.55834085", "0.55710554", "0.55692685", "0.55671763", "0.55655867", "0.5563508", "0.5562507", "0.5554961", "0.555372", "0.554802", "0.5525347", "0.5514889", "0.5513995" ]
0.0
-1
option ['swiftversion'], 'SWIFT_VERSION', 'What Swift version to change into', :required => true
def execute supported_swift_versions = ['3.0', '4.0', '4.2'] if !supported_swift_versions.include? swift_version signal_usage_error "'#{swift_version}' swift version is not supported. Supported values: " + supported_swift_versions.map { |v| "'#{v}'" }.join(", ") end ProjectMod.apply_build_setting(name: 'SWIFT_VERSION', value: "#{swift_version}.0", target_names: target_list) targets_string = target_list.empty? ? 'All targets' : (target_list.join(", ") + " targets") puts "#{targets_string} were updated to use Swift #{swift_version}!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_swift_version\n return unless uses_swift?\n spec_swift_versions = spec.swift_versions.map(&:to_s)\n\n unless spec_swift_versions.empty?\n message = nil\n if !dot_swift_version.nil? && !spec_swift_versions.include?(dot_swift_version)\n message = \"Specification `#{spec.name}` specifies inconsistent `swift_versions` (#{spec_swift_versions.map { |s| \"`#{s}`\" }.to_sentence}) compared to the one present in your `.swift-version` file (`#{dot_swift_version}`). \" \\\n 'Please remove the `.swift-version` file which is now deprecated and only use the `swift_versions` attribute within your podspec.'\n elsif !swift_version.nil? && !spec_swift_versions.include?(swift_version)\n message = \"Specification `#{spec.name}` specifies inconsistent `swift_versions` (#{spec_swift_versions.map { |s| \"`#{s}`\" }.to_sentence}) compared to the one passed during lint (`#{swift_version}`).\"\n end\n unless message.nil?\n error('swift', message)\n return\n end\n end\n\n if swift_version.nil? && spec.swift_versions.empty?\n if !dot_swift_version.nil?\n # The user will be warned to delete the `.swift-version` file in favor of the `swift_versions` DSL attribute.\n # This is intentionally not a lint warning since we do not want to break existing setups and instead just soft\n # deprecate this slowly.\n #\n UI.warn 'Usage of the `.swift_version` file has been deprecated! Please delete the file and use the ' \\\n \"`swift_versions` attribute within your podspec instead.\\n\".yellow\n else\n warning('swift',\n 'The validator used ' \\\n \"Swift `#{DEFAULT_SWIFT_VERSION}` by default because no Swift version was specified. \" \\\n 'To specify a Swift version during validation, add the `swift_versions` attribute in your podspec. ' \\\n 'Note that usage of a `.swift-version` file is now deprecated.')\n end\n end\n end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def add_swift_fallback_version(installer_context, version)\n installer_context.pod_targets.select(&:uses_swift?).each do |target|\n target.root_spec.swift_versions << swift_fallback_version if target.root_spec.swift_versions.empty?\n\n # fix crash in target_validator.rb:119 (undefined method `empty?' for nil:NilClass)\n target.instance_variable_set(:@swift_version, swift_fallback_version) unless target.swift_version\n end\nend", "def compiler_swift_version(user_version)\n unless user_version\n return podspec_swift_version || LATEST_SWIFT_VERSION\n end\n\n LONG_SWIFT_VERSIONS.select do |version|\n user_version.start_with?(version)\n end.last || \"#{user_version[0]}.0\"\n end", "def ruby_version; '2.6.3' end", "def ensure_shell_commands\n xcodebuild_version\n swift_version\n end", "def rubocop_version; end", "def flipper_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == 'YogaKit'\n target.build_configurations.each do |config|\n config.build_settings['SWIFT_VERSION'] = '4.1'\n end\n end\n end\nend", "def patch_kingfisher_for_ios10\n system(\"rm -rf ./Pods/Kingfisher/Sources/SwiftUI\")\n code_file = \"./Pods/Kingfisher/Sources/General/KFOptionsSetter.swift\"\n code_text = File.read(code_file)\n code_text.gsub!(/#if canImport\\(SwiftUI\\) \\&\\& canImport\\(Combine\\)(.|\\n)+#endif/,'')\n system(\"rm -rf \" + code_file)\n aFile = File.new(code_file, 'w+')\n aFile.syswrite(code_text)\n aFile.close()\nend", "def option_type_config; end", "def bump_option?(options)\n options[:major] || options[:minor] || options[:patch] || options[:commit] || options[:preid] || options[:release]\n end", "def configure_js_fusion_vm(options)\n options['os-type'] = get_js_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def target_version; end", "def option_type; end", "def build_framework?; ARGV.include? '--framework'; end", "def default_version; end", "def version_helper=(_arg0); end", "def version_helper=(_arg0); end", "def version_helper=(_arg0); end", "def verify_options_hook; end", "def version\n options['version']\n end", "def target_version=(_arg0); end", "def test_add_option04c\n assert_nothing_raised {\n ArgumentManager.add_option(\n [ 'u' ],\n :type => :string,\n :mandatory => true,\n :df_str => 'foo'\n )\n }\n end", "def rubocop_version\n args.find { |a| a =~ /version=/ }.to_s.split('=').last\n end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def missing_option=(_arg0); end", "def view_with_check_option_support\n # :nocov:\n :local if server_version >= 90400\n # :nocov:\n end", "def min_ios_version_supported\n return '13.4'\nend", "def upgrade\n add option: \"-upgrade\"\n end", "def verify_options_hook=(_arg0); end", "def def_version; end", "def test_add_option04h\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'z' ],\n :type => :string,\n :df_str => 0\n )\n }\n end", "def required_ruby_version\n spec.required_ruby_version\n end", "def validate_options; end", "def options(opt); end", "def options(opt); end", "def test_add_option04a\n assert_nothing_raised {\n ArgumentManager.add_option(\n [ 's' ],\n :type => :string,\n :df_str => 'foo'\n )\n }\n end", "def user_options; end", "def test_add_option03c\n assert_nothing_raised( Exception ) {\n ArgumentManager.add_option(\n [ 'k' ],\n :type => :integer,\n :mandatory => true,\n :df_int => 0\n )\n }\n end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def cass_version\n ENV['CASS_VERSION'] || '2.1.1'\nend", "def major_version; end", "def php_version\n \"5.6\"\n end", "def options(opt)\n end", "def version!\r\n fail\r\n end", "def increment_version_code(options={})\n version_code_regex = /versionCode\\s+(\\d+)/\n\n # This path structure assumes we have seperate ios and android fastlane setups (android/fastlane)\n Dir.glob(\"../**/app/build.gradle\") do |path|\n UI.message(\" -> Found a build.gradle file at path: (#{path})!\")\n build_gradle = File.read(path)\n current_version_code = build_gradle[version_code_regex, 1].to_i\n new_version_code = options[:version_code] || current_version_code + 1\n UI.message(\" -> Setting versionCode to: #{new_version_code}\")\n build_gradle[version_code_regex, 1] = new_version_code.to_s\n\n f = File.new(path, 'w')\n f.write(build_gradle)\n f.close\n end\n end", "def yardopts(file = T.unsafe(nil)); end", "def target_chef_version(version)\n RuboCop::Config.new('AllCops' => { 'TargetChefVersion' => version })\nend", "def target_chef_version(version)\n RuboCop::Config.new('AllCops' => { 'TargetChefVersion' => version })\nend", "def has_version?; end", "def check_option_support\n assert_option_supported(:foodcritic) &&\n assert_option_supported(:scmversion, 'thor-scmversion') &&\n assert_default_supported(:no_bundler, 'bundler')\n end", "def options\n [['--build32', 'Force a 32-bit build.']]\n end", "def version=(_arg0); end", "def version=(_arg0); end", "def version=(_arg0); end", "def version=(_arg0); end", "def version=(_arg0); end", "def test_add_option04d\n assert_nothing_raised {\n ArgumentManager.add_option(\n [ 'v' ],\n :type => :string,\n :mandatory => true\n )\n }\n end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end" ]
[ "0.6580914", "0.5924886", "0.5924886", "0.5924886", "0.5924886", "0.5924886", "0.5924886", "0.5924886", "0.5924886", "0.5924886", "0.590996", "0.57647663", "0.5632774", "0.5626702", "0.56221426", "0.56058323", "0.55801165", "0.5579629", "0.55401284", "0.55283296", "0.5526932", "0.55222464", "0.5513686", "0.54874814", "0.5481582", "0.5481582", "0.5481582", "0.5479732", "0.54508924", "0.54253536", "0.5420811", "0.5420241", "0.5419709", "0.5419709", "0.5419709", "0.5419709", "0.5419709", "0.5419709", "0.53649676", "0.5339811", "0.53166306", "0.531319", "0.53085953", "0.5284776", "0.5256015", "0.5247488", "0.5246074", "0.5245502", "0.5232479", "0.52312183", "0.52091175", "0.5208027", "0.5208027", "0.5208027", "0.5208027", "0.5197231", "0.51760477", "0.5172617", "0.51604134", "0.5158143", "0.5152071", "0.51499003", "0.51493853", "0.51493853", "0.51474714", "0.5144428", "0.5132367", "0.51280075", "0.51280075", "0.51280075", "0.51280075", "0.51280075", "0.5121876", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762", "0.5120762" ]
0.5974765
1
To replicate the behavior in ActiveRecordattributes, :except takes precedence over :only. If :only is not set for a N level model but is set for the N+1 level models, then because :except is set to a default value, the second level model can have both :except and :only set. So if :only is set, always delete :except.
def attributes_hash attributes = @serializable.attributes if options[:only].any? attributes.slice(*options[:only]) elsif options[:except].any? attributes.except(*options[:except]) else attributes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only\n attributes.fetch(:only)\n end", "def except(*keys)\n common = keys & self.class.required_attributes\n\n if common.empty?\n self.class.new(@hash.except(*keys))\n else\n to_hash.except(*keys)\n end\n end", "def except_attributes\n [].freeze\n end", "def clear_original_attributes(options = {})\n if !(options[:only] or options[:except]) || !@original_attributes\n return @original_attributes = nil\n end\n \n attributes_to_clear = if options[:only]\n Array(options[:only]).map(&:to_s)\n elsif options[:except]\n except = Array(options[:except]).map(&:to_s)\n self.class.column_names.reject { |c| except.include?(c) }\n end\n \n attributes_to_clear.each do |attribute|\n @original_attributes[attribute] = @attributes[attribute]\n end\n end", "def except(*skips)\n result = self.class.new(@klass, table)\n result.default_scoped = default_scoped\n\n ((Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS) - skips).each do |method|\n result.send(:\"#{method}_values=\", send(:\"#{method}_values\"))\n end\n\n (Relation::SINGLE_VALUE_METHODS - skips).each do |method|\n result.send(:\"#{method}_value=\", send(:\"#{method}_value\"))\n end\n\n # Apply scope extension modules\n result.send(:apply_modules, extensions)\n\n result\n end", "def restore_attributes(options = {})\n original_attributes_before_type_cast = self.original_attributes_before_type_cast.dup\n \n if options[:only]\n only = Array(options[:only]).map(&:to_s)\n original_attributes_before_type_cast.delete_if { |key, value| !only.include?(key) }\n elsif options[:except]\n except = Array(options[:except]).map(&:to_s)\n original_attributes_before_type_cast.delete_if { |key, value| except.include?(key) }\n end\n \n @attributes.update(original_attributes_before_type_cast)\n end", "def prohibit_all(except: [])\n set_all :prohibited, except: { exceptions: except, status: :allowed }\n end", "def attributes_without_encrypted_values\n attributes_with_decrypted_values.except *eager_load_conductors.map(&:encrypted_attribute)\n end", "def to_attributes( only: nil, except: nil, set: false ) # rubocop:disable Metrics/PerceivedComplexity\n self.class.attributes.each_with_object({}) do |(name, options), attrs|\n next if ( only && !match_attribute?( only, name ) ) || ( except && match_attribute?( except, name ) )\n next unless serialize_attribute?( name, options )\n next if set && !set?(name)\n\n attrs[name] = send( name )\n end\n end", "def omitted_attributes\n (self.class.replicate_omit_attributes + @replicate_opts[:omit]).uniq\n end", "def ignore_attributes\n read_inheritable_attribute(:attr_ignore) || []\n end", "def attr_read_only(*attributes)\n self.read_only_attributes = Set.new(attributes.map { |a| a.to_s }) + (read_only_attributes || [])\n end", "def exclude_from_model\n []\n end", "def read_only\n @attributes[:read_only]\n end", "def ext_attrs(values, attrs_skip = [])\n result = values.except *attrs_always_skip\n return result\n end", "def remove_readonly_attributes(attributes)\n unless self.class.readonly_attributes.nil?\n attributes.delete_if { |key, value| self.class.readonly_attributes.include?(key.gsub(/\\(.+/,\"\")) }\n else\n attributes\n end\n end", "def replicate_omit_attributes(*attribute_names)\n self.replicate_omit_attributes = attribute_names if attribute_names.any?\n @replicate_omit_attributes || superclass.replicate_omit_attributes\n end", "def except(dataset, all = false)\n clone(:except => dataset, :except_all => all)\n end", "def skipped_attributes\n if model.respond_to?(:skipped_alchemy_resource_attributes)\n model.skipped_alchemy_resource_attributes\n else\n DEFAULT_SKIPPED_ATTRIBUTES\n end\n end", "def except(*methods)\r\n with_options(except: methods)\r\n end", "def operate\n # by default, copy all attributes and no associations\n attributes_except\n end", "def as_json(options={})\n exclusion_list = []\n exclusion_list += ConfigCenter::Defaults::EXCLUDED_JSON_ATTRIBUTES\n exclusion_list += ConfigCenter::User::EXCLUDED_JSON_ATTRIBUTES\n options[:except] ||= exclusion_list\n super(options)\n end", "def allow_all(except: [])\n set_all :allowed, except: { exceptions: except, status: :prohibited }\n end", "def attr_readonly(*attributes)\n write_inheritable_attribute(:attr_readonly, Set.new(attributes.map(&:to_s)) + (readonly_attributes || []))\n end", "def setter_methods(only, except)\n only = only.nil? ? model.allowed_columns : only\n except = except.nil? ? model.restricted_columns : except\n if only\n only.map{|x| \"#{x}=\"}\n else\n meths = methods.collect{|x| x.to_s}.grep(/=\\z/) - RESTRICTED_SETTER_METHODS\n meths -= Array(primary_key).map{|x| \"#{x}=\"} if primary_key && model.restrict_primary_key?\n meths -= except.map{|x| \"#{x}=\"} if except\n meths\n end\n end", "def ignored_merge_attributes\n IGNORED_ATTRIBUTES\n end", "def model_attrs(except: [])\n attrs = %i(\n name starts_at duration budget fb_ad_account_id interests location\n age_min age_max\n )\n attrs << :publication_id unless [except].flatten.include?(:publication_id)\n attributes.slice(*attrs)\n end", "def only!(*keys)\n ret = only(*keys)\n replace(except(*keys))\n return ret\n end", "def retain_except_on_create\n data[:retain_except_on_create]\n end", "def allowed_attributes\n self.new.attributes.keys.reject do |col|\n protected_attributes.include?(col)\n end\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def strip_non_model_safe_params parameters\n safe_params = if include_only = self._wrapper_options[:include]\n parameters.slice(*include_only)\n else\n exclude = _wrapper_options[:exclude] || []\n parameters.except(*(exclude + EXCLUDE_PARAMETERS))\n end \n return safe_params\n end", "def except(attributes_to_exclude)\n attributes_to_exclude = [attributes_to_exclude] unless attributes_to_exclude.kind_of? Array\n attributes_to_exclude.map! { |a| a.to_s.singularize }\n attributes.select { |a| !attributes_to_exclude.include?(a.id) }\n end", "def ignored_associations\n %w().freeze\n end", "def set_except(hash, *except)\n set_restricted(hash, false, except.flatten)\n end", "def exclude_attrs(hash, attrs, must_exclude, associations)\n exclude = attrs + associations + must_exclude\n hash.except(*exclude)\n end", "def deny_all!(kind = :all, attributes = {})\n allow_all(kind, attributes).save\n end", "def ignoring(*attributes)\n attributes.each do |attr_name|\n @_attributes.delete(attr_name.to_sym)\n end\n end", "def exclusive\n @attributes[:exclusive]\n end", "def set_only(hash, *only)\n set_restricted(hash, only.flatten, false)\n end", "def remove_all_except(*args)\n set_option_array_values(:remove_all_except, *args)\n end", "def excluded_models; %w[Tenant] end", "def extract_serializable_attributes(options = {})\n opts = options.try(:dup) || {}\n only = Array.wrap(opts[:only]).map(&:to_s)\n\n only = if only.blank?\n serializable_attributes\n else\n only & serializable_attributes\n end\n\n only -= Array.wrap(opts[:except]).map(&:to_s) if opts.key?(:except)\n only.uniq\n end", "def ignore_if_not_exists\n attributes.fetch(:ignoreIfNotExists)\n end", "def readonly_attributes(*attrs)\n @readonly_attributes ||= [:created_at, :updated_at, :completed_at]\n if attrs.any?\n @readonly_attributes.map!(&:to_sym).concat(attrs).uniq!\n setup_attributes(@readonly_attributes, true)\n end\n @readonly_attributes\n end", "def method_missing(meth, *args) # :nodoc:\n if stems.size == 1 and stems.only.respond_to? meth then\n stems.only.send meth, *args\n else\n super\n end\n end", "def should_be_partially_valid_except(*attrs)\n invalid_attributes = []\n all_attrs = self.instance_variables.map {|iv| iv.gsub('@','')}\n # use the key names from @attributes for ActiveRecord objects\n all_attrs = self.attributes.keys if self.instance_variables.include?('attributes')\n attrs.each do |attr_name|\n invalid_attributes << attr_name.to_s\n end\n should_be_valid_on = all_attrs - invalid_attributes\n should_be_partially_valid_on(should_be_valid_on)\n end", "def api_clear(*only, **opt)\n opt[:user] = current_user unless opt.key?(:user)\n if only.present?\n ApiService.table(**opt).except!(*only)\n else\n ApiService.clear(**opt)\n end\n end", "def except!(*keys)\r\n replace(except(*keys))\r\n end", "def except!(*keys)\r\n replace(except(*keys))\r\n end", "def readonly_attributes\n read_inheritable_attribute(:attr_readonly)\n end", "def serializable_attribute_names\n attribute_names = @record.attribute_names\n\n if options[:only]\n options.delete(:except)\n attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }\n else\n options[:except] = Array(options[:except]) | Array(@record.class.inheritance_column)\n attribute_names = attribute_names - options[:except].collect { |n| n.to_s }\n end\n\n attribute_names\n end", "def serializable_attribute_names\n attribute_names = @record.attribute_names\n\n if options[:only]\n options.delete(:except)\n attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }\n else\n options[:except] = Array(options[:except]) | Array(@record.class.inheritance_column)\n attribute_names = attribute_names - options[:except].collect { |n| n.to_s }\n end\n\n attribute_names\n end", "def writable_attributes resource = nil\n attrs = accessible_attributes(resource).delete_if { |attribute| attribute =~ /(_attributes)$/ }\n attrs -= get_associations(resource)\n end", "def serializable_hash\n attrs = self.class._attributes.dup.keys\n\n # Inclusive fields.\n if @opts[:only].present? || @opts[:fields].present?\n (@opts[:only] ||= []).concat(@opts[:fields] ||= [])\n attrs = (attrs & @opts[:only].map(&:to_sym))\n # Exclusive fields.\n elsif @opts[:exclude].present?\n attrs = (attrs - @opts[:exclude].map(&:to_sym))\n end\n\n filter_attributes(attrs)\n end", "def except!(*keys)\n keys.each { |key| delete(key) }\n self\n end", "def except!(*keys)\n keys.each { |key| delete(key) }\n self\n end", "def except!(*keys)\n keys.each { |key| delete(key) }\n self\n end", "def except!(*keys)\n keys.each { |key| delete(key) }\n self\n end", "def except!(*keys)\n keys.each { |key| delete(key) }\n self\n end", "def restricted_attributes\n if model.respond_to?(:restricted_alchemy_resource_attributes)\n model.restricted_alchemy_resource_attributes\n else\n []\n end\n end", "def update_except(hash, *except)\n update_restricted(hash, false, except.flatten)\n end", "def createonly()\n merge(createonly: 'true')\n end", "def update_only(hash, *only)\n update_restricted(hash, only.flatten, false)\n end", "def attr_unsearchable(*args)\n if table_exists?\n opts = args.extract_options!\n args.flatten.each do |attr|\n attr = attr.to_s\n raise(ArgumentError, \"No persisted attribute (column) named #{attr} in #{self}\") unless self.columns_hash.has_key?(attr)\n self._metasearch_exclude_attributes = self._metasearch_exclude_attributes.merge(\n attr => {\n :if => opts[:if]\n }\n )\n end\n end\n end", "def serializable_attributes\n #attribute_names = @record.attributes.keys # This includes all attributes including associations\n attribute_names = @record.class.keys.keys # This includes just keys\n idex = attribute_names.index(\"_id\")\n attribute_names[idex] = \"id\" if idex\n\n if options[:only]\n options.delete(:except)\n attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }\n else\n options[:except] = Array(options[:except]) \n attribute_names = attribute_names - options[:except].collect { |n| n.to_s }\n end\n\n attribute_names.collect { |name| Attribute.new(name, @record) }\n end", "def exclude\n [exceptions, self.class.exclude_always, foreign_key, polymorphic_type].flatten.uniq\n end", "def update_restricted(hash, only, except)\n set_restricted(hash, only, except)\n save_changes\n end", "def set_restricted(hash, only, except)\n columns_not_set = model.instance_variable_get(:@columns).blank?\n meths = setter_methods(only, except)\n strict = strict_param_setting\n hash.each do |k,v|\n m = \"#{k}=\"\n if meths.include?(m)\n send(m, v)\n elsif columns_not_set && (Symbol === k)\n self[k] = v\n elsif strict\n raise Error, \"method #{m} doesn't exist or access is restricted to it\"\n end\n end\n self\n end", "def except *filter_list\n filter.except filter_list\n self\n end", "def no_where\n @data.where_behavior = :exclude\n return self\n end", "def except(dataset, opts=OPTS)\n raise(InvalidOperation, \"EXCEPT not supported\") unless supports_intersect_except?\n raise(InvalidOperation, \"EXCEPT ALL not supported\") if opts[:all] && !supports_intersect_except_all?\n compound_clone(:except, dataset, opts)\n end", "def except!(*keys)\r\n keys.each { |key| delete(key.to_s); delete(key.to_sym) }\r\n self\r\n end", "def check_exclude_fields\n=begin\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n exc= exclude_fields.send(key)\n next if exc # Leave user options if given.\n \n # By default, the foreign key of the parents are assigned on nested resources,\n # so i remove the from the default columns of new\n exclude_fields.send(\"#{key}=\", parent_ids) if key == :for_new && !parent_ids.empty?\n end\n=end\n # Because a single resource can have multiple resource parents,\n # this check is going to be done on \"runtime\" (ie remove the field for the \n # current parent, not all parents' fields)\n end", "def attributes_for_saving_with_person attributes\n attributes = attributes_for_saving_without_person(attributes)\n\n attributes.delete(:company)\n attributes.delete(:deals)\n attributes.delete(:won_deals_total)\n attributes.delete(:lead_status)\n attributes.delete(:viewed_at)\n attributes.delete(:deal_ids)\n attributes.delete(:predefined_contacts_tag_ids)\n attributes.delete(:user_id)\n attributes.delete(:user)\n\n attributes.delete(:image_thumb_url) if attributes[:image_thumb_url] == \"/images/thumb/missing.png\"\n\n attributes\n end", "def only(*methods)\r\n with_options(only: methods)\r\n end", "def exclude(*names)\n self.class.new(prefix, attributes, excluded.dup.concat(names))\n end", "def except(*skips)\n skips.each {|option| @options.delete option}\n end", "def allbut(attributes)\n project(attributes, :allbut => true)\n end", "def filtered_attributes\n # Run the read permission check\n allow_and_deny_fields(:read).then do |allow, deny|\n\n result = nil\n\n if allow && allow != true && allow.size > 0\n # always keep id\n allow << :id\n\n # Only keep fields in the allow list\n result = @attributes.select { |key| allow.include?(key) }\n elsif deny == true\n # Only keep id\n # TODO: Should this be a full reject?\n result = @attributes.reject { |key| key != :id }\n elsif deny && deny.size > 0\n # Reject any in the deny list\n result = @attributes.reject { |key| deny.include?(key) }\n else\n result = @attributes\n end\n\n # Deeply filter any nested models\n result.then do |res|\n keys = []\n values = []\n res.each do |key, value|\n if value.is_a?(Model)\n value = value.filtered_attributes\n end\n keys << key\n values << value\n end\n\n Promise.when(*values).then do |values|\n keys.zip(values).to_h\n end\n end\n end\n end", "def all_access_to(options = {})\n options.assert_valid_keys(:only, :except)\n if options.has_key?(:only)\n self.public_actions = [options[:only]].flatten.compact.collect{ |a| a.to_sym }\n end\n if options.has_key?(:except)\n instance_methods_array = instance_methods(false).collect{ |a| a.to_sym }\n opts = [options[:except]].flatten.compact.collect{ |a| a.to_sym }\n self.public_actions = opts - instance_methods_array\n self.private_actions = opts\n end\n end", "def attributes_protected_by_default\n []\n end", "def deny_keys(*keys)\r\n tmp = self.clone\r\n tmp.delete_if {|k,v| keys.include?(k) }\r\n tmp\r\n end", "def only_create!\n self.operation = :only_create\n end", "def attributes_protected_by_default\n []\n end", "def update!(**args)\n @propagate_only = args[:propagate_only] if args.key?(:propagate_only)\n end", "def only(*fields)\n query('_only' => fields)\n end", "def ignore_non_read_or_write_attributes\n ['title', 'email', 'expertise_list', 'tool_list', 'mbox_sha1sum']\n end", "def serializable_hash(options = nil)\n options = options.try(:dup) || {}\n options[:except] = Array(options[:except]).dup\n\n if options[:force_except]\n options[:except].concat Array(options[:force_except])\n else\n options[:except].concat UNSAFE_ATTRIBUTES_FOR_SERIALIZATION\n end\n\n super(options)\n end", "def restrict_to *privileges, &blk\n options = privileges.last.is_a?( Hash ) ? privileges.pop : {}\n\n if not options[:only]\n options[:except] = Array(options[:except]) + [:login, :logout, :reminder, :profile, :signup]\n end\n \n privileges << options\n \n super( *privileges, &blk )\n end", "def deny_all(kind = :all, attributes = {})\n new attributes.merge(:kind => kind, :name => 'all', :allow => false)\n end", "def allbut(relation, *attributes)\n attributes = relation.header.reject{|a| attributes.include?(a.name)}.collect{|a| a.name}\n project(relation, *attributes)\n end", "def include_forbidden_attributes_protection?(node)\n node.receiver.to_s == 'ActiveRecord::Base' && node.message.to_s == 'send' &&\n node.arguments.all.map(&:to_s) == ['include', 'ActiveModel::ForbiddenAttributesProtection']\n end", "def remove_protected_attributes(attributes)\n protected_names = protected_properties.map { |prop| prop.name }\n return attributes if protected_names.empty? or attributes.nil?\n\n attributes.reject do |property_name, property_value|\n protected_names.include?(property_name.to_s)\n end\n end", "def excluded; end", "def encrypted_attributes\n active_record_attributes.except(*attributes_without_encrypted_values.keys)\n end" ]
[ "0.67332566", "0.6430014", "0.6336545", "0.63268477", "0.60581917", "0.59833455", "0.59803396", "0.5867166", "0.5836784", "0.58291423", "0.58207476", "0.5781079", "0.57531565", "0.57452184", "0.57451046", "0.57441616", "0.56608605", "0.5618999", "0.56106395", "0.5602447", "0.56008863", "0.55776334", "0.55582845", "0.5533234", "0.55071527", "0.5487533", "0.5487363", "0.5480269", "0.5463954", "0.54478335", "0.5444224", "0.5444224", "0.5444224", "0.5444224", "0.5444224", "0.5442682", "0.54338783", "0.54271674", "0.54122645", "0.54058844", "0.53903735", "0.5380066", "0.53683424", "0.5343767", "0.53373384", "0.53345406", "0.5323758", "0.53193104", "0.53100497", "0.5307241", "0.5298355", "0.52949667", "0.52794373", "0.52794373", "0.52777165", "0.52743363", "0.52743363", "0.52529156", "0.5251049", "0.52469784", "0.52469784", "0.52469784", "0.52469784", "0.52469784", "0.5238979", "0.5234172", "0.52317965", "0.5226577", "0.5212455", "0.5211843", "0.51989305", "0.51904124", "0.5185093", "0.5182396", "0.5178101", "0.5163306", "0.51572156", "0.51549304", "0.51508886", "0.51323354", "0.51283425", "0.51259685", "0.5117462", "0.51158243", "0.50976735", "0.5093028", "0.5085822", "0.50819534", "0.50742483", "0.50737953", "0.50725406", "0.50627095", "0.50613713", "0.506101", "0.5055934", "0.50324595", "0.5024026", "0.5018322", "0.50071317", "0.5001922" ]
0.53207374
47
Returns FXML representing the model. Configuration can be passed through +options+.
def to_fxml(options = {}, &block) options.merge!(:dasherize => false) default_except = [:encrypted_password, :password_salt, :remember_token, :remember_token_expires_at, :created_at, :updated_at] options[:except] = (options[:except] ? options[:except] + default_except : default_except) Serializer.new(self, options).serialize(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_fxml(options = {})\n options.merge!(:dasherize => false)\n default_except = [:crypted_password, :salt, :remember_token, :remember_token_expires_at, :created_at, :updated_at]\n options[:except] = (options[:except] ? options[:except] + default_except : default_except)\n \n RestfulX::Serialization::FXMLSerializer.new(self, options).to_s\n end", "def get_model( options )\n return options[:model] if options[:model]\n return options[:node].getModel if options[:node] && options[:node].resource? && options[:node].getModel\n default_model\n end", "def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end", "def property( options )\n self << view( :form, options[:type], options )\n end", "def generatexml()\n merge(rvgeneratexml: 'true')\n end", "def create(model_name,options={})\n # @TODO: this is another path that parallels the ModelFactory\n model_class = Metro::Models.find(model_name)\n mc = model_class.new options\n mc.scene = scene\n mc.window = window\n mc\n end", "def render options\n options.view_model = self\n \n determine_and_set_format options\n \n self.class.render view_instance, options\n end", "def generatexml()\n merge(gadrgeneratexml: 'true')\n end", "def model\n @opts[:model]\n end", "def show(options = {})\n if @data.length > 0\n default = {:url => \"/\" + @type.pluralize.downcase + \"/show/:id\", :text => \"show\"}\n @show_action = default.merge(options)\n @actions = true\n end\n return self\n end", "def view(name, opts = {})\n CouchRest::Model::Designs::View.new(self, model, opts, name)\n end", "def to_xml(options = {})\n options[:save_with] ||= SaveOptions::DEFAULT_XML\n serialize(options)\n end", "def to_xml options = {}\n properties.to_xml options\n end", "def to_node(options={})\n options[:doc] ||= Nokogiri::XML::Document.new\n\n tag_name = options[:binding] && options[:binding].from\n root_tag = options[:wrap] || tag_name || representation_wrap\n\n create_representation_with(Nokogiri::XML::Node.new(root_tag.to_s, options[:doc]), options, PropertyBinding)\n end", "def xf_model\n result = \"\"\n models = @request.env[:models]\n unless models.nil?\n models.each{|name, model|\n result += model_start name\n result += model.submission\n result += model_end model\n }\n end\n styles = @request.env[:styles]\n unless styles.nil?\n result += \"<style type=\\\"text/css\\\">\" + styles + \"</style>\"\n end\n return result\n end", "def kml_representation(options = {}) #:nodoc: \r\n result = \"<Point#{options[:id_attr]}>\\n\"\r\n result += options[:geom_data] if options[:geom_data]\r\n result += \"<coordinates>#{x},#{y}\"\r\n result += \",#{options[:fixed_z] || z ||0}\" if options[:allow_z]\r\n result += \"</coordinates>\\n\"\r\n result += \"</Point>\\n\"\r\n end", "def to_xml(opt={})\n to_markup(opt).target!\n end", "def to_xml(opt={})\n to_markup(opt).target!\n end", "def model(main_model, options={})\n self.model_options = [main_model, options]\n end", "def kml_representation(options = {}) #:nodoc:\n out = \"<Point#{options[:id_attr]}>\\n\"\n out += options[:geom_data] if options[:geom_data]\n out += \"<coordinates>#{x},#{y}\"\n out += \",#{options[:fixed_z] || z || 0}\" if options[:allow_z]\n out += \"</coordinates>\\n\"\n out + \"</Point>\\n\"\n end", "def model\n XFile \n end", "def render(model, options)\n Template.new(model).to_json(options)\n end", "def to_kml(options = {})\n raise RuntimeError, 'No coordinates available for KML generation' unless to_kml?\n to_kml_file(options).render\n end", "def make_view_from(options = {})\n o = {}\n o.merge! options\n options.each do |k, v| o[k.to_sym] = v unless k.kind_of? Symbol\n end\n \n # Set defaults\n [\n [ :altitude, 0 ],\n [ :altitudeMode, :relativeToGround ],\n [ :latitude, 0 ],\n [ :longitude, 0 ],\n [ :tilt, 0 ],\n [ :heading, 0 ],\n [ :extrude, 0 ],\n ].each do |a|\n o[a[0]] = a[1] unless o.has_key? a[0]\n end\n \n p = point o[:longitude], o[:latitude], o[:altitude], o[:altitudeMode], o[:extrude]\n \n if o.has_key? :roll then\n view = Kamelopard::Camera.new p\n else\n view = Kamelopard::LookAt.new p\n end\n \n [ :altitudeMode, :tilt, :heading, :timestamp, :timespan, :timestamp, :range, :roll, :viewerOptions ].each do |a|\n view.method(\"#{a.to_s}=\").call(o[a]) if o.has_key? a\n end\n \n view\n end", "def to_fxml(options = {})\n options[:root] ||= \"errors\"\n options[:indent] ||= 2\n options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])\n options[:builder].instruct! unless options.delete(:skip_instruct)\n options[:builder].errors do |e|\n # The @errors instance variable is a Hash inside the Errors class\n @errors.each do |attr, msg|\n next if msg.nil?\n if attr == \"base\"\n options[:builder].error(\"message\", msg.to_s)\n else\n options[:builder].error(\"field\" => attr.camelcase(:lower), \"message\" => msg.to_s)\n end\n end\n end\n end", "def show\n run List::Show\n render cell(List::Cell::Show, result['model']), layout: true\n end", "def obj\n @model\n end", "def model()\n @props[:model]\n end", "def model(options = nil)\n if options.is_a?(Class)\n @klass = options\n elsif options\n type = options.fetch(:type) { DEFAULT_TYPE }\n @builder = ModelBuilder[type].new(options)\n end\n\n build_class unless options\n end", "def root\n instance.options[:root]\n end", "def root\n instance.options[:root]\n end", "def initialize(options={})\n\t\t\t@model = options[:model]\n\t\t\t@view = options[:view]\n\t\t\t@router = options[:router]\n\t\tend", "def to_xml(options={})\n attributes.to_xml({:root => self.class.element_name}.merge(options))\n end", "def to_xml(options={})\n attributes.to_xml({:root => self.class.element_name}.merge(options))\n end", "def view(name, opts = {})\n design_doc.create_view(name, opts)\n end", "def build(options = {}, & block)\n require 'limelight/dsl/prop_builder'\n builder = Limelight::DSL::PropBuilder.new(self)\n builder.__install_instance_variables(options)\n builder.__root_path__ = scene.path\n builder.instance_eval(& block)\n end", "def render(options={}, result=Result.new)\n name = options[:as] || wrapped_model_name.underscore\n result[name] = view = self.view\n _include_associations(result, view, options[:include])\n end", "def to_xml(options = {})\r\n options.update :root => @root ||\r\n self.class.name.split('::').last.underscore\r\n attributes.to_xml options\r\n end", "def to_xml\n builder.target!\n end", "def view(model_name, *args)\n orange[model_name].view(self, *args)\n end", "def as_kml(options = {})\r\n id_attr = \"\"\r\n id_attr = \" id=\\\"#{options[:id]}\\\"\" if options[:id]\r\n\r\n geom_data = \"\"\r\n geom_data += \"<extrude>#{options[:extrude]}</extrude>\\n\" if options[:extrude]\r\n geom_data += \"<tesselate>#{options[:tesselate]}</tesselate>\\n\" if options[:tesselate]\r\n geom_data += \"<altitudeMode>#{options[:altitude_mode]}</altitudeMode>\\n\" if options[:altitude_mode]\r\n \r\n allow_z = (with_z || !options[:altitude].nil? )&& (!options[:altitude_mode].nil?) && options[:atitude_mode] != \"clampToGround\"\r\n fixed_z = options[:altitude]\r\n \r\n kml_representation(options.merge(:id_attr => id_attr, :geom_data => geom_data, :allow_z => allow_z, :fixed_z => fixed_z))\r\n end", "def model\n self\n end", "def create_representation_with(doc, options, format)\n propagated_options, private_options = normalize_options!(options)\n\n representable_mapper(format, propagated_options).serialize(represented, doc, propagated_options, private_options)\n end", "def load_view options\n options ||= {}\n options = options[:fancygrid] || options\n options = options[self.name] || options\n self.view = Fancygrid::View.new(options)\n \n # reorder current leafs\n new_leafs = self.leafs\n self.leafs = []\n new_leafs.each do |leaf|\n insert_node(leaf)\n end\n end", "def to_xml(options = {})\n doc = super\n ns = self.class.ns\n\n if ns and ns.size == 2 # prefix and name\n doc.add_namespace_definition(*ns)\n doc.name = \"#{ns.first}:#{doc.name}\"\n end\n\n doc\n end", "def model_object\n @opts[:model_object]\n end", "def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @model }\n end\n end", "def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @model }\n end\n end", "def as_hqmf_model\n json = {\n \"id\" => self.measure_id,\n \"title\" => self.title,\n \"description\" => self.description,\n \"population_criteria\" => self.population_criteria,\n \"data_criteria\" => self.data_criteria,\n \"source_data_criteria\" => self.source_data_criteria,\n \"measure_period\" => self.measure_period,\n \"attributes\" => self.measure_attributes,\n \"populations\" => self.populations,\n \"hqmf_id\" => self.hqmf_id,\n \"hqmf_set_id\" => self.hqmf_set_id,\n \"hqmf_version_number\" => self.hqmf_version_number,\n \"cms_id\" => self.cms_id\n }\n\n HQMF::Document.from_json(json)\n end", "def as_hqmf_model\n json = {\n \"id\" => self.measure_id,\n \"title\" => self.title,\n \"description\" => self.description,\n \"population_criteria\" => self.population_criteria,\n \"data_criteria\" => self.data_criteria,\n \"source_data_criteria\" => self.source_data_criteria,\n \"measure_period\" => self.measure_period,\n \"attributes\" => self.measure_attributes,\n \"populations\" => self.populations,\n \"hqmf_id\" => self.hqmf_id,\n \"hqmf_set_id\" => self.hqmf_set_id,\n \"hqmf_version_number\" => self.hqmf_version_number,\n \"cms_id\" => self.cms_id\n }\n\n HQMF::Document.from_json(json)\n end", "def show\n default_semantic_show\n end", "def create_model(ns, model_name, options)\r\n model = super # create the model with defaulted model options\r\n create_timetable(model, options) if options[:create_timetable] == true\r\n model\r\n end", "def show()\n @view__.show\n self\n end", "def get_model_files(options); end", "def options\n if @store and @store.rdoc then\n @store.rdoc.options\n else\n RDoc::Options.new\n end\n end", "def configure! options = {}\n apply_options! options\n configure_models if auto_config?(:models)\n end", "def configure! options = {}\n apply_options! options\n configure_models if auto_config?(:models)\n end", "def title\n case options.title\n when false then nil\n when true\n if domain.name then \"#{domain.name} domain model\" else \"Domain model\" end\n else options.title\n end\n end", "def render_model\n model.render\n end", "def UseCaseDiagram( options={}, &block )\n # options :name => \"Name of the Diagram\"\n $name = \"#{$name}\\n#{options[:name]}\" if options.has_key? :name\n # first create internal model,\n # i.e. the <code> in the DSL is executed\n # UseCaseDiagram () do ...<code>... end is executed\n # thereby building the internal use case diagram representation\n block.call\n # display the model\n displayOpen options # display preamble, also provide specific options for the display\n displayUseCases $usecases # display all use cases\n displayLinks $usecases # display links between the use cases\n displayActors $actors # display actors and their links to use cases\n displayClose # display epilogue\nend", "def show\n @ole.Show\n end", "def model\n return @model\n end", "def view_model_path\n @view_model_path || @view_model_path = self.name.underscore\n end", "def to_xml\n a = REXML::Element.new(\"property\")\n a.add_attribute(\"id\", name)\n a.add_element(\"name\").text = name\n if (parameter)\n a.add_element(\"parameter\").text = parameter\n end\n if (description)\n a.add_element(\"description\").text = description\n end\n if (@options)\n p @options\n @options.each {|name, value|\n a.add_element(name.to_s).text = value.to_s\n }\n end\n return a\n end", "def model\n @model\n end", "def model\n @model\n end", "def model\n @model\n end", "def model\n @model\n end", "def model\n node_value = at_node(doc)\n lookup_model(node_value)\n end", "def show\n @selection = Selection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @selection }\n end\n end", "def initialize(options = {})\n super()\n $app = App.current = self\n set_sketch_path unless online?\n make_accessible_to_the_browser\n options = {\n :width => 400, \n :height => 400, \n :title => \"\",\n :full_screen => false\n }.merge(options)\n @width, @height, @title = options[:width], options[:height], options[:title]\n @render_mode = P2D\n determine_how_to_display options\n end", "def to_kml_file(options = {})\n raise RuntimeError, 'No coordinates available for KML generation' unless to_kml?\n options = apply_default_file_options(options)\n\n style = 'kmlfile-style-id'\n kml_flights = @flights.select(&:to_kml?)\n marks = kml_flights.each_with_object({ :style_url => \"##{style}\" }).map(&:to_kml_placemark)\n\n kml = KMLFile.new\n kml.objects << KML::Document.new(\n :name => options[:name],\n :description => options[:description],\n :styles => [\n KML::Style.new(\n :id => style,\n :line_style => KML::LineStyle.new(:color => '7F00FFFF', :width => 4),\n :poly_style => KML::PolyStyle.new(:color => '7F00FF00')\n )\n ],\n :features => marks\n )\n kml\n end", "def render(options = {}) \n return if @view and !options[:force] # Avoid double rendering, if we have already attached a view\n \n if options == {} # default rendering\n render(:file => default_template_name)\n\n elsif action_name = options[:action]\n result = render(:file => default_template_name(action_name.to_s))\n\n elsif options[:file]\n file = options[:file]\n if file =~ /^\\// # Render from view root\n @view = render_for_file(File.join(\"app\", \"views\", \"#{file}.xml.builder\"))\n else\n @view = render_for_file(view_path(file)) \n end\n\n elsif options[:nothing]\n @view = Skates::Base::View.new()\n end\n end", "def model\n return @model\n end", "def model\n return @model\n end", "def build\n view\n self\n end", "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @document.to_json(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n format.xml { render :xml => @document.to_xml(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n end\n end", "def show\n @option = Options.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @option }\n end\n end", "def show\n raise NotImplementedError\n end", "def get(name, resource_group = configuration.resource_group)\n super.tap { |model| model.configuration = configuration }\n end", "def show()\n view.show\n end", "def to_xml(options={})\n options = options.reverse_merge(:root => false)\n to_hash(options).to_xml(:root => data_name(@_data))\n end", "def to_xml options={}\n\n super(options) do |xml|\n\n xml.reqNumber self.reqNumber\n\n if ! self.category.nil?\n xml.category self.category.catName\n else\n xml.category \"Not defined\"\n end\n\n\n xml.industries do\n industries.each do |industry|\n xml.industry industry.indName\n end\n end\n\n end\n\n end", "def model\n return Sketchup.active_model if not @rep\n @rep.model\nend", "def to_xml(options={})\r\n a = attributes.clone\r\n a.delete(\"ino:id\")\r\n a.to_xml({:root => self.class.doctype}.merge(options))\r\n end", "def view(name, opts = {})\n View.create(model, name, opts)\n create_view_method(name)\n end", "def show\n init\n end", "def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @label_sheet }\n end\n end", "def show\n @lens_model = LensModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lens_model }\n end\n end", "def model\n @model ||= resource.model\n end", "def to_xml(opts = {})\n mapper.to_xml(self, opts)\n end", "def show\n @test_model = TestModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_model }\n end\n end", "def to_xml(options={}, &block)\n super(options.reverse_merge(:include => :parts), &block)\n end", "def show\n set_index_options\n end", "def generate_path_from options\n options.path || view_model_path\n end", "def show\n @model_section = ModelSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @model_section }\n end\n end", "def get options\n table = DB.from(@table)\n result = table.first :id => options[:id]\n # return an instance of the model class with the data attributes\n @model_class.new result\n end", "def doc\n if model\n model.doc\n end\n end", "def model!(options, params:)\n options['model'] = Event.find(params[:id])\n end", "def represented\n model\n end" ]
[ "0.6096836", "0.54186976", "0.5318185", "0.52335274", "0.5195478", "0.51227534", "0.50567734", "0.5029529", "0.5011169", "0.49898344", "0.4956624", "0.48802328", "0.48799238", "0.48693708", "0.48692635", "0.48650995", "0.48609874", "0.48609874", "0.48133314", "0.48082572", "0.47780535", "0.47656053", "0.47599083", "0.46989927", "0.46909437", "0.4625579", "0.4613822", "0.4612228", "0.46025476", "0.45851487", "0.45851487", "0.45741415", "0.45691997", "0.45691997", "0.45608893", "0.45484126", "0.45415187", "0.45389473", "0.4536544", "0.4512515", "0.4484275", "0.44827527", "0.447317", "0.44651484", "0.4464571", "0.4462827", "0.44619212", "0.44619212", "0.44398108", "0.44398108", "0.44337496", "0.44336575", "0.44283155", "0.44244823", "0.44164425", "0.44069704", "0.44069704", "0.44035015", "0.43924147", "0.43904862", "0.43867713", "0.43752983", "0.4366557", "0.43657658", "0.43615147", "0.43615147", "0.43615147", "0.43615147", "0.43611407", "0.4355393", "0.43552977", "0.4355024", "0.43497342", "0.43496725", "0.43496725", "0.43488842", "0.43484142", "0.43465394", "0.43455064", "0.43134248", "0.43087226", "0.43083268", "0.4305874", "0.43056703", "0.42990318", "0.4289678", "0.42844823", "0.42830756", "0.4271388", "0.42707366", "0.42687342", "0.42659247", "0.426233", "0.42615253", "0.42593038", "0.42447758", "0.42443746", "0.4241891", "0.42409438", "0.42327675" ]
0.54155153
2
serialize errors to JSON
def as_json(options = {}) "{#{'errors'.inspect}:#{as_json_original(options)}}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_json\n { errors: @errors.as_json }\n end", "def error_messages_as_json\n { errors: object.errors.messages }\n end", "def errors_to_json(model)\n\t\treturn ModelError.new({\n\t\t\t:model => model,\n\t\t\t:error => model.errors.collect{ |attr,msg| attr.humanize+' - '+msg }.join('\\n'),\n\t\t})\n\tend", "def validation_error_as_json\n Jbuilder.encode do |json|\n json.error 'Validation Failed'\n end\n end", "def format_errors(_data)\n _data.errors.as_json\n end", "def as_json(*)\n {\n error_type: error_type,\n error_message: error_message,\n meta: meta\n }\n end", "def to_json(options = {})\n \"{#{'errors'.inspect}:#{to_json_original(options)}}\"\n end", "def json_resource_errors\n resource.errors.messages.to_json\n end", "def output_json_errors\n errors_as_hashes =\n errors.map do |err|\n { filename: err.filename, line_number: err.line_number, message: err.message }\n end\n\n File.open(@options['output-file'], 'w+') do |file|\n file.write JSON.dump(errors_as_hashes)\n end\n end", "def error(data = false)\n { error: data }.to_json\n end", "def json_resource_errors\n {\n error: true,\n errors: resource.errors,\n }\n end", "def errors_for(object)\n { json: { errors: object.errors }, status: :unprocessable_entity }\n end", "def serializable_hash\n { errors: (super[:data] || []).map { |error| error[:attributes] } }\n end", "def json_resource_errors\n { errors: resource.errors.full_messages }\n end", "def format_error(e)\n data = { error: e.class.to_s, message: e.message, backtrace: e.backtrace }\n JSON.pretty_generate(data)\n end", "def as_json(options=nil)\n return {} if messages.empty?\n attribute, types = messages.first\n type = types.first\n\n {\n :error => {\n :param => attribute,\n :type => type,\n :message => nil\n }\n }\n end", "def serialize_error\n case error\n when Common::Exceptions::BaseError\n base_error\n when Common::Client::Errors::ClientError\n client_error\n when EMISRedis::VeteranStatus::NotAuthorized\n emis_error(:not_authorized)\n when EMISRedis::VeteranStatus::RecordNotFound\n emis_error(:not_found)\n when MPI::Errors::RecordNotFound\n mpi_error(404)\n when MPI::Errors::FailedRequestError\n mpi_error(503)\n when MPI::Errors::DuplicateRecords\n mpi_error(404)\n else\n standard_error\n end\n end", "def json_render_errors(errors)\n json_fail errors\n end", "def error\n\t\t{ \n\t\t\terror: { \n\t\t\t\tmessage: self.object[:message],\n\t\t\t\tfield: self.object[:field]\n\t\t\t} \n\t\t}\n\tend", "def json_error(message = 'An error occurred')\n { status: 'error', message: message }\n end", "def json_validation_errors( errors, **context, &block )\n response = build_json_response( context )\n response.validation_errors errors, &block\n\n response.as_json\n end", "def render_errors(model)\n render json: { errors: model.errors.full_messages.join(',\\n')}, status: 422\n end", "def json_resource_errors\n { message: resource.errors.full_messages.first }\n end", "def exception_json(exception,code=500)\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end", "def to_ext_json(options = {})\n success = options.delete(:success)\n if errors.empty?#if success || (success.nil? && valid?)\n { :success => true,\n :data => if options.delete(:in_array)\n [ExtJsonSerializer.new(self,options).serialize]\n else\n ExtJsonSerializer.new(self,options).serialize\n end\n }.to_json(options)\n else\n error_hash = {}\n # attributes.each do |field, value|\n # if errors = self.errors.on(field)\n # error_hash[ExtJson::ext_name(self,field,options[:format]||@ext_format)] =\n # \"#{errors.is_a?(Array) ? errors.first : errors}\"\n # end\n # end\n errors.each do |attr,msg|\n error_hash[ExtJson::ext_name(self,attr,options[:format]||@ext_format)] = msg\n logger.debug \"ERROR: #{attr}: #{msg}\"\n end\n json={ :success => false, :errors => error_hash }.to_json(options)\n logger.debug \"JSON:#{json}\"\n return json\n end\n end", "def as_json(options={})\n options[:except] ||= ['errors']\n super.except(options)\n end", "def errors\n self.__source.errors.messages.to_hash.stringify_keys\n end", "def build_json_error(opts = {})\n json_body = { errors: [{ status: opts[:error_code] }] }\n json_body[:errors][0].store('message', opts[:message]) if opts[:message]\n if opts[:pointer]\n json_body[:errors][0].store(\n 'source',\n build_json_error_source(\n opts[:pointer],\n opts[:parameter]\n )\n )\n end\n json_body.to_json\n end", "def to_json\n\n hash = self.to_hash\n\n if (hash[:error] == nil)\n h = {\n success: true\n }.merge(hash)\n h\n else\n {\n success: false,\n err: {\n internal_id: hash[:internal_id] || 'SDK',\n code: hash[:error],\n msg: hash[:error_message],\n error_data: hash[:error_data] || []\n }\n }\n end\n\n end", "def errors\n {}\n end", "def render_error\n render json: { errors: @collection.errors.full_messages }, status: :unprocessable_entity\n end", "def error(status_code, error_message)\n content_type 'application/json'\n [status_code, JSON.dump({error: {message: error_message}})]\n end", "def to_json\n raise StandardError, \"Not implemented!\"\n end", "def error\n return {error: \"\"}\n end", "def to_str\n body={\n id: @id,\n event: @event,\n data: @data,\n }\n if errors.any?\n body[:errors_count][email protected]\n body[:errors]=@errors\n end\n body.to_json\n end", "def render_json_error(obj, opts = {})\n opts = { status: opts } if opts.is_a?(Fixnum)\n render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422\n end", "def render_error\n render json: { errors: @collectioner.errors.full_messages }, status: :unprocessable_entity\n end", "def error_object\n {:success => false, :error => \"Error encountered\"}\n end", "def render_error\n render json: { errors: @address.errors.full_message }, status: unprocessable_entity\n end", "def error_base\n {\n code: JSONAPI::VALIDATION_ERROR,\n status: :unprocessable_entity\n }\n end", "def render_error_save status = :unprocessable_entity, obj\n render status: status, json: {errors: obj.errors.full_messages}\n end", "def render_error_save status = :unprocessable_entity, obj\n render status: status, json: {errors: obj.errors.full_messages}\n end", "def json_error err, status = 400, headers = {}\n\t\t\tjson_resp({'error' => err}, status, headers)\n\t\tend", "def format_rest_error\n Array(Chef::JSONCompat.from_json(exception.response.body)[\"error\"]).join(\"; \")\n rescue Exception\n safe_format_rest_error\n end", "def render_errors(errors)\n render json: errors, status: :bad_request\n end", "def save_model_error object\n error_str = I18n.t 'term.error'\n error_str += ' : '\n # Grab the error message from the student\n object.errors.each do |attr,msg|\n error_str += \"#{attr} - #{msg},\"\n end\n render :json => { error: error_str }, :status => :unprocessable_entity\n end", "def failure_json\n { errors: 'Sorry you are not eligible for WellMatch' }\n end", "def error\n @obj['error']\n end", "def invalid_json_json(exception)\n code = 500\n render :json => Status::Errors.exception_json(\"We are currently experiencing issues with our data server, please try again soon.\", code).to_json, :status => code\n end", "def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n end", "def exception_to_hash(id, exception, status)\n json_error(id, exception.class.name, exception.message, status)\n end", "def render_json_error(error_message, status = 400)\n render_json_errors [error_message], status\n end", "def render_error(resource, status)\n render json: resource, status: status, adapter: :json_api, serializer: ActiveModel::Serializer::ErrorSerializer\n end", "def errors\n json = parsed_body\n json ? json['Error'] : nil\n end", "def error_message(errors, status)\n render json: { errors: errors }, status: status\n end", "def json_fail(message)\n { status: 'fail', data: { message: message } }\n end", "def errors\n @errors ||= {}\n end", "def serializable_hash\n if @object.class.ancestors.include?(ActiveModel::Model)\n return _model_errors\n end\n if @object.kind_of? Matterhorn::ResourceError\n return _exceptions \n end\n end", "def render_error(err)\n json_response({ message: err }, :unprocessable_entity)\n end", "def render_error_json(msg = '', status = :internal_server_error, data = nil, links = nil)\n render json: {\n status: 'error',\n code: ApplicationHelper.code_status[status],\n msg: msg,\n data: data,\n links: links\n }, status: status\n end", "def render_error_messages(errors, status = :unprocessable_entity)\n render(json: { errors: errors }, status: status)\n end", "def write_errors(obj, scope: false)\n obj.errors.map { |e| \"#{t_field(e.attribute, scope || obj.class.table_name.singularize)} #{e.message}\" }.join(', ')\n end", "def errors_h\n\t\t{errors: self.errors.messages}\n\tend", "def render_json_with_exception(exception)\n render :json => { :error => exception.message }, :status => exception.status_code\n end", "def render_error\n render json: { errors: @product.errors.full_messages }, status: :unprocessable_entity\n end", "def record_invalid(error)\n #Our object should look something like this:\n # {\n # errors: [\n # {\n # type: \"ActiveRecord::RecordInvalid\",\n # record_type: \"Question\",\n # field: \"body\",\n # message: '...'\n # }\n # ]\n # }\n\n invalid_record = error.record\n errors = invalid_record.errors.map do |field, message|\n {\n type: error.class.to_s, #need it in string format\n record_type: invalid_record.class.to_s,\n field: field,\n message: message\n }\n end\n render(\n json: { status: 422, errors: errors },\n status: 422 #alias is :unprocessable_entity\n )\n end", "def build_error_response(error)\n error_messages = messages_from_error(error)\n\n JsonRender.convert(:status => :error, :messages => error_messages)\n end", "def errors\n @_errors ||= {}\n @_errors\n end", "def as_json(options={})\n super(options.merge({:except => [:errors, :validation_context]}))\n end", "def format_errors(body)\n {\n error: {\n engine: 'google',\n code: body['error']['code'],\n message: body['error']['message']\n }\n }\n end", "def legacy_error status, message, extra={}\n case status\n when Error\n status = status.http_code\n when StandardError\n extra[:backtrace] = status.backtrace if params[:backtrace]\n status = 500\n end\n content_type 'application/json'\n return status, {\n error: message,\n }.merge(extra).to_json\n end", "def error\n response_json.fetch(\"error\", \"\")\n end", "def error_hash(exception)\n {\n success: false,\n payload: {\n error: exception.class.name,\n message: exception.message\n }\n }\n end", "def error\n @data['error']\n end", "def error\n @data['error']\n end", "def process_error(errors)\n\n res = {\n :msg => '',\n :fields => []\n }\n errors.each do |err|\n res[:fields].push(err[0])\n res[:msg] += \"<p>#{err[0]} #{err[1]}</p>\"\n end\n res\n end", "def errors_string\n getErrors.map { |e| \"(#{e.object || ''}): #{e.error}\" }.join(', ').strip\n end", "def error_message\n if !success?\n body\n end\n rescue JSON::ParserError => ex\n ex.message\n end", "def to_h\n Utils::Hash.new(@errors).deep_dup\n end", "def error\n return unless body['error'] || body['error_message']\n\n error_response = normalize_error(body)\n deserialize_json(error_response)\n end", "def error\n data['error']\n end", "def record_invalid(exception)\n render json: exception.record.errors, status: :unprocessable_entity\n end", "def wrap_error(message)\n { error: message }\nend", "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 build_error(msg, status)\n {\n json: {\n errors: [\n {\n \"status\": Rack::Utils::SYMBOL_TO_STATUS_CODE[status].to_s,\n \"title\": msg,\n \"detail\": msg\n }\n ]\n },\n content_type: 'application/vnd.api+json',\n status: status\n }\n end", "def error(body)\n parsed_body = JSON.parse(body)\n \"#{parsed_body['errorNum']}: #{parsed_body[\"errorMessage\"]}\"\n end", "def errors\n @errors ||= Hash.new { |hash, key| hash[key] = [] }\n end", "def errors\n @errors ||= Hash.new { |hash, key| hash[key] = [] }\n end", "def json_parser_error_class\n ::JSON::ParserError\n end", "def errors\n @error.fetch('errors', [])\n end", "def errors\n return nil if @errors.nil? || @errors.empty?\n\n errs = @errors.map { |err| parse_error err }\n Hash[*errs.flatten].with_indifferent_access\n end", "def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end", "def json_serialize\n end", "def to_jq_upload_error(uploaded)\n res = {\n name: uploaded.read_attribute(:uploaded_file_name),\n size: uploaded.read_attribute(:upload_file_size),\n error: uploaded.errors.full_messages,\n }\n return res\n end", "def four_twenty_two(error)\n json_response({ errors: error }, :unprocessable_entity)\n end", "def record_not_unique_json(exception)\n code = 405\n original_message = exception.message\n exception = ActiveRecord::RecordNotUnique.new(Status::Errors::ERROR_NON_UNIQUE_DB_ID[\"message\"])\n render :json => Status::Errors.exception_json(exception, code, original_message).to_json, :status => code\n end", "def as_json\n {\n code: code,\n field: field,\n message: full_message\n }\n end", "def to_s(value)\n \"#{@errors.inspect}\"\n end", "def resource_save_failure_response\n error_string = \"\"\n resource.errors.full_messages.each do |msg| #Concatinating error message into 1 string.\n error_string += msg\n end\n render :json => {:success => \"false\",\n :message => \"Something went wrong. Please try again later. #{error_string}\"}\n end", "def hashify_errors\n self.errors.map(&:first).uniq.inject({}) { |h, v|\n h[v] = (self.errors[v].is_a?(Array) ) ? self.errors[v].join(', ') : self.errors[v]\n h\n }\n end" ]
[ "0.80529106", "0.77316046", "0.7552049", "0.75032115", "0.7482961", "0.7448", "0.74449426", "0.7393748", "0.71646625", "0.7100807", "0.7095447", "0.7089109", "0.70874184", "0.69845635", "0.6957885", "0.69160426", "0.68817127", "0.6829011", "0.6715763", "0.6695147", "0.66695756", "0.6635852", "0.66226894", "0.66185904", "0.66106814", "0.65876216", "0.6569621", "0.65518314", "0.65432024", "0.6541681", "0.6487883", "0.6482891", "0.64213455", "0.640089", "0.6395638", "0.63525754", "0.63479406", "0.634092", "0.6290269", "0.62725276", "0.6258192", "0.6258192", "0.6241244", "0.62330985", "0.62091523", "0.62049925", "0.6189066", "0.6153017", "0.61472744", "0.6141324", "0.6138921", "0.6126432", "0.61202806", "0.6117016", "0.6104907", "0.6091314", "0.6079952", "0.6072882", "0.6069562", "0.6051311", "0.60456973", "0.6034811", "0.60235196", "0.60137576", "0.59877187", "0.5980886", "0.5975904", "0.59645087", "0.5953224", "0.59344006", "0.5931497", "0.5915849", "0.591504", "0.5914391", "0.5914391", "0.5907819", "0.590688", "0.59002954", "0.58979493", "0.58976454", "0.58895653", "0.588921", "0.58843166", "0.58683604", "0.5866907", "0.5859632", "0.5859145", "0.5859145", "0.585732", "0.5841254", "0.5839971", "0.5819655", "0.5813854", "0.5805949", "0.5802857", "0.5798652", "0.5779881", "0.5768305", "0.57645345", "0.57642007" ]
0.7398163
7
serialize errors to AMF
def to_amf(options = {}) options[:amf_version] = 3 options[:serializer] ||= RestfulX::AMF::RxAMFSerializer.new options[:serializer].serialize_errors(Hash[*@errors.to_a.flatten]).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_amf(options = {})\n options[:amf_version] = 3\n options[:serializer] ||= RestfulX::AMF::RxAMFSerializer.new\n options[:serializer].serialize_errors(Hash[*@errors.to_a.flatten]).to_s\n end", "def serialize_error\n case error\n when Common::Exceptions::BaseError\n base_error\n when Common::Client::Errors::ClientError\n client_error\n when EMISRedis::VeteranStatus::NotAuthorized\n emis_error(:not_authorized)\n when EMISRedis::VeteranStatus::RecordNotFound\n emis_error(:not_found)\n when MPI::Errors::RecordNotFound\n mpi_error(404)\n when MPI::Errors::FailedRequestError\n mpi_error(503)\n when MPI::Errors::DuplicateRecords\n mpi_error(404)\n else\n standard_error\n end\n end", "def serializable_hash\n { errors: (super[:data] || []).map { |error| error[:attributes] } }\n end", "def error\n\t\t{ \n\t\t\terror: { \n\t\t\t\tmessage: self.object[:message],\n\t\t\t\tfield: self.object[:field]\n\t\t\t} \n\t\t}\n\tend", "def write_error_info\n end", "def as_json\n { errors: @errors.as_json }\n end", "def error_messages_as_json\n { errors: object.errors.messages }\n end", "def process_error(errors)\n\n res = {\n :msg => '',\n :fields => []\n }\n errors.each do |err|\n res[:fields].push(err[0])\n res[:msg] += \"<p>#{err[0]} #{err[1]}</p>\"\n end\n res\n end", "def serialize\n stream = \"\"\n\n # Write version\n stream << pack_int16_network(@amf_version)\n\n # Write headers\n stream << pack_int16_network(@headers.length) # Header count\n @headers.each_value do |h|\n name_str = h.name\n name_str.encode!(\"UTF-8\").force_encoding(\"ASCII-8BIT\") if name_str.respond_to?(:encode)\n stream << pack_int16_network(name_str.bytesize)\n stream << name_str\n stream << pack_int8(h.must_understand ? 1 : 0)\n stream << pack_word32_network(-1)\n stream << RocketAMF.serialize(h.data, 0)\n end\n\n # Write messages\n stream << pack_int16_network(@messages.length) # Message count\n @messages.each do |m|\n uri_str = m.target_uri\n uri_str.encode!(\"UTF-8\").force_encoding(\"ASCII-8BIT\") if uri_str.respond_to?(:encode)\n stream << pack_int16_network(uri_str.bytesize)\n stream << uri_str\n\n uri_str = m.response_uri\n uri_str.encode!(\"UTF-8\").force_encoding(\"ASCII-8BIT\") if uri_str.respond_to?(:encode)\n stream << pack_int16_network(uri_str.bytesize)\n stream << uri_str\n\n stream << pack_word32_network(-1)\n stream << AMF0_AMF3_MARKER if @amf_version == 3\n stream << RocketAMF.serialize(m.data, @amf_version)\n end\n\n stream\n end", "def error_object\n {:success => false, :error => \"Error encountered\"}\n end", "def format_errors(_data)\n _data.errors.as_json\n end", "def errors\n self.__source.errors.messages.to_hash.stringify_keys\n end", "def encode_amf serializer\n ::Rails.logger.debug \"[HawkAMF] using default encode_amf method -----------\"\n self.to_amf.encode_amf serializer\n end", "def errors_for(object)\n { json: { errors: object.errors }, status: :unprocessable_entity }\n end", "def json_resource_errors\n resource.errors.messages.to_json\n end", "def error(data = false)\n { error: data }.to_json\n end", "def record_invalid(error)\n #Our object should look something like this:\n # {\n # errors: [\n # {\n # type: \"ActiveRecord::RecordInvalid\",\n # record_type: \"Question\",\n # field: \"body\",\n # message: '...'\n # }\n # ]\n # }\n\n invalid_record = error.record\n errors = invalid_record.errors.map do |field, message|\n {\n type: error.class.to_s, #need it in string format\n record_type: invalid_record.class.to_s,\n field: field,\n message: message\n }\n end\n render(\n json: { status: 422, errors: errors },\n status: 422 #alias is :unprocessable_entity\n )\n end", "def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n end", "def validation_error_as_json\n Jbuilder.encode do |json|\n json.error 'Validation Failed'\n end\n end", "def errors\n {}\n end", "def error(ex) [:error, ex]; end", "def render_error\n render json: { errors: @collectioner.errors.full_messages }, status: :unprocessable_entity\n end", "def format_error(e)\n data = { error: e.class.to_s, message: e.message, backtrace: e.backtrace }\n JSON.pretty_generate(data)\n end", "def to_amf(options = {})\n default_except = [:crypted_password, :salt, :remember_token, :remember_token_expires_at, :created_at, :updated_at]\n options[:except] = (options[:except] ? options[:except] + default_except : default_except)\n \n RestfulX::Serialization::AMFSerializer.new(self, options).to_s\n end", "def to_amf(options = {})\n default_except = [:encrypted_password, :password_salt, :remember_token, :remember_token_expires_at, :created_at, :updated_at]\n options[:except] = (options[:except] ? options[:except] + default_except : default_except)\n \n AMFSerializer.new(self, options).serialize(&block)\n end", "def render_error\n render json: { errors: @collection.errors.full_messages }, status: :unprocessable_entity\n end", "def recover_from(_error); end", "def error\n @obj['error']\n end", "def error\n @error_response\n end", "def errors\n err = []\n err << article_id\n err << title\n err << authors\n err << research_domain\n err << funder\n err << abstract\n err << subjects\n\n err << s3_error_uploads\n err << url_error_validating\n err << over_file_count\n err << over_files_size\n err << data_required\n\n err.flatten\n end", "def json_resource_errors\n { errors: resource.errors.full_messages }\n end", "def errors_for(_object); end", "def error\n []\n end", "def error\n records\n @config[:error]\n end", "def error_hash(exception)\n {\n success: false,\n payload: {\n error: exception.class.name,\n message: exception.message\n }\n }\n end", "def errors_to_json(model)\n\t\treturn ModelError.new({\n\t\t\t:model => model,\n\t\t\t:error => model.errors.collect{ |attr,msg| attr.humanize+' - '+msg }.join('\\n'),\n\t\t})\n\tend", "def json_resource_errors\n {\n error: true,\n errors: resource.errors,\n }\n end", "def auth_error(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end", "def error\n @data['error']\n end", "def error\n @data['error']\n end", "def error\n @error\n end", "def serializable_hash\n if @object.class.ancestors.include?(ActiveModel::Model)\n return _model_errors\n end\n if @object.kind_of? Matterhorn::ResourceError\n return _exceptions \n end\n end", "def errors\n @attributes[:errors]\n end", "def error\n return {error: \"\"}\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def check_errors\n unless valid? \n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n \n raise \"format should not be nil\" if format.nil?\n raise \"invalid format #{format}\" unless format.valid? \n raise \"#{self.errors.to_a}, error encountered while saving #{@datafile_id}, #{@bitstream_id} \" \n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"error\", @error)\n writer.write_enum_value(\"status\", @status)\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 format_rest_error\n Array(Chef::JSONCompat.from_json(exception.response.body)[\"error\"]).join(\"; \")\n rescue Exception\n safe_format_rest_error\n end", "def record_invalid(error)\n # For a ActiveRecord::RecordInvalid error, the .record method \n # returns the model instance that failed validation\n invalid_record = error.record\n errors = invalid_record.errors.map do |field, message|\n {\n type: error.class.to_s,\n record_type: error.record.class.to_s,\n field: field,\n message: message\n }\n end\n render(\n json: {\n errors: errors\n },\n status: :unprocessable_entity # alias for status 422\n ) \n end", "def errors\n @_errors ||= {}\n @_errors\n end", "def to_a\n errors.dup\n end", "def error\r\n @error\r\n end", "def record_error (error)\n\n path = get_path(error.fei)\n\n dirpath = File.dirname(path)\n\n FileUtils.mkdir_p(dirpath) unless File.exist?(dirpath)\n\n File.open(path, 'a+') do |f|\n f.puts(error.to_yaml)\n end\n end", "def errors=(_); end", "def errors\n @errors ||= {}\n end", "def save\n respond_to do |format|\n format.amf do\n @contact = params[0]\n\n if @contact.save\n render :amf => @contact\n else\n render :amf => FaultObject.new(@contact.errors.full_messages.join('\\n'))\n end\n end\n end\n end", "def record_invalid(exception)\n render json: exception.record.errors, status: :unprocessable_entity\n end", "def to_h\n {\n response_type: 'ephemeral',\n text: 'Sorry, I could not send your message',\n attachments: errors.flat_map { |message| { text: message } }\n }\n end", "def error\n return unless body['error'] || body['error_message']\n\n error_response = normalize_error(body)\n deserialize_json(error_response)\n end", "def error(status_code, error_message)\n content_type 'application/json'\n [status_code, JSON.dump({error: {message: error_message}})]\n end", "def add_errors_from_response_exception(e)\n return if !e.respond_to?(:response)\n errors = (BackchatResource::Base.format.decode(e.response.body))[\"errors\"]\n if errors.any?\n errors.each do |err|\n if err.length == 1 # message only\n self.errors.add(:base, err[0])\n else #key, message(*)\n key = err[0].to_sym\n err[1..-1].each do |value|\n self.errors.add(key, value)\n end\n end\n end\n end\n end", "def attribute_errors\n {}\n end", "def parse_error(error, req); end", "def write_error_definitions!\n self.output[:definitions].merge!(\n 'Error' => {\n type: 'object',\n properties: {\n type: type_and_format('string'),\n message: type_and_format('string')\n }\n },\n 'Errors' => {\n type: 'object',\n properties: {\n errors: {\n type: 'array',\n items: { '$ref' => '#/definitions/Error' }\n }\n }\n }\n )\n end", "def error\n data['error']\n end", "def json_resource_errors\n { message: resource.errors.full_messages.first }\n end", "def as_json(*)\n {\n error_type: error_type,\n error_message: error_message,\n meta: meta\n }\n end", "def as_json(options=nil)\n return {} if messages.empty?\n attribute, types = messages.first\n type = types.first\n\n {\n :error => {\n :param => attribute,\n :type => type,\n :message => nil\n }\n }\n end", "def errors(*args)\n @amv_errors\n end", "def write_errors(obj, scope: false)\n obj.errors.map { |e| \"#{t_field(e.attribute, scope || obj.class.table_name.singularize)} #{e.message}\" }.join(', ')\n end", "def errors\n @error.fetch('errors', [])\n end", "def output_json_errors\n errors_as_hashes =\n errors.map do |err|\n { filename: err.filename, line_number: err.line_number, message: err.message }\n end\n\n File.open(@options['output-file'], 'w+') do |file|\n file.write JSON.dump(errors_as_hashes)\n end\n end", "def errors_h\n\t\t{errors: self.errors.messages}\n\tend", "def render_error\n render json: { errors: @address.errors.full_message }, status: unprocessable_entity\n end", "def validation_error(obj)\n error(406, obj.errors.full_messages)\n end", "def process_errors\n Sparkql::ErrorsProcessor.new(errors)\n end", "def render_error(err)\n json_response({ message: err }, :unprocessable_entity)\n end", "def errors\n json = parsed_body\n json ? json['Error'] : nil\n end", "def store_error(error, env = {})\n env[\"rack.errors\"].puts(errors_string(error)) if env\n end", "def amf_exception_handler(ex)\n RAILS_DEFAULT_LOGGER.error ex.message\n RAILS_DEFAULT_LOGGER.error ex.backtrace.join( \"\\n\" )\n render :amf => FaultObject.new(ex.to_s) if is_amf\n end", "def recover_from(_error)\n end", "def error\n end", "def rest_errorhandler(error_obj)\n error_obj\n end", "def errors\n @errors ||= []\n end" ]
[ "0.7167281", "0.67037886", "0.6085184", "0.58845764", "0.5805347", "0.56878185", "0.56590694", "0.56496", "0.56488997", "0.5643584", "0.56181484", "0.56171775", "0.5615485", "0.5604924", "0.5600717", "0.5592583", "0.55849624", "0.558445", "0.55825907", "0.5560151", "0.5531363", "0.54915506", "0.5485992", "0.54806864", "0.5471669", "0.54684997", "0.54672176", "0.54498076", "0.54448915", "0.5424171", "0.5409927", "0.5405842", "0.54050463", "0.53776014", "0.5371948", "0.5359003", "0.5354753", "0.5340031", "0.5339361", "0.5339361", "0.5333925", "0.5329039", "0.532806", "0.53162163", "0.53126174", "0.53126174", "0.53126174", "0.53126174", "0.53126174", "0.53126174", "0.53126174", "0.53126174", "0.53126174", "0.5293899", "0.5293899", "0.5293899", "0.5293899", "0.5293899", "0.5293899", "0.5293899", "0.52780753", "0.5277474", "0.52769774", "0.5273579", "0.52689964", "0.5268116", "0.5265353", "0.52650374", "0.5260239", "0.52571356", "0.52535677", "0.52493644", "0.5241559", "0.52407974", "0.5238512", "0.52380675", "0.52356625", "0.5235028", "0.5226202", "0.52152354", "0.5213013", "0.5211349", "0.5206379", "0.52044624", "0.5184698", "0.5184669", "0.51804817", "0.5179298", "0.51784426", "0.51721597", "0.5171135", "0.5171083", "0.51649195", "0.5156068", "0.5155796", "0.5153875", "0.5147233", "0.51440895", "0.5140958", "0.5131968" ]
0.7100394
1
Whether this station has a "borne" (yellow selfservice ticket machine)
def has_borne? sncf_self_service_machine == "t" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_bees?\n state == 'bees'\n end", "def away?\n online? and (presence.show == :away or presence.show == :xa)\n end", "def in_journey?\n @entry_station != nil\n end", "def away?\n status == :away\n end", "def occupied?\n !!@boat\n end", "def global_water_sport?\n # TODO\n end", "def works_at_hanson_st?\n @city == HANSON\n end", "def busy?\n online? and presence.show == :dnd\n end", "def away?\n ! self.active.blank?\n end", "def human_lost?\n human_ship_cells = @human_board.cells_containing_ships.map {|key| @human_board.cells[key].fired_upon?}\n if human_ship_cells.all? {|fired_upon_status| fired_upon_status == true} == true\n return true\n end\n end", "def ballot_registered?\n @ballot_registered\n end", "def battery_connected?\n $ioreg_return.split(' = ')[4].strip.split(\"\\n\")[0] == \"Yes\" ? true : false\n end", "def has_bridge?\r\n not @bridges.empty?\r\n end", "def waiver?\n free_agent? && !waiver_bid\n end", "def away?\n self.state == :away\n end", "def is_ball_mine?\n \treturn @agentInfo.getIsBallMine\n end", "def lost?\n all_bombs = @grid.flatten.select { | tile | tile.value == BOMB }\n all_bombs.all? { | tile | tile.revealed }\n end", "def stay_alive?(live_neighbors)\n live_neighbors == 2 || live_neighbors == 3\nend", "def bear_off?\n to.instance_of?(JustBackgammon::OffBoard)\n end", "def bass?\n @cr[0xa][7] == 1\n end", "def faab?\n free_agent? && !waiver_bid.nil?\n end", "def trainer_battle?\n !@names[1].empty?\n end", "def busy?\n BusyPhases.any? {|phase| battle_phase == phase }\n end", "def correspondence?\n correspondence_indicator && !ojt? && !offer_degree?\n end", "def schengen_check?\n schengen_overstay? == false && continuious_overstay? == false\n end", "def already_used?\n p \"Checking already used\"\n vehicle.present? and state == 1\n end", "def can_use_ill?\n !virginia_borrower?\n end", "def hungry?\n\n\t\t @stuff_in_belly <= 2\n\t\tend", "def alive?\n\t\t\[email protected]? || @battery > 0\n\t\tend", "def someone_won?\n !!winnning_marker\n end", "def check_mate?(b_or_w)\n checked_team_locs = find_checked_team_locs(b_or_w)\n\n return false if ally_piece_can_uncheck_king?(checked_team_locs)\n return true\n end", "def throbbing?\n return get_throb.running?\n end", "def someone_won_round?\r\n !!winner\r\n end", "def bladeserver?\n physical_type == \"BLADE\"\n end", "def bureaucrat?\n (status =~ /bureaucrat/) != nil\n end", "def is_my_bottle?(id)\n bottle = Bottle.find_by_id(id)\n bottle.cellar.user_id == current_user ? true : false\n end", "def is_connected_east?\r\n return true if @connected_directions.include?(:east)\r\n return false\r\n end", "def hometown_show d\n if (venue.city == band)\n true\n else\n false\n end\n end", "def hometown_show\n if self.venue.city == self.band.hometown\n return true\n end\n end", "def trigger_king_rock?\n return data.status != 7\n end", "def hungry?\n\t\t@stuff_in_belly <= 2\n\tend", "def hungry?\n\t\t@stuff_in_belly <= 2\n\tend", "def has_closed_rent\r\n if ((self.rent_closed) && (self.rent_closed != 0))\r\n if Time.at(rent_closed) <= Time.now\r\n return true\r\n else\r\n return false\r\n end\r\n else\r\n return false\r\n end\r\n end", "def business_day?\n !holiday?\n end", "def come_alive?(live_neighbors)\n live_neighbors == 3\nend", "def has_bingo?\n self.num_bingos > 0\n end", "def live?\n networks = self.class.all false\n network = networks.find { |net| net.name == name }\n network ? true : false\n end", "def state?\n usa?\n end", "def send?\n # TODO: rename to better name\n !Holiday.today?\n end", "def hometown_show?\n # self.venue.city\n # self.band.hometown\n\n self.venue.city == self.band.hometown\n end", "def baremetal?\n if dell_server?\n !related_switches.empty? && related_volumes.empty? && related_clusters.empty?\n else\n related_volumes.empty? && related_clusters.empty?\n end\n end", "def alive?\n self.status == \"Alive\"\n end", "def busy?\n @battler && BusyPhases.any? do |phase|\n phase == @battler.battle_phase\n end && [email protected] || (@battler && @battler.moving?)\n end", "def is_hardwire?(); @type == GRT_HARDWIRE; end", "def night?\n return $game_switches[::Yuki::Sw::TJN_NightTime]\n end", "def ounce_troy? = unit == 'ounce-troy'", "def abonneCoursDeNatation?\n ln = Activite.natation\n return activite?(ln.id);\n end", "def living_condition\n neighboars_count = neighbours_living.count\n alive && !(neighboars_count < 2 || neighboars_count > 3)\n end", "def terminus?(node, corporation)\n (node.city? && node.tokened_by?(corporation)) ||\n (node.town? && FACTORY_INFO[node.hex.id]) ||\n (node.city? && !node.blocks?(corporation) &&\n (((mine = find_mine_in_hex(node.hex)) && mine_open?(mine)) || FACTORY_INFO[node.hex.id]))\n end", "def ready_for_war?\n return true if (self.embassy && self.army)\n end", "def towerserver?\n physical_type == \"TOWER\"\n end", "def someone_won?(brd)\n !!detect_winner(brd)\n end", "def rental?\n business_activity == :rental or business_activity == :both_rental_activities_tours\n end", "def running?\n update_state()\n return @society_state == RUNNING\n end", "def hungry?\r\n # methods that return true or false\r\n @stuff_in_belly <= 2\r\n end", "def see_ball?\n \tball.notSeenLongTime() < 5\n end", "def check_for_a_bomb\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking?\n return true\n end\n end\n return false\n end", "def washington_state_resident?\n resident == 1 || resident == 2\n end", "def new_born\n !alive && neighbours_living.count == 3\n end", "def hail?\n return false if $game_temp.in_battle && ::BattleEngine.state[:air_lock]\n return current_weather == 4\n end", "def slaveof?\n return [email protected]?\n end", "def has_autopay_rent\r\n if ((self.actual_rent) && (self.actual_rent.has_autopay))\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def stalking?(boat)\n\t\tstalked_boats.include?(boat)\n\tend", "def indoors?\n @info.indoors\n end", "def active_scheduled_leaderbits_receiver?\n !discarded? &&\n schedule_id.present? &&\n leaderbits_sending_enabled? &&\n organization.leaderbits_sending_enabled?\n end", "def poopy?\n\t\t@stuff_in_intestine >= 8\n\tend", "def took_off?\n if self.status == \"flying\"\n true\n end\n end", "def won?\n @state.id == 14\n end", "def is_obstacle? \n return false\n end", "def alive?()\n\t\tamount_of( :deuterium ) > 0\n\tend", "def pbBikeCheck\n if $PokemonGlobal.surfing ||\n (!$PokemonGlobal.bicycle && pbGetTerrainTag==PBTerrain::TallGrass)\n Kernel.pbMessage(_INTL(\"Can't use that here.\"))\n return false\n end\n# if $game_player.pbHasDependentEvents?\n# Kernel.pbMessage(_INTL(\"It can't be used when you have someone with you.\"))\n# return false\n# end\n if $PokemonGlobal.bicycle\n if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)\n Kernel.pbMessage(_INTL(\"You can't dismount your Bike here.\"))\n return false\n end\n return true\n else\n val=pbGetMetadata($game_map.map_id,MetadataBicycle)\n val=pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil\n if !val\n Kernel.pbMessage(_INTL(\"Can't use that here.\"))\n return false\n end\n return true\n end\nend", "def hungry?\n\t @stuff_in_belly <= 2\n\tend", "def is_stormy?\n\t\tweather?\n\tend", "def unknown?\n home_team.nil? && away_team.nil?\n end", "def available?\n vehicle.nil?\n end", "def round_actual?\n !self.club.round_actual.nil?\n end", "def check_status \n return self.status == :open_hotel_block\n end", "def obstacle?\n @color == @@colors[:grey]\n end", "def sandstorm?\n return false if $game_temp.in_battle && ::BattleEngine.state[:air_lock]\n return current_weather == 3\n end", "def machine?\n machine_flag != '0'\n end", "def stone? = unit == 'stone'", "def flight?\n !correspondence? && flight_indicator && !ojt? && !offer_degree?\n end", "def can_make_reserves?\n !undergraduate? && !virginia_borrower?\n end", "def rainy_today?\n self.rainy_today == true\n end", "def business?\n self.business.any?\n end", "def happy_walker?\n @dog_walker.favorite_breed == @dog.breed \n end", "def round_now?\n #something like the above, but also goes into finding the tournament and then cheking if any rounds are active.\n return false;\n end", "def is_alive?\n @alive = false if Dates.is_greatter(@last_wash, @limit_wash)\n @alive = false if Dates.is_greatter(@last_food, @limit_food)\n return @alive\n end", "def auto_battle?\r\n special_flag(FLAG_ID_AUTO_BATTLE)\r\n end", "def relay_on?(relay_number, bank_number)\n relay_status(relay_number, bank_number) == 1\n end" ]
[ "0.6407664", "0.63906956", "0.6372528", "0.635399", "0.6334876", "0.62397814", "0.6199753", "0.61698484", "0.61692524", "0.61418283", "0.6135924", "0.6134875", "0.6134158", "0.6130723", "0.6125004", "0.611604", "0.6097274", "0.60916394", "0.6061751", "0.6046658", "0.60454136", "0.6045092", "0.6035877", "0.60301644", "0.6021728", "0.60023123", "0.5989347", "0.59623826", "0.5957748", "0.5955131", "0.5952615", "0.5950216", "0.593108", "0.5930426", "0.5928646", "0.5927752", "0.59264463", "0.5913007", "0.5910872", "0.5908063", "0.5901592", "0.5901592", "0.5898778", "0.58981955", "0.58952534", "0.58949107", "0.5891307", "0.58875644", "0.58814466", "0.58777577", "0.5869357", "0.58643126", "0.58629596", "0.5856538", "0.5846164", "0.58409923", "0.58378756", "0.5835857", "0.58340275", "0.58325326", "0.58314115", "0.5830542", "0.5825606", "0.58169127", "0.581227", "0.5810004", "0.5806146", "0.5805853", "0.5797583", "0.57962847", "0.5783666", "0.5780635", "0.5779777", "0.5772921", "0.57663757", "0.5761371", "0.57606506", "0.5749977", "0.5736237", "0.57351226", "0.5735057", "0.57348335", "0.573442", "0.5732265", "0.57297695", "0.572785", "0.57252055", "0.57185423", "0.5713348", "0.5712631", "0.5710819", "0.57053566", "0.57053345", "0.5704411", "0.5701703", "0.5698089", "0.56973344", "0.56932384", "0.5687512", "0.5686061" ]
0.8183597
0
List of the next departing trains from this station.
def departures(refresh = false) if tvs trains(:departure, refresh) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_train(station, destinations, opts = {})\n ldbws.next_departures_with_details(station, destinations, opts)\n end", "def next_station\n @route.stations[@current_station_index + 1]\n end", "def next_station\n @route.stations[@current_station + 1] if current_station != @route.stations.last\n end", "def next_station\n if @current_station == @route.stations.last\n @current_station\n else\n @current_station = @route.stations[@route.stations.index(@current_station) + 1]\n end\n end", "def next_station\n return @current_station if @current_station == @route.last\n\n @route.stations[@route.stations.index(@current_station) + 1]\n end", "def list_all_trains\n Train.all.sort{|a,b| a.destination <=> b.destination}.each.with_index(1) do |element, index|\n puts\"\\n\"\n puts \"#{index}: Destination: #{element.destination}\"\n puts \" Base time: #{element.event_time}\"\n puts \" Line: #{element.line}\"\n puts \" Direction: #{element.dir}\"\n puts \" Incoming Stations:\"\n element.station.each{|hash| puts \"Station: #{hash['station']}\\nWait Time: #{hash['waiting_time']}\\n-----------------------------------\\n\"}\n end\n puts \"\\nType 1 to restart and anything else to end:\\n\"\n get_end = gets.strip\n if get_end == '1'\n restart\n end\nend", "def future_steps\n if active\n Step.filter(:system => system).where{ |o| o.number >= next_step_number}.order(:number.asc)\n else\n []\n end\n end", "def next_station_index\n current_station_index + 1\n end", "def prev_next_dwelling_ids\n prev_id = nil\n next_id = nil\n idx = self.dwelling_number.to_i\n pc_id = self.freecen_piece_id\n if idx && idx >= 0\n prev_dwel = FreecenDwelling.where(freecen_piece_id: pc_id, dwelling_number: (idx - 1)).first\n prev_id = prev_dwel[:_id] unless prev_dwel.nil?\n next_dwel = FreecenDwelling.where(freecen_piece_id: pc_id, dwelling_number: (idx + 1)).first\n next_id = next_dwel[:_id] unless next_dwel.nil?\n end\n [prev_id, next_id]\n end", "def next_station\n if @index + 1 != @stations.size\n @stations[@index + 1]\n else\n 'Это последняя станция'\n end\n end", "def next_tasks\n\t\tincomplete_tasks.select{ |t| !t.blocked? }\n\tend", "def get_available_station_graph\n station_list = []\n line_station_list = []\n station_index = 0\n line_station_index = 0\n single_line_station_index = 0\n junction_line_station_index = 0\n # Getting the adjacent staions of each available stations\n @stations.each do |line_stations|\n line_station_index = 0\n line_stations.each do |_line_station|\n adjacent_station = {}\n line_station_list = []\n if line_station_index.zero?\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n else\n adjacent_station[@stations[station_index][line_station_index - 1][0]] = @timeline[station_index][2] # assigning the time values for waiting\n if line_station_index < (@stations[station_index].length - 1)\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n end\n end\n single_line_station_index = 0\n # Getting the adjacent interchange staions of each available stations\n @stations.each do |junction_line_stations|\n unless single_line_station_index == station_index\n junction_line_station_index = 0\n junction_line_stations.each do |_single_line_station|\n if @stations[station_index][line_station_index][1] == @stations[single_line_station_index][junction_line_station_index][1]\n adjacent_station.store(@stations[single_line_station_index][junction_line_station_index][0], @timeline[single_line_station_index][3]) # assigning the time values for interchange\n end\n junction_line_station_index += 1\n end\n end\n single_line_station_index += 1\n end\n line_station_list.push([@stations[station_index][line_station_index][0], adjacent_station])\n station_list.push(line_station_list)\n line_station_index += 1\n end\n station_index += 1\n end\n station_list # The station list for the graph. formatted as [[[\"NS1\", {\"NS2\"=>12, \"EW24\"=>15}]]]\n end", "def previous_driver_trips\n driver_list = []\n rider_trips = RideShare::Trip.all_rider_trip_instances(@rider_id)#does this mean i need to make a self method of rider trip instances?\n rider_trips.each do |object|\n driver_list << object.driver_object\n end\n return driver_list\n end", "def next_stop\n stops.first\n end", "def current_trains\n data = parse_json\n current_trains = []\n data['Trips'].each do |train|\n if !train['Position'].nil?\n train_number = train['Position']['Train']\n position = {lat: train['Position']['Lat'], long: train['Position']['Long']}\n end\n destination = train['Destination']\n stops = []\n train['Predictions'].each do |stop|\n stops << {stop: stop['Stop'], seconds: stop['Seconds']} # stop needs better name, maybe stop_name or name\n end\n current_trains << MbtaWrapper::Subway.new(train_number, destination, stops, position)\n end\n current_trains\n end", "def next_list\n @_next ? @resource.list(abs_url: @_next) : nil\n end", "def index\n @upcoming_trips =\n Trip.where('departure > ?', DateTime.now).order(departure: :asc)\n @previous_trips =\n Trip.where('departure < ?', DateTime.now).order(departure: :desc)\n end", "def next_steps_from(coordinates)\n increments_from(coordinates).select { |coords| valid_for_lists?(coords, lists) }\n end", "def trains_list\n @trains.each_with_index do |train, index|\n puts \"#{index}. Поезд номер #{train.num}\"\n end\n end", "def next_distances(save = true)\n next_task(@@DISTANCE_TASKS, save)\n end", "def trades\n Client.current.get(\"#{resource_url}/trades\")\n end", "def tfl_journey_planner\n Tube.display_lines\n get_start_line\n Station.list_all_stations(@start_line)\n get_start_station\n Tube.display_lines\n get_end_line\n get_end_station\n print_stations_en_route\n end", "def plan_trip (first_s, last_s)\n stations = []\n beginning = $lineN.index(first_s.to_s)\n ending = $lineN.index(last_s.to_s)\n this_many = beginning + ending\n stations = $lineN[beginning, this_many]\n return stations\nend", "def last_and_next\n\t\t\t\t\t\treturn [self.last, self.next]\n\t\t\t\t\tend", "def trains\n @trains ||= init_trains\n end", "def next_distances(save = true) ; next_task(@@DISTANCE_TASKS, save) ; end", "def arrivals(refresh = false)\n if tvs\n trains(:arrival, refresh)\n end\n end", "def next_station_available?\n current_station_index != @route.stations.length - 1\n end", "def next_nodes\n transitions.map(&:target)\n end", "def first_departure_time(list, time)\n\n trains_at_11 = list.select do |trains|\n trains[:departure] == time\n end\n\n trains_at_11.map! do |train|\n train[:train]\n end\nend", "def get_upstream_stations(origin_station)\n\t\t\n\t\tstarting_station = Bartstation.where(\"short_name = '#{origin_station}'\").pluck(\"id\")[0]\n\t\t\n\t\t# Find all the instances of the starting station\n\t\t# The station may appear on multiple routes\n\t\t\n\t\tstation_routes = {}\n\t\t\n\t\tBartroutestation.where(\"bartstation_id = #{starting_station}\").each do |routestation|\n\t\t\t\tstation_routes[routestation.bartroute_id] = routestation.route_station_sequence\n\t\tend\n\n\t\t# For each route that has the starting station:\n\t\t# Find the starting station \n\t\t# Find the next 5 stations in the reverse direction\n\t\t# (The stations are sequenced in the database to increment from the east \n\t\t# bay direction)\n\n\t\tupstream_stations = {}\n\t\tstation_routes.each do |station_route,station_sequence|\n\t\t\tbartroute_id = station_route\n\t\t\tbartstation_sequence = station_sequence\t\t\t\n\t\t\tupstream_stations[bartroute_id] = \n\t\t\t\tBartroutestation.where(\"bartroute_id = #{bartroute_id} AND \n\t\t\t\t\troute_station_sequence >= #{bartstation_sequence}\").order('route_station_sequence').take(6)\n\t\tend\n\n\t\t# Return the list of upstream stations for each route from the origin station\n\n\t\treturn upstream_stations\n\n\tend", "def stations\n [\n master_station,\n SLCStationReport.new(@fields[5..9], false),\n SLCStationReport.new(@fields[10..14], false),\n SLCStationReport.new(@fields[15..19], false),\n SLCStationReport.new(@fields[20..24], false),\n SLCStationReport.new(@fields[25..29], false)\n ]\n end", "def move_forward\n raise 'Это последняя станция' if @stations[@index + 1].nil?\n\n @stations[@index].departure(self)\n @index += 1\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end", "def next\n after.ascending.first\n end", "def next_time_slots\n\t\ttime_slot_array = self.timeslots\n\t\ttime_slot_array.drop_while do |x|\n\t\t\tx[0].split(\"-\")[0].to_time < Time.now\n\t\tend\n\tend", "def ahead\n if self.route_check_true\n if @current_station != @route.stations.last\n @route.stations[@route.stations.index(@current_station)].departure(self)\n @current_station = next_station\n @route.stations[@route.stations.index(@current_station)].coming(self)\n end\n end\n end", "def next_tasks\n find(:all, :order => \"execute_at asc\")\n end", "def next_steps\n @cell.neighbours.map do |cell|\n Step.new(cell:cell,number:@number+1,previous:self)\n end.reject { |step| (step.cell.status == :wall)}.reject do |step|\n step.cell == @previous.cell if @previous \n # we must add 'if @previous' since, if it's the starting cell,\n # @previous is nil.\n end\n end", "def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend", "def arrival(train)\n @trains << train\n end", "def trains\n currently_owned(Transaction::IS_TRAIN)\n end", "def prev_station\n @route.stations[@current_station - 1] if current_station != @route.stations.first\n end", "def current_and_next\n\t\t\t\t\t\treturn [self.current, self.next]\n\t\t\t\t\tend", "def next\n @next||=after.first\n end", "def next_in_chain\n @_next_in_chain ||= nil\n @_next_in_chain\n end", "def find_tails\n transfers = calculate_transfers_range(transfers_number, false)\n return if transfers.nil?\n departure_from = arrival + MIN_TRANSFER_DURATION\n departure_to = arrival + MAX_TRANSFER_DURATION\n\n tracks = Track.where(\n :departure => (departure_from..departure_to),\n :origin_id => destination_id,\n :transfers_number => transfers\n )\n tracks.each do |t|\n Track.join_tracks(self, t)\n end\n end", "def next_coach_training\n train = group_trainings.where('trainings.date >= ?',\n DateTime.now)\n train.min_by { |t| t.date }\n end", "def next_times(count)\n\n next_time ? [ next_time ] : []\n end", "def intend_next\n intend_with :first, :next\n end", "def intend_next\n intend_with :first, :next\n end", "def next_step_from(paths)\n paths.map do |path|\n possible_neighbours(path.most_recent_step.coordinate, @max_x, @max_y) \n .map { |c| coord_to_step_on_path(c, path) }\n .reject { |p| p == nil }\n end\n .flatten\n end", "def go_next_station\n @current_station = next_station\n puts \"Поезд приехал на станцию #{@current_station}\"\n puts 'Это конечная станция' if @current_station == stations_last\n end", "def arrivals_for(stops)\n return [] if stops.nil? or stops.empty?\n query = {\n :locIDs => [stops].flatten.map { |s| s.is_a?(Stop) ? s.locid : s }.join(','),\n :appID => @app_id\n }\n xml = get_xml(([\"http://developer.trimet.org/ws/V1/arrivals\"] + query.to_a).join(\"/\"))\n\n if xml[\"errorMessage\"]\n raise xml[\"errorMessage\"].join(\"\\n\")\n end\n\n arrivals = xml[\"arrival\"].map do |a|\n stop = Stop.first(:locid => a[\"locid\"])\n line = Line.first(:route => a[\"route\"])\n dir = Direction.first(:dir => a[\"dir\"], :line_id => line.id)\n Arrival.new(:stop => stop,\n :direction => dir,\n :line => dir.line,\n :block => a[\"block\"],\n :departed => (a[\"departed\"] == \"true\"),\n :estimated => to_time(a[\"estimated\"]),\n :full_sign => a[\"fullSign\"],\n :piece => a[\"piece\"],\n :scheduled => to_time(a[\"scheduled\"]),\n :short_sign => a[\"shortSign\"],\n :status => a[\"status\"],\n :detour => (a[\"detour\"] == \"true\"))\n end\n end", "def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend", "def current_and_last_and_next\n\t\t\t\t\t\treturn [self.current, self.last, self.next]\n\t\t\t\t\tend", "def read_837_trailer\r\n trailer = []\r\n 2.times {trailer << read_elements} \r\n # raise X12N835ParseError.new('Transaction Set Trailer not found') unless trailer[0] && trailer[0].first == 'SE'\r\n # raise X12N835ParseError.new('Functional Group Trailer not found') unless trailer[0] && trailer[0].first == nil\r\n # raise X12N835ParseError.new('Interchange Trailer not found') unless trailer[1] && trailer[1].first == nil\r\n @callbacks[:trailer].call(trailer) if @callbacks[:trailer]\r\n self\r\n end", "def list_stations\n @stations.each_with_index { |station, i| puts \"#{i + 1} #{station.name}\" }\n end", "def following_entries\n tree.all_data[(index + 1)..-1]\n end", "def all_trails\n # find all trails in this park\n ParkTrails.all.select do |pt|\n pt.park == self\n end.collect do |this_park|\n this_park.trail.name\n end\n end", "def remaining_steps\n ([ current_step ] + future_steps.map {|ea| ea}).compact\n end", "def previous_station_index\n current_station_index - 1\n end", "def popular_starting_station\n Trip.popular_starting_station\n end", "def next\n\t\tTask.order(:position).where(\"position > ?\", position).first\n\tend", "def next_events\n self.around_events.select{|event|\n event.location.present? && event.start_time > self.end_time\n }.sort{|a,b| a.start_time <=> b.start_time}\n end", "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end", "def all_previous(start_serial = self)\n # provides an array of all previous incarnations of me\n\n out_array = []\n start_serial.immediately_preceding_serials.order(:name).each do |serial|\n out_array.push(serial)\n prev = all_previous(serial)\n\n out_array.push(prev) unless prev.empty?\n end\n return out_array\n end", "def journey_start\n @entry_station\n end", "def next\n return nil unless next?\n ensure_zone!\n @zone.records token: token\n end", "def train_travel(first_stop, last_stop, line)\n line_stop = @railwayslines[line]\n\n stop_a = line_stop.index(first_stop)\n stop_b = line_stop.index(last_stop)\n if stop_a < stop_b\n travelled = line_stop[stop_a..stop_b]\n else\n travelled = line_stop[stop_b..stop_a]\n travelled = travelled.reverse\n # return travelled\n end\n travelled\nend", "def stations\r\n return @stations\r\n end", "def stations_list\n @route.stations_list\n end", "def next\n after.first\n end", "def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end", "def next_in_chain\n @_next_in_chain ||= nil\n @_next_in_chain\n end", "def read_trailer\r\n trailer = []\r\n 3.times {trailer << read_elements} \r\n raise X12N835ParseError.new('Transaction Set Trailer not found') unless trailer[0] && trailer[0].first == 'SE'\r\n raise X12N835ParseError.new('Functional Group Trailer not found') unless trailer[1] && trailer[1].first == nil\r\n raise X12N835ParseError.new('Interchange Trailer not found') unless trailer[2] && trailer[2].first == nil\r\n @callbacks[:trailer].call(trailer) if @callbacks[:trailer]\r\n self\r\n end", "def train(origin, destination, date)\n\turl = \"http://ojp.nationalrail.co.uk/service/timesandfares/#{origin}/#{destination}/#{date}/0900/dep\"\n\txml = Nokogiri::HTML(open(url).read)\n\t#get prices\n\tprice_string = xml.css('.opsingle').inner_html\n\tprice_string.gsub!(/\\s+/, \"\")\n\tprices = price_string.scan(/£\\d*.\\d*/)\n\t\n\t#get durations\n\tduration_string = xml.css('.dur').inner_html\n\tduration_string.gsub!(/\\s+/, \"\")\n\tduration_string.gsub!(/<abbrtitle=\"hours\">h<\\/abbr>/, \":\")\n\tduration_string.gsub!(/<abbrtitle=\"minutes\">m<\\/abbr>/, \",\")\n\tduration_string.gsub!(/^.*>/, \"\")\n\tduration_string = duration_string.split(',')\n\tdurations = Array.new\n\tduration_string.each do |d|\n\t\thours = d[0, d.index(':')]\n\t\tmins = d[d.index(':')+1, d.length]\n\t\tif mins[0,1] == \"0\"\n\t\t\tmins = mins[1,1]\n\t\tend\n\t\tdurations.push(Integer(hours)*60 + Integer(mins))\n\tend\n\tresults = Array.new\n\t\tprices.count().times do |count|\n\t\t \tpair = [prices[count][1,prices[count].length], durations[count]] #rather messy way of taking out the £ at the last minute!\n\t\t\tresults.push(pair)\n\t\tend\n\treturn results, url\nend", "def next_departures_on_route_for_stop(route_id, stop_id)\n time = Time.now.strftime(\"%H:%M:%S\")\n stop_name = get_stop_name_by_id(stop_id)\n\n departures = @db[:stop_times].\n join(:trips, :trip_id => :trip_id).\n join(:calendar_dates, :service_id => :service_id).\n where(:date => Date.today.strftime(\"%Y%m%d\")).\n select(:trips__trip_id, :stop_id, :departure_time, :trip_headsign).\n where(:route_id => route_id).\n where(:stop_id => stop_id).\n where{ departure_time > time }.\n where(~{:trip_headsign => stop_name}).\n order(:departure_time)\n\n departures.map do |departure|\n departure[:departure_time] = convert_transit_time(departure[:departure_time])\n departure\n end\n end", "def finishings\n return @finishings\n end", "def next_sibling_by_date\n siblings_by_date.where(\"starts_at >= ?\", starts_at)&.first\n end", "def go_to_the_next_station!\n gain_speed\n current_station.send_out(self) if current_station\n self.current_station_id += 1\n current_station.take(self) if current_station\n stop\n end", "def itineraries\n if object.next_trip \n (object.itineraries + object.next_trip.itineraries).map{ |x| ItinerarySerializer.new(x) }\n else \n (object.itineraries).map{ |x| ItinerarySerializer.new(x) }\n end\n end", "def next\n update_current(list_index_of(@current))\n end", "def second_trip(l2, s2)\n ## find index of stop s2 on line l2\n index_s2 = $lines[l2].index(s2)\n ## find index of Union Square Staion on line l2\n index_of_USquare = $lines[l2].index('Union Square')\n\n trip2 = []\n\n if index_s2 > index_of_USquare\n trip2 = $lines[l2][index_of_USquare..index_s2].drop(1) # drop(1) to exclude Union Square station from the list\n else\n trip2 = $lines[l2][index_s2..index_of_USquare].reverse.drop(1) # drop(1) to exclude Union Square station from the list\n end\n\n\n puts \">>> Your journey continues through the following stops on the #{l2} line: #{trip2.join(', ')}.\"\n\n trip2\nend", "def next_list\n @list_index += 1\n\n if @lists.size < @list_index\n @lists << []\n end\n\n @co_index = 1\n\n nil\n end", "def next\r\n next_values[0]\r\n end", "def next_paths\n Operations.list.map do |operation|\n new_value = Operations.send(operation, @current_value)\n operation_history = @operation_history + [operation]\n Path.new(new_value, @target_value, operation_history: operation_history)\n end\n end", "def move_forward\n position.depart_train(self)\n @current_station += 1 if @route.stations[@current_station] != @route.stations.last\n position.add_train(self)\n end", "def previous_station\n return @current_station if @current_station == @route.first\n\n @route.stations[@route.stations.index(@current_station) - 1]\n end", "def stations_list\n @route.get_stations_list\n end", "def next_observance\n @next_observance ||= upcoming_observances.first\n end", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def trades(tid = nil)\n params = { since: tid } unless tid.nil?\n params ||= {}\n\n plain_orders = Fyb.public.trades(params).perform.parse\n\n return [] if plain_orders.empty?\n\n plain_orders.map do |data|\n Order.new data['amount'], data['price'], :undefined, data['tid']\n end\n end", "def predecessor\n car.refuelings.order(:date).where(\"date < ?\", date).last\n end", "def get_bart_schedule(origin_station, destination_station, direction)\n\n\t\tresponse = Typhoeus.get(\"http://api.bart.gov/api/sched.aspx?cmd=depart&orig=#{origin_station}&dest=#{destination_station}&date=now&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t# Extract the station names and short names\n\n\t\tresponse_XML = Nokogiri.XML(response.body)\n\n\t\t# Create a hash list of the station names and abbreviations\n\n\t\t# Use a hash to store the route options to manage duplicate entries\n\n\t\tbartroute_options = {}\n\t\tfeasible_train_options ={}\n\t\tupstream_station_codes\t= {}\n\n\t\tresponse_XML.xpath(\"///trip\").each do |node|\n\t\t\t\n\t\t\t# Check to see if any transfers are involved\n\t\t\t# *** IF SO DEAL WITH THOSE LATER ****\n\n\n\t\t\tif node['transfercode'] == nil\n\n\t\t\t\t# There is only one leg for this journey\n\t\t\t\tnode.children.each do |leg|\n\n\t\t\t\t\t# Get the available bart routes from the \"leg\" of the journey\n\n\t\t\t\t\tbartroute_options[node.at('leg')['trainHeadStation']] = \n\t\t\t\t\t\tnode.at('leg')['trainHeadStation']\n\t\t\t\t\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t# If the direction is \"normal\", loop through the route options and find the \n\t\t\t# real time departures for each route option that originates from the origin \n\t\t\t# station.\n\t\t\t# If the direction is \"reverse\", find the upstream stations and include the \n\t\t\t# departures from those stations\n\n\t\t\tdeparture_times = {}\n\t\t\tdeparture_stations = []\t\t\n\n\t\t\tif @bartjourney.direction == \"Normal\"\n\t\t\t\tbart_direction = nil\n\t\t\t\tdeparture_times = get_real_time_departures(origin_station,bart_direction)\n\t\t\t\t\n\t\t\t\tfeasible_train_options = \n\t\t\t\t\tfilter_departures(departure_times,bartroute_options)\n\t\t\telse\n\n\t\t\t\tfeasible_train_options = \n\t\t\t\t\tcalculate_upstream_options(origin_station,upstream_station_codes,bartroute_options)\n\t\t\tend\n\t\tend\n\n\t\tif @bartjourney.direction == \"Reverse\"\n\t\t\tfeasible_train_options = sort_feasible_trains(feasible_train_options)\n\t\tend\n\n\t\treturn feasible_train_options\n\tend", "def follows; [] end" ]
[ "0.6469744", "0.61163056", "0.5991272", "0.5883788", "0.5858357", "0.5711918", "0.57000464", "0.5684157", "0.56806576", "0.5672466", "0.5582665", "0.55755", "0.5536568", "0.5531512", "0.54865736", "0.5446997", "0.54408914", "0.54368967", "0.53815633", "0.53712076", "0.5270465", "0.5256272", "0.52254325", "0.5215103", "0.52137846", "0.5173993", "0.51676416", "0.51662385", "0.51599634", "0.51592934", "0.51396924", "0.5136417", "0.5130658", "0.5129427", "0.5121047", "0.51117444", "0.5104542", "0.5081765", "0.50805503", "0.5069791", "0.5069467", "0.50682265", "0.50678575", "0.50614226", "0.50545985", "0.50530946", "0.5048321", "0.50463563", "0.5046007", "0.5046007", "0.5045914", "0.50364316", "0.50287807", "0.50259054", "0.50250506", "0.502357", "0.502016", "0.50139874", "0.5010361", "0.5006531", "0.50038123", "0.5000304", "0.4995141", "0.49868876", "0.49843508", "0.4970091", "0.4960507", "0.49589163", "0.49586213", "0.49524832", "0.49498793", "0.49390313", "0.49373972", "0.4936757", "0.49191183", "0.49057513", "0.49018154", "0.4899113", "0.4898654", "0.48906055", "0.4881", "0.48786193", "0.48676398", "0.48670647", "0.4850569", "0.4832573", "0.482582", "0.48056874", "0.48051354", "0.48042035", "0.48011732", "0.48011732", "0.48011732", "0.48011732", "0.48011732", "0.48011732", "0.47965777", "0.47936592", "0.47887763", "0.4788738" ]
0.4956044
69
List of the next arriving trains in this station.
def arrivals(refresh = false) if tvs trains(:arrival, refresh) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_station\n @route.stations[@current_station_index + 1]\n end", "def current_trains\n data = parse_json\n current_trains = []\n data['Trips'].each do |train|\n if !train['Position'].nil?\n train_number = train['Position']['Train']\n position = {lat: train['Position']['Lat'], long: train['Position']['Long']}\n end\n destination = train['Destination']\n stops = []\n train['Predictions'].each do |stop|\n stops << {stop: stop['Stop'], seconds: stop['Seconds']} # stop needs better name, maybe stop_name or name\n end\n current_trains << MbtaWrapper::Subway.new(train_number, destination, stops, position)\n end\n current_trains\n end", "def next_station\n @route.stations[@current_station + 1] if current_station != @route.stations.last\n end", "def next_station\n return @current_station if @current_station == @route.last\n\n @route.stations[@route.stations.index(@current_station) + 1]\n end", "def next_station\n if @current_station == @route.stations.last\n @current_station\n else\n @current_station = @route.stations[@route.stations.index(@current_station) + 1]\n end\n end", "def list_all_trains\n Train.all.sort{|a,b| a.destination <=> b.destination}.each.with_index(1) do |element, index|\n puts\"\\n\"\n puts \"#{index}: Destination: #{element.destination}\"\n puts \" Base time: #{element.event_time}\"\n puts \" Line: #{element.line}\"\n puts \" Direction: #{element.dir}\"\n puts \" Incoming Stations:\"\n element.station.each{|hash| puts \"Station: #{hash['station']}\\nWait Time: #{hash['waiting_time']}\\n-----------------------------------\\n\"}\n end\n puts \"\\nType 1 to restart and anything else to end:\\n\"\n get_end = gets.strip\n if get_end == '1'\n restart\n end\nend", "def next_station\n if @index + 1 != @stations.size\n @stations[@index + 1]\n else\n 'Это последняя станция'\n end\n end", "def next_train(station, destinations, opts = {})\n ldbws.next_departures_with_details(station, destinations, opts)\n end", "def index\n @upcoming_trips =\n Trip.where('departure > ?', DateTime.now).order(departure: :asc)\n @previous_trips =\n Trip.where('departure < ?', DateTime.now).order(departure: :desc)\n end", "def arrival(train)\n @trains << train\n end", "def journey_start\n @entry_station\n end", "def arrivals_for(stops)\n return [] if stops.nil? or stops.empty?\n query = {\n :locIDs => [stops].flatten.map { |s| s.is_a?(Stop) ? s.locid : s }.join(','),\n :appID => @app_id\n }\n xml = get_xml(([\"http://developer.trimet.org/ws/V1/arrivals\"] + query.to_a).join(\"/\"))\n\n if xml[\"errorMessage\"]\n raise xml[\"errorMessage\"].join(\"\\n\")\n end\n\n arrivals = xml[\"arrival\"].map do |a|\n stop = Stop.first(:locid => a[\"locid\"])\n line = Line.first(:route => a[\"route\"])\n dir = Direction.first(:dir => a[\"dir\"], :line_id => line.id)\n Arrival.new(:stop => stop,\n :direction => dir,\n :line => dir.line,\n :block => a[\"block\"],\n :departed => (a[\"departed\"] == \"true\"),\n :estimated => to_time(a[\"estimated\"]),\n :full_sign => a[\"fullSign\"],\n :piece => a[\"piece\"],\n :scheduled => to_time(a[\"scheduled\"]),\n :short_sign => a[\"shortSign\"],\n :status => a[\"status\"],\n :detour => (a[\"detour\"] == \"true\"))\n end\n end", "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end", "def get_upstream_stations(origin_station)\n\t\t\n\t\tstarting_station = Bartstation.where(\"short_name = '#{origin_station}'\").pluck(\"id\")[0]\n\t\t\n\t\t# Find all the instances of the starting station\n\t\t# The station may appear on multiple routes\n\t\t\n\t\tstation_routes = {}\n\t\t\n\t\tBartroutestation.where(\"bartstation_id = #{starting_station}\").each do |routestation|\n\t\t\t\tstation_routes[routestation.bartroute_id] = routestation.route_station_sequence\n\t\tend\n\n\t\t# For each route that has the starting station:\n\t\t# Find the starting station \n\t\t# Find the next 5 stations in the reverse direction\n\t\t# (The stations are sequenced in the database to increment from the east \n\t\t# bay direction)\n\n\t\tupstream_stations = {}\n\t\tstation_routes.each do |station_route,station_sequence|\n\t\t\tbartroute_id = station_route\n\t\t\tbartstation_sequence = station_sequence\t\t\t\n\t\t\tupstream_stations[bartroute_id] = \n\t\t\t\tBartroutestation.where(\"bartroute_id = #{bartroute_id} AND \n\t\t\t\t\troute_station_sequence >= #{bartstation_sequence}\").order('route_station_sequence').take(6)\n\t\tend\n\n\t\t# Return the list of upstream stations for each route from the origin station\n\n\t\treturn upstream_stations\n\n\tend", "def tfl_journey_planner\n Tube.display_lines\n get_start_line\n Station.list_all_stations(@start_line)\n get_start_station\n Tube.display_lines\n get_end_line\n get_end_station\n print_stations_en_route\n end", "def trains\n @trains ||= init_trains\n end", "def stations\n [\n master_station,\n SLCStationReport.new(@fields[5..9], false),\n SLCStationReport.new(@fields[10..14], false),\n SLCStationReport.new(@fields[15..19], false),\n SLCStationReport.new(@fields[20..24], false),\n SLCStationReport.new(@fields[25..29], false)\n ]\n end", "def trains_list\n @trains.each_with_index do |train, index|\n puts \"#{index}. Поезд номер #{train.num}\"\n end\n end", "def stations\r\n return @stations\r\n end", "def next_station_index\n current_station_index + 1\n end", "def future_steps\n if active\n Step.filter(:system => system).where{ |o| o.number >= next_step_number}.order(:number.asc)\n else\n []\n end\n end", "def stations_list\n @route.stations_list\n end", "def stations_list\n @route.get_stations_list\n end", "def list_stations\n @stations.each_with_index { |station, i| puts \"#{i + 1} #{station.name}\" }\n end", "def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end", "def get_available_station_graph\n station_list = []\n line_station_list = []\n station_index = 0\n line_station_index = 0\n single_line_station_index = 0\n junction_line_station_index = 0\n # Getting the adjacent staions of each available stations\n @stations.each do |line_stations|\n line_station_index = 0\n line_stations.each do |_line_station|\n adjacent_station = {}\n line_station_list = []\n if line_station_index.zero?\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n else\n adjacent_station[@stations[station_index][line_station_index - 1][0]] = @timeline[station_index][2] # assigning the time values for waiting\n if line_station_index < (@stations[station_index].length - 1)\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n end\n end\n single_line_station_index = 0\n # Getting the adjacent interchange staions of each available stations\n @stations.each do |junction_line_stations|\n unless single_line_station_index == station_index\n junction_line_station_index = 0\n junction_line_stations.each do |_single_line_station|\n if @stations[station_index][line_station_index][1] == @stations[single_line_station_index][junction_line_station_index][1]\n adjacent_station.store(@stations[single_line_station_index][junction_line_station_index][0], @timeline[single_line_station_index][3]) # assigning the time values for interchange\n end\n junction_line_station_index += 1\n end\n end\n single_line_station_index += 1\n end\n line_station_list.push([@stations[station_index][line_station_index][0], adjacent_station])\n station_list.push(line_station_list)\n line_station_index += 1\n end\n station_index += 1\n end\n station_list # The station list for the graph. formatted as [[[\"NS1\", {\"NS2\"=>12, \"EW24\"=>15}]]]\n end", "def routes_list\n Route.all.each.with_index(1) do |(route), index|\n puts \"#{index}. Маршрут: #{route.stations.first.name} - #{route.stations.last.name}\"\n end\n end", "def next_times(count)\n\n next_time ? [ next_time ] : []\n end", "def previous_driver_trips\n driver_list = []\n rider_trips = RideShare::Trip.all_rider_trip_instances(@rider_id)#does this mean i need to make a self method of rider trip instances?\n rider_trips.each do |object|\n driver_list << object.driver_object\n end\n return driver_list\n end", "def plan_trip (first_s, last_s)\n stations = []\n beginning = $lineN.index(first_s.to_s)\n ending = $lineN.index(last_s.to_s)\n this_many = beginning + ending\n stations = $lineN[beginning, this_many]\n return stations\nend", "def list_stations\n if @stations.empty?\n stations_void\n else\n stations_list\n end\n end", "def trains\n currently_owned(Transaction::IS_TRAIN)\n end", "def popular_starting_station\n Trip.popular_starting_station\n end", "def next_stop\n stops.first\n end", "def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend", "def trades\n Client.current.get(\"#{resource_url}/trades\")\n end", "def first_departure_time(list, time)\n\n trains_at_11 = list.select do |trains|\n trains[:departure] == time\n end\n\n trains_at_11.map! do |train|\n train[:train]\n end\nend", "def current_journey\n if !(@entry_station == nil)\n @journey_history << {@entry_station => @exit_station}\n # @entry_station = nil\n end\n if !(@exit_station == nil)\n @journey_history << {@entry_station => @exit_station}\n # @entry_station = nil\n end\n end", "def view_current_trips\n @trips = Request.all\n @count = Request.count\n @trips.each do |trip|\n @curLoc = trip.currentLoc\n @destination = trip.destination\n end\n end", "def next_events\n self.around_events.select{|event|\n event.location.present? && event.start_time > self.end_time\n }.sort{|a,b| a.start_time <=> b.start_time}\n end", "def itineraries\n if object.next_trip \n (object.itineraries + object.next_trip.itineraries).map{ |x| ItinerarySerializer.new(x) }\n else \n (object.itineraries).map{ |x| ItinerarySerializer.new(x) }\n end\n end", "def ahead\n if self.route_check_true\n if @current_station != @route.stations.last\n @route.stations[@route.stations.index(@current_station)].departure(self)\n @current_station = next_station\n @route.stations[@route.stations.index(@current_station)].coming(self)\n end\n end\n end", "def next_station_available?\n current_station_index != @route.stations.length - 1\n end", "def arrivals\n require 'cobravsmongoose'\n require 'open-uri'\n \n begin\n response = open(\"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=04dec4048adc48b580220bb154ea0014&mapid=\" + self.cta_id.to_s).read\n arrays_of_hashes = CobraVsMongoose.xml_to_hash(response)\n \n return [arrays_of_hashes['ctatt']['eta']] if arrays_of_hashes['ctatt']['eta'][0].nil?\n \n arrays_of_hashes['ctatt']['eta']\n rescue\n []\n end\n end", "def trainers\n trainer_locations = TrainerLocation.all.select {|trainer_location| trainer_location.location == self}\n trainer_locations.map {|trainer_location| trainer_location.trainer}\n end", "def prev_station\n @route.stations[@current_station - 1] if current_station != @route.stations.first\n end", "def next_observance\n @next_observance ||= upcoming_observances.first\n end", "def stations_on_line(code)\n Station.get_on_line(code)\n end", "def next_coach_training\n train = group_trainings.where('trainings.date >= ?',\n DateTime.now)\n train.min_by { |t| t.date }\n end", "def next_tasks\n\t\tincomplete_tasks.select{ |t| !t.blocked? }\n\tend", "def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end", "def arrivals(station, opts = {})\n ldbws.arrival_board(station, opts)\n end", "def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend", "def upcoming_reservations\n upcoming = []\n reservations.each do |r|\n if r.schedule.start_at >= Time.now\n upcoming.push(r)\n end\n end\n upcoming.sort_by { |r| r.schedule.start_at }\n end", "def next_tasks\n find(:all, :order => \"execute_at asc\")\n end", "def time_travel_offsets\n @time_travel_offsets ||= []\n end", "def next_list\n @_next ? @resource.list(abs_url: @_next) : nil\n end", "def get_upcoming_lessons\n\t\tstudents = self.students\n\t\tlessons = []\n\t\tstudents.each { |student| \n\t\t\tcurrent = student.get_upcoming_lessons\n\t\t\tif (current.count > 0 && lessons.count == 0)\n\t\t\t\tlessons = current\n\t\t\telsif (current.count > 0 && lessons.count > 0)\n\t\t\t\tlessons = lessons + current\n\t\t\tend\n\t\t}\n\t\treturn lessons.sort_by(&:schedule)\n\tend", "def go_next_station\n @current_station = next_station\n puts \"Поезд приехал на станцию #{@current_station}\"\n puts 'Это конечная станция' if @current_station == stations_last\n end", "def move_forward\n raise 'Это последняя станция' if @stations[@index + 1].nil?\n\n @stations[@index].departure(self)\n @index += 1\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end", "def current_lead_at\n []\n end", "def listings\n self.trips.map{|trip| trip.listing}\n end", "def initialize_trains\r\n @trains = Array.new\r\n\r\n @lines.each {|line, stations|\r\n @trains.push(Train.new(line))\r\n }\r\n \r\n return @trains\r\n end", "def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def all_flights\n self.flights.in_order_of_creation \n end", "def next_time_slots\n\t\ttime_slot_array = self.timeslots\n\t\ttime_slot_array.drop_while do |x|\n\t\t\tx[0].split(\"-\")[0].to_time < Time.now\n\t\tend\n\tend", "def get_stationList(uPos)\n stationList = []\n for n in @@networks\n resp = Net::HTTP.get_response(URI.parse(n)).body\n result = JSON.parse(resp)['network']['stations']\n (stationList << result).flatten!\n end\n stationList.sort! {|s1, s2| dist_user(s1, uPos) <=> dist_user(s2, uPos)}\n end", "def next_paths\n Operations.list.map do |operation|\n new_value = Operations.send(operation, @current_value)\n operation_history = @operation_history + [operation]\n Path.new(new_value, @target_value, operation_history: operation_history)\n end\n end", "def current_trains\n @trains\n end", "def getRoutesTo(station)\n routeList = @toNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def next_steps_from(coordinates)\n increments_from(coordinates).select { |coords| valid_for_lists?(coords, lists) }\n end", "def current_and_next\n\t\t\t\t\t\treturn [self.current, self.next]\n\t\t\t\t\tend", "def surrounding_journeys\n @route = Route.find(params[:route_id])\n @previous_journeys = @route.journeys.where('start_time < ?', params[:datetime]).order('start_time DESC').limit(2)\n @next_journeys = @route.journeys.where('start_time > ?', params[:datetime]).order('start_time ASC').limit(2)\n render layout: false\n end", "def stop_times\n page.search('table#trip-details tbody tr').reduce(Array.new) do |stop_times, table_row|\n stop_time = StopTime.new.html! table_row\n duplicate = stop_times.find do |duplicate|\n duplicate.stop_page.stop_id == stop_time.stop_page.stop_id &&\n duplicate.arrival_time == stop_time.arrival_time\n end\n stop_times << stop_time unless duplicate\n stop_times\n end.each_with_index.map do |stop_time, index|\n stop_time.stop_sequence = index\n stop_time\n end\n end", "def train(origin, destination, date)\n\turl = \"http://ojp.nationalrail.co.uk/service/timesandfares/#{origin}/#{destination}/#{date}/0900/dep\"\n\txml = Nokogiri::HTML(open(url).read)\n\t#get prices\n\tprice_string = xml.css('.opsingle').inner_html\n\tprice_string.gsub!(/\\s+/, \"\")\n\tprices = price_string.scan(/£\\d*.\\d*/)\n\t\n\t#get durations\n\tduration_string = xml.css('.dur').inner_html\n\tduration_string.gsub!(/\\s+/, \"\")\n\tduration_string.gsub!(/<abbrtitle=\"hours\">h<\\/abbr>/, \":\")\n\tduration_string.gsub!(/<abbrtitle=\"minutes\">m<\\/abbr>/, \",\")\n\tduration_string.gsub!(/^.*>/, \"\")\n\tduration_string = duration_string.split(',')\n\tdurations = Array.new\n\tduration_string.each do |d|\n\t\thours = d[0, d.index(':')]\n\t\tmins = d[d.index(':')+1, d.length]\n\t\tif mins[0,1] == \"0\"\n\t\t\tmins = mins[1,1]\n\t\tend\n\t\tdurations.push(Integer(hours)*60 + Integer(mins))\n\tend\n\tresults = Array.new\n\t\tprices.count().times do |count|\n\t\t \tpair = [prices[count][1,prices[count].length], durations[count]] #rather messy way of taking out the £ at the last minute!\n\t\t\tresults.push(pair)\n\t\tend\n\treturn results, url\nend", "def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end", "def stations\n doc = request(@user, \"stations\")\n stations = []\n doc.xpath('//rss/channel/item').each do |node|\n stations << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,\n :songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,\n :songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,\n :composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,\n :artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}\n end\n stations\n end", "def index\n @raiway_stations = RaiwayStation.all\n end", "def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0\n elsif start_line_sym == :bakerloo\n start_line_sym_index = 0\n elsif start_line_sym == :central\n start_line_sym_index = 0\n end\n\n stations_on_start_line = Tube.new.lines.values_at(start_line_sym)\n stations_on_end_line = Tube.new.lines.values_at(end_line_sym)\n \n stations_start = stations_on_start_line[start_line_sym_index]\n\n start_index = stations_start.find_index(start_station_sym) \n\n if start_line_sym != end_line_sym\n\n intersection = (stations_on_start_line[0] & stations_on_end_line[0])[0] \n\n start_int_index = stations_on_start_line[0].index(intersection)\n stops_between = (start_index.to_i - start_int_index.to_i).abs \n\n end_index = stations_on_end_line[0].find_index(end_station_sym)\n\n end_int_index = stations_on_end_line[0].index(intersection)\n between = (end_index.to_i - end_int_index.to_i).abs\n\n stations_on_first = stations_on_start_line[0][start_index, (start_int_index - 1)]\n stations_on_second = stations_on_end_line[0][end_int_index, (end_index + 1)]\n\n number_of_stops = (end_index - start_index).abs\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n\n stations_en_route = stations_on_first + stations_on_second\n \n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n else\n\n end_index = stations_start.find_index(end_station_sym)\n\n number_of_stops = ((end_index.to_i - start_index.to_i).abs + 1)\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n #Use indexes to print stations between and including\n #\n stations_en_route = stations_start.slice(start_index..end_index)\n #Generate list and make print print ready\n #\n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n end\n end", "def index\n @trainees = Trainee.all.sort_by(&:created_at).reverse\n end", "def previous_station\n return @current_station if @current_station == @route.first\n\n @route.stations[@route.stations.index(@current_station) - 1]\n end", "def index\n @train_routes = TrainRoute.includes(:departure_station, :arrival_station).all\n byebug\n end", "def next_time\n\n schedule_info\n end", "def all_previous(start_serial = self)\n # provides an array of all previous incarnations of me\n\n out_array = []\n start_serial.immediately_preceding_serials.order(:name).each do |serial|\n out_array.push(serial)\n prev = all_previous(serial)\n\n out_array.push(prev) unless prev.empty?\n end\n return out_array\n end", "def last_and_next\n\t\t\t\t\t\treturn [self.last, self.next]\n\t\t\t\t\tend", "def move_forward\n position.depart_train(self)\n @current_station += 1 if @route.stations[@current_station] != @route.stations.last\n position.add_train(self)\n end", "def get_next_calendar_events\n next_events = JSON.parse search_for_future_calendar_events\n next_events[\"items\"]\n end", "def previous_station_index\n current_station_index - 1\n end", "def index\n @tollstations = Tollstation.all\n end", "def second_trip(l2, s2)\n ## find index of stop s2 on line l2\n index_s2 = $lines[l2].index(s2)\n ## find index of Union Square Staion on line l2\n index_of_USquare = $lines[l2].index('Union Square')\n\n trip2 = []\n\n if index_s2 > index_of_USquare\n trip2 = $lines[l2][index_of_USquare..index_s2].drop(1) # drop(1) to exclude Union Square station from the list\n else\n trip2 = $lines[l2][index_s2..index_of_USquare].reverse.drop(1) # drop(1) to exclude Union Square station from the list\n end\n\n\n puts \">>> Your journey continues through the following stops on the #{l2} line: #{trip2.join(', ')}.\"\n\n trip2\nend", "def next_step_from(paths)\n paths.map do |path|\n possible_neighbours(path.most_recent_step.coordinate, @max_x, @max_y) \n .map { |c| coord_to_step_on_path(c, path) }\n .reject { |p| p == nil }\n end\n .flatten\n end", "def listings\n self.trips.map do |ti|\n ti.listing \n end\n end", "def all_following_transitions\n all = [] + available_transitions[:allow]\n following_transitions.each do |t|\n t = Restfulie::Server::Transition.new(t[0], t[1], t[2], nil) if t.kind_of? Array\n all << t\n end\n all\n end", "def initialize_stations\r\n @stations = Array.new\r\n i = 0\r\n\r\n @lines.each {|line, stations|\r\n stations.each_with_index {|item, index|\r\n @stations.push(Station.new(item))\r\n if index == 0\r\n @stations.at(-1).set_train(@trains.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n\r\n @stations = @stations.uniq { |s| s.station.to_s}\r\n end", "def current_and_last_and_next\n\t\t\t\t\t\treturn [self.current, self.last, self.next]\n\t\t\t\t\tend", "def trucks_currently_open\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_open_now = []\n trucks.each do |truck|\n if date.strftime('%H:%M') <= truck[\"end24\"] && \n date.strftime('%H:%M') > truck[\"start24\"]\n trucks_open_now << truck[\"applicant\"]\n end \n end\n p trucks_open_now\n end", "def find_tails\n transfers = calculate_transfers_range(transfers_number, false)\n return if transfers.nil?\n departure_from = arrival + MIN_TRANSFER_DURATION\n departure_to = arrival + MAX_TRANSFER_DURATION\n\n tracks = Track.where(\n :departure => (departure_from..departure_to),\n :origin_id => destination_id,\n :transfers_number => transfers\n )\n tracks.each do |t|\n Track.join_tracks(self, t)\n end\n end", "def next_distances(save = true)\n next_task(@@DISTANCE_TASKS, save)\n end", "def index\n @trainees = current_user.trainees\n end", "def show_trains_by_station\n if @stations.empty?\n stations_void\n else\n request = [\"Enter station name: [#{@stations.keys.join(', ')}]: \"]\n getting(request, :approve_station_selection, :show_train)\n end\n end" ]
[ "0.6327635", "0.6229601", "0.6184856", "0.61160535", "0.60464865", "0.6030311", "0.59977305", "0.5937847", "0.59195274", "0.58768094", "0.5801475", "0.57896984", "0.57860595", "0.574707", "0.57089055", "0.56736386", "0.56332046", "0.5628711", "0.56283045", "0.5627789", "0.5610019", "0.55842674", "0.5535571", "0.5530158", "0.5509663", "0.549811", "0.54641175", "0.5441772", "0.5441482", "0.5441142", "0.54002297", "0.53873974", "0.5377157", "0.5372484", "0.536706", "0.53471816", "0.5335889", "0.53151685", "0.5302809", "0.52947634", "0.52878064", "0.5258967", "0.5255514", "0.5253636", "0.5250362", "0.5249214", "0.52065873", "0.51878244", "0.5183412", "0.51809925", "0.51746905", "0.5168481", "0.5149067", "0.51453114", "0.5143581", "0.51268816", "0.5122748", "0.5103453", "0.5089471", "0.5088904", "0.5065961", "0.5065942", "0.5059671", "0.5053722", "0.5048507", "0.5035168", "0.5026678", "0.502306", "0.501426", "0.5005899", "0.5003122", "0.4987926", "0.4985073", "0.49737355", "0.4959737", "0.49482778", "0.49405313", "0.49330837", "0.4927549", "0.4919181", "0.49165788", "0.49158505", "0.4902756", "0.48981926", "0.48912403", "0.4890779", "0.4880011", "0.4867652", "0.48642212", "0.48599017", "0.48547688", "0.48536828", "0.48527858", "0.48479247", "0.48455545", "0.48443893", "0.48421025", "0.4834891", "0.4834102", "0.48337635" ]
0.60622156
4
Remove all competitors, and readd them to the competition
def rebuild_competitors(bib_numbers) clear_competitors build_competitors(bib_numbers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_competencies\r\n @communication.destroy\r\n @decision_making.destroy\r\n @problem_solving.destroy\r\n end", "def remove_competence(competence)\n # Remove competence\n competences.delete(competence)\n\n # Remove courses\n needed_scoped_course_ids = needed_scoped_courses(self.competences).map {|scoped_course| scoped_course.id}\n \n self.plan_courses.each do |plan_course|\n if plan_course.scoped_course_id && !needed_scoped_course_ids.include?(plan_course.scoped_course_id)\n plan_course.destroy\n end\n end\n \n # Reset grouping\n PlanCourse.where(:study_plan_id => self.id, :competence_node_id => competence.id).update_all(:competence_node_id => nil)\n end", "def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end", "def deletable_scoped_courses(competence)\n # Make an array of competences that the user has after deleting the given competence\n remaining_competences = competences.clone\n remaining_competences.delete(competence)\n\n # Make a list of scoped_courses that aren't needed\n self.scoped_courses.to_set - self.needed_scoped_courses(remaining_competences)\n end", "def remove_from_combos\n # Get all the combos associated with this trick\n self.combos.uniq.each do |combo|\n # Get the number of times the trick appears in this combo\n # and subtract from total num of tricks\n no_tricks = combo.no_tricks\n no_duplicates = combo.tricks.where(:name => @trick.name).length\n combo.no_tricks = no_tricks - no_duplicates\n \n # If a combo ends up with less than 2 tricks, delete it\n if (combo.no_tricks < 2)\n combo.destroy\n else\n # Update the indexes of the remaining tricks in the combo\n index = 1\n combo.elements.each do |elem|\n if elem.trick.name != self.name\n elem.index = index\n elem.save\n index += 1\n else\n elem.delete\n end\n end\n end\n combo.cache_sequence\n end\n end", "def delete_duplicate_program_players_and_user_traits\n @program_players = ProgramPlayer.order(:id)\n \n @user_to_program = Hash.new\n @program_players.each do |program_player|\n @user_to_program[program_player.user] ||= Hash.new\n @user_to_program[program_player.user][program_player.program] ||= Array.new\n @user_to_program[program_player.user][program_player.program] << program_player\n end\n \n @user_to_program.each do |user, program_hash|\n if program_hash.size > 1\n program_hash.each do |program, program_players|\n latest_program_player = nil\n program_players.reverse.each_with_index do |program_player, index|\n next unless program_player.program.present?\n if index == 0\n logger.warn \"keeping #{program_player.id}\" \n latest_program_player = program_player \n else\n logger.warn \"deleting #{program_player.id} (replacing it with #{latest_program_player.id})\"\n PlayerBudge.update_all(['program_player_id = ?', latest_program_player.id], ['program_player_id = ?', program_player.id])\n PlayerNote.update_all(['program_player_id = ?', latest_program_player.id], ['program_player_id = ?', program_player.id])\n PlayerMessage.update_all(['program_player_id = ?', latest_program_player.id], ['program_player_id = ?', program_player.id])\n \n program_player.destroy\n end\n end\n end\n end\n end\n\n\n\n @user_traits = UserTrait.order(:id)\n \n @user_to_trait = Hash.new\n @user_traits.each do |user_trait|\n @user_to_trait[user_trait.user] ||= Hash.new\n @user_to_trait[user_trait.user][user_trait.trait] ||= Array.new\n @user_to_trait[user_trait.user][user_trait.trait] << user_trait\n end\n \n @user_to_trait.each do |user, trait_hash|\n if trait_hash.size > 1\n trait_hash.each do |trait, user_traits|\n latest_user_trait = nil\n user_traits.reverse.each_with_index do |user_trait, index|\n if user_trait.trait.present?\n if index == 0\n logger.warn \"keeping user_trait #{user_trait.id}\" \n latest_user_trait = user_trait \n else\n logger.warn \"deleting user_trait #{user_trait.id} (replacing it with #{latest_user_trait.id})\"\n user_trait.destroy\n end\n else\n user_trait.destroy\n end\n end\n end\n end\n end\n end", "def sell_pets \n self.dogs.each do |dog|\n dog.owner = nil\n dog.mood = \"nervous\"\n self.dogs.delete(dog)\n end \n self.cats.each do |cat|\n cat.owner = nil\n cat.mood = \"nervous\"\n self.cats.delete(cat)\n end\n end", "def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end", "def add_removed_actors(actor, summon_id)\n if actor.summon? \n for actors in actor.removed_actors\n next if $game_actors[summon_id].removed_actors.include?(actors)\n $game_actors[summon_id].removed_actors << actors\n end\n else\n $game_actors[summon_id].removed_actors << [actor, actor.index]\n end\n end", "def remove_access_to(organisations_to_remove)\n self.organisations = self.organisations - Array(organisations_to_remove)\n end", "def remove_access_to(organisations_to_remove)\n self.organisations = self.organisations - Array(organisations_to_remove)\n end", "def destroy\n\t\t@competition=Competition.find(params[:id])\n\t\tif @competition.finished? || @competition.started_at.nil?\n\t\t\[email protected]\n\t\t\tcurrent_user.competition_id=nil\n\t\t\tcurrent_user.submitted_at=nil\n\t\t\tcurrent_user.submitted_competition= false\n\t\t\tcurrent_user.results={}\n\t\t\tcurrent_user.save!\n\t\t\t\n\t\t\tif current_user.can_get_free_gold\n\t\t\t\tcurrent_user.notifications.create!( message: \"Congratulations! You are now entitled to 1000 gold free gift.\" )\n\t\t\tend\n\t\t\t\n\t\t\tif users.count == 0\n\t\t\t\[email protected]\n\t\t\tend\n\t\t\tredirect_to competitions_path\n\t\telse\n\t\t\tflash[:danger]=\"You cannot leave when competition is started and not finished!!!\"\n\t\t\tredirect_to comepetition_path(@competition)\n\t\tend\n end", "def destroy\n \t@competitor = Competitor.find(params[:id])\n \[email protected]\n \tredirect_to competitors_path\n end", "def remove_all_participants\n Hyrax::CollectionTypeParticipant.where(hyrax_collection_type_id: id).all.find_each(&:destroy!)\n end", "def remove_all_participants\n Hyrax::CollectionTypeParticipant.where(hyrax_collection_type_id: id).all.find_each(&:destroy!)\n end", "def collaborators=(value)\n value = value.dup.uniq\n removals = collaborators - value\n additions = value - collaborators\n debug \"removals: #{removals.join(', ')}\"\n debug \"additions: #{additions.join(', ')}\"\n removals.each do |remove|\n post(\"/repos/collaborators/#{name}/remove/#{remove}\")\n end\n additions.each do |addition|\n post(\"/repos/collaborators/#{name}/add/#{addition}\")\n end\n @collaborators = nil\n end", "def destroy\n @competition.destroy\n\n redirect_to competition_setup_path\n end", "def remove_cards_forAI(cardToRemove1, cardToRemove2, cardToRemove3)\n\t\[email protected](cardToRemove1)\n\t\[email protected](cardToRemove2)\n\t\[email protected](cardToRemove3)\n\tend", "def remove_future_registrations\n self.registrations.select{|r| r.camp.start_date >= Date.current}.each{|r| r.destroy}\n end", "def sell_pets\n self.cats.each{ |each_cat|\n each_cat.mood = \"nervous\"\n each_cat.owner = nil\n }\n \n self.dogs.each{ |each_dog|\n each_dog.mood = \"nervous\"\n each_dog.owner = nil\n }\n\n self.cats.clear\n self.dogs.clear\n end", "def update_projectiles\n @projectiles.delete_if do |proj|\n proj.update\n proj.disposed?\n end\n end", "def comics_owned\n comics_array = self.comics.map do |comic|\n comic\n end\n comics_array.uniq\n end", "def finalize\n @list.each do |bp|\n bp.related_bp.each { |bp| bp.remove! }\n bp.remove!\n end\n clear\n end", "def set_summon_actors(battler)\n battler.summon_config = Summon_Skill[battler.summoning][0].dup\n set_summoned_battlers(battler)\n $game_party.summoned_party << Summon_Skill[battler.summoning][1]\n $game_party.summoned_party.uniq!\n for actor in $game_party.actors\n battler.removed_actors.delete(actor)\n next if actor.summon? or @old_party.include?(actor)\n @old_party << actor\n end\n case battler.summon_config[0]\n when 0\n for actor in $game_party.actors\n next if actor.id == battler.id or $game_party.removed_actors.include?(actor)\n $game_party.removed_actors << actor\n end\n when 1\n for actor in $game_party.actors\n next if $game_party.removed_actors.include?(actor)\n $game_party.removed_actors << actor\n end\n when 2\n $game_party.removed_actors << battler\n end\n end", "def delete_production_companies( current_companies )\n if params[:companies].nil?\n @movie.production_companies = []\n else\n current_companies.each do |id|\n unless params[:companies].include?( id )\n @movie.production_companies.each { |pc| pc.destroy if pc.company.id == id.to_i }\n end\n end\n end\n end", "def delete_amorts\n self.amortizations.delete_all\n end", "def sell_pets\n#this makes them all nervous\n pets.each do |species, animals|\n animals.each do |animal|\n animal.mood = \"nervous\"\n end\n animals.clear\n end\n end", "def cleanupSprites\n # remove from actors list\n @game_actors -= @clean_up_sprites\n\n # reset the clean up sprites\n @clean_up_sprites.clear\n end", "def break_cooperation(battler)\n if battler.actor?\n $game_temp.cp_actors[battler.cp_skill].delete(battler)\n else\n $game_temp.cp_enemies[battler.cp_skill].delete(battler)\n end\n battler.cp_skill = 0\n end", "def clear_equipments\n equip_slots.size.times do |i|\n change_equip(i, nil) if equip_change_ok?(i)\n end\n end", "def remove_everything_about_testuser\n list_of_activerecords = [\n Follow.find_by(leader_id: TESTUSER_ID),\n Follow.find_by(user_id: TESTUSER_ID),\n Mention.find_by(username: TESTUSER_NAME),\n Tweet.find_by(user_id: TESTUSER_ID),\n User.find_by(username: TESTUSER_NAME)\n ]\n list_of_activerecords.each { |ar| destroy_and_save(ar) }\nend", "def release_players\n Player.where(team_id: id).update_all(team_id: nil, active: false)\n end", "def manage_gone_contributors(current_contributor_names)\n previous_contributor_names = NamesManager.all_names\n gone_names = previous_contributor_names - current_contributor_names\n unless gone_names.empty?\n reassign_contributors_to = destroy_gone_contributors(gone_names)\n reassign_contributors_to.each {|commit| commit.contributions.clear}\n end\n end", "def remove_all\n @registry = []\n sync\n end", "def destroy\n if Solution::where( commissioning_id: @commissioning.id ).empty? and Activity::where( commissioning_id: @commissioning.id ).empty?\n @commissioning.destroy\n super( true )\n else\n super( false )\n end\n end", "def reset_combination(battler)\n battler.union = []\n battler.fusion = []\n battler.union_members = []\n battler.combination_battlers = []\n battler.cooperation = {}\n battler.old_skill_used_id = 0\n battler.combination_id = 0\n battler.move_size = 0\n battler.current_move = 0\n battler.in_combination = ''\n battler.current_phase = ''\n battler.old_fusion = 0\n battler.new_fusion = 0\n battler.union_leader = false\n battler.current_action.clear\n party = battler.actor? ? $game_temp.cp_actors : $game_temp.cp_enemies\n for id in party.keys\n party[id].delete(battler)\n end\n end", "def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end", "def removeSprites *sprites\n @game_actors -= sprites\n end", "def destroy_all_results\n authorize @competition\n\n results = @competition.scoring_helper.all_competitor_results\n if results.present?\n Competition.transaction do\n results.each(&:destroy)\n end\n flash[:notice] = \"Deleted all data for this competition\"\n else\n flash[:alert] = \"No results to be deleted\"\n end\n\n redirect_to @competition\n end", "def destroy\n # In order to guard Player dependency on Equipo and avoid the system to crash\n # Execute player.seguro for all players associated to this team first\n #\n safeTeam = Equipo.find_by(name: \"99 - NO DETERMINADO\")\n @equipo.players.each do |plyr|\n plyr.seguro safeTeam.id\n end\n\n @equipo.destroy\n flash[:success] = 'Se eliminó correctamente el equipo.'\n redirect_to equipos_url\n end", "def remove_from_general\n # Get general committees (may be more than one)\n general = Committee.where(\n committee_type_id: CommitteeType.general.id\n )\n\n # If this member is in the general members group (tested using set difference)\n if (general - self.committees).empty?\n general.each do |committee|\n self.committees.delete(general)\n end\n end\n end", "def obliterate()\n @@users_by_uid.delete(@uid)\n @@users_by_nick.delete(Channel.to_lower(@nick))\n part_all()\n end", "def sell_pets\n @pets.each do |type, pet| \n pet.each { |animal| animal.mood = \"nervous\"}\n end\n @pets.clear\n end", "def destroy_collaborated_wikis_before_delete\n #1 fetch list of wiki_ids for that the user is a collaborator on\n wiki_ids = $redis.smembers(self.collaborated_wikis_hash_key)\n #2 iterate over those wiki ids and remove instances where that user/wiki relationship exists\n #not sure about the below\n wiki_ids.each do |wiki_id|\n $redis.srem(Wiki.wiki_collaborators_hash_key(wiki_id), self.id)\n end\n $redis.del(self.collaborated_wikis_hash_key)\n end", "def assign_prisoners\n if @prisoner_ids\n\n new_ids = @prisoner_ids\n old_ids = prisoners.collect{|p| p.id}\n ids_to_delete = old_ids - (old_ids & new_ids)\n ids_to_add = new_ids - (old_ids & new_ids)\n\n game_id = id\n \n ids_to_delete.each do |prisoner_id|\n GamePrisoner.destroy_all(:game_id => game_id, :prisoner_id => prisoner_id)\n end\n\n ids_to_add.each do |prisoner_id|\n GamePrisoner.create(:game_id => game_id, :prisoner_id => prisoner_id)\n end\n end\n end", "def remove c\n if components.summands.any? {|list| list.delete(c)}\n raise unless c.world == self\n c.__set__world(nil)\n else\n raise \"Tried to remove #{c} from #{self}, but its world is #{c.world}.\"\n end\n end", "def destroy_boats\n boats.each do |b|\n if b.memberships.size == 1\n b.delete\n end\n end\n end", "def clear_difficulties\n Drink.update_all(\"difficulty = NULL\")\nend", "def destroy\n @user = current_user\n if @user.competences.count == 1\n @user.user_profile_progress -= 10\n end\n @competence.destroy\n @user.save!\n respond_to do |format|\n format.html { redirect_to '/profile#addMoreCompetences', notice: t('competences_controller.competences_delete_success') }\n format.json { head :no_content }\n end\n end", "def nuke_all_amorts\n delete_amorts\n delete_amort_details\n self.tranche_pegged_items.each do |tpi|\n tpi.delete_amorts\n tpi.delete_amort_details\n end\n self.reload\n end", "def normalize_games\n @match.games.each do |game|\n if !game.player1_score.present? && !game.player2_score.present?\n @match.games.delete(game)\n next\n end\n game.player1_id = @match.player1_id\n game.player2_id = @match.player2_id\n end\n end", "def destroy_dependents\n @old_namings.each do |naming|\n naming.observation = nil # (tells it not to recalc consensus)\n naming.destroy\n end\n end", "def touch_competitors\n touch\n competitors.map(&:touch)\n end", "def clear_new_badges\n achievements.each(&:clear_new_badges)\n end", "def clear_world\n @all_persons.clear\n @all_monsters.clear\n @all_strawberries.clear\n @all_mushrooms.clear\n\n @iteration = 0\n end", "def BuildCoauthors(investigator)\n coauthor_ids = investigator.abstracts.collect{|x| x.investigator_abstracts.collect(&:investigator_id)}.flatten.uniq\n coauthor_ids.delete(investigator.id)\n coauthor_ids.each do |coauthor_id|\n colleague=Investigator.find(coauthor_id)\n citation_overlap = investigator.abstracts.collect{|x| x.id}.flatten & colleague.abstracts.collect{|x| x.id}.flatten\n citation_overlap = citation_overlap.uniq.compact\n InsertUpdateInvestigatorColleague(investigator.id,coauthor_id,citation_overlap)\n InsertUpdateInvestigatorColleague(coauthor_id,investigator.id,citation_overlap)\n end\nend", "def delete_partial_data\n destroy :accounts\n destroy :bank_accounts\n destroy :currencies\n destroy :customers\n destroy :delivery_methods\n destroy :keywords\n destroy :menus\n destroy :parameter\n destroy :permissions # permissions need to be destroyed, even if we dont duplicate\n destroy :printers\n destroy :sum_levels\n destroy :terms_of_payments\n destroy :user_profiles\n destroy :users\n destroy :warehouses\n\n new_company.destroy\n end", "def destroy_dependents\n self.clouds.each do |cloud| cloud.destroy end\n self.groups.each do |group| group.destroy end\n self.roles.each do |role| role.destroy end\n self.recipes.each do |recipe| recipe.destroy end\n self.questions.each do |question| question.destroy end\n end", "def unprepare_mega_evolve(pokemon)\n @mega_evolved_trainer_ids.delete(pokemon.trainer_id)\n @prepared_mega_evolve.delete_if { |cell| cell.first == pokemon }\n end", "def destroy\n @competitor = Competitor.find(params[:id])\n @competitor.destroy\n\n respond_to do |format|\n format.html { redirect_to competitors_url }\n format.json { head :no_content }\n end\n end", "def break_relations\n # delete the relations between projects and tags\n # ( category is also be a kind of tags )\n dtp = TagcloudsProject.find :all, :conditions => { :tagcloud_id => self.id }\n dtp.each { | dp | dp.destroy } unless dtp.empty?\n\n # remove the categories of projects\n if self.tag_type == Tagcloud::TYPE[ :CATEGORY ]\n projs = Project.find :all, :conditions => { :category => self.id }\n projs.each { | p | p.category = nil; p.save }\n end\n end", "def modification_2_deletion\n projects = Perpetuity[Project].all.sort(:created_at).reverse.to_a[0..4]\n document_mapper = Perpetuity[Document]\n documents = document_mapper.all.to_a\n document_mapper.load_association! documents, :projects\n contract_mapper = Perpetuity[LegalContract]\n contracts = contract_mapper.all.to_a\n contract_mapper.load_association! contracts, :projects\n\n projects.each do |project|\n ds = document_mapper.select{|document| document.project.id == project.id}\n ds.each do |doc|\n document_mapper.delete doc\n end\n\n lc = contract_mapper.select{|contract| contract.project.id == project.id}\n lc.each do |lcon|\n contract_mapper.delete lcon\n end\n\n Perpetuity[Project].delete project\n end\n\n return \"deleted\"\nend", "def unload_reactions\n @reactor.clear if @reactor\n @reaction_files.clear if @reaction_files\n end", "def destroy\n @championship.destroy\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def undolist\n @rank_participants = RankParticipant.only_deleted.reverse\n end", "def destroy\n @competition = Competition.find(params[:id])\n @competition.destroy\n\n respond_to do |format|\n format.html { redirect_to competitions_path }\n end\n end", "def remove_dead_actors\n for battler in tactics_all\n if (battler.actor? && battler.death_state? &&\n $game_party.all_members.include?(battler) &&\n !GTBS::Prevent_Actor_Leave_List.include?(battler.id))\n $game_party.remove_actor(battler.id) \n end\n end\n end", "def builds_competitions\n competitions.each do |competition|\n Competition.create(id: competition[\"id\"], name: competition[\"caption\"])\n end\n end", "def destroy\n if @aramis_entity.collaborators.empty?\n @aramis_entity.destroy\n respond_to do |format|\n format.html { redirect_to @aramis_entity.project_code, notice: \"L'Entité Aramis #{@aramis_entity.name} a été supprimée avec succès\"}\n format.json { head :no_content }\n end\n else\n redirect_to :back, alert: \"L'Entité Aramis #{@aramis_entity.name} n'a pas été supprimée car elle dispose de Collaborateurs\"\n end\n end", "def remove_observers\n\t\t\[email protected] {|observer| self.remove_observer(observer) }\n\t\tend", "def destroy_gone_contributors(gone_names)\n gone_contributors = Contributor.all(:conditions => [\"name IN (?)\", gone_names])\n commits_of_gone_contributors = gone_contributors.map(&:commits).flatten.uniq\n gone_contributors.each(&:destroy)\n commits_of_gone_contributors\n end", "def summon_part4(battler)\n for summon_id in Summon_Skill[battler.summoning][1]\n case battler.summon_config[0]\n when 0\n for actor in $game_party.actors\n next if actor == battler\n add_removed_actors(actor, summon_id)\n end\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon(summon_id)\n when 1\n for actor in $game_party.actors\n next if actor.summon?\n add_removed_actors(actor, summon_id)\n end\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon(summon_id)\n when 2\n $game_actors[summon_id].removed_actors << [battler, battler.index]\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon_by_index($game_party.actors.index(battler), summon_id)\n when 3\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon(summon_id)\n end\n reset_action($game_actors[summon_id])\n $game_actors[summon_id].summoned_id = battler.summoning\n end\n for actor in $game_party.removed_actors\n $game_party.summoned.delete(actor) if actor.summon?\n $game_party.remove_actor(actor.id)\n end\n $game_party.refresh\n for actor in $game_party.actors\n if Summon_Skill[battler.summoning][0][4] or Summon_Skill[battler.summoning][1].include?(actor.id)\n actor.battler_position_setup\n else\n actor.retunt_to_original_position\n end\n actor.pose_id = 0\n end\n if $atoa_script['Atoa ATB']\n reset_bars\n elsif $atoa_script['Atoa CTB']\n update_all_ctb\n @ctb_window.refresh \n end\n battler.current_phase = 'Summon 5'\n end", "def rebuild_contributions(copy_statuses)\n p = self.parent\n\n self.contributions.destroy_all\n\n p.contributions.each do|c|\n new_c = c.clone\n new_c.contribution_types << c.contribution_types\n self.contributions << new_c\n end\n end", "def delete_assigned_members\n @card.members.each{|member| @card.remove_member member}\n end", "def destroy_interview_taggings\n manager_interview_taggings.each do |tagging|\n tagging.destroy\n end\n end", "def sell_pets\n all_animals = self.pets.values\n\n all_animals.each do |species|\n species.each {|pet| pet.mood = \"nervous\"}\n species.clear\n end\n end", "def remove_from_all_tables\n\t\t\t\treturn if !@players || @players.empty?\n\t\t\t\[email protected] do |p|\n\t\t\t\t\tp.quit\n\t\t\t\tend\n\t\t\tend", "def remove2(curation_concern, id)\n member = ActiveFedora::Base.find(id)\n curation_concern.ordered_members.delete(member)\n curation_concern.members.delete(member)\n end", "def remove(entity)\n @entities.delete(entity)\n @late_comers.delete(entity)\n @combat_order.delete(entity)\n @map.remove(entity, battle: self) if @map\n end", "def remove!; end", "def remove_player\n add_remove_player :remove\n end", "def remove_actor(actor_id)\r\n # アクターを削除\r\n @actors.delete($game_actors[actor_id])\r\n # プレイヤーをリフレッシュ\r\n $game_player.refresh\r\n end", "def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }\n c.save\n end\n end\n end", "def add_to_global_competition\n\t\treturn if (!self.in_grand_competition)\n\t\t\n\t\tcompetitions = Competition.where({:status=>STATUS[:ACTIVE], :is_complete=>false, :competition_type=>COMPETITION_TYPE[:GLOBAL]})\n\t\tcompetitions.each do |competition|\n\t\t\tCompetitionParticipant.add_participant(self.id, competition.id)\n\t\tend\n\tend", "def sell_pets\n pets.each do |type, all_type|\n all_type.each do |pet|\n pet.mood = \"nervous\"\n end\n end\n pets.clear\n end", "def remove_collaborator\n @project = current_user.projects.find(params[:id])\n @collaborator = User.find(params[:collaborator_id])\n @project.users.delete(@collaborator)\n\n redirect_to project_path(@project), :alert => \"Supervisor is deleted successfully\"\n end", "def reset_equipments\n floors.each{ |floor| floor.reset_equipments }\n end", "def test_party_disperses_if_all_removed\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n\n party = Party.new([character1, character2])\n party.remove(character1)\n\n assert_equal(true, party.dispersed?, \"Party should have been dispersed\")\n assert_nil(character1.party, \"`character1` should not be in party\")\n assert_nil(character2.party, \"`character2` should not be in party\")\n\n party = Party.new([character1, character2])\n character1.leave_party\n\n assert_equal(true, party.dispersed?, \"Party should have been dispersed\")\n assert_nil(character1.party, \"`character1` should not be in party\")\n assert_nil(character2.party, \"`character2` should not be in party\")\n end", "def destroy\n @competitor.destroy\n respond_to do |format|\n format.html { redirect_to competitors_url, notice: 'Competitor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @competitor.destroy\n respond_to do |format|\n format.html { redirect_to competitors_url, notice: 'Competitor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clean_up\n show do\n title 'Store pellets on ice'\n note temp_instructions(ON_ICE)\n\n note 'Keep the labeled cell pellets, in the 24-well aluminum block, on ice until you are ready for FACS.'\n end\n\n buffers = operations.map { |op| op.inputs.select { |i| ALL_BUFFERS.include?(i.name) } }.flatten\n buffers.map! { |b| b.child_item }.uniq!\n\n release(buffers, interactive: true)\n\n show do\n title 'Clean up'\n\n check 'Any items that remain on the bench (other than the labeled cell pellets) can be discarded.'\n check \"Set the refigerated centrifuge back to 25 #{DEGREES_C}.\"\n end\n end", "def normalize_candidate_entries\n a = Candidate.campany_candidate.where(email: email)\n a.each do |candidate|\n cp = CandidatesCompany.where(candidate_id: candidate.id)\n cp.update_all(candidate_id: id)\n # group_ids= candidate.groups.map{|g| g.id}\n # self.update_attribute(:group_ids, group_ids)\n candidate.delete\n end\n end", "def saveParticipations(parms)\n if parms\n self.participation_ids = parms.values\n else\n self.participations.clear\n end\n end", "def revome_unused_faces\n actors_ids = []\n for actor in $game_party.actors\n actors_ids << actor.id\n end\n for i in 0..@battler_face.size\n next if @battler_face[i].nil? or actors_ids.include?(i)\n @battler_face[i].dispose\n @battler_face[i] = nil\n end\n end", "def remove_empty_composition\n compositions.select { |composition| composition.percentage.nil? || composition.material.nil? }.each { |composition| composition.delete }\n end", "def destroy\n retired_org = Organisation.find_or_create_by(name: 'Retrait') do |org|\n org.abbreviation = 'Retrait'\n end\n\n if Author.where(person_id: self.id).count > 0\n self.organisation = retired_org\n self.save\n else\n super\n end\n end" ]
[ "0.72931963", "0.6423695", "0.61529243", "0.58806735", "0.58217484", "0.56935084", "0.5682762", "0.5674633", "0.5671789", "0.56699336", "0.56699336", "0.56460965", "0.55888903", "0.55872184", "0.55872184", "0.5582059", "0.55765736", "0.5573042", "0.55425006", "0.55383384", "0.5526788", "0.55221325", "0.55073494", "0.5472158", "0.54602164", "0.54499686", "0.5446011", "0.5431633", "0.54134375", "0.53910106", "0.5370915", "0.5354984", "0.5353541", "0.53249925", "0.53236413", "0.5317395", "0.5314826", "0.5311686", "0.5270777", "0.52640337", "0.52526915", "0.52401185", "0.5235518", "0.5228697", "0.52243716", "0.52230215", "0.5221783", "0.5219905", "0.5217277", "0.5214693", "0.52041227", "0.5202012", "0.520036", "0.5191828", "0.51806283", "0.5180265", "0.517792", "0.5176918", "0.5174504", "0.5171171", "0.51595455", "0.5151079", "0.51469773", "0.5139803", "0.5134688", "0.5134688", "0.5134688", "0.5134688", "0.51344883", "0.5133409", "0.51232535", "0.5123194", "0.5120267", "0.51170206", "0.51117593", "0.51104087", "0.5109157", "0.5104723", "0.5100208", "0.5099665", "0.50957245", "0.5093296", "0.5091282", "0.50892264", "0.5087365", "0.5085786", "0.5082628", "0.50768155", "0.5072667", "0.5064539", "0.50632006", "0.5061991", "0.50573194", "0.50573194", "0.50553155", "0.50501275", "0.50469244", "0.50459117", "0.50433666", "0.503822" ]
0.5492919
23
describes how to label the results of this competition
def result_description nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels\n return \"Title: #{@title}; Description: #{@desc}; #{@complete}\"\n end", "def lab_obs_lab_results_string(observation)\n if observation.answer_concept\n if !observation.answer_concept.fullname.include?(\"NO\")\n \"#{(observation.concept.fullname == \"LAB TEST RESULT\" ? \"<b>#{observation.answer_concept.fullname rescue nil}</b>\" :\n \"#{observation.concept.fullname}: #{observation.answer_concept.fullname rescue nil}#{observation.value_text rescue nil}#{observation.value_numeric rescue nil}\") rescue nil}\"\n end\n else\n \"#{observation.concept.fullname rescue nil}: #{observation.value_text rescue 1 }#{observation.value_numeric rescue 2 }\"\n end\n end", "def labels\n return \"Title: #{@title}; Description: #{@desc}; #{@complete}, Due Date: #{@dueDate}\"\n end", "def label\n label = \"#{number}: #{name}\"\n end", "def label() @positive end", "def label\n REASON_LABELS[@num - 1]\n end", "def label\n end", "def question_label\n \"#{self.id} - #{self.title}\"\n end", "def labels; end", "def label\n \"#{@name} (#{@id})\"\n end", "def label; end", "def label; end", "def label\n return @label\n end", "def answerLabel(question) \n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n \treturn choiceLabel(question.input, currentChoice(question.input))\n else\n \treturn questionAnswer(question)\n end\nend", "def answerLabel(question) \n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n \treturn choiceLabel(question.input, question.input.currentChoice)\n else\n \treturn questionAnswer(question)\n end\nend", "def label_and_parafilm\n show do \n title \"Label and Parafilm\"\n \n plates_to_parafilm = operations.reject { |op| op.temporary[:delete] || op.temporary[:re_incubate] }.map { |op| op.input(\"Plate\").item.id }\n note \"Perform the steps with the following plates: #{plates_to_parafilm.join(\",\")}\"\n note \"Label the plates with their item ID numbers on the side, and parafilm each one.\"\n note \"Labelling the plates on the side makes it easier to retrieve them from the fridge.\"\n end\n end", "def search_result_label item\n label = item.id\n unless item[\"title_display\"].blank?\n label = truncate(item[\"title_display\"], length: 35)\n end\n \n if ! item['duration_t'].nil? && ! item['duration_t'].empty? \n item_duration = item['duration_t'].first\n if item_duration.respond_to?(:to_i)\n formatted_duration = milliseconds_to_formatted_time(item_duration.to_i)\n label += \"(#{formatted_duration})\"\n end\n end\n\n label\n end", "def label\n full_title\n end", "def race_label\n\t\tlabel = self.object.race.to_s\t#.dup.capitalize\n#\t\tlabel << (( self.object.race.is_other? ) ? ' (not eligible)' : ' (eligible)')\n\tend", "def label\n return @label\n end", "def print_iteration(useLabel = false)\r\n if useLabel == true then label = 'iteration: ' end\r\n puts \"#{label}#{@iteration.to_s}\"\r\n end", "def contest_status_label(contest)\n if contest.closed?\n \"Votação Encerrada\"\n elsif contest.open?\n \"<span class='label label-success'>Votação Aberta</span>\".html_safe\n elsif contest.open_enrollment?\n \"<span class='label label-info'>Inscrições Abertas</span>\".html_safe\n elsif contest.idle?\n \"<span class='label label-default'>Votação inicia em #{format_date_old(contest.opening)}</span>\".html_safe\n elsif contest.waiting?\n \"<span class='label label-default'>Inscrições iniciam em #{format_date_old(contest.opening_enrollment)}</span>\".html_safe\n end\n end", "def label_name\n \n \"#{nombre_etiqueta}\"\n \n end", "def player_label(player_hash)\r\n return \"N/A\" unless player_hash.has_key?(:player_id)\r\n\r\n \"#{player_hash[:first_name]} #{player_hash[:last_name]} (#{player_hash[:player_id]})\"\r\n end", "def skills_display_label\n ret = ''\n self.skills.each do |s|\n ret += \"<span class='label label-default label-type-1'>#{s.name}</span>\"\n end\n\n return ret\n end", "def print_label\n puts \"#{@nombre_etiqueta}\"\n puts \"\\nValor energetico o nutriente | por 100g o 100ml de producto \"\n puts \"--------------------------------|--------------------------------\"\n puts \"valor energetico |\" + \" #{energetic_value_KJ}\" + \" KJ/\" + \"#{energetic_value_Kcal}\" + \" Kcal\"\n puts \"Camtidad de grasas |\" + \" #{@grasa}g\"\n puts \"Camtidad de grasas saturadas |\" + \" #{@grasa_saturada}g\"\n puts \"Camtidad de hidratos de carbono |\" + \" #{@hid_carbono}g\"\n puts \"Camtidad de azucares |\" + \" #{@azucares}g\"\n puts \"Camtidad de proteinas |\" + \" #{@proteinas}g\"\n puts \"Camtidad de sal |\" + \" #{@sal}g\"\n @nombre_etiqueta\n end", "def tell_fortunte()\n\t\tprint \"The answer is \" + $prediction + \". \\n\\n: \"\n\tend", "def to_s\n label\n end", "def label (hash)\n @labeled_answers.merge! hash\n end", "def to_s\r\n label\r\n end", "def label\n \tif !player.nil? && !opponent.nil?\n \t\t\"#{player_name}\\n#{opponent_name}\"\n \telsif !player.nil? && opponent.nil?\n \t\t\"#{player_name}\\n-----\"\n \telse\n \t\t\"----\\n----\"\n \tend\n end", "def display_str\n \"#{objective.code} - #{short_desc}\"\n end", "def label\n \"\"\n end", "def label\n self['label']\n end", "def label\n return computing_id\n end", "def tally\n return \"\"\n\n text = \"%s concerns: %s passed, %s failed, %s errored (%s/%s assertions)\"\n total = @passed.size + @failed.size + @raised.size\n text = text % [total, @passed.size, @failed.size, @raised.size, $assertions - $failures, $assertions]\n if @failed.size > 0\n text.ansi(:red)\n elsif @raised.size > 0\n text.ansi(:yellow)\n else\n text.ansi(:green)\n end\n end", "def description\n \"#{match.description} #{label}\"\n end", "def label\n @label || \"unknown\"\n end", "def print_details( result_counts, score )\n puts ('=' * 10) << \"\\n\"\n @groups.each_with_index { |group, index| group.each { |row| puts \"#{row} Group \" << (index + 1).to_s } }\n puts '-' * (@groups[0][0].length * 3)\n puts \"#{result_counts} Score\"\n puts \"\\nTotal Score: #{score}\\n\"\n end", "def name\n label\n end", "def announce_the_result\n if check_for_winner == \"Computer\"\n \"The Computer wins!\\n\"\n elsif check_for_winner == \"Player\"\n \"The Player wins!\\n\"\n elsif check_for_open_board == false\n \"It's a tie!\"\n end\n end", "def visionLabels\n @labels = @json[\"responses\"][0][\"labelAnnotations\"]\n @label_descriptions = []\n @label_scores = []\n @labels.each do |label|\n @label_descriptions << label[\"description\"]\n @label_scores << label[\"score\"] * 100\n end\n end", "def printAnswersOnScreen()\n $lblAnswerA['text'] = $arrAnswerA[$intQuestionOnScreen - 1]\n $lblAnswerB['text'] = $arrAnswerB[$intQuestionOnScreen - 1]\n $lblAnswerC['text'] = $arrAnswerC[$intQuestionOnScreen - 1]\n $lblAnswerD['text'] = $arrAnswerD[$intQuestionOnScreen - 1]\nend", "def label\n return computing_id\n end", "def labels\n [label()]\n end", "def label\n nome\n end", "def display_guess_results(results)\n if @role == \"computer\"\n addressing_string = \"Your\"\n else\n addressing_string = \"The computer's\"\n end\n puts \"#{addressing_string} guess had #{results[0]} colors in the right position and #{results[1]} total correct colors\"\n end", "def label\n return @frequency_data[ :label ]\n end", "def label\n code.to_s.capitalize\n end", "def labels_tech_demo\n outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), \"This is a label located at the top left.\"]\n outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), \"This is a label located at the bottom left.\"]\n outputs.labels << [ 5, 690, \"Labels (x, y, text, size, align, r, g, b, a)\"]\n outputs.labels << [ 5, 660, \"Smaller label.\", -2]\n outputs.labels << [ 5, 630, \"Small label.\", -1]\n outputs.labels << [ 5, 600, \"Medium label.\", 0]\n outputs.labels << [ 5, 570, \"Large label.\", 1]\n outputs.labels << [ 5, 540, \"Larger label.\", 2]\n outputs.labels << [300, 660, \"Left aligned.\", 0, 2]\n outputs.labels << [300, 640, \"Center aligned.\", 0, 1]\n outputs.labels << [300, 620, \"Right aligned.\", 0, 0]\n outputs.labels << [175, 595, \"Red Label.\", 0, 0, 255, 0, 0]\n outputs.labels << [175, 575, \"Green Label.\", 0, 0, 0, 255, 0]\n outputs.labels << [175, 555, \"Blue Label.\", 0, 0, 0, 0, 255]\n outputs.labels << [175, 535, \"Faded Label.\", 0, 0, 0, 0, 0, 128]\n end", "def correctAnswerLabel(question)\n\tif question.input.is_a? org.concord.otrunk.ui.OTChoice\n\t\treturn choiceLabel(question.input, question.correctAnswer)\n\telse\n\t\treturn 'Not Available'\n\tend\nend", "def correctAnswerLabel(question)\n\tif question.input.is_a? org.concord.otrunk.ui.OTChoice\n\t\treturn choiceLabel(question.input, question.correctAnswer)\n\telse\n\t\treturn 'Not Available'\n\tend\nend", "def name label\n label(label)\n end", "def label\n @example.description.scan(/Campo\\s(.*?)\\s\\(\\w+\\)/).flatten.first\n rescue\n @example.description\n end", "def render_decision args\n decision = current_decision args\n # text is either the value of decision's description key or warning that no description exists\n args.labels << [640, 360, decision[:description] || \"No definition found for #{args.state.decision_id}. Please update decision.rb.\", 0, 1] # uses string interpolation\n\n # All decisions are stored in a hash\n # The descriptions output onto the screen are the values for the description keys of the hash.\n if decision[:option_one]\n args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label\n args.labels << [10, 335, \"(Press 'left' on the keyboard to select this decision)\", -5, 0] # label of what key to press to select the decision\n end\n\n if decision[:option_two]\n args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description\n args.labels << [1270, 335, \"(Press 'right' on the keyboard to select this decision)\", -5, 2]\n end\n\n if decision[:option_three]\n args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description\n args.labels << [640, 20, \"(Press 'down' on the keyboard to select this decision)\", -5, 1]\n end\n\n if decision[:option_four]\n args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description\n args.labels << [640, 675, \"(Press 'up' on the keyboard to select this decision)\", -5, 1]\n end\nend", "def printQuestionOnScreen()\n $lblQuestionNumber.grid :column => 0, :row => 0\n $lblQuestionNumber['text'] = $intQuestionOnScreen.to_s + \".\"\n $lblQuestion.grid :column => 1, :row => 0\n $lblQuestion['text'] = $arrQuestions[$intQuestionOnScreen - 1]\nend", "def names_of_people_who_failed_english(results_set)\nend", "def results_for (label)\n @results[label] || []\n end", "def OPRLabel(text:)\n {\n type: \"label\",\n text: text\n }\nend", "def to_label(label)\n return unless label\n label.draw_multi_text(type.name, {:font_reverse => true})\n label.draw_multi_text(observations.collect{|obs|obs.to_short_s}.join(\", \"), {:font_reverse => false})\n end", "def show_results\n \"Correct answers: #{@correct_answers} out of #{NUMBER_OF_QUESTIONS}\\n\" \\\n \"You got #{@points} #{Sklonyator.sklonenie(@points, 'point', 'points', 'points')}\"\n end", "def next_match_title\n \"Match#{next_match_number}\"\n end", "def display_predictions(name)\n first_name = name.split(\" \")[0]\n last_name = name.split(\" \")[1]\n\n puts \"Predictions for \" + name + \" are - \"\n @predictions.each do |prediction|\n if (prediction == 'first_name_dot_last_name')\n puts first_name.downcase + \".\" + last_name.downcase + \"@\" + @domain_name\n end\n\n if (prediction == 'first_name_dot_last_initial')\n puts first_name.downcase + \".\" + last_name[0].downcase + \"@\" + @domain_name\n end\n\n if (prediction == 'first_initial_dot_last_name')\n puts first_name[0].downcase + \".\" + last_name.downcase + \"@\" + @domain_name\n end\n\n if (prediction == 'first_initial_dot_last_initial')\n puts first_name[0].downcase + \".\" + last_name[0].downcase + \"@\" + @domain_name\n end\n end\n puts \"-\" * 50\n end", "def labels\n inject_block(:name, :label)\n end", "def show_label(t)\n t(t) + ':'\n end", "def label(operate, label, number)\n Giic::Core.label(:user => @project.user, :repo => @project.repo, :number => number,\n :operate => operate, :label => label,\n :params => authentication_data)\n end", "def result_for_title\r\n result_for_txt.text\r\n end", "def result\n 'Scissors'\n end", "def get_label(t)\n labels = t.counterplayers(:atype => @base_locator+\"/association/scoping\", :rtype=>@base_locator+\"/types/named_topic_type\", :otype => @base_locator+\"/types/displaylabel\" )\n for label in labels\n if $current_lang\n return get_label_in_scope(t,$current_lang)\n else\n return get_default_label(label)\n end\n end\n return get_default_label(t)\n end", "def genOutputLabelArray()\n return [\"timeIndex\",\n \"posIndex_x\", \"posIndex_y\", \"posIndex_z\",\n \"population\"] ;\n end", "def to_label\n \"#{name}\"\n end", "def label\r\n\t\t''\r\n\tend", "def display_name\n return '' unless @research_output.is_a?(ResearchOutput)\n return \"#{@research_output.title[0..49]} ...\" if @research_output.title.length > 50\n\n @research_output.title\n end", "def discovery_label(stage)\n return \"#{stage.humanize} Processing\"\n end", "def to_label\n to_s\n end", "def result_for (label)\n (results = @results[label]) && # There are results for this tag\n results.first && # First hash in the list of results\n results.first.out[0]\n end", "def to_label\n \"#{label}\"\n end", "def tell_fortune()\r\n\t\tprint \"The answer is \" + $predicition + \". \\n\\n: \"\r\n\tend", "def to_label\n manufacturer.to_s + \" - \" + title\n end", "def match_to_preflabel(name)\n name = name.downcase\n case name\n when /reconstruction/\n standard_name = 'University of York. Post-war Reconstruction and'\\\n ' Development Unit'\n when /applied human rights/\n standard_name = 'University of York. Centre for Applied Human Rights'\n when /health economics/\n standard_name = 'University of York. Centre for Health Economics'\n when /health sciences/\n standard_name = 'University of York. Department of Health Sciences'\n when /lifelong learning/\n standard_name = 'University of York. Centre for Lifelong Learning'\n when /medieval studies/\n standard_name = 'University of York. Centre for Medieval Studies'\n when /renaissance/\n standard_name = 'University of York. Centre for Renaissance and Early'\\\n ' Modern Studies'\n when /reviews/\n standard_name = 'University of York. Centre for Reviews and'\\\n ' Disseminations'\n when /women/\n standard_name = \"University of York. Centre for Women's Studies\"\n when /school of social and political science/\n standard_name = 'University of York. School of Social and Political'\\\n ' Science'\n when /social policy/\n standard_name = 'University of York. Department of Social Policy and'\\\n ' Social Work'\n when /school of politics economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /politics/\n standard_name = 'University of York. Department of Politics'\n when /economics and related/\n standard_name = 'University of York. Department of Economics and Related'\\\n ' Studies'\n when /economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /history of art/\n standard_name = 'University of York. Department of History of Art'\n when /history/\n standard_name = 'University of York. Department of History'\n when /electronic/\n standard_name = 'University of York. Department of Electronic Engineering'\n when /theatre/\n standard_name = 'University of York. Department of Theatre, Film and'\\\n ' Television'\n when /physics/\n standard_name = 'University of York. Department of Physics'\n when /computer/\n standard_name = 'University of York. Department of Computer Science'\n when /psychology/\n standard_name = 'University of York. Department of Psychology'\n when /law/\n standard_name = 'University of York. York Law School'\n when /mathematics/\n standard_name = 'University of York. Department of Mathematics'\n when /advanced architectural/\n standard_name = 'University of York. Institute of Advanced Architectural'\\\n ' Studies'\n when /conservation/\n standard_name = 'University of York. Centre for Conservation Studies'\n when /eighteenth century/\n standard_name = 'University of York. Centre for Eighteenth Century\n Studies'\n when /chemistry/\n standard_name = 'University of York. Department of Chemistry'\n when /sociology/\n standard_name = 'University of York. Department of Sociology'\n when /education/\n standard_name = 'University of York. Department of Education'\n when /music/\n standard_name = 'University of York. Department of Music'\n when /archaeology/\n standard_name = 'University of York. Department of Archaeology'\n when /biology/\n standard_name = 'University of York. Department of Biology'\n when /biochemistry/ # confirmed with metadata team - recheck?\n standard_name = 'University of York. Department of Biology'\n when /english and related/ # confirmed directly with English department\n standard_name = 'University of York. Department of English and Related'\\\n ' Literature'\n when /philosophy/\n standard_name = 'University of York. Department of Philosophy'\n when /management studies/\n standard_name = 'University of York. Department of Management Studies'\n when /management school/\n # older versionof department name which should be retained if match found\n standard_name = 'University of York. The York Management School'\n when /language and linguistic science/\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /language and lingusitic science/ # deal with common typo\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /for all/ # this is 'languages for all' but in some records 'language'\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science. Languages for All'\n when /hull/\n standard_name = 'Hull York Medical School'\n when /international pathway/\n standard_name = 'University of York. International Pathway College'\n when /school of criminology/\n standard_name = 'University of York. School of Criminology'\n when /natural sciences/\n standard_name = 'University of York. School of Natural Sciences'\n when /environment and geography/ # order important, more precise must be first\n standard_name = 'University of York. Department of Environment and Geography'\n when /environment/\n standard_name = 'University of York. Environment Department'\n else\n standard_name = 'COULD NOT MATCH ' + name\n end\n standard_name\n end", "def create_top_labels ops\n now = Time.now\n ops.each do |op|\n item = op.output(OUTPUT).item\n temporary_label = op.temporary[:output_label]\n item_label = \"\"\n if item\n temporary_label = temporary_label.strike.add_tag(\"font\", color: \"red\")\n item_label = \" \" + op.output(OUTPUT).item.id.to_s.bold.add_tag(\"font\", color: \"green\")\n end\n\n op.temporary[:top_label] = \\\n \"<table style=\\\"width:100%\\\">\n <tr><td>#{temporary_label}#{item_label}</td></tr>\n <tr><td>#{op.output(OUTPUT).sample.name}</td></tr>\n <tr><td>#{now.strftime(\"%a %m/%d/%y\") }</td></tr>\n <tr><td>P: #{ op.temporary[:passage] }</td></tr>\n <tr><td>Seed: #{ op.input(SEED).val }%</td></tr>\n </table>\"\n end\n end", "def display_status\n exam_state = (all_questions_answered? ? FINISHED_STATE : UNFINISHED_STATE).titleize\n \"#{exam_state} Subject\"\n end", "def issues_label_with_pending_count\n @_label ||= \"ISSUES\" + (pending_issues_count > 0 ? \" (#{pending_issues_count})\" : \"\")\n end", "def issues_label_with_pending_count\n @_label ||= \"ISSUES\" + (pending_issues_count > 0 ? \" (#{pending_issues_count})\" : \"\")\n end", "def finderlabels\n %w{ Image Title Description }\n end", "def get_label_summary(label)\n labels = get_labels_summary\n unless labels.nil?\n labels.results.find { |item| item.name == label }\n end\n end", "def correct_answer\n new_question\n @label_quess.text = \"That's correct!\"\n @label_quess.textColor = UIColor.blueColor \n # return @scores = 0 if @scores > 10000 \n # @scores += 1\n return @correct = 0 if @correct > 10000\n @correct +=1\n @label_corect.text = \" ✓: \" + @correct.to_s \n\n end", "def label\n attribute :label\n end", "def print_results(results)\n important \"\"\n print_stats(results)\n\n important \"* #{format_float(results.failure_rate)}% failure rate\"\n suffix = \" (#{format_float(results.elapsed / ITERATIONS.to_f)}/iteration)\" if ITERATIONS > 0\n important \"* #{format_float(results.elapsed)} seconds elapsed#{suffix}\"\nend", "def status_label label\n if label == \"assigned\"\n raw \"<span class='label'>Assigned</span>\"\n elsif label == \"progress\"\n raw \"<span class='label label-info'>In Progress</span>\"\n elsif label == \"submit\"\n raw \"<span class='label label-warning'>Submitted</span>\"\n elsif label == \"reopen\"\n raw \"<span class='label label-info'>Reopened and Now In Progress</span>\"\n elsif label == \"approve\"\n raw \"<span class='label label-success'>Approved</span>\"\n else\n \"\"\n end\n end", "def print_results(name, result, score, separator = \"\\n\")\n print \" \" + name.ljust(24).slice(0, 23) +\n \" Result: \" + result.ljust(10).slice(0, 9) +\n \" Score: \" + score.to_s.ljust(10).slice(0, 9) +\n separator\n end", "def extra_label(index)\r\n return nil if index < 1 || index > 5\r\n txt = send(\"extra_#{index}_label\")\r\n txt = extra_name(index).to_s.humanize.capitalize if txt.blank?\r\n txt\r\n end", "def tell_fortune()\r\n print \"The answer is \" + $prediction + \". \\n\\n: \"\r\n end", "def to_s\n label_name.to_s + ':' + rule.embed\n end", "def to_s\n @label\n end", "def code_and_label\n code + ' - ' + label\n end", "def label\n parse_normal_range\n if self.critical? \n return \"critical\" \n elsif self.warning? \n return \"warning\"\n else\n return \"\"\n end\n end", "def analyze_and_return_labels_with_score\n image_annotator = Google::Cloud::Vision::ImageAnnotator.new\n file_name = self.image_on_disk\n response = image_annotator.label_detection image: file_name\n return_data = Hash.new()\n response.responses.each do |res|\n res.label_annotations.each do |label|\n return_data[label.description] = label.score\n end\n end\n return_data\n end", "def descriptive_label\n @attributes[:descriptive_label]\n end", "def full_label\n ''\n end", "def title(label)\n \n \"#{label}\\n\"\n \n end" ]
[ "0.71965396", "0.6990186", "0.66584706", "0.6623342", "0.65199596", "0.64700925", "0.64518017", "0.6416198", "0.6406615", "0.63071686", "0.62908536", "0.62908536", "0.6266051", "0.6250404", "0.62403315", "0.6234206", "0.6205086", "0.62042624", "0.61774296", "0.6152176", "0.6126238", "0.6096906", "0.6091178", "0.6090832", "0.6078068", "0.60753447", "0.6065265", "0.60479546", "0.60469294", "0.6037379", "0.60368675", "0.6033518", "0.6016042", "0.60095626", "0.5999939", "0.59902465", "0.59846765", "0.5984036", "0.5973487", "0.5965612", "0.59546024", "0.5953589", "0.5952616", "0.5947706", "0.5940274", "0.5938152", "0.5934707", "0.5930705", "0.59049225", "0.5891779", "0.5887541", "0.5887541", "0.58831", "0.58789665", "0.5872841", "0.5861615", "0.58440626", "0.58400893", "0.5829719", "0.5825181", "0.58186555", "0.58181167", "0.58024025", "0.57898325", "0.5787522", "0.5782234", "0.5780971", "0.5770645", "0.5764335", "0.5752908", "0.5749693", "0.5746551", "0.5745955", "0.5735931", "0.57190645", "0.5717845", "0.57128245", "0.57074964", "0.57060105", "0.5705554", "0.56839114", "0.5683743", "0.56722987", "0.56722987", "0.56676716", "0.5662161", "0.56615293", "0.5657956", "0.56538004", "0.56508577", "0.56494904", "0.56463957", "0.56453466", "0.564471", "0.5642831", "0.56346536", "0.56228566", "0.56151813", "0.5614723", "0.56126887", "0.5609601" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_attached_image @attached_image = AttachedImage.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def action\n end", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; 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 around_hooks; end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516", "0.5311442", "0.52963835", "0.52955836", "0.5295297", "0.5258503", "0.52442217", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5234908", "0.5230927", "0.52263695", "0.5222485", "0.5216462", "0.52128595", "0.52070963", "0.520529", "0.517586", "0.5174021", "0.5172379", "0.5165636", "0.5161574", "0.51556087", "0.5153217", "0.5152898", "0.5151238", "0.5144674", "0.51387095", "0.51342636", "0.5113545", "0.51131564", "0.51131564", "0.5107665", "0.5107052", "0.50908124", "0.5089785", "0.50814754", "0.50807786", "0.5064482", "0.5053022", "0.50526255", "0.5050246", "0.5050246", "0.50329554", "0.5023997", "0.5021236", "0.5014815", "0.5014393", "0.4999298", "0.49990913", "0.4997733", "0.49884573", "0.49884573", "0.49840933", "0.49786162", "0.49784446", "0.49782816", "0.49659815", "0.49655175", "0.4956222", "0.49543875", "0.49536037", "0.495265", "0.4951427", "0.49438462", "0.49436793", "0.49335384", "0.49321616", "0.49264926", "0.49247074", "0.49246994", "0.49226475", "0.49194494", "0.49152806", "0.49149707", "0.49149227", "0.49144953", "0.49141943" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def attached_image_params params.require(:attached_image).permit(:image_id, :response_id, :question_id) 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
Get all tickets. Can select projects p[]=
def overall_tickets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end", "def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end", "def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end", "def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end", "def find_tickets(*ids)\n ids.map do |id|\n project.tickets(id).first\n end.compact\n end", "def all_ticket_entries\n @ac = ApplicationController.new\n @tickets = Ticket.find(:all, :order => \"created_at\")[0..5000].reverse!\n @species = Specie.all\n @woodtypes = WoodType.all\n end", "def tickets\n sql = \"SELECT * FROM tickets\"\n values = []\n tickets = SqlRunner.run(sql, values)\n result = tickets.map { |ticket| Ticket.new( ticket ) }\n return result\n end", "def index\n @sprint = params[:sprint].presence || Sprint.current!\n @tickets = Ticket.for_sprint(@sprint).by_created_at_desc\n @tickets = @tickets.for_project(params[:project]) if params[:project].present?\n @tickets = @tickets.for_user(params[:user]) if params[:user].present?\n @tickets = @tickets.search_name(params[:description]) if params[:description].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "def index\n @project = Project.find(params[:project_id])\n @ticket = @project.tickets.new\n\n @tags = Ticket.tag_counts_on(:tags)\n\n if params[:tags]\n @tickets = {}\n @tickets[:both] = [params[:tags].gsub(', ', ',').split(',').map(&:capitalize).join(', '), @project.tickets.tagged_with(params[:tags])]\n @tickets[:other] = params[:tags].gsub(', ', ',').split(',').map do |tag|\n [tag.capitalize, (@project.tickets.tagged_with(tag) - @tickets[:both][1])]\n end\n else\n @tickets = @project.tickets\n end\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def index\n @tickets = Ticket.all\n end", "def tickets()\n sql = \"SELECT * FROM tickets where customer_id = $1\"\n values = [@id]\n ticket_data = SqlRunner.run(sql, values)\n return ticket_data.map{|ticket| Ticket.new(ticket)}\n end", "def index\n @tickets = get_current_user_ticket_list(@user)\n end", "def tickets\n Ticket.find(:all, :params => { :q => \"milestone:\\\"#{title}\\\" state:open sort:priority\" })\n end", "def tickets\n records do |instance|\n instance['tickets'] = ticket.where('organization_id': instance['_id'])\n end\n end", "def get_all_withassigned(projectid)\n get(\"projects/#{projectid}/assigned_todos.json\")\n end", "def index\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n @tickets = Ticket.all_for_project(@project)\n render json: @tickets, status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:project_id]}\" }, status: 404\n end\n end", "def index_all\n @tickets = Ticket.all_tickets\n render json: @tickets, status: 200\n end", "def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def scoped_tickets\n return @sprint.assigned_tickets if @sprint\n return @project.tickets if @project\n end", "def tickets\n sql = \"\n SELECT * FROM tickets\n WHERE customer_id = $1\n \"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return nil if result.count == 0\n return result.map {|ticket| Ticket.new(ticket)}\n end", "def index\n @tickets = current_user.tickets\n end", "def index\n @tickets = current_user.tickets\n end", "def index\n @tickets = Ticket.where(user: current_user)\n end", "def my_tickets\n user = current_user.id if !current_user.nil?\n # OCO\n init_oco if !session[:organization]\n\n @search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !user.blank?\n with :created_by, user\n end\n with(:ticket_status_id).less_than(4)\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n\n @tickets = @search.results\n\n respond_to do |format|\n format.html # my_tickets.html.erb\n format.json { render json: @tickets }\n end\n end", "def index\n @project_threads = ProjectThread.all\n end", "def getList fields = [\"*\"]\n\t\tputs \"here\"\n\t\ttickets = @tickets.read fields\n\t\tputs \"here jjj\"\n\t\toutput = \"Projects:\\n\"\n\n\t\ttickets.each do |row|\n\t\t\toutput += \"| \"\n\t\t\trow.each do |cell|\n\t\t\t output += \"#{cell[1]} | \"\n\t\t\tend\n\t\t\toutput += \"\\n\"\n\t\tend\n\t\toutput\n\tend", "def tickets\n where(:_type => TicketCategory.name)\n end", "def all\n @projects\n end", "def all\n @projects\n end", "def find_all(project_id)\n query = \"project:=#{project_id}\"\n cols = %w(dtLastUpdated ixBug sStatus sTitle sLatestTextSummary\n ixProject sProject sPersonAssignedTo sPriority).join(',')\n api.command(:search, :q => query, :cols => cols).collect do |ticket|\n self.new ticket[1][\"case\"]\n end.flatten\n end", "def index\n @support_tickets = SupportTicket.all\n end", "def index\n @bugs = Project.find(params[:project_id]).bugs.all\n end", "def index\n @tickets = @event.tickets\n end", "def tickets(filters = {})\n tickets = send(:get , '/api/v1/ticket_reports/dynamic.json', filters)\n\n tickets = tickets[:body][\"groups\"].first[\"tickets\"]\n\n process_list_response( tickets , Unfuddled::Ticket)\n end", "def tickets(*options)\n options.insert 0, id\n easy_finder(provider_parent(self.class)::Ticket, :all, options, 1)\n end", "def index\n\n # default: show all\n @tickets=Ticket.all\n\n # cases for showing open tockets, closed tickets, and per technician\n case params[:state]\n when \"open\"\n @[email protected](closed: nil)\n when \"closed\"\n @[email protected](closed: nil)\n end\n if params.has_key? :assigned_technician\n @[email protected](assigned_technician: params[:assigned_technician])\n end\n end", "def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks.all\n end", "def get_ticket_ids\n @tickets = Ticket.all.map(&:id)\n end", "def show\n @projects = @board.projects\n @columns = @board.columns.order(:position)\n @sprints = @board.sprints.where(is_active: true)\n @backlog_tickets = Ticket.all.where(\"project_id In (?)\", @board.projects.pluck(:id))\n if @board.sprints.joins(:tickets).pluck(\"tickets.id\").length > 0\n @backlog_tickets = @backlog_tickets.where(\"id not in (?)\", @board.sprints.joins(:tickets).pluck(\"tickets.id\"))\n end\n @tickets = Ticket.where(\"project_id IN (?)\", @board.projects.pluck(:id))\n @tickets = @tickets.joins(:sprints).where(\"board_sprints_tickets.board_sprint_id IN (?)\", @sprints.where(\"is_complete IS NOT ?\", true).pluck(:id))\n end", "def index\n \n @tickets = Ticket.all\n @tickets = @tickets.order(:updated_at)\n @tickets = @tickets.joins(:payment).where(\"payments.id = ?\",params[:clave]) unless params[:clave]==\"\" or params[:clave].nil?\n \n @payment = Payment.find(params[:clave])\n end", "def index\n @ticket_items = TicketItem.all\n end", "def projects\n PivotalTracker::Project.all\n end", "def index\n @tickets = Ticket.includes({ :comments => :user}, :creator, :assignee).in_progress\n end", "def index\n\n @clients = Ticket.joins(:clients).where(client_id: params[:id])\n # @tickets = Ticket.joins(:computers).where(client_id: params[:id])\n @tickets = Ticket.all.order(:due_date).limit(10).offset(0).page params[:page]\n if params[:search]\n @tickets = Ticket.search(params[:search]).order(\"created_at DESC\").page params[:page]\n else\n @tickets = Ticket.all.order(:due_date).limit(10).offset(0).page params[:page]\n @tickets = Ticket.all.order(:due_date).limit(10).offset(0).page params[:page]\n end\n \n #@client = Ticket.joins(:clients).where(@ticket => client.full_name)\n @open_tickets = Ticket.where.not(\"status_id = 8\").count\n #@computers = @ticket.computer.id\n @new_tickets = Ticket.where(\"status_id = 4\").limit(10).offset(0).page params[:page]\n @diagnostic_tickets = Ticket.where(\"status_id = 9\").page params[:page] \n @parts_tickets = Ticket.where(\"status_id = 6\").page params[:page]\n @waiting_tickets = Ticket.where(\"status_id = 7\").page params[:page]\n @in_progress_tickets = Ticket.where(\"status_id = 5\").page params[:page]\n @completed_tickets = Ticket.where(\"status_id = 8\").limit(10).offset(0).page params[:page]\n @expected_date = Date.today + (@open_tickets / 5) + 3.days\n #@expected_date = Ticket.due_date.created_at + 3.days\n end", "def all_tickets()\n sql = \"SELECT customers.name, films.title, tickets.id\n FROM tickets\n INNER JOIN customers\n ON tickets.customer_id = customers.id\n INNER JOIN screenings\n ON tickets.screening_id = screenings.id\n INNER JOIN films\n ON screenings.film_id = films.id\n WHERE customers.id = $1\"\n values = [@id]\n result = Sqlrunner.run(sql, values)\n return result.each {|info| p info}\n end", "def index\n # @tickets = Ticket.all\n @q = Ticket.ransack(params[:q])\n @tickets = @q.result(distinct: true).paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n end", "def index\n @tickets_recently = Ticket.where(reporter: current_user)\n .where.not('status_id = (?) OR status_id = (?)', Status.closed_id, Status.cancel_id)\n .where(updated_at: (Time.now - 24.hours)..Time.now)\n .order(updated_at: :desc)\n .page(params[:recently]).per(6)\n @tickets = Ticket.where(reporter: current_user).order(updated_at: :desc).page(params[:page]).per(10)\n end", "def index\n # @open_tickets are tickets not assgined to any agent\n # @ip_tickets are in progress tickets\n # @closed_tickets are closed tickets to show in history\n @ip_tickets, @closed_tickets, @open_tickets = current_user.get_tickets\n end", "def get_owner_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_owner(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def index\n if current_user.is? :admin\n if params[:user_id]\n @tickets = User.find(params[:user_id]).tickets.paginate(:page => params[:page])\n elsif params[:team_id]\n @tickets = Team.find(params[:team_id]).tickets.paginate(:page => params[:page])\n else\n @tickets = Ticket.paginate(:page => params[:page])\n end\n else\n @tickets = current_user.tickets.paginate(:page => params[:page])\n end\n\n if params[:status] == \"closed\"\n @tickets = @tickets.closed\n else\n @tickets = @tickets.open\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "def tickets\n subtree_map(Ticket, :tickets)\n end", "def index\n @ticket_options = TicketOption.all\n end", "def projects\n request(method: 'getAllProjects')\n end", "def all\n cookies[:allProjects]=true\n @all_projects=true\n @projects={\n \"current\"=> Project.find_all_by_state('current'),\n \"finished\"=> Project.find_all_by_state('finished'),\n \"aborted\"=> Project.find_all_by_state('aborted')\n }\n\t\tself.bread\n authorize! :list_all, @projects\n render 'index'\n end", "def index\n @o_all = @ticket.ticket_logs\n end", "def index\n @projects = Project.find_all_by_user_id current_user[:id]\n @project_issues = ProjectIssue.find_all_by_user_id current_user[:id]\n end", "def my_tickets\n if user_type_id == 1\n Ticket.where(issuer_user_id: id)\n else\n Ticket.where(assigned_to_id: id)\n end\n end", "def index\n @tickets = Ticket.order(id: :desc).all\n end", "def index\n @ticket_loops = TicketLoop.all\n end", "def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks\n end", "def tickets()\n sql = \"SELECT * FROM tickets\n WHERE customer_id = $1\"\n values = [@id]\n tickets = SqlRunner.run(sql, values)\n return tickets.map{|ticket|Ticket.new(ticket)}\nend", "def projects\n @projects ||= Project.all\n end", "def index\n p1=Project.find_by(id: params[:project_id])\n @project_bugs = p1.project_bugs\n end", "def index\n @ticket_events = TicketEvent.all\n end", "def index\n @bugs = Bug.where(project_id: params[:project_id])\n @project = params[:project_id]\n end", "def find_projects\n @projects = Project.all\n end", "def index\n @all_projects = Project.by_user_plan_and_tenant(params[:tenant_id], current_user)\n end", "def index\n @tickets = Ticket.all\n @tickets_ordered \n end", "def index\n @bugs = Bug.all\n project_id = params[:id]\n @project = Project.find_by(id: project_id)\n end", "def index\n @ticketings = Ticketing.all\n end", "def index\n @tissues = Tissue.all\n end", "def index\n @bugs = @project.bugs.all\n end", "def index\n @projects = Project.active\n if params[:project_id].present?\n @project = Project.find(params[:project_id])\n @teams = @project.teams.active\n else\n @teams = Team.for_user(current_user)\n end\n end", "def index\n @tickets = Ticket.effectiveness\n end", "def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end", "def list_all\n query = create_query(:Project, :all, by: default_sort_order)\n show_selected_projects(query)\n end", "def tickets\n Ticket.all.select do |ticket|\n ticket.event == self\n end\n end", "def index\n # Show all tickets if admin otherwise just tickets by user\n if current_user.id == 1 then\n @tickets = Ticket.all\n else\n @tickets = Ticket.where(:user_id => current_user.id)\n end\n end", "def index\n @project_tasks = ProjectTask.all\n end", "def index\n @project_tasks = ProjectTask.all\n end", "def index\n users_tickets = if current_employee.manager?\n Ticket::Ticket.all\n elsif current_employee.crew_chief?\n Ticket::Ticket.where(crew_chief: current_employee)\n end\n \n @tickets = users_tickets.not_finalized.decorate\n @tickets_finalized = users_tickets.finalized.decorate\n end", "def get_projects\n @params=task_params\n @client=current_user.clients.find(@params[:client_id])\n counter=0\n @res=[]\n @client.projects.each do |c|\n if c.users.include? current_user\n @res[counter]={\n project_id: c.id, \n name: c.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end", "def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end", "def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].map { |p| self.new p }\n end.flatten\n end", "def index\n @projects = Project.order(is_billable: :desc, name: :asc)\n .includes(:team, contracts: [:full_reports])\n .search(params[:search]).page(params[:page])\n end", "def index\n\t @tickets = Ticket.order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end" ]
[ "0.77884585", "0.773211", "0.7170943", "0.6977903", "0.69335794", "0.69092107", "0.67012507", "0.6667955", "0.6654992", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.66492873", "0.6648203", "0.6613165", "0.6611273", "0.6604442", "0.6597819", "0.6584742", "0.6547642", "0.6514871", "0.6508172", "0.65066", "0.65018636", "0.6491918", "0.64842635", "0.6477006", "0.6477006", "0.64762384", "0.64733285", "0.6454146", "0.64472", "0.64443916", "0.64340186", "0.64340186", "0.6431958", "0.64135003", "0.64050424", "0.6398303", "0.6382549", "0.6363754", "0.6355854", "0.63428974", "0.63331264", "0.6329313", "0.6320852", "0.63053656", "0.6288118", "0.6285832", "0.62857854", "0.626867", "0.626331", "0.62441593", "0.62389535", "0.6218113", "0.62145656", "0.6213948", "0.6205835", "0.6205027", "0.6199659", "0.6197159", "0.6180903", "0.6169941", "0.61615443", "0.61433303", "0.61317563", "0.6106973", "0.6106109", "0.6105914", "0.610518", "0.61044127", "0.60766095", "0.6070726", "0.60682935", "0.6054151", "0.60443896", "0.60415643", "0.6037265", "0.6027493", "0.60125756", "0.60072297", "0.5996269", "0.59882855", "0.59860605", "0.5982311", "0.5982311", "0.5958163", "0.59556335", "0.5950925", "0.5947123", "0.59426326", "0.5941215", "0.5938281" ]
0.0
-1
:nodoc: Initialize a new MessageEncryptor. +secret+ must be at least as long as the cipher key size. For the default 'aes256gcm' cipher, this is 256 bits. If you are using a userentered secret, you can generate a suitable key by using ActiveSupport::KeyGenerator or a similar key derivation function. The first additional parameter is used as the signature key for MessageVerifier. This allows you to specify keys to encrypt and sign data. Ignored when using an AEAD cipher like 'aes256gcm'. ActiveSupport::MessageEncryptor.new('secret', 'signature_secret') ==== Options [+:cipher+] Cipher to use. Can be any cipher returned by +OpenSSL::Cipher.ciphers+. Default is 'aes256gcm'. [+:digest+] Digest used for signing. Ignored when using an AEAD cipher like 'aes256gcm'. [+:serializer+] The serializer used to serialize message data. You can specify any object that responds to +dump+ and +load+, or you can choose from several preconfigured serializers: +:marshal+, +:json_allow_marshal+, +:json+, +:message_pack_allow_marshal+, +:message_pack+. The preconfigured serializers include a fallback mechanism to support multiple deserialization formats. For example, the +:marshal+ serializer will serialize using +Marshal+, but can deserialize using +Marshal+, ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy to migrate between serializers. The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ serializers support deserializing using +Marshal+, but the others do not. Beware that +Marshal+ is a potential vector for deserialization attacks in cases where a message signing secret has been leaked. If possible, choose a serializer that does not support +Marshal+. The +:message_pack+ and +:message_pack_allow_marshal+ serializers use ActiveSupport::MessagePack, which can roundtrip some Ruby types that are not supported by JSON, and may provide improved performance. However, these require the +msgpack+ gem. When using \Rails, the default depends on +config.active_support.message_serializer+. Otherwise, the default is +:marshal+. [+:url_safe+] By default, MessageEncryptor generates RFC 4648 compliant strings which are not URLsafe. In other words, they can contain "+" and "/". If you want to generate URLsafe strings (in compliance with "Base 64 Encoding with URL and Filename Safe Alphabet" in RFC 4648), you can pass +true+. [+:force_legacy_metadata_serializer+] Whether to use the legacy metadata serializer, which serializes the message first, then wraps it in an envelope which is also serialized. This was the default in \Rails 7.0 and below. If you don't pass a truthy value, the default is set using +config.active_support.use_message_serializer_for_metadata+.
def initialize(secret, sign_secret = nil, **options) super(**options) @secret = secret @cipher = options[:cipher] || self.class.default_cipher @aead_mode = new_cipher.authenticated? @verifier = if !@aead_mode MessageVerifier.new(sign_secret || secret, **options, serializer: NullSerializer) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(secret, *signature_key_or_options)\n options = signature_key_or_options.extract_options!\n sign_secret = signature_key_or_options.first\n @secret = secret\n @sign_secret = sign_secret\n @cipher = options[:cipher] || 'aes-256-cbc'\n @verifier = MessageVerifier.new(@sign_secret || @secret, :serializer => NullSerializer)\n @serializer = options[:serializer] || Marshal\nend", "def encryptor\n ActiveSupport::MessageEncryptor.new(ActiveSupport::KeyGenerator.new(\n ENV.fetch(\"SECRET_KEY_BASE\")\n ).generate_key(\n ENV.fetch(\"ENCRYPTION_SERVICE_SALT\"),\n ActiveSupport::MessageEncryptor.key_len\n ))\n end", "def initialize(options = {})\n key = options.fetch(:key)\n salt = options.fetch(:salt)\n\n @encryptor = ::ActiveSupport::MessageEncryptor.new \\\n ::ActiveSupport::KeyGenerator.new(key).generate_key(salt, 32)\n end", "def cryptor\n key = Rails.application.secrets.secret_key_base.bytes[0..31].pack( \"c\" * 32 )\n ActiveSupport::MessageEncryptor.new(key)\n end", "def client\n @client ||= ActiveSupport::MessageEncryptor.new(@key, cipher: 'aes-256-cbc')\n end", "def secret_params\n params.require(:secret).permit(:message, :key, :algorithm)\n end", "def initialize(opts)\n @secret = opts.fetch(:secret)\n @message = opts[:message]\n @iv = opts[:iv]\n @now = opts[:now]\n end", "def initialize(private_key: nil, encryptor: OnlineVoting::Crypto::Message, signer: OnlineVoting::Crypto::BlindSigner, admin_client: OnlineVoting::AdminClient)\n @signer = signer.new\n @private_key = private_key\n @encryptor = encryptor\n @admin_client = admin_client.new(uri: Voter.config.administrator_module_uri)\n end", "def message_params\n params.require(:message).permit(:sender, :cipher, :iv, :key_recipient_enc, :sig_recipient, :timestamp, :recipient, :sig_service)\n end", "def initialize(key, secret)\n super()\n self.key = key\n self.secret = secret\n end", "def secret=(secret)\n if (secret.nil? or secret.empty? or (secret.size < 16))\n fatal(\"Error: secret=: Secret must be non-null and at least 16 characters.\") \n end\n @signkey = derive(secret, \"SIGNATURE\")\n @cryptkey = derive(secret, \"ENCRYPTION\")\n end", "def use_encryption\n if config[:secret] && config[:secret_file]\n ui.fatal(\"please specify only one of --secret, --secret-file\")\n exit(1)\n end\n config[:secret] || config[:secret_file]\n end", "def initialize(secret = '', base64: false)\n raise 'Secret can\\'t be nil' if secret.nil?\n @secret = secret\n @base64 = base64\n end", "def create\n\n data = secret_params\n \n plaintext = data[:message]\n key = data[:key]\n errors = []\n\n \n errors.append([:message, \"must consist of only ASCII characters\"]) if !plaintext.ascii_only?\n errors.append([:key, \"must consist of only ASCII characters\"]) if !key.ascii_only?\n errors.append([:message, \"can't be blank\"]) if plaintext.blank?\n errors.append([:key, \"can't be blank\"]) if key.blank?\n\n algorithm = data[:algorithm].to_i\n\n if errors.empty?\n ciphertext = CriptoAlgorithms.encrypt(algorithm,plaintext,key)\n @secret = Secret.new({ciphertext: ciphertext, algorithm: algorithm, user_id: current_user.id})\n else\n @secret = Secret.new({ciphertext: \"\", algorithm: algorithm})\n for e in errors do @secret.errors.add(e[0], e[1]) end\n end \n\n respond_to do |format|\n if errors.empty? && @secret.save\n format.html { redirect_to @secret, notice: 'El secreto se creó correctamente.' }\n format.json { render :show, status: :created, location: @secret }\n else\n format.html { render :new }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def build(salt = nil, iv = nil)\n cipher = OpenSSL::Cipher.new(arguments[:cipher] || DEFAULT_CIPHER)\n iv ? cipher.decrypt : cipher.encrypt\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n arguments[:key],\n salt,\n arguments.fetch(:iterations, CRYPT_ITER),\n arguments.fetch(:key_length, CRYPT_KEY_LENGTH)\n )\n cipher.iv = iv if iv\n cipher.key = key\n cipher\n end", "def encrypt_and_sign(value, **options)\n create_message(value, **options)\n end", "def message_params\n params.require(:message).permit(:timestamp, :recipientname, :sig_service, :name, :cipher, :iv, :key_recipient_enc, :sig_recipient, :signature)\n end", "def initialize(secret, *_signature_key_or_options)\n @box = RbNaCl::SimpleBox.from_secret_key(secret)\n end", "def build_encrypter\n @encrypter = Crypt::AutoEncrypter.new(\n @options[:auto_encryption_options].merge(client: self)\n )\n end", "def build_cipher(args={})\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n args[:decrypt] ? cipher.decrypt : cipher.encrypt\n iv = args[:iv]\n until(iv.length > 65)\n iv = iv * 2\n end\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n args[:key], CRYPT_SALT, CRYPT_ITER, CRYPT_KEY_LENGTH\n )\n cipher.iv = iv\n cipher.key = key\n cipher\n end", "def initialize(key, secret)\n @encoder = Encoder.new(key, secret)\n # @debug = true\n end", "def sign_request\n # By default OpenSSL generates an all-zero array for the encriptation vector\n # You can read it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-iv-3D\n # If you want to declare it, you can take a look at the next couple of lines\n #bytes = Array.new(8,0)\n #iv = bytes.map(&:chr).join\n # We need to decode the secret key\n key = Base64.strict_decode64(credentials[:secret_key])\n # In thee cipher initialization we need to speficy the encryptation like method-length-mode (http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-c-new).\n # Sermepa needs DES3 in CBC mode\n # The direct way the declare it's: des-ede3-cbc\n # You can also declare like 'des3' wich use CBC mode by default\n des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')\n # OpenSSL use by default PKCS padding. But Sermepa (mcrypt_encrypt PHP function) use zero padding.\n # OpenSSL do not allow zero padding. So we need to disable the default padding and make zero padding by hand\n # Padding in cryptography is to fill the data with especial characteres in order to use the data in blocks of N (https://en.wikipedia.org/wiki/Padding_(cryptography))\n # We need to use blocks of 8 bytes\n block_length = 8\n # We tell OpenSSL not to pad\n des3.padding = 0\n # We want to encrypt\n des3.encrypt\n # Key set\n des3.key = key\n #des3.iv = iv\n order_number = @fields[\"Ds_Merchant_Order\"]\n # Here is the 'magic'. Instead use the default OpenSSL padding (PKCS). We fill with \\0 till the data have\n # a multiple of the block size (8, 16, 24...)\n order_number += \"\\0\" until order_number.bytesize % block_length == 0\n # For example: the string \"123456789\" will be transform in \"123456789\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n # data must be in blocks of 8 or the update will break\n key_des3 = des3.update(order_number) + des3.final\n # The next step is to encrypt in SHA256 the resulting des3 key with the base64 json\n result = OpenSSL::HMAC.digest('sha256', key_des3, merchant_parameters_base64_json)\n # The last step is to encode the data in base64\n Base64.strict_encode64(result)\n end", "def initialize(options={},&block)\n @mode = options.fetch(:mode,:encrypt).to_sym\n @block_size = options.fetch(:block_size,DEFAULT_BLOCK_SIZE).to_i\n @key_size = options.fetch(:key_size,DEFAULT_KEY_SIZE).to_i\n @iv = options.fetch(:iv,DEFAULT_IV).to_s\n @hash = options.fetch(:hash,DEFAULT_HASH).to_s.downcase\n @key = if options[:key]\n options[:key].to_s\n elsif (password = options[:password])\n begin\n Digest.const_get(@hash.upcase).hexdigest(password)\n rescue RuntimeError => e\n raise(InvalidHash,\"invalid hash name #{@hash.dump}\")\n end\n end\n\n yield self if block_given?\n end", "def initialize(opts = {})\n # Parses from encoded private key\n if opts.has_key?(:encoded)\n encoded = opts[:encoded]\n @asn1 = OpenSSL::ASN1.decode(encoded)\n @encrypted_data = @asn1.value[1].value\n @algorithm = @asn1.value[0].value[0].value\n @encoded = encoded\n else\n @algorithm = opts[:algorithm]\n @encrypted_data = opts[:encrypted_data]\n @encoded = encode(@algorithm, @encrypted_data)\n end\n end", "def initialize(enc_hash, secret)\n @enc_hash = enc_hash\n @secret = secret\n end", "def initialize\n @edit_distance = 3\n @cipher_spec = \"AES-256-CBC\"\n @padding_byte_size = 32\n end", "def consumer_secret\n config_method_not_implemented\n end", "def initialize(options = {})\n invalid_options = options.keys - [:private_key_file, :public_key_file, :algorithm, :password]\n raise ArgumentError, \"Unknown key(s): #{invalid_options.join(\", \")}\" unless invalid_options.empty?\n \n options = {\n :private_key_file => AsymmetricCipher.default_private_key_file,\n :public_key_file => AsymmetricCipher.default_public_key_file\n }.merge(options)\n \n @public_key = @private_key = nil\n \n self.private_key_file = options[:private_key_file]\n self.public_key_file = options[:public_key_file]\n raise ArgumentError, 'At least one key file must be specified (:private_key_file or :public_key_file)' unless private_key_file || public_key_file\n \n self.algorithm = options[:algorithm]\n self.password = options[:password]\n \n super()\n end", "def initialize(secret, **options)\n raise ArgumentError, \"Secret should not be nil.\" unless secret\n super(**options)\n @secret = secret\n @digest = options[:digest]&.to_s || \"SHA1\"\n end", "def encryptor_obj\n @e_obj ||= LocalCipher.new(GlobalConstant::SecretEncryptor.cache_data_sha_key)\n end", "def encryptor_obj\n @e_obj ||= LocalCipher.new(GlobalConstant::SecretEncryptor.cache_data_sha_key)\n end", "def encryption_client; end", "def static_key_ecb(message)\n unknown = \"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK\"\n udecoded = Base64.decode64(unknown)\n\n message_appended = message + udecoded\n message_appended = pkcs7_pad(message_appended, 16)\n\n cipher = encrypt_ecb(message_appended, STATIC_KEY)\nend", "def encrypted_private_key\n return private_key unless passphrase\n key_object.to_pem(OpenSSL::Cipher.new(\"AES-128-CBC\"), passphrase)\n end", "def encrypted_options\n encrypt(construct_encrypted_options())\n end", "def secret_keygen\n ('k' + Digest.hexencode(rand(9).to_s + self.message[0..2]) + self.id.to_s) \n end", "def initialize(context, offset = T.unsafe(nil), decrypter = T.unsafe(nil)); end", "def encrypt_message(message)\n aes = OpenSSL::Cipher.new(@cipher).encrypt\n aes.key = @encryption_key\n iv = aes.random_iv\n aes.iv = iv\n iv + (aes.update(message) << aes.final)\n end", "def maybe_encrypt(connection, context)\n # Do nothing if the Message subclass has not implemented this method\n self\n end", "def initialize(options = {})\n ::ActiveSupport.run_load_hooks(:crypt_keeper_mysql_aes_log, self)\n @key = digest_passphrase(options[:key], options[:salt])\n end", "def initialize(secret)\n @secret = secret\n end", "def initialize(client_id, client_secret, options = {})\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n\n options = {\n :self_key => 'WePay',\n :hash_algo => 'sha512',\n }.merge(options)\n\n @self_key = options[:self_key].to_s\n @hash_algo = options[:hash_algo].to_s\n end", "def signed_or_encrypted; end", "def initialize(options = {})\n options = options.symbolize_keys\n options.assert_valid_keys(\n :private_key_file,\n :public_key_file,\n :key,\n :algorithm\n )\n options.reverse_merge!(\n :private_key_file => @@default_private_key_file,\n :public_key_file => @@default_public_key_file,\n :algorithm => @@default_algorithm\n )\n \n @public_key = @private_key = nil\n @key = options[:key]\n @algorithm = options[:algorithm]\n \n self.private_key_file = options[:private_key_file]\n self.public_key_file = options[:public_key_file]\n \n super()\n end", "def encrypt_and_send_message(opts={})\n opts.merge!(:persistent => true)\n encrypted_message = encrypt_message(opts[:message], opts[:password])\n exchange.publish(encrypted_message,opts)\n end", "def secret_generate\n Secret.generate\n end", "def to_encrypted_string\n self.class.send(:encryptor).encrypt_and_sign to_hash\n end", "def secret_key; end", "def initialize(password, config = {})\n self.config = config\n @secret_key = @secret_iv = @clear_data = @encrypted_data = ''\n\n begin\n @public_key = OpenSSL::PKey::RSA.new(File.open(self.config[:public_key]))\n @private_key =\n OpenSSL::PKey::RSA.new(File.open(self.config[:private_key]), password)\n @keystore = Nachos::KeyStore.new\n\n keypair\n rescue Errno::ENOENT\n raise Nachos::EncryptorException, \"Public or private key missing! \" +\n \"(maybe both!)\"\n rescue Nachos::KeyStoreException => e\n raise\n rescue => e\n raise Nachos::EncryptorException, \"There was a problem loading or \" +\n \"decrypting the keypair and/or keystore! (#{e})\" \n end\n end", "def initialize(appid=nil, secret=nil, securityalgorithm=nil)\n self.appid = appid if appid\n self.secret = secret if secret\n self.securityalgorithm = securityalgorithm if securityalgorithm\n end", "def generate_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n {e_secret_key: r.data[:ciphertext_blob], d_secret_key: client_api_secret_d}\n end", "def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end", "def secret\n decrypt_secret\n end", "def secret\n decrypt_secret\n end", "def initialize(password, size=256, mode=\"cbc\")\n @password = password\n @size = size\n @mode = mode\n @cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{size}-#{mode}\")\n end", "def encryption_oracle(message)\n rand_key = SecureRandom.random_bytes(16)\n rand_iv = SecureRandom.random_bytes(16)\n front_bytes = SecureRandom.random_bytes(rand(5..10))\n end_bytes = SecureRandom.random_bytes(rand(5..10))\n\n padded_message = front_bytes + message + end_bytes\n\n (rand(1..2) == 1) ? encrypt_ecb(message, rand_key) : encrypt_cbc(message, rand_key, rand_iv)\nend", "def public_key_params\n params.require(:public_key).permit(:body, :algorithm)\n end", "def initialize secret, options = {}\n @secret = Base32.decode secret\n @digits = options[:digits] || DEFAULT_DIGITS\n @digest = 'sha1'\n @type = 'hotp'\n end", "def encryption_config\n @grpc.encryption_config\n end", "def initialize(options = {})\n requires!(options, :pem, :pem_password)\n @options = options\n super\n end", "def consumer_secret; config[:consumer_secret]; end", "def secret_key\n \"\"\n end", "def initialize( publish_key, subscribe_key, secret_key, cipher_key, ssl_on )\n @publish_key = publish_key\n @subscribe_key = subscribe_key\n @secret_key = secret_key\n @cipher_key = cipher_key\n @ssl = ssl_on\n @origin = 'pubsub.pubnub.com'\n\n if @ssl\n @origin = 'https://' + @origin\n else\n @origin = 'http://' + @origin\n end\n end", "def sign_and_encrypt_encapsulated(message)\n sign(message)\n encrypt(message)\n end", "def new_cipher(direction, passwd, options = {})\n check_platform_can_encrypt!\n cipher = OpenSSL::Cipher::Cipher.new(CIPHER_TYPE)\n case direction\n when :encrypt\n cipher.encrypt\n when :decrypt\n cipher.decrypt\n else\n raise \"Bad cipher direction #{direction}\"\n end\n cipher.key = encrypt_key(passwd, options)\n cipher\n end", "def to_secret_uri\n \"secret.key:///#{@cipher.algorithm};#{Cryptor::Encoding.encode(@secret_key)}\"\n end", "def initialize(opts = {})\n @options = opts.reduce({}) do |opts_array, (k, v)|\n unless v.nil?\n opts_array[k.to_s.gsub(/_/, '.')] = v\n end\n opts_array\n end\n if options['broker.list']\n options['metadata.broker.list'] = options.delete 'broker.list'\n end\n if options['metadata.broker.list'].is_a? Array\n options['metadata.broker.list'] = options['metadata.broker.list'].join(',')\n end\n if options['compressed.topics'].is_a? Array\n options['compressed.topics'] = options['compressed.topics'].join(',')\n end\n validate_arguments\n @send_method = proc { throw StandardError.new 'Producer is not connected' }\n end", "def encrypt_ecb_nofinal(msg, key)\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.encrypt\n cipher.key = key\n return cipher.update(msg)\nend", "def initialize(opts = {})\n raise InvalidOption, :shared_secret unless opts[:shared_secret]\n self.shared_secret = opts[:shared_secret]\n self.issuer = opts[:issuer]\n self.audience = opts[:audience]\n self.expiration = (opts[:expiration] or 3600)\n end", "def secret(new_secret = nil)\n if !new_secret\n @secret\n else\n @secret = new_secret\n @encrypt = true if @encrypt.nil?\n end\n end", "def get_cipher\n OpenSSL::Cipher::Cipher.new('AES-256-CBC')\n end", "def initialize(opts = {})\n raise InvalidOption, :shared_secret unless opts[:shared_secret]\n self.shared_secret = opts[:shared_secret]\n self.trusted_issuers = opts[:trusted_issuers]\n self.audiences = opts[:audiences]\n end", "def algorithm\n secret ? (@algorithm || ALGORITHM_HMAC_HS256) : 'none'\n end", "def receive_and_decrypt_message(opts={})\n msg = pop(opts)\n unless msg.nil?\n decrypted_message = decrypt_message(msg, opts[:password])\n decrypted_message\n end\n decrypted_message || msg\n end", "def inspect\n \"#<Fernet::Verifier @secret=[masked] @token=#{@token} @message=#{@message.inspect} @ttl=#{@ttl} @enforce_ttl=#{@enforce_ttl}>\"\n end", "def encrypt(secret, fields = [:amount, :currency, :account, :order])\n signature_fields = fields.collect{ |field| mappings[field] }\n add_field('signatureFields', signature_fields.join(':'))\n\n field_values = fields.collect{ |field| form_fields[mappings[field]] }\n signature = \"#{secret}:#{field_values.join(':')}\"\n add_field('signature', Digest::MD5.hexdigest(signature))\n end", "def key_pem; end", "def signature(params)\n self.class._hmac(secret, params) if secret.to_s.length > 0\n end", "def encrypt(msg, rng: Botan::RNG.new)\n msg_buf = FFI::MemoryPointer.from_data(msg)\n Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_pk_op_encrypt(@ptr, rng.ptr, b, bl,\n msg_buf, msg_buf.size)\n })\n end", "def initialize secret, options = {}\n super\n @interval = options[:interval] || DEFAULT_INTERVAL\n @digest = options[:digest] || DEFAULT_DIGEST\n @type = 'totp'\n end", "def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end", "def encrypt(secret, fields = [:amount, :currency, :account, :order])\n signature_fields = fields.collect{ |field| mappings[field] }\n add_field('signatureFields', signature_fields.join(':'))\n\n field_values = fields.collect{ |field| form_fields[mappings[field]] }\n signature = \"#{secret}:#{field_values.join(':')}\" \n add_field('signature', Digest::MD5.hexdigest(signature))\n end", "def decrypt(encrypted, secret, signing_secret)\n check_secret(secret)\n check_signing_secret(signing_secret)\n\n secret = secret[0..31] if secret.bytesize > 32\n aes128_gcm_decrypt(encrypted, secret, signing_secret)\n end", "def encrypt(object)\n result = ''\n if cipher.respond_to?(:iv=) and @iv == nil\n iv = OpenSSL::Random.random_bytes(cipher.iv_len)\n cipher.iv = iv\n result << Ripple::Contrib::VERSION << iv\n end\n\n if cipher.respond_to?(:public_encrypt)\n result << cipher.public_encrypt(object)\n else\n cipher_setup :encrypt\n result << cipher.update(object) << cipher.final\n cipher.reset\n end\n return serialize_base64(result)\n end", "def encrypt_hash(hash)\n encryptor = ActiveSupport::MessageEncryptor.new($encryption_key)\n encryptor.encrypt_and_sign(hash.to_json)\nend", "def encryption_server; end", "def initialize(key,secret,options={}, base_url = DEFAULT_BASE_URL)\n consumer_key = key\n consumer_secret = secret\n\n consumer_key.empty? and raise ArgumentError, \"Toopher consumer key cannot be empty!\"\n consumer_secret.empty? and raise ArgumentError, \"Toopher consumer secret cannot be empty!\"\n\n @base_url = base_url\n @oauth_consumer = OAuth::Consumer.new(consumer_key, consumer_secret)\n @oauth_options = options\n end", "def encrypt(msg, key)\n Rails.logger.debug \"AesEncryptDecrypt::encrypt::BEGIN\"\n begin\n cipher = OpenSSL::Cipher.new(ALGORITHM)\n cipher.encrypt()\n cipher.padding = 1\n cipher.key = key\n crypt = cipher.update(msg) + cipher.final\n return (Base64.encode64(crypt))\n rescue Exception => exc\n Rails.logger.error (\"Error when encrypting message #{msg} is #{exc.message}\")\n raise exc\n end\n end", "def encrypt; end", "def encrypt_secret\n return if @secret.to_s.empty?\n self.crypted_secret = Password.create(@secret)\n end", "def cipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.encrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def verifier\n ActiveSupport::MessageVerifier.new(ENV['SECRET_KEY_BASE'], digest: 'SHA512')\n end", "def initialize(token, secret)\n @token, @secret = token, secret\n end", "def initialize( application, options = {} )\n\n @application = application\n @options = options\n @cipher = OpenSSL::Cipher.new( DataCipher )\n @iv_cipher = OpenSSL::Cipher.new( InitializationVectorCipher )\n @digest = OpenSSL::Digest::Digest.new( DigestType )\n @session_stack = [ ]\n\n end", "def initialize(algo:, public_key:, private_key:)\n @algo = algo\n @public_key = public_key\n @private_key = private_key\n end", "def encrypt_message plaintext\n key_pair.encrypt plaintext\n end", "def asymmetric_options\n if user_recipients.empty?\n Logger.warn \"No recipients available for asymmetric encryption.\"\n nil\n else\n # skip trust database checks\n \"-e --trust-model always \" +\n user_recipients.map { |r| \"-r '#{r}'\" }.join(\" \")\n end\n end", "def sign(msg)\n Digest::SHA1.hexdigest(@secret + msg)\n end", "def initialize_with_sign_and_crypt(method_name, *parameters)\n default_settings = {\n sign: false,\n crypt: false,\n p12: nil,\n crypt_cert: nil,\n crypt_cipher: :des,\n crypt_method: :smime,\n passphrase: nil,\n ca_cert: nil\n }\n\n initialize_without_sign_and_crypt(method_name, *parameters)\n mail = @_message\n\n @x509_settings = default_settings.merge @x509_settings\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_settings[:crypt_method]} method.\")\n end\n send(\"x509_#{@x509_settings[:crypt_method]}\", mail)\n end\n end", "def new_cipher(direction, password, salt)\n cipher = OpenSSL::Cipher::Cipher.new(CIPHER_TYPE)\n direction == :encrypt ? cipher.encrypt : cipher.decrypt\n cipher.key = encrypt_key(password, salt)\n cipher\n end" ]
[ "0.76652634", "0.62599945", "0.61852354", "0.6174547", "0.60118634", "0.5985314", "0.5906838", "0.5849017", "0.5724652", "0.54843014", "0.5484181", "0.548224", "0.5430207", "0.5414475", "0.5410282", "0.5389058", "0.53805494", "0.5374937", "0.537212", "0.5371237", "0.53517276", "0.5338298", "0.53207296", "0.5307714", "0.5296949", "0.5290639", "0.5284186", "0.52734566", "0.5270923", "0.5260513", "0.5260513", "0.52525187", "0.5215166", "0.5199193", "0.519509", "0.5193989", "0.510693", "0.50960803", "0.5050186", "0.50500786", "0.503486", "0.50280577", "0.5023828", "0.5001251", "0.50008786", "0.49972096", "0.49845448", "0.49842563", "0.49801528", "0.49713093", "0.49650398", "0.49631965", "0.4962993", "0.4962993", "0.49479175", "0.49414706", "0.49340227", "0.49315077", "0.49282524", "0.4925041", "0.4922006", "0.49181378", "0.49132335", "0.49031627", "0.4894038", "0.48897308", "0.48822024", "0.48776898", "0.48767778", "0.48668453", "0.48556104", "0.48490652", "0.48326796", "0.4829444", "0.48251832", "0.4824861", "0.48234376", "0.48222417", "0.48208323", "0.48175263", "0.48098946", "0.48089424", "0.48084062", "0.48022684", "0.47905228", "0.478651", "0.47783598", "0.47756767", "0.47753453", "0.47731477", "0.4772088", "0.47669828", "0.47666055", "0.47514772", "0.47496095", "0.4747998", "0.4722177", "0.47199386", "0.47105223", "0.47102916" ]
0.6988171
1
Encrypt and sign a message. We need to sign the message in order to avoid padding attacks. Reference: ==== Options [+:expires_at+] The datetime at which the message expires. After this datetime, verification of the message will fail. message = encryptor.encrypt_and_sign("hello", expires_at: Time.now.tomorrow) encryptor.decrypt_and_verify(message) => "hello" 24 hours later... encryptor.decrypt_and_verify(message) => nil [+:expires_in+] The duration for which the message is valid. After this duration has elapsed, verification of the message will fail. message = encryptor.encrypt_and_sign("hello", expires_in: 24.hours) encryptor.decrypt_and_verify(message) => "hello" 24 hours later... encryptor.decrypt_and_verify(message) => nil [+:purpose+] The purpose of the message. If specified, the same purpose must be specified when verifying the message; otherwise, verification will fail. (See decrypt_and_verify.)
def encrypt_and_sign(value, **options) create_message(value, **options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_and_encrypt_encapsulated(message)\n sign(message)\n encrypt(message)\n end", "def encrypt(data, expires_at: nil, expires_in: nil, purpose: nil)\n return nil unless data\n\n service.encrypt_and_sign(\n data,\n expires_at: expires_at,\n expires_in: expires_in,\n purpose: purpose\n )\n end", "def sign(message); end", "def sign_then_encrypt(bytes, private_key, *public_keys)\n bytes = Validation.check_filled_array_argument!(bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n cipher = Core::VirgilCipher.new\n custom_bytes = cipher.custom_params\n custom_bytes.set_data(\n CUSTOM_PARAM_KEY_SIGNATURE,\n generate_signature(bytes, private_key)\n )\n\n public_key = extract_public_key(private_key)\n custom_bytes.set_data(\n CUSTOM_PARAM_KEY_SIGNER_ID,\n wrap_bytes(public_key.id)\n )\n encrypt_for_recipients(bytes, cipher, public_keys)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def sign_request\n # By default OpenSSL generates an all-zero array for the encriptation vector\n # You can read it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-iv-3D\n # If you want to declare it, you can take a look at the next couple of lines\n #bytes = Array.new(8,0)\n #iv = bytes.map(&:chr).join\n # We need to decode the secret key\n key = Base64.strict_decode64(credentials[:secret_key])\n # In thee cipher initialization we need to speficy the encryptation like method-length-mode (http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-c-new).\n # Sermepa needs DES3 in CBC mode\n # The direct way the declare it's: des-ede3-cbc\n # You can also declare like 'des3' wich use CBC mode by default\n des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')\n # OpenSSL use by default PKCS padding. But Sermepa (mcrypt_encrypt PHP function) use zero padding.\n # OpenSSL do not allow zero padding. So we need to disable the default padding and make zero padding by hand\n # Padding in cryptography is to fill the data with especial characteres in order to use the data in blocks of N (https://en.wikipedia.org/wiki/Padding_(cryptography))\n # We need to use blocks of 8 bytes\n block_length = 8\n # We tell OpenSSL not to pad\n des3.padding = 0\n # We want to encrypt\n des3.encrypt\n # Key set\n des3.key = key\n #des3.iv = iv\n order_number = @fields[\"Ds_Merchant_Order\"]\n # Here is the 'magic'. Instead use the default OpenSSL padding (PKCS). We fill with \\0 till the data have\n # a multiple of the block size (8, 16, 24...)\n order_number += \"\\0\" until order_number.bytesize % block_length == 0\n # For example: the string \"123456789\" will be transform in \"123456789\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n # data must be in blocks of 8 or the update will break\n key_des3 = des3.update(order_number) + des3.final\n # The next step is to encrypt in SHA256 the resulting des3 key with the base64 json\n result = OpenSSL::HMAC.digest('sha256', key_des3, merchant_parameters_base64_json)\n # The last step is to encode the data in base64\n Base64.strict_encode64(result)\n end", "def encrypt(plaintext, options = {})\n # TODO\n end", "def sign(msg)\n Digest::SHA1.hexdigest(@secret + msg)\n end", "def sign(key, string)\n SSL.new(nil, key).sign(string, true)\n end", "def sign(params)\n string = params_to_string(params)\n\n case @sign_type\n when 'RSA'\n ::Alipay::Sign::RSA.sign(@app_private_key, string)\n when 'RSA2'\n ::Alipay::Sign::RSA2.sign(@app_private_key, string)\n else\n raise \"Unsupported sign_type: #{@sign_type}\"\n end\n end", "def signed_or_encrypted; end", "def sign(data)\n @key.sign(@algo.new, data)\n end", "def encrypt_token *args\n raw = [\"Ra\", ThreeScale::SSO::VERSION, \"%10.5f\" % Time.now.utc, @expires_at, \"zZ\"]\n raw.insert 3, *args\n @me.encrypt_and_sign raw.join(ThreeScale::SSO::SEPARATOR)\n end", "def sign(message)\n OpenSSL::HMAC.digest('SHA256', @key, message)\n end", "def encrypt(value)\n encryptor.encrypt_and_sign(value)\n end", "def sign_and_encrypt_combined(message)\n source_part = body_to_part(message)\n restrict_encoding(source_part)\n signer = find_signer_for(message)\n recipients = find_recipients_for(message)\n encrypted =\n sign_and_encrypt_string(source_part.encoded, signer, recipients).to_s\n encrypted_part = build_encrypted_part(encrypted)\n control_part = build_encryption_control_part\n\n rewrite_body(\n message,\n content_type: multipart_encrypted_content_type,\n parts: [control_part, encrypted_part],\n )\n end", "def initialize_with_sign_and_crypt(method_name, *parameters)\n default_settings = {\n sign: false,\n crypt: false,\n p12: nil,\n crypt_cert: nil,\n crypt_cipher: :des,\n crypt_method: :smime,\n passphrase: nil,\n ca_cert: nil\n }\n\n initialize_without_sign_and_crypt(method_name, *parameters)\n mail = @_message\n\n @x509_settings = default_settings.merge @x509_settings\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_settings[:crypt_method]} method.\")\n end\n send(\"x509_#{@x509_settings[:crypt_method]}\", mail)\n end\n end", "def sign(string)\n @key.sign OpenSSL::Digest::SHA256.new, string\n end", "def encrypt_and_send_message(opts={})\n opts.merge!(:persistent => true)\n encrypted_message = encrypt_message(opts[:message], opts[:password])\n exchange.publish(encrypted_message,opts)\n end", "def sign(params, shared_secret = nil)\n shared_secret ||= params.delete['sharedSecret']\n raise ArgumentError, \"Cannot verify a signature without a shared secret\" unless shared_secret\n sig = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), Array(shared_secret).pack(\"H*\"), string_to_sign(params))\n params.merge('merchantSig' => Base64.encode64(sig).strip)\n end", "def encode(data)\n @encryptor.encrypt_and_sign(data)\n end", "def sign(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to sign data with.\") unless key\n options = settings[:sign].merge(options)\n digest = OpenSSL::Digest.new(options[:algorithm])\n signature = OpenSSL::HMAC.digest(digest, key, data)\n encode(signature, options)\n end", "def encrypt(msg, rng: Botan::RNG.new)\n msg_buf = FFI::MemoryPointer.from_data(msg)\n Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_pk_op_encrypt(@ptr, rng.ptr, b, bl,\n msg_buf, msg_buf.size)\n })\n end", "def encrypt_message plaintext\n key_pair.encrypt plaintext\n end", "def sign(message)\n Ed25519.provider.sign(@keypair, message)\n end", "def encrypt(key, message)\n key.public_key? or raise \"Must have public key to encrypt\"\n @cipher.reset\n\n ephemeral_key = OpenSSL::PKey::EC.generate(key.group)\n ephemeral_public_key_octet = ephemeral_key.public_key.to_octet_string(:compressed)\n\n shared_secret = ephemeral_key.dh_compute_key(key.public_key)\n\n key_pair = kdf(shared_secret, @cipher.key_len + @mac_length, ephemeral_public_key_octet)\n cipher_key = key_pair.byteslice(0, @cipher.key_len)\n hmac_key = key_pair.byteslice(-@mac_length, @mac_length)\n\n @cipher.encrypt\n @cipher.iv = IV\n @cipher.key = cipher_key\n ciphertext = @cipher.update(message) + @cipher.final\n\n mac = OpenSSL::HMAC.digest(@mac_digest, hmac_key, ciphertext + @mac_shared_info).byteslice(0, @mac_length)\n\n ephemeral_public_key_octet + ciphertext + mac\n end", "def encrypt(message)\n xcrypt(:encrypt, message)\n end", "def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end", "def sign!(request,options = {})\n consumer.sign!(request,self,options)\n end", "def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end", "def encrypt(plaintext, passwd, options = {})\n cipher = new_cipher(:encrypt, passwd, options)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plaintext)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_and_ciphertext(iv, ciphertext))\n end", "def encrypt(plaintext)\n begin\n ciphertext_blob = client.encrypt_and_sign(plaintext)\n\n success_with_data(\n ciphertext_blob: ciphertext_blob\n )\n rescue Exception => e\n error_with_data('lc_1',\n \"LocalCipher could not encrypt text with message => #{e.message}\",\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {})\n end\n end", "def sign(secret_key_base, salt, data, options = {})\n encoded = encode(data, options)\n key = get_secret(secret_key_base, salt, options)\n MessageVerifier.sign(encoded, key)\n end", "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, NaCl::SIGNATUREBYTES, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "def initialize_with_sign_and_crypt(method_name, *parameters)\n mail = initialize_without_sign_and_crypt(method_name, *parameters)\n\n x509_initvar()\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_sign_and_crypt_method} method.\")\n end\n __send__(\"x509_#{@x509_sign_and_crypt_method}\", mail)\n end\n\n end", "def initialize_with_sign_and_crypt(method_name, *parameters)\n mail = initialize_without_sign_and_crypt(method_name, *parameters)\n\n x509_initvar()\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_sign_and_crypt_method} method.\")\n end\n __send__(\"x509_#{@x509_sign_and_crypt_method}\", mail)\n end\n\n end", "def sign_key; end", "def sign_and_encode(text_to_sign, base64_encode=true)\n return nil if text_to_sign.nil? || text_to_sign.empty?\n sig = @key.sign(OpenSSL::Digest::SHA256.new, text_to_sign)\n base64_encode ? Base64UrlSafe.encode(sig) : sig\n end", "def sign!(key, sign_nonce = T.unsafe(nil)); end", "def encrypt_and_sign(value)\n Base64.urlsafe_encode64(@box.encrypt(::JSON.dump(value)))\n end", "def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end", "def sign()\n # TODO\n end", "def sign(data, padding: nil, rng: Botan::RNG.new)\n sign = Botan::PK::Sign.new(key: self, padding: padding)\n sign << data\n sign.finish(rng)\n end", "def encrypt(msg, key)\n Rails.logger.debug \"AesEncryptDecrypt::encrypt::BEGIN\"\n begin\n cipher = OpenSSL::Cipher.new(ALGORITHM)\n cipher.encrypt()\n cipher.padding = 1\n cipher.key = key\n crypt = cipher.update(msg) + cipher.final\n return (Base64.encode64(crypt))\n rescue Exception => exc\n Rails.logger.error (\"Error when encrypting message #{msg} is #{exc.message}\")\n raise exc\n end\n end", "def sign(str)\n @signer.sign(str) unless str.nil? || str.empty?\n end", "def sign(message, encoding = :raw)\n buffer = Util.prepend_zeros(NaCl::SIGNATUREBYTES, message)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign(buffer, buffer_len, message, message.bytesize, @signing_key)\n\n signature = buffer[0, NaCl::SIGNATUREBYTES]\n Encoder[encoding].encode(signature)\n end", "def sign(message, foreign_keys)\n raise ArgumentError \"Foreign keys must all have the same hasher\" unless foreign_keys.all?{ |e| e.hasher == hasher }\n\n message_digest = hasher.hash_string(message)\n seed = hasher.hash_array([value, message_digest])\n\n all_keys = hasher.shuffle([self] + foreign_keys, seed)\n\n q_array, w_array = generate_q_w(all_keys, seed)\n ll_array, rr_array = generate_ll_rr(all_keys, q_array, w_array)\n challenge = hasher.hash_array([message_digest] + ll_array + rr_array)\n c_array, r_array = generate_c_r(all_keys, q_array, w_array, challenge)\n\n public_keys = all_keys.map(&:public_key)\n signature = Signature.new(key_image, c_array, r_array, hasher)\n\n [signature, public_keys]\n end", "def encrypt_message(message)\n aes = OpenSSL::Cipher.new(@cipher).encrypt\n aes.key = @encryption_key\n iv = aes.random_iv\n aes.iv = iv\n iv + (aes.update(message) << aes.final)\n end", "def sign!(request, options = {})\n consumer.sign!(request, self, options)\n end", "def encrypt(message)\n # encrypt the message\n encrypted = encrypt_message(message)\n\n [authenticate_message(encrypted) + encrypted].pack('m0')\n end", "def seal(plaintext, associated_data = [])\n raise TypeError, \"expected String, got #{plaintext.class}\" unless plaintext.is_a?(String)\n\n v = _s2v(associated_data, plaintext)\n ciphertext = @ctr.encrypt(_zero_iv_bits(v), plaintext)\n v + ciphertext\n end", "def sign\n write_attr('mid', SecureRandom.uuid)\n write_attr('ts', Time.now.utc.to_i)\n canonical_msg = self.canonicalize\n\n #priv_key = OmfCommon::Key.instance.private_key\n #digest = OpenSSL::Digest::SHA512.new(canonical_msg)\n\n #signature = Base64.encode64(priv_key.sign(digest, canonical_msg)).encode('utf-8') if priv_key\n #write_attr('digest', digest)\n #write_attr('signature', signature) if signature\n\n if OmfCommon::Measure.enabled?\n MPMessage.inject(Time.now.to_f, operation.to_s, mid, cid, self.to_s.gsub(\"\\n\",''))\n @@mid_list << mid\n end\n self\n end", "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, signature_bytes, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_ed25519_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "def sign(message, private_key)\n msg_point = BLS.norm_p2h(message)\n msg_point * BLS.normalize_priv_key(private_key)\n end", "def verify(*args, **options)\n verified(*args, **options) || raise(InvalidSignature)\n end", "def sign( identity, data )\n info = find_identity( identity )\n\n if info[:key].nil? && info[:from] == :file\n begin\n info[:key] = @keys.load_private_key( info[:file] )\n rescue Exception => e \n raise UserKeyManagerError,\n \"the given identity is known, \" +\n \"but the private key could not be loaded \" +\n \"(#{e.message} [#{e.class}])\"\n end\n end\n\n if info[:key]\n sig_blob = @buffers.writer\n sig_blob.write_string identity.ssh_type\n sig_blob.write_string info[:key].ssh_do_sign( data.to_s )\n return sig_blob.to_s\n end\n\n if info[:from] == :agent\n raise UserKeyManagerError,\n \"the agent is no longer available\" unless @agent\n return @agent.sign( identity, data.to_s )\n end\n\n raise UserKeyManagerError,\n \"[BUG] can't determine identity origin (#{info.inspect})\"\n end", "def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end", "def handle_signing(jwt, key=nil)\n if jwt.alg =~ /none/i\n jwt.to_s\n else\n raise JSON::JWS::UnexpectedAlgorithm.new(\"Encryption algorithm '#{jwt.alg}' requires key.\") if key.nil?\n alg = jwt.alg.upcase\n case\n when alg.start_with?(\"HS\")\n key\n when alg.start_with?(\"RS\")\n key = OpenSSL::PKey::RSA.new(key)\n when alg.start_with?(\"PS\")\n key = OpenSSL::PKey::RSA.new(key)\n when alg.start_with?(\"ES\")\n # key = OpenSSL::PKey::RSA.new(key)\n print_error(\"Signing for ECDSA-SHA is not yet implemented\")\n print_warning 'Please report the issue to: https://github.com/KINGSABRI/jwtear/issues'.underline\n else\n print_warning(\"Undefined algorithm. This might generate a wrong token\")\n print_warning 'Please report the issue to: https://github.com/KINGSABRI/jwtear/issues'.underline\n key\n end\n jwt.alg = alg.to_sym\n jwt.sign(key).to_s\n end\n end", "def sign; adapter_class.new(self).sign; end", "def encrypt_ecb_nofinal(msg, key)\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.encrypt\n cipher.key = key\n return cipher.update(msg)\nend", "def verify(signed_message, message, signing_key = admin_key)\n msg_int = rsa.text_to_int(message)\n rsa.verify(signed: signed_message, message: msg_int, key: signing_key)\n end", "def encrypt; end", "def sign(string, base64=false)\n sig = @private_key.sign(OpenSSL::Digest.new(\"SHA1\"), string)\n\n base64 ? base64_encode(sig) : sig\n end", "def sign(payload)\n payload = payload.merge({\n :client_id => @client_id,\n :client_secret => @client_secret,\n })\n\n scope = create_scope\n context = create_context(payload)\n s2s = create_string_to_sign(scope, context)\n signing_key = get_signing_salt\n OpenSSL::HMAC.hexdigest(@hash_algo, signing_key, s2s)\n end", "def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\t\treturn nil unless sb1 == sb2\n \t\t\t\t\tcmd\n \t\t\t\trescue NoMethodError\n \t\t\t\t\tputs \"verify exception: #{msg}\"\n \t\t\t\tend\n \t\t\tend", "def sign\n fail NotImplementedError\n end", "def aws_sign(key, data)\n OpenSSL::HMAC.digest(\"SHA256\", key, data)\n end", "def sign(cmd)\n \t\t\t\tiv = rand(0xffffffff).to_i.to_s(16).upcase.rjust(8,\"0\")\n \t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\tsb = [@signature_block + digest].pack(\"h*\")\n \t\t\t\tsig = @signingkey_priv.private_encrypt(sb).unpack(\"h*\")[0].upcase\n \t\t\t\t# i haven't a clue what those numbers are on the front, 10|3|22\n \t\t\t\t\"10|3|22|#{cmd}|#{sig}|#{iv}\"\n \t\t\tend", "def sign\n begin\n data64 = params[:data]\n data = Base64.decode64(data64)\n crypto = GPGME::Crypto.new(password: ENV[\"PASSPHRASE\"].to_s)\n signature = crypto.sign(data, signer: ENV[\"EMAIL\"].to_s, mode: GPGME::SIG_MODE_DETACH)\n render json: {\"email\": ENV[\"EMAIL\"].to_s,\n \"signature\": Base64.strict_encode64(signature.to_s)}, \n status: 200\n\n rescue => error\n render json: {\"error\": error.message},\n status: 500\n end\n end", "def sign!(ha)\n ha[:sig] = compute_checksum(ha)\n end", "def encrypt(header, payload)\n key = get_encryption_key\n mac_key, enc_key = derive_keys(key)\n encrypted_key = @alg.encrypt_key(key)\n\n cipher = OpenSSL::Cipher.new(@cipher_name).encrypt\n cipher.key = enc_key\n cipher.iv = iv = SecureRandom.random_bytes(16)\n ciphertext = cipher.update(payload) + cipher.final\n\n auth_data = Sandal::Util.jwt_base64_encode(header)\n auth_data_length = [auth_data.length * 8].pack(\"Q>\")\n mac_input = [auth_data, iv, ciphertext, auth_data_length].join\n mac = OpenSSL::HMAC.digest(@digest, mac_key, mac_input)\n auth_tag = mac[0...(mac.length / 2)]\n\n remainder = [encrypted_key, iv, ciphertext, auth_tag].map { |part| Sandal::Util.jwt_base64_encode(part) }\n [auth_data, *remainder].join(\".\")\n end", "def generate_signature\n sha1x16 = Digest::SHA1.hexdigest(signed_string)\n .tap { |s| logger.debug \"sha1x16 #{s}\" }\n enc = case form_fields['signMethod']\n when '01' # 01 means RSA\n merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)\n .tap { |s| logger.debug \"enc #{s}\" }\n else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs\n raise \"sign method #{form_fields['signMethod']} is not implemented yet.\"\n end\n Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\\n'\n .tap { |s| logger.debug \"final: #{s}\" }\n end", "def encrypt(msg)\n msg = Bytes.new(msg) unless msg.is_a?(Bytes)\n\n # Capture the IV for this message.\n iv = @state\n\n # Setup OpenSSL cipher mode.\n @cipher.encrypt\n @cipher.padding = 0\n @cipher.key = @key.ascii\n\n # Encrypt message block by block.\n ctext = []\n (0..msg.length/BLOCK_SZ).each do |block_i|\n block = msg.slice(block_i*BLOCK_SZ, BLOCK_SZ)\n block = Crypto.pkcs7_padding(block) unless block.length == BLOCK_SZ\n\n block ^= @state\n enc = Bytes.new(@cipher.update(block.ascii) + @cipher.final)\n ctext << enc\n\n @state = enc\n end\n\n [iv, ctext.reduce(:concat)]\n end", "def sign_request(options)\n options.merge!(:pub => @api_key)\n options.merge!(:key => Digest::MD5.hexdigest(@api_secret + @api_key))\n end", "def sign(message, privkey)\n group = ECDSA::Group::Secp256k1\n digest = Digest::SHA256.digest(message)\n signature = nil\n while signature.nil?\n temp_key = 1 + SecureRandom.random_number(group.order - 1)\n signature = ECDSA.sign(group, privkey.to_i(16), digest, temp_key)\n return ECDSA::Format::SignatureDerString.encode(signature).unpack(\"H*\").first\n end\n end", "def x509_smime(mail)\n if logger\n logger.debug(\"actionmailer_x509: X509 SMIME signing with p12 #{@x509_settings[:p12]}\") if should_sign?\n logger.debug(\"actionmailer_x509: X509 SMIME crypt with cert #{@x509_settings[:crypt_cert]}\") if should_crypt?\n end\n\n # We should set content_id, otherwise Mail will set content_id after signing and will broke sign\n mail.content_id ||= nil\n mail.parts.each {|p| p.content_id ||= nil}\n\n if @x509_settings[:ca_cert]\n ca_cert = OpenSSL::X509::Certificate.new( File::read(@x509_settings[:ca_cert]) )\n end\n\n # We load certificate and private key\n if @x509_settings[:sign]\n if @x509_settings[:p12]\n sign_p12 = OpenSSL::PKCS12.new(File.read(@x509_settings[:p12]), @x509_settings[:passphrase])\n\n sign_cert = sign_p12.certificate\n sign_prv_key = sign_p12.key\n elsif @x509_settings[:sign_cert] && @x509_settings[:sign_key]\n sign_cert = OpenSSL::X509::Certificate.new( File::read(@x509_settings[:sign_cert]) )\n sign_prv_key = OpenSSL::PKey::RSA.new( File::read(@x509_settings[:sign_key]), @x509_settings[:passphrase])\n else\n logger.info \"X509 signing required, but no certificate and key files configured\"\n end\n end\n\n if should_crypt?\n crypt_cert = OpenSSL::X509::Certificate.new( File::read(@x509_settings[:crypt_cert]) )\n cipher = OpenSSL::Cipher.new(@x509_settings[:crypt_cipher])\n end\n\n # Sign and crypt the mail\n # NOTE: the one following line is the slowest part of this code, signing is sloooow\n p7 = mail.encoded\n p7 = OpenSSL::PKCS7.sign(sign_cert, sign_prv_key, p7, [ca_cert || nil], OpenSSL::PKCS7::DETACHED) if sign_cert && sign_prv_key\n p7 = OpenSSL::PKCS7.encrypt([crypt_cert], (should_sign? ? OpenSSL::PKCS7::write_smime(p7) : p7), cipher, nil) if should_crypt?\n smime0 = OpenSSL::PKCS7::write_smime(p7)\n\n # Adding the signature part to the older mail\n newm = Mail.new(smime0)\n\n # We need to overwrite the content-type of the mail so MUA notices this is a signed mail\n newm.delivery_method(mail.delivery_method.class, mail.delivery_method.settings)\n newm.subject = mail.subject\n newm.to = mail.to\n newm.cc = mail.cc\n newm.from = mail.from\n newm.mime_version = mail.mime_version\n newm.date = mail.date\n @_message = newm\n end", "def sign(signed_data, algo: nil)\n algo ||= self.algo\n raise AlgorithmError unless algo == self.algo\n openssl_sig = openssl.sign(public_key.digest.new, signed_data)\n raw_sig = PublicKey::ECDSA.ssh_signature(openssl_sig)\n Encoding.encode_signature(algo, raw_sig)\n end", "def sign!(options = {})\n binary_security_token_node if options[:security_token]\n x509_data_node if options[:issuer_serial]\n\n if options[:inclusive_namespaces]\n c14n_method_node = signed_info_node.at_xpath('ds:CanonicalizationMethod', ds: 'http://www.w3.org/2000/09/xmldsig#')\n inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)\n inclusive_namespaces_node.add_namespace_definition('ec', c14n_method_node['Algorithm'])\n inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')\n c14n_method_node.add_child(inclusive_namespaces_node)\n end\n\n signed_info_canon = canonicalize(signed_info_node, options[:inclusive_namespaces])\n\n signature = private_key.sign(@sign_digester.digester, signed_info_canon)\n signature_value_digest = Base64.encode64(signature).delete(\"\\n\")\n\n signature_value_node = Nokogiri::XML::Node.new('SignatureValue', document)\n signature_value_node.content = signature_value_digest\n signed_info_node.add_next_sibling(signature_value_node)\n self\n end", "def encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend", "def get_secure_signature(message)\n digest = OpenSSL::Digest.new('SHA256')\n Base64.strict_encode64(private_key.sign(digest, message))\n end", "def sign secret, string_to_sign, digest_method = 'sha256'\n Base64.encode64(hmac(secret, string_to_sign, digest_method)).strip\n end", "def sign(data)\n key.dsa_sign_asn1(data)\n end", "def initialize(secret, *signature_key_or_options)\n options = signature_key_or_options.extract_options!\n sign_secret = signature_key_or_options.first\n @secret = secret\n @sign_secret = sign_secret\n @cipher = options[:cipher] || 'aes-256-cbc'\n @verifier = MessageVerifier.new(@sign_secret || @secret, :serializer => NullSerializer)\n @serializer = options[:serializer] || Marshal\nend", "def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Tenpay.generate_signature(@params, @key) #.tap{|sig| puts \"Generated sig #{sig}\"}\n end", "def sign(data)\n if rsa?\n @priv.sign(OpenSSL::Digest::SHA1.new,data)\n elsif dsa?\n # DSS1 was dropped from OpenSSL in version 1.1\n # @priv.sign(OpenSSL::Digest::DSS1.new,data)\n raise StandardError, 'DSA is not supported'\n end\n end", "def x509_smime(mail)\n if logger\n logger.debug(\"actionmailer_x509: X509 SMIME signing with cert #{@x509_cert} and key #{@x509_key}\") if should_sign?\n logger.debug(\"actionmailer_x509: X509 SMIME crypt with cert #{@x509_cert}\") if should_crypt?\n end\n\n # We should set content_id, otherwise Mail will set content_id after signing and will broke sign\n mail.content_id ||= nil\n mail.parts.each {|p| p.content_id ||= nil}\n\n # We can remove the headers from the older mail we encapsulate.\n # Leaving allows to have the headers signed too within the encapsulated\n # email, but MUAs make no use of them... :(\n #\n # mail.subject = nil\n # mail.to = nil\n # mail.cc = nil\n # mail.from = nil\n # mail.date = nil\n # headers.each { |k, v| mail[k] = nil }\n # mail['Content-Type'] = 'text/plain'\n # mail.mime_version = nil\n\n # We load certificate and private key\n if should_sign?\n sign_cert = OpenSSL::X509::Certificate.new( smart_read(@x509_sign_cert) )\n sign_prv_key = OpenSSL::PKey::RSA.new( smart_read(@x509_sign_key), @x509_sign_passphrase)\n end\n\n if should_crypt?\n crypt_cert = OpenSSL::X509::Certificate.new( smart_read(@x509_crypt_cert) )\n cipher = OpenSSL::Cipher.new(@x509_crypt_cipher)\n end\n\n# begin\n # Sign and crypt the mail\n\n # NOTE: the one following line is the slowest part of this code, signing is sloooow\n p7 = mail.encoded\n p7 = OpenSSL::PKCS7.sign(sign_cert,sign_prv_key, p7, [], OpenSSL::PKCS7::DETACHED) if should_sign?\n p7 = OpenSSL::PKCS7.encrypt([crypt_cert], (should_sign? ? OpenSSL::PKCS7::write_smime(p7) : p7), cipher, nil) if should_crypt?\n smime0 = OpenSSL::PKCS7::write_smime(p7)\n\n # Adding the signature part to the older mail\n newm = Mail.new(smime0)\n\n # We need to overwrite the content-type of the mail so MUA notices this is a signed mail\n# newm.content_type = 'multipart/signed; protocol=\"application/x-pkcs7-signature\"; micalg=sha1; '\n newm.delivery_method(mail.delivery_method.class, mail.delivery_method.settings)\n newm.subject = mail.subject\n newm.to = mail.to\n newm.cc = mail.cc\n newm.from = mail.from\n newm.mime_version = mail.mime_version\n newm.date = mail.date\n# newm.body = \"This is an S/MIME signed message\\n\"\n# headers.each { |k, v| m[k] = v } # that does nothing in general\n\n # NOTE: We can not use this as we need a B64 encoded signature, and no\n # methods provides it within the Ruby OpenSSL library... :(\n #\n # We add the signature\n # signature = Mail.new\n # signature.mime_version = '1.0'\n # signature['Content-Type'] = 'application/x-pkcs7-mime; smime-type=signed-data; name=\"smime.p7m\"'\n # signature['Content-Transfer-Encoding'] = 'base64'\n # signature['Content-Disposition'] = 'attachment; filename=\"smime.p7m\"'\n # signature.body = p7sign.to_s\n # newm.parts << signature\n\n @_message = newm\n# rescue Exception => detail\n# logger.error(\"Error while SMIME signing and\\or crypting the mail : #{detail}\")\n# end\n\n ## logger.debug(\"x509_sign_smime, resulted email\\n-------------( test X509 )----------\\n#{m.encoded}\\n-------------( test X509 )----------\")\n\n end", "def sign(args)\n return Digest::MD5.hexdigest(@secret + args.sort.flatten.join).to_s\n end", "def signature\n Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))\n end", "def x509_smime(mail)\n if logger\n logger.debug(\"actionmailer_x509: X509 SMIME signing with cert #{@x509_cert} and key #{@x509_key}\") if should_sign?\n logger.debug(\"actionmailer_x509: X509 SMIME crypt with cert #{@x509_cert}\") if should_crypt?\n end\n\n # We should set content_id, otherwise Mail will set content_id after signing and will broke sign\n mail.content_id ||= nil\n mail.parts.each {|p| p.content_id ||= nil}\n\n # We can remove the headers from the older mail we encapsulate.\n # Leaving allows to have the headers signed too within the encapsulated\n # email, but MUAs make no use of them... :(\n #\n # mail.subject = nil\n # mail.to = nil\n # mail.cc = nil\n # mail.from = nil\n # mail.date = nil\n # headers.each { |k, v| mail[k] = nil }\n # mail['Content-Type'] = 'text/plain'\n # mail.mime_version = nil\n\n # We load certificate and private key\n if should_sign?\n sign_cert = OpenSSL::X509::Certificate.new( File::read(@x509_sign_cert) )\n sign_prv_key = OpenSSL::PKey::RSA.new( File::read(@x509_sign_key), @x509_sign_passphrase)\n end\n\n if should_crypt?\n crypt_cert = OpenSSL::X509::Certificate.new( File::read(@x509_crypt_cert) )\n cipher = OpenSSL::Cipher.new(@x509_crypt_cipher)\n end\n\n# begin\n # Sign and crypt the mail\n\n # NOTE: the one following line is the slowest part of this code, signing is sloooow\n p7 = mail.encoded\n p7 = OpenSSL::PKCS7.sign(sign_cert,sign_prv_key, p7, [], OpenSSL::PKCS7::DETACHED) if should_sign?\n p7 = OpenSSL::PKCS7.encrypt([crypt_cert], (should_sign? ? OpenSSL::PKCS7::write_smime(p7) : p7), cipher, nil) if should_crypt?\n smime0 = OpenSSL::PKCS7::write_smime(p7)\n\n # Adding the signature part to the older mail\n newm = Mail.new(smime0)\n\n # We need to overwrite the content-type of the mail so MUA notices this is a signed mail\n# newm.content_type = 'multipart/signed; protocol=\"application/x-pkcs7-signature\"; micalg=sha1; '\n newm.delivery_method(mail.delivery_method.class, mail.delivery_method.settings)\n newm.subject = mail.subject\n newm.to = mail.to\n newm.cc = mail.cc\n newm.from = mail.from\n newm.mime_version = mail.mime_version\n newm.date = mail.date\n# newm.body = \"This is an S/MIME signed message\\n\"\n# headers.each { |k, v| m[k] = v } # that does nothing in general\n\n # NOTE: We can not use this as we need a B64 encoded signature, and no\n # methods provides it within the Ruby OpenSSL library... :(\n #\n # We add the signature\n # signature = Mail.new\n # signature.mime_version = '1.0'\n # signature['Content-Type'] = 'application/x-pkcs7-mime; smime-type=signed-data; name=\"smime.p7m\"'\n # signature['Content-Transfer-Encoding'] = 'base64'\n # signature['Content-Disposition'] = 'attachment; filename=\"smime.p7m\"'\n # signature.body = p7sign.to_s\n # newm.parts << signature\n\n @_message = newm\n# rescue Exception => detail\n# logger.error(\"Error while SMIME signing and\\or crypting the mail : #{detail}\")\n# end\n\n ## logger.debug(\"x509_sign_smime, resulted email\\n-------------( test X509 )----------\\n#{m.encoded}\\n-------------( test X509 )----------\")\n\n end", "def sign_vote(message, voter_id, key = nil, iv = nil)\n encrypted_msg, msg_key, iv = @encryptor.encrypt(message.to_json, key, iv)\n encoded_encrypted_msg = Base64.encode64(encrypted_msg)\n blinded_encoded_encrypted_msg, r = rsa.blind(encoded_encrypted_msg, admin_key)\n voter_signed_blinded_encoded_encrypted_msg = rsa._sign(blinded_encoded_encrypted_msg, voter_key)\n\n admin_response = admin_client.get_admin_signature(\n voter_id,\n blinded_encoded_encrypted_msg,\n voter_signed_blinded_encoded_encrypted_msg,\n voter_key.public_key.to_s)\n\n raise AdminSignatureError if admin_response.to_s == \"\" || admin_response['error']\n\n admin_signed_blinded_encoded_encrypted_msg = admin_response['data']['admin_signature']\n admin_signed_encoded_encrypted_msg = rsa.unblind(admin_signed_blinded_encoded_encrypted_msg, r, admin_key)\n\n msg_int = rsa.text_to_int(encoded_encrypted_msg)\n\n if rsa.verify(signed: admin_signed_encoded_encrypted_msg, message: msg_int, key: admin_key)\n puts \"\\n UNBLINDED SINGED IS VERIFIED!\\n\"\n else\n raise AdminSignatureError.new(\"unblinded signature invalid\")\n end\n\n DataSignerResult.new(msg_int, blinded_encoded_encrypted_msg, admin_signed_blinded_encoded_encrypted_msg, r, voter_key.to_s, msg_key, Base64.encode64(iv))\n end", "def encrypt!(cipher, iv, options={}) # rubocop:disable Naming/MethodParameterName\n opt = { salt: '' }.merge!(options)\n\n set_crypto cipher, opt[:intmode]\n compute_iv_for_encrypting iv, opt[:salt]\n\n authenticate_if_needed iv\n encrypted_msg = encrypt_body(iv, opt)\n encrypted_msg << generate_auth_tag(opt) if authenticated?\n self[:content].read(iv + encrypted_msg)\n\n # Remove plain payloads\n self[:body] = PacketGen::Types::String.new\n\n remove_enciphered_packets\n self.calc_length\n self\n end", "def sign(data, key)\n hmac = OpenSSL::HMAC.new(key, OpenSSL::Digest::SHA256.new)\n hmac.update data\n hmac.digest\n end", "def sign()\n exp_payload = { :data => to_json, :exp => validto.to_s}\n JWT.encode exp_payload, secret, 'HS512'\n end", "def signing_input; end", "def signing_input; end", "def encrypt(plain_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n cipher = new_cipher(:encrypt, password, salt)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plain_text)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_ciphertext(iv, ciphertext))\n end", "def encode(options = {})\n options[:expires] = case options[:expires]\n when Fixnum then Time.at(options[:expires]).to_s\n when Time, DateTime, Date then options[:expires].to_s\n else options[:expires].to_s\n end\n self.class.encode_64 @crypto_key.encrypt(options.to_json), @url_safe\n end", "def test_seal\n seal = Themis::ScellSeal.new(@master_key)\n\n encrypted = seal.encrypt(@message, @context)\n decrypted = seal.decrypt(encrypted, @context)\n\n assert(encrypted.length > @message.length)\n assert_equal(@message, decrypted)\n end", "def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end", "def static_key_ecb(message)\n unknown = \"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK\"\n udecoded = Base64.decode64(unknown)\n\n message_appended = message + udecoded\n message_appended = pkcs7_pad(message_appended, 16)\n\n cipher = encrypt_ecb(message_appended, STATIC_KEY)\nend" ]
[ "0.73770535", "0.65298843", "0.6349692", "0.61546856", "0.59450585", "0.59331924", "0.58103764", "0.57964015", "0.5724142", "0.56248355", "0.56002694", "0.55829126", "0.55593044", "0.54894763", "0.54792666", "0.5453584", "0.5436879", "0.54147094", "0.54018295", "0.53944355", "0.5367224", "0.5341844", "0.53187877", "0.53153616", "0.53084856", "0.5288882", "0.5283371", "0.5258547", "0.52470464", "0.5238395", "0.52311057", "0.52310723", "0.52209204", "0.5218193", "0.5218193", "0.5214304", "0.5204433", "0.52041537", "0.5196363", "0.51832145", "0.5177359", "0.5166319", "0.51657945", "0.5159754", "0.51490176", "0.5141462", "0.5118614", "0.510577", "0.510252", "0.51007485", "0.5092797", "0.50892174", "0.50666517", "0.5056969", "0.5056499", "0.50523967", "0.5044564", "0.50435054", "0.5025653", "0.5025563", "0.5022104", "0.5014468", "0.50122565", "0.50038254", "0.49788365", "0.49768206", "0.4971527", "0.4969891", "0.49694705", "0.49611276", "0.49499014", "0.49495944", "0.4944985", "0.49353975", "0.49345782", "0.4908865", "0.49047166", "0.48977166", "0.48898897", "0.488815", "0.487659", "0.4872589", "0.48670563", "0.48579794", "0.48457506", "0.48395336", "0.48387593", "0.48376188", "0.48317492", "0.4825227", "0.48250508", "0.4820757", "0.48175687", "0.48155087", "0.48155087", "0.4806923", "0.48034233", "0.47956723", "0.4784708", "0.478385" ]
0.7556189
0
Decrypt and verify a message. We need to verify the message in order to avoid padding attacks. Reference: ==== Options [+:purpose+] The purpose that the message was generated with. If the purpose does not match, +decrypt_and_verify+ will return +nil+. message = encryptor.encrypt_and_sign("hello", purpose: "greeting") encryptor.decrypt_and_verify(message, purpose: "greeting") => "hello" encryptor.decrypt_and_verify(message) => nil message = encryptor.encrypt_and_sign("bye") encryptor.decrypt_and_verify(message) => "bye" encryptor.decrypt_and_verify(message, purpose: "greeting") => nil
def decrypt_and_verify(message, **options) catch_and_raise :invalid_message_format, as: InvalidMessage do catch_and_raise :invalid_message_serialization, as: InvalidMessage do catch_and_ignore :invalid_message_content do read_message(message, **options) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\t\treturn nil unless sb1 == sb2\n \t\t\t\t\tcmd\n \t\t\t\trescue NoMethodError\n \t\t\t\t\tputs \"verify exception: #{msg}\"\n \t\t\t\tend\n \t\t\tend", "def decypt_and_verify(passphrase)\n decrypted_message = decrypt(passphrase)\n\n expected = Digest::SHA256.digest(decrypted_message)\n raise SlyErrors::StateError, \"Failed SHA-256 checksum\" unless expected == Base64.decode64(message_hash)\n\n decrypted_message\n end", "def decrypt_message ciphertext\n key_pair.decrypt ciphertext\n end", "def receive_and_decrypt_message(opts={})\n msg = pop(opts)\n unless msg.nil?\n decrypted_message = decrypt_message(msg, opts[:password])\n decrypted_message\n end\n decrypted_message || msg\n end", "def decode(data)\n @encryptor.decrypt_and_verify(data)\n rescue ActiveSupport::MessageVerifier::InvalidSignature, ActiveSupport::MessageEncryptor::InvalidMessage\n 'Wrong password'\n end", "def verify(message, **options)\n catch_and_raise :invalid_message_format, as: InvalidSignature do\n catch_and_raise :invalid_message_serialization do\n catch_and_raise :invalid_message_content, as: InvalidSignature do\n read_message(message, **options)\n end\n end\n end\n end", "def decrypt_then_verify(bytes, private_key, *public_keys)\n bytes = Validation.check_filled_array_argument!(bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n cipher = Core::VirgilCipher.new\n decrypted_bytes = cipher.decrypt_with_key(\n bytes,\n private_key.id,\n private_key.raw_key\n )\n signature = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNATURE)\n\n signer_public_key = public_keys.first\n\n if public_keys.count > 1\n signer_id = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNER_ID)\n signer_public_key = public_keys.find {|public_key| public_key.id == signer_id}\n end\n\n is_valid = verify_signature(signature, decrypted_bytes, signer_public_key)\n raise VirgilCryptoException, 'Signature is not valid' unless is_valid\n\n wrap_bytes(decrypted_bytes)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def decrypt(msg)\n msg_buf = FFI::MemoryPointer.from_data(msg)\n Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_pk_op_decrypt(@ptr, b, bl, msg_buf, msg_buf.size)\n })\n end", "def decrypt(ciphertext, options = {})\n # TODO\n end", "def decrypt_and_verify(value)\n ::JSON.parse(\n @box.decrypt(\n Base64.urlsafe_decode64(value)),\n symbolize_names: true)\n rescue RbNaCl::CryptoError\n raise InvalidMessage\n end", "def verify(message)\n generator.verify(message)\n end", "def verify(message, digest)\n MD4_MAC::verify(@key, message, digest)\n end", "def decrypt_pin(msg)\n msg = Base64.strict_decode64 msg\n iv = msg[0..15]\n cipher = msg[16..47]\n aes_key = JOSE::JWA::PKCS1.rsaes_oaep_decrypt('SHA256', pin_token, private_key, session_id)\n alg = 'AES-256-CBC'\n decode_cipher = OpenSSL::Cipher.new(alg)\n decode_cipher.decrypt\n decode_cipher.iv = iv\n decode_cipher.key = aes_key\n decoded = decode_cipher.update(cipher)\n decoded[0..5]\n end", "def decrypt; end", "def decrypt(ciphertext, passwd, options = {})\n iv_and_ciphertext = Base64.decode64(ciphertext)\n cipher = new_cipher(:decrypt, passwd, options)\n cipher.iv, ciphertext = iv_and_ciphertext(cipher, iv_and_ciphertext)\n plaintext = cipher.update(ciphertext)\n plaintext << cipher.final\n plaintext\n end", "def decrypt(value)\n encryptor.decrypt_and_verify(value)\n end", "def receive_message(opts={})\n msg = pop(opts)\n password = opts[:password]\n if msg && password\n decrypted_message = decrypt_message(msg, password)\n decrypted_message\n end\n decrypted_message || msg\n end", "def decrypt(msg, private_key)\n # 1\n rsa_encrypted_aes_key = msg[0..255] # 256 bits\n rsa_encrypted_aes_iv = msg[256..511] # next 256 bits\n aes_encrypted_message = msg[512..msg.length]\n\n # 2\n rsa_decryptor = OpenSSL::PKey::RSA.new private_key\n aes_key = rsa_decryptor.private_decrypt rsa_encrypted_aes_key\n aes_iv = rsa_decryptor.private_decrypt rsa_encrypted_aes_iv\n\n # 3\n decipher = OpenSSL::Cipher::AES256.new(AES_MODE)\n decipher.decrypt\n decipher.key = aes_key\n decipher.iv = aes_iv\n\n decipher.update(aes_encrypted_message) + decipher.final\n end", "def decrypt(message)\n xcrypt(:decrypt, message)\n rescue OpenSSL::Cipher::CipherError\n raise CipherError, 'invalid password'\n end", "def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end", "def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end", "def receive(ciphertext)\n if ciphertext.start_with? '-----BEGIN '\n ciphertext = Akero.replate(ciphertext, Akero::PLATE_CRYPTED, true)\n end\n begin\n body, signer_cert, body_type = verify(ciphertext, nil)\n rescue ArgumentError\n raise ERR_MSG_MALFORMED_ENV\n end\n\n case body_type.ord\n when 0x00\n # public message (signed)\n return Message.new(body, signer_cert, :signed)\n when 0x01\n # private message (signed, crypted, signed)\n signed_plaintext = _decrypt(body)\n plaintext, _verified_cert, _body_type = verify(signed_plaintext, signer_cert)\n msg = Message.new(plaintext, signer_cert, :encrypted)\n return msg\n end\n raise ERR_MSG_MALFORMED_BODY\n end", "def verify(signed_message, message, signing_key = admin_key)\n msg_int = rsa.text_to_int(message)\n rsa.verify(signed: signed_message, message: msg_int, key: signing_key)\n end", "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, NaCl::SIGNATUREBYTES, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "def decrypt(key, encrypted_message)\n key.private_key? or raise \"Must have private key to decrypt\"\n @cipher.reset\n\n ephemeral_public_key_length = key.group.generator.to_octet_string(:compressed).bytesize\n ciphertext_length = encrypted_message.bytesize - ephemeral_public_key_length - @mac_length\n ciphertext_length > 0 or raise OpenSSL::PKey::ECError, \"Encrypted message too short\"\n\n ephemeral_public_key_octet = encrypted_message.byteslice(0, ephemeral_public_key_length)\n ciphertext = encrypted_message.byteslice(ephemeral_public_key_length, ciphertext_length)\n mac = encrypted_message.byteslice(-@mac_length, @mac_length)\n\n ephemeral_public_key = OpenSSL::PKey::EC::Point.new(key.group, OpenSSL::BN.new(ephemeral_public_key_octet, 2))\n\n shared_secret = key.dh_compute_key(ephemeral_public_key)\n\n key_pair = kdf(shared_secret, @cipher.key_len + @mac_length, ephemeral_public_key_octet)\n cipher_key = key_pair.byteslice(0, @cipher.key_len)\n hmac_key = key_pair.byteslice(-@mac_length, @mac_length)\n\n computed_mac = OpenSSL::HMAC.digest(@mac_digest, hmac_key, ciphertext + @mac_shared_info).byteslice(0, @mac_length)\n computed_mac == mac or raise OpenSSL::PKey::ECError, \"Invalid Message Authenticaton Code\"\n\n @cipher.decrypt\n @cipher.iv = IV\n @cipher.key = cipher_key\n\n @cipher.update(ciphertext) + @cipher.final\n end", "def verify(signed_message)\n verified(signed_message)\n end", "def verify(params, shared_secret = nil)\n their_sig = params.delete('merchantSig')\n raise ArgumentError, \"params must include 'merchantSig' for verification\" if their_sig.empty?\n our_sig = sign(params, shared_secret)['merchantSig']\n secure_compare(their_sig, our_sig)\n end", "def verify(*args, **options)\n verified(*args, **options) || raise(InvalidSignature)\n end", "def decrypt(msg)\n msg = Bytes.new(msg) unless msg.is_a?(Bytes)\n\n @cipher.decrypt\n @cipher.padding = 0\n @cipher.key = @key.ascii\n\n ptext = []\n (0..msg.length/BLOCK_SZ - 1).each do |block_i|\n block = msg.slice(block_i*BLOCK_SZ, BLOCK_SZ)\n\n dec = Bytes.new(@cipher.update(block.ascii) + @cipher.final)\n dec ^= @state\n ptext << dec\n\n @state = block\n end\n\n ptext = ptext.reduce(:concat)\n\n # Strip off padding.\n Bytes.new(ptext.reject { |b| b == ptext[-1] })\n end", "def decrypt(data)\n\t\tbegin\n\t\t\tkey = OpenSSL::PKey::RSA.new File.read '../keys/victim.pem'\n\t\t\treturn key.private_decrypt(data)\n\t\trescue\n\t\t\treturn false\n\t\tend\n\tend", "def verifymessage(bitcoinaddress, signature, message)\n @api.request 'verifymessage', bitcoinaddress, signature, message\n end", "def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encrypted_data = Base64.decode64($2)\n # puts \"**** decipher.iv=#{Base64.encode64 iv}\"\n # puts \"**** encrypted=#{Base64.encode64 encrypted}\"\n return decipher.update(encrypted_data) + decipher.final \n rescue\n return nil\n end \n end", "def decrypt(*args, &block)\n crypt :decrypt, *args, &block\n end", "def decrypt(ciphertext)\n ciphertext = ciphertext.unpack('m').first\n tag = ciphertext[0, hmac_length]\n ciphertext = ciphertext[hmac_length..-1]\n\n # make sure we actually had enough data for the tag too.\n if tag && ciphertext && verify_message(tag, ciphertext)\n decrypt_ciphertext(ciphertext)\n else\n nil\n end\n end", "def decrypt(ciphertext_blob)\n begin\n plaintext = client.decrypt_and_verify(ciphertext_blob)\n\n success_with_data(\n plaintext: plaintext\n )\n rescue Exception => e\n error_with_data('lc_2',\n \"LocalCipher could not decrypt cipher with message => #{e.message}\",\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {})\n end\n end", "def decrypt(passphrase)\n self.user.decrypt(self.encrypted_message, passphrase)\n end", "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, signature_bytes, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_ed25519_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "def verify_message(authenticator, message)\n correct = Util.zeros(BYTES)\n compute_authenticator(correct, message)\n Util.verify32(correct, authenticator)\n end", "def private_decrypt(ciphertext)\n @private_key.private_decrypt(ciphertext)\n end", "def verify!(config, params)\n sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last\n generated_signature = Signature.generate(config, params)\n\n if sent_signature.nil? || generated_signature.nil? || !safe_equals?(sent_signature, generated_signature)\n raise SignatureException.new(sent_signature, generated_signature)\n end\n end", "def decrypt(data, password = nil)\n data = Base64.strict_decode64(data) if @base64\n\n salt = data[0, @salt_len]\n iv = data[@salt_len, @iv_len]\n ciphertext = data[@salt_len + @iv_len..-@mac_len - 1]\n mac = data[data.length - @mac_len, @mac_len]\n\n aes_key, mac_key = keys(salt, password)\n verify(iv + ciphertext, mac, mac_key)\n\n aes = cipher(aes_key, iv, false)\n plaintext = aes.update(ciphertext) + aes.final\n plaintext\n rescue TypeError, ArgumentError, NoMethodError => e\n error_handler e\n rescue OpenSSL::OpenSSLError => e\n error_handler e\n end", "def decrypt(string)\n require_key\n\n @private_key.private_decrypt(Base64.decode64(string))\n end", "def decrypt(text_to_decrypt, base64_encoded=true)\n text = base64_encoded ? Base64UrlSafe.decode(text_to_decrypt) : text_to_decrypt\n begin\n @key.private_decrypt(text)\n rescue OpenSSL::PKey::RSAError\n nil\n end\n end", "def decrypt phrase, key\n decrypt = encrypt phrase, key\n return decrypt\nend", "def decrypt\n rotations_one = rotation_gen\n rotations = rotations_one.map do |rotation|\n rotation * (-1)\n end\n message.each_with_index do |char, i|\n letter = decrypt_letter(char, rotations[(i % 4)])\n decrypted_message << letter\n end\n decrypted_message.join(\"\")\n end", "def decrypt(ciphertext_blob)\n begin\n\n d_resp = client.decrypt({\n ciphertext_blob: ciphertext_blob\n }).to_h\n\n plaintext = d_resp[:plaintext]\n\n return success_with_data(\n plaintext: plaintext\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_1',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role,\n ciphertext_blob: ciphertext_blob\n }\n )\n end\n end", "def maybe_decrypt(context)\n # TODO determine if we should be decrypting data coming from pre-4.2\n # servers, potentially using legacy wire protocols. If so we need\n # to implement decryption for those wire protocols as our current\n # encryption/decryption code is OP_MSG-specific.\n self\n end", "def decrypt(keys, cypher)\n keys.each do |key|\n verifier = ::Fernet.verifier(key, cypher, enforce_ttl: false)\n next unless verifier.valid?\n return verifier.message\n end\n cypher # Return cypher has it's probably just plain text\n end", "def decrypt(ciphertext)\n @cipher.decrypt(@secret_key, ciphertext)\n end", "def decrypt(data)\n @cert_chain[0].public_key.public_decrypt(Base64::decode64(data))\n end", "def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end", "def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end", "def decrypt(value)\n return unless value\n fail ArgumentError, 'Value is not encrypted' unless value.match(REGEXP)\n @key.private_decrypt(Base64.strict_decode64(Regexp.last_match(:value)))\n end", "def verify_message(record, message_body)\n assert_equal 'messages', message_body['type']\n assert_equal record.id, message_body['id']\n assert_equal record.content, message_body['attributes']['content']\n assert_equal record.is_palindrome == 'true', message_body['attributes']['is_palindrome']\n end", "def decrypt(alg, password, cipher)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n when \"Blowfish\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'blowfish')\n when \"Plaintext\" then return cipher\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n end\n decrypted_text = key.decrypt64(cipher)\n rescue => e\n p e.message\n end\n return decrypted_text\n \n end", "def sign_and_encrypt_encapsulated(message)\n sign(message)\n encrypt(message)\n end", "def decrypt(encrypted_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n iv_ciphertext = Base64.decode64(encrypted_text)\n cipher = new_cipher(:decrypt, password, salt)\n cipher.iv, ciphertext = separate_iv_ciphertext(cipher, iv_ciphertext)\n plain_text = cipher.update(ciphertext)\n plain_text << cipher.final\n plain_text\n end", "def decrypt(message, hash: nil)\n # 0\n message = Base64.decode64(message)\n hmac = message[0..63] # 64 bits of hmac signature\n\n case\n when hash && hmac != hash\n raise Error, \"Provided hash mismatch for encrypted file!\"\n when hmac != hmac_signature(message[64..-1])\n raise Error, \"HMAC signature mismatch for encrypted file!\"\n end\n\n # 1\n rsa_encrypted_aes_key = message[64..319] # next 256 bits\n rsa_encrypted_aes_iv = message[320..575] # next 256 bits\n aes_encrypted_message = message[576..-1]\n\n # 2\n aes_key = @rsa.private_decrypt rsa_encrypted_aes_key\n aes_iv = @rsa.private_decrypt rsa_encrypted_aes_iv\n\n # 3\n @cipher.reset\n @cipher.decrypt\n @cipher.key = aes_key\n @cipher.iv = aes_iv\n content = @cipher.update(aes_encrypted_message) + @cipher.final\n\n { signature: hmac, content: content }\n rescue OpenSSL::OpenSSLError => e\n raise Error.new(e.message)\n end", "def decrypt(encrypted, secret, signing_secret)\n check_secret(secret)\n check_signing_secret(signing_secret)\n\n secret = secret[0..31] if secret.bytesize > 32\n aes128_gcm_decrypt(encrypted, secret, signing_secret)\n end", "def _decrypt_packet_internal(keys, data)\n # Don't decrypt if we don't have a key set\n if(!ready?(keys))\n @@window.puts(\"Not decrypting data (incoming data seemed to be cleartext): #{data.unpack(\"H*\")}\")\n return data\n end\n\n # Parse out the important fields\n header, signature, nonce, encrypted_body = data.unpack(\"a5a6a2a*\")\n\n # Put together the data to sign\n signed_data = header + nonce + encrypted_body\n\n # Check the signature\n correct_signature = SHA3::Digest::SHA256.digest(keys[:their_mac_key] + signed_data)\n if(correct_signature[0,6] != signature)\n @@window.puts(\"Couldn't verify packet signature!\")\n raise(Encryptor::Error, \"Invalid signature!\")\n end\n\n # Check the nonce *after* checking the signature (otherwise, we might update the nonce to a bad value and Bad Stuff happens)\n nonce_int = nonce.unpack(\"n\").pop()\n if(nonce_int < keys[:their_nonce])\n @@window.puts(\"Client tried to use an invalid nonce: #{nonce_int} < #{keys[:their_nonce]}\")\n raise(Encryptor::Error, \"Invalid nonce!\")\n end\n keys[:their_nonce] = nonce_int\n\n # Decrypt the body\n body = Salsa20.new(keys[:their_write_key], nonce.rjust(8, \"\\0\")).decrypt(encrypted_body)\n\n #@@window.puts(\"Decryption successful\")\n return header+body\n end", "def letsencrypt_verify\n render body: 'ZfWSZ-8jDoGc8OenfP8JC79QPITHFU6BH9YPvVabGd8.f7vLMOThcyEXB9qAI5BSN_yaTVOEKeyNNW23TFYNCRA'\n end", "def decrypt(encrypted_string)\n CRYPTO.decrypt_string(encrypted_string.decode64)\nend", "def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end", "def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end", "def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end", "def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end", "def test_seal\n seal = Themis::ScellSeal.new(@master_key)\n\n encrypted = seal.encrypt(@message, @context)\n decrypted = seal.decrypt(encrypted, @context)\n\n assert(encrypted.length > @message.length)\n assert_equal(@message, decrypted)\n end", "def verify(_password, _encoded)\n raise NotImplementedError\n end", "def decrypt(message)\n new_message = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \n counter = 0\n while counter < message.length\n if alphabet.index(message[counter]) == 0\n new_message += alphabet[25]\n else\n new_message += alphabet[alphabet.index(message[counter]) - 1]\n end\n counter += 1\n end\n new_message\nend", "def verify_message(tag, message)\n own_tag = authenticate_message(message)\n Rack::Utils.secure_compare(tag, own_tag)\n end", "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "def decrypt\n self\n end", "def decrypt(data)\n return nil if data.to_s.empty?\n\n password =\n if /^(1\\.[0-9.]+|2\\.0)(\\.[0-9]+)?/ =~ GPGME::Engine.info.first.version || @pinmode\n { password: @gpg_pass }\n else\n { password: @gpg_pass,\n pinentry_mode: GPGME::PINENTRY_MODE_LOOPBACK }\n end\n\n crypto = GPGME::Crypto.new(armor: true)\n crypto\n .decrypt(data, password)\n .read.force_encoding('utf-8')\n rescue => e\n raise \"#{I18n.t('error.gpg_file.decrypt')}\\n#{e}\"\n end", "def decipher(key, user_iv, text)\n ssl_decipher = OpenSSL::Cipher.new('AES-256-CBC')\n ssl_decipher.decrypt\n ssl_decipher.key = key\n ssl_decipher.iv = user_iv\n ssl_decipher.update(text) + ssl_decipher.final\n end", "def decrypt(data)\n crypto_key.decrypt64(data)\n end", "def decrypt_string(ciphertext, auth_tag, key, iv, auth_data = '')\n cipher = OpenSSL::Cipher.new(CIPHER_TYPE)\n cipher.decrypt\n cipher.key = key\n cipher.iv = iv[0, IV_LENGTH]\n\n cipher.auth_tag = auth_tag\n cipher.auth_data = auth_data\n\n cipher.update(ciphertext) + cipher.final\n end", "def decrypt\n unless @encrypted_data.blank?\n plaintext_data\n end\n end", "def decrypt()\n \t@private_key = AES.decrypt(self.encrypted_private_key, ENV[\"DECRYPTION_KEY\"])\n end", "def decrypt(bin64, iv64)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n aes.decrypt\n aes.key = $key\n aes.iv = Base64.urlsafe_decode64(iv64)\n aes.update(Base64.urlsafe_decode64(bin64)) + aes.final\nend", "def decrypt(data, padding: nil)\n dec = Botan::PK::Decrypt.new(key: self, padding: padding)\n dec.decrypt(data)\n end", "def decrypt_with_password(password, salt, iterations, key, iv, tag, data, debug_text=nil)\n\n\n # Create the key with our password\n @logger.debug(\"Apple Decrypter: #{debug_text} Attempting decryption with password #{password}\")\n\n # Create variables to track our generated and unwrapped keys between blocks\n decrypt_result = false\n plainext = false\n\n # Generate the key-encrypting key from the user's password\n generated_key = generate_key_encrypting_key(password, salt, iterations)\n\n # Unwrap the key\n unwrapped_key = aes_key_unwrap(key, generated_key) if generated_key\n\n # Decrypt the content only if we have a key\n plaintext = aes_gcm_decrypt(unwrapped_key, iv, tag, data, debug_text) if unwrapped_key\n\n if plaintext\n decrypt_result = { plaintext: plaintext, password: password }\n @logger.debug(\"Apple Decrypter: #{debug_text} generated a decrypt using password #{password}\")\n end\n\n return decrypt_result\n end", "def can_decrypt?\n false\n end", "def decrypt(sentence, combination)\n encrypt(sentence, combination)\nend", "def receive_message_and_peer(message, peer_identity) # :nodoc:\n receive_message(message)\n end", "def decrypt!(data, options = {})\n unless options.has_key?(:secret)\n options[:secret] = PreciousCargo::Secret.decrypt!(options)\n end\n\n PreciousCargo::Data.decrypt!(data, options)\n end", "def public_decrypt(ciphertext)\n @public_key.public_decrypt(ciphertext)\n end", "def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end", "def decrypt(data)\n raise NoPrivateKeyError, \"Private key file: #{@private_key_file}\" unless private?\n \n decrypted_data = Base64.decode64(data)\n private_rsa.private_decrypt(decrypted_data)\n end", "def verify_signature(cleartext, signature_string)\n cmd_output = run_verify(cleartext, signature_string)\n cmd_result = analyse_verify_output(*cmd_output)\n\n if cmd_result[:well_formed_pgp_data]\n match_constraints(**cmd_result)\n else\n msg_no_pgg_data(signature_string)\n end\n end", "def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n # OpenSSH compatibility: if a the number of bytes in the signature is less than the number of bytes of the RSA\n # modulus, prepend the signature with zeros.\n # See https://github.com/openssh/openssh-portable/blob/ac383f3a5c6f529a2e8a5bc44af79a08c7da294e/ssh-rsa.c#L531\n difference = n.num_bytes - raw_sig.bytesize\n raw_sig = \"\\0\" * difference + raw_sig if difference.positive?\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end", "def decrypt(value)\n if @private_key.present? && encrypted?(value)\n escape_and_execute_sql([\"SELECT pgp_pub_decrypt(?, dearmor(?), ?)\",\n value, @private_key, @key])['pgp_pub_decrypt']\n else\n value\n end\n end", "def decrypt\n self\n end", "def verify_signatures?; end", "def _decrypt_packet_internal(keys, data)\n @l.debug(\"Encryptor: Decrypting a #{data.length}-byte packet\")\n # Don't decrypt if we don't have a key set\n# if(@keys[:shared_secret].nil?)\n# return data\n# end\n\n # Parse out the important fields\n header, signature, nonce, encrypted_body = data.unpack(\"a5a6a2a*\")\n\n # Check if it was truncated\n if(nonce.nil? || nonce.length < 2)\n raise(Error, \"Invalid encrypted packet!\")\n end\n\n # Check the signature\n correct_signature = SHA3::Digest::SHA256.digest(keys[:their_mac_key] + header + nonce + encrypted_body)\n if(correct_signature[0,6] != signature)\n raise(Error, \"Invalid signature on incoming packet!\")\n end\n\n # Check the nonce *after* checking the signature (otherwise, we might update the nonce to a bad value and Bad Stuff happens)\n nonce_int = nonce.unpack(\"n\").pop()\n if(nonce_int < keys[:their_nonce])\n raise(Error, \"Client tried to use an invalid nonce: #{nonce_int} < #{keys[:their_nonce]}\")\n end\n keys[:their_nonce] = nonce_int\n\n # Decrypt the body\n body = Salsa20.new(keys[:their_write_key], nonce.rjust(8, \"\\0\")).decrypt(encrypted_body)\n\n return header + body\n end", "def find_signed!(signed_id, purpose: nil)\n if id = signed_id_verifier.verify(signed_id, purpose: combine_signed_id_purposes(purpose))\n find(id)\n end\n end", "def decrypt(str)\n str = str.unpack('m0').first\n aes = OpenSSL::Cipher::Cipher.new('aes-128-cbc').decrypt\n aes.key = @secret\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end", "def decrypt!(encrypted_data, options = {})\n secret = options[:secret]\n cipher = Gibberish::AES.new(secret)\n cipher.decrypt(encrypted_data).strip\n end", "def decrypt(cipher_bytes, private_key)\n cipher_bytes = Validation.check_filled_array_argument!(cipher_bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n cipher = Core::VirgilCipher.new\n decrypted_bytes = cipher.decrypt_with_key(\n cipher_bytes,\n private_key.id,\n private_key.raw_key\n )\n wrap_bytes(decrypted_bytes)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end" ]
[ "0.6425691", "0.62018293", "0.60890734", "0.60718334", "0.60361207", "0.59915733", "0.5948968", "0.5900383", "0.5837054", "0.57272506", "0.5719386", "0.5656487", "0.563251", "0.5623464", "0.5613236", "0.5608425", "0.55842906", "0.5573507", "0.55440694", "0.55421746", "0.55421746", "0.5521749", "0.5517641", "0.5466767", "0.54463387", "0.54127485", "0.5371581", "0.53319", "0.53218377", "0.53130776", "0.5308908", "0.5280127", "0.5272578", "0.52604103", "0.52540463", "0.52400625", "0.5233061", "0.51714873", "0.51706123", "0.51535034", "0.5079784", "0.507458", "0.50721365", "0.50661033", "0.5060129", "0.50086707", "0.50061285", "0.50012815", "0.49945384", "0.49811086", "0.49742272", "0.49742272", "0.49695793", "0.49430594", "0.4938104", "0.4930851", "0.4924876", "0.4919149", "0.49171683", "0.49115434", "0.49100497", "0.4884363", "0.48759642", "0.48759642", "0.48759642", "0.48759642", "0.48707783", "0.48682055", "0.48541635", "0.48390558", "0.48317266", "0.48317266", "0.48317266", "0.48136365", "0.48114908", "0.48000106", "0.47901055", "0.47875386", "0.4775784", "0.47717336", "0.4770789", "0.47699633", "0.47619516", "0.47529942", "0.4749879", "0.47484422", "0.4738595", "0.4738237", "0.4734125", "0.47277564", "0.47276682", "0.47264653", "0.4720223", "0.4719476", "0.47180575", "0.4716423", "0.47139132", "0.4707143", "0.4704691", "0.47015104" ]
0.70903915
0
Execute 'query' and output response to 'output_file'. 'skip_lines' specifies which lines to exclude, where skip_lines[1] indicates the first line of the response. precondition: query != nil && ! output_file.closed? && ! skip_lines.nil?
def output_response(output_file, skip_lines = {}) begin open(query) do |f| current_line_index = 1 # Process (output, if appropriate) the first line: first_line = f.readline if bad_data_match(first_line) or first_line.empty? then raise "Bad or no data [#{first_line}]" end if first_line && ! skip_lines[current_line_index] then if @filter_function != nil then first_line << @filter_function.call(first_line, current_line_index) end if ! first_line.nil? then output_file.write(first_line) end end if ! f.eof? then current_line_index += 1 f.each_line do |l| if @filter_function != nil then if ! skip_lines[current_line_index] then filtered_line = @filter_function.call(l, current_line_index) if ! filtered_line.empty? then output_file.write(filtered_line) end end else if ! skip_lines[current_line_index] then output_file.write(l) end end current_line_index += 1 end end end rescue StandardError => error @fatal_error = true @error_message = error.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_reversed_response(output_file, skip_lines)\n output_file.write(reversed_response(skip_lines).join(\"\\n\") + \"\\n\")\n end", "def reversed_response(skip_lines)\n if query then\n begin\n open(query) do |f|\n i = 1\n f.each_line do |l|\n if i == 1 then\n if bad_data_match(l) or first_line.empty? then\n raise \"Bad or no data [#{first_line}]\"\n end\n end\n if ! skip_lines[i] then\n @response_lines << l.chomp\n end\n i += 1\n end\n end\n rescue OpenURI::HTTPError => error\n @fatal_error = true\n response = error.io\n @error_message = \"status: #{response.status}, error: #{response.string}\"\n end\n end\n result = []\n if ! @fatal_error then\n current_line_index = 1\n if @filter_function != nil then\n (0 .. response_lines.count - 1).reverse_each do |i|\n result << @filter_function.call(response_lines[i], current_line_index)\n current_line_index += 1\n end\n else\n (0 .. response_lines.count - 1).reverse_each do |i|\n result << response_lines[i]\n end\n end\n end\n result\n end", "def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end", "def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.get_result.stream_each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end", "def query\n rdr = PostgresReader.new(@options)\n query = File.open(@sql_file, 'r', &:read)\n File.open(@output_file, 'w') do |file|\n rdr.query(query, file)\n end\n end", "def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end", "def extract_data(output_file, options = {})\n log.info \"Exporting #{@cube} data via report script...\"\n\n rep_script = generate_script(options)\n save_query_to_file(rep_script, options[:query_file], '.rep')\n\n # Submit the report\n iter = nil\n instrument 'report.extract', script: rep_script, output_file: output_file do\n iter = cube.report(rep_script, false, false, true, false)\n end\n\n # Write the returned data to the file\n log.fine \"Writing data to #{output_file}\"\n file = File.new(output_file, \"w\")\n count = 0\n begin\n # TODO: Handle header, non-tab delimiters\n while !try{ iter.is_end_of_data } do\n chunk = try{ iter.next_string }\n file.puts chunk\n count += chunk.lines.count\n end\n ensure\n file.close\n end\n log.fine \"Output #{count} records\"\n end", "def execute(options={})\n build_headers\n write_data(@output)\n end", "def run\n check_xhr unless params[:download]\n\n query = DataExplorer::Query.find(params[:id].to_i)\n query.last_run_at = Time.now\n\n if params[:id].to_i < 0\n query.created_by = Discourse::SYSTEM_USER_ID.to_s\n query.save_default_query\n else\n query.save\n end\n\n if params[:download]\n response.sending_file = true\n end\n\n params[:params] = params[:_params] if params[:_params] # testing workaround\n query_params = {}\n query_params = MultiJson.load(params[:params]) if params[:params]\n\n opts = { current_user: current_user.username }\n opts[:explain] = true if params[:explain] == \"true\"\n\n opts[:limit] =\n if params[:limit] == \"ALL\" || params[:format] == \"csv\"\n \"ALL\"\n elsif params[:limit]\n params[:limit].to_i\n end\n\n result = DataExplorer.run_query(query, query_params, opts)\n\n if result[:error]\n err = result[:error]\n\n # Pretty printing logic\n err_class = err.class\n err_msg = err.message\n if err.is_a? ActiveRecord::StatementInvalid\n err_class = err.original_exception.class\n err_msg.gsub!(\"#{err_class}:\", '')\n else\n err_msg = \"#{err_class}: #{err_msg}\"\n end\n\n render json: {\n success: false,\n errors: [err_msg]\n }, status: 422\n else\n pg_result = result[:pg_result]\n cols = pg_result.fields\n respond_to do |format|\n format.json do\n if params[:download]\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.json\"\n end\n json = {\n success: true,\n errors: [],\n duration: (result[:duration_secs].to_f * 1000).round(1),\n result_count: pg_result.values.length || 0,\n params: query_params,\n columns: cols,\n default_limit: DataExplorer::QUERY_RESULT_MAX_LIMIT\n }\n json[:explain] = result[:explain] if opts[:explain]\n\n if !params[:download]\n relations, colrender = DataExplorer.add_extra_data(pg_result)\n json[:relations] = relations\n json[:colrender] = colrender\n end\n\n json[:rows] = pg_result.values\n\n render json: json\n end\n format.csv do\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.csv\"\n\n require 'csv'\n text = CSV.generate do |csv|\n csv << cols\n pg_result.values.each do |row|\n csv << row\n end\n end\n\n render plain: text\n end\n end\n end\n end", "def run_query(query_file , exp , o = {})\n index_path = o[:index_path] || @index_path\n cmd = fwrite('cmd_galago_run_query.log' , \"#{$galago_path}/bin/galago batch-search --index=#{index_path} #{o[:param_query]} \\\n #{to_path(query_file)} |grep -e ^[0-9] > #{to_path(exp+'.res')}\" , :mode=>'a')\n `#{cmd}`\n end", "def process_skipped_lines(lines); end", "def perform\n $stdout.write \"Outputting file to #{filepath_string}\\n\"\n CSV.open(filepath_string, \"wb\") do |csv|\n csv << output_header_row\n orders.each do |order|\n csv << order.output_row\n end\n end\n end", "def assert_not_result_matches(query, expected_result_file, filter_exp=nil, sort=nil, qrserver_id=0)\n result_xml = search(query, qrserver_id).xmldata\n expected_lines = []\n File.open(expected_result_file) do |file|\n expected_lines = file.readlines\n end\n @current_assert_file = expected_result_file\n assert_not_resultsets_match(result_xml.split(\"\\n\", -1), expected_lines, filter_exp, sort)\n @current_assert_file = nil\n end", "def process_page_results(output_file_name, result_items)\n file = output_file(output_file_name)\n\n result_items.each do |result|\n file.write(\"#{result['id']},#{result['full_name']},#{result['language']}\\n\")\n end\nend", "def triple_output_to_file(graph_name, filename, prefix)\n base_query_addition = \"SELECT ?s ?p ?o FROM <#{graph_name}> WHERE { ?s ?p ?o }\"\n current_iteration = 0\n additions = query(base_query_addition + \" OFFSET #{(LINES_PER_EXTRACT * current_iteration).to_s} LIMIT #{LINES_PER_EXTRACT}\")\n while additions.length > 0\n additions.each_solution do |addition|\n log.info \"#{prefix} #{addition['s'].to_s} #{addition['p'].to_s} #{addition['o'].to_s}\"\n append_line_to_file(filename,\"#{prefix} #{addition['s'].to_s} #{addition['p'].to_s} #{addition['o'].to_s}\" + \"\\n\")\n end\n log.info additions.to_s\n current_iteration += 1\n additions = query(base_query_addition + \" OFFSET #{(LINES_PER_EXTRACT * current_iteration).to_s} LIMIT #{LINES_PER_EXTRACT}\")\n end\nend", "def run(query, options = {})\n options = { verbose: false }.merge(options)\n \n # Format the query for execution\n query_path = case\n when File.exists?(query) then query\n else\n # Write the query to a file.\n tempfile = Tempfile.new(\"#{@blast_command}_query\")\n tempfile.puts \">Query\"\n tempfile.puts query\n tempfile.close\n \n tempfile.path\n end\n \n # Execute the command\n CommandLine.run(prepare_command(query_path)) do |f|\n puts f.read\n end\n \n # Grab the output file\n output_file.rewind\n output_file\n end", "def execute\n processed_header = false\n\n File.open(outfile, 'w') do |out|\n File.open(infile).each_with_index do |line, index|\n next if line.chomp.empty? || unstring(line).chomp.split(';').empty?\n\n unless processed_header\n header_row = header.process(line.chomp)\n header_row = @write_filter.process(header_row) unless @final_header\n out.puts header_row unless header_row.nil? or header_row.empty?\n processed_header = true\n next\n end\n\n next if row_filter.process(line, row: index).nil?\n\n @columns = unstring(line).chomp.split(';')\n formulae.each do |col, formula|\n @columns[col.to_i] = eval(formula)\n end\n out.puts @write_filter.process(@columns.join(';'))\n\n @columns.each_with_index do |column, index|\n column = 0 unless column.to_s =~ /^[\\d\\.,]*$/\n\n if @sum_row[index]\n @sum_row[index] += to_number column\n else\n @sum_row[index] = to_number column\n end\n end if add_sum_row\n\n end\n\n out.puts @write_filter.process(@sum_row.join(';')) if add_sum_row\n\n end\n end", "def execute\n rows = File.readlines(infile)\n\n skipped_rows = []\n\n unless headerless\n skipped_rows[0] = \"\"\n skipped_rows[0] = rows.shift while skipped_rows[0].chomp.strip.empty?\n end\n\n if start\n (0...start.to_i).each { |row| skipped_rows << rows.shift } \n end\n\n rows.each_with_index do |line, index|\n filtered = col_type_filter.process(row_filter.process(line, row: index))\n next if filtered.nil?\n sorted_rows << (filtered << index)\n end\n\n File.open(outfile, 'w') do |out|\n skipped_rows.each { |row| out.puts unstring(row) }\n\n if desc\n sorted_rows.compact.sort.reverse.each do |row|\n out.puts unstring(rows[row.last])\n end\n else\n sorted_rows.compact.sort.each do |row|\n out.puts unstring(rows[row.last])\n end\n end\n end\n end", "def query(sql, file)\n return if sql.nil? || file.nil?\n sql.strip!\n get_copy_data(sql.chomp(';'), file)\n end", "def work_received(results)\n # write results to disk\n @@output_file.puts results\n end", "def write_output\n rows = data_to_rows\n CSV.open(@filename, 'wb') do |csv|\n rows.each {|row| csv << row}\n end\n end", "def processRequest\n # retrieve the requests with data\n \n req = DSRequest.new(@request, @model) \n # set the response variable\n res = req.execute\n File.open('kris.txt', 'w') { |file| file.write(res) }\n # safeguard, if was null, create an empty response with failed status\n if res.nil?\n res = DSResponse.new\n res.status=-1\n end \n return res \n end", "def output lines\n nil\n end", "def execute(db_client)\n query_file = @query_options['file']\n query_file_path = \"./config/queries/#{query_file}\"\n query_content = File.read(query_file_path)\n\n if @query_options.has_key?('params') || @params\n query_params = @query_options['params'] ? @query_options['params'] : @params.split(',')\n query_params.each_with_index do |p, i|\n query_content = query_content.gsub(/@@#{i}@@/, p)\n end\n end\n\n return db_client.query(query_content)\n end", "def process_output(file=nil)\n output = if file\n File.new(file.to_s,'w')\n else\n STDOUT\n end\n\n yield output if block_given?\n\n output.flush\n output.close\n return nil\n end", "def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end", "def run\n headers = %w(id)\n @mappings.keys.each do |mapping|\n unless [:id, :sort_as].include?(mapping)\n headers << mapping\n end\n end\n puts CSV.generate_line(headers)\n\n Zip::ZipFile.open(open(@url)) do |zipfile|\n entry = zipfile.entries.find{|entry| File.extname(entry.name) == \".dbf\"}\n if entry\n DBF::Table.new(StringIO.new(zipfile.read(entry))).map do |record|\n ShapefileRecord.new(record, @mappings)\n end.select(&@filter).sort.each do |record|\n output(@prefix, *headers.map{|header| record.send(header)})\n end\n else\n raise \"DBF file not found!\"\n end\n end\n end", "def save_result(query, file, qrserver_id=0)\n result = search(query, qrserver_id)\n File.open(file, \"w\") do |file|\n file.print(result.xmldata)\n end\n return result\n end", "def add_to_all_results_file(filename,output)\n self.add_to_file(filename,output)\n end", "def download_csv\n query = params[:query]\n company_id = params[:company_id]\n file = Operation.create_csv(query, company_id) \n send_file file\n end", "def create_export(query, args={})\n args[\"search\"] = query\n # Suppress segmentation (<sg> tags in the XML response) by default:\n if !args.has_key?(:segmentation)\n args[:segmentation] = \"none\"\n end\n response = @service.request(:method => :GET,\n :resource => @resource + [\"export\"],\n :query => args)\n return ExportStream.new(response.body)\n end", "def execute!(query)\n http_response = request.post(@url, params: @params, json: { query: query.to_gql })\n\n fail \"Error: #{http_response.reason}\\nBody: #{http_response.body}\" if http_response.status >= 300\n\n parsed_response = JSON.parse(http_response.to_s)\n data = parsed_response['data']\n errors = parsed_response['errors']\n\n Response.new(data, errors, query)\n end", "def load_outputs\n if File.exist?(@reciprocal_hits)\n # puts \"reciprocal output already exists\"\n else\n @query_results = Hash.new\n @target_results = Hash.new\n q_count=0\n t_count=0\n if !File.exists?(\"#{@output1}\")\n raise RuntimeError.new(\"can't find #{@output1}\")\n end\n if !File.exists?(\"#{@output2}\")\n raise RuntimeError.new(\"can't find #{@output2}\")\n end\n if File.exists?(\"#{@output1}\") and File.exists?(\"#{@output2}\")\n File.open(\"#{@output1}\").each_line do |line|\n cols = line.chomp.split(\"\\t\")\n hit = Hit.new(cols, @query_is_prot, @target_is_prot)\n @query_results[hit.query] = [] if !@query_results.has_key?(hit.query)\n @query_results[hit.query] << hit\n q_count += 1\n end\n File.open(\"#{@output2}\").each_line do |line|\n cols = line.chomp.split(\"\\t\")\n hit = Hit.new(cols, @target_is_prot, @query_is_prot)\n @target_results[hit.query] = [] if !@target_results.has_key?(hit.query)\n @target_results[hit.query] << hit\n t_count += 1\n end\n else\n raise \"need to run blast first\"\n end\n end\n [q_count, t_count]\n end", "def yield_skip_page_r(unit, total_rows, start_page=1, query_opts) # :yields: limit, skip, page, max_page, new_query_opts\n opts = query_opts.dup\n limit = unit\n\n # swaping +startkey+, +endkey+ and \"descending\" options.\n case \"#{opts.has_key?('startkey')}.#{opts.has_key?('endkey')}\"\n when \"true.true\"\n opts[\"startkey\"] = query_opts[\"endkey\"]\n opts[\"endkey\"] = query_opts[\"startkey\"]\n when \"true.false\"\n opts[\"endkey\"] = opts[\"startkey\"]\n opts.delete(\"startkey\")\n when \"false.true\"\n opts[\"startkey\"] = opts[\"endkey\"]\n opts.delete(\"endkey\")\n end\n if opts.has_key?(\"descending\")\n opts[\"descending\"] = (opts[\"descending\"].to_s == \"true\") ? \"false\" : \"true\"\n else\n opts[\"descending\"] = \"true\"\n end\n \n max_page = (total_rows.to_f / limit.to_f).ceil\n \n sanitized_start_page = start_page > 0 ? start_page : 1\n page = (max_page - sanitized_start_page + 1)\n page = 1 if page < 1 ## 'page' must be greater than one, even though max_page is zero.\n skip = total_rows - (limit * (max_page - page + 1))\n skip = total_rows if skip > total_rows\n skip = 0 if skip < 0\n \n $stderr.puts \"[debug] yield_skip_page_r() sanitized_start_page=#{sanitized_start_page},skip=#{skip},page=#{page}\" if @debug\n \n while page >= 1\n $stderr.puts \"[debug] yield_skip_page_r() skip=#{skip},page=#{page},max_page=#{max_page}\" if @debug\n if skip == 0\n tmp_limit = total_rows % limit\n tmp_limit = limit if tmp_limit == 0\n yield [tmp_limit, skip, page, max_page, opts]\n else\n yield [limit, skip, page, max_page, opts]\n end\n page -= 1\n # skip = limit * (page - 1)\n skip -= limit\n skip = 0 if skip < 0\n end\n end", "def SPARQL_query(service, query, query_file, forcePOST=false, args2={})\n if ! query_file.nil?\n query = open(query_file, 'rb'){|f| f.read}\n end\n if forcePOST || query.length >= 2*1024 \n SPARQL_query_POST(service, query, args2)\n else\n SPARQL_query_GET(service, query, args2)\n end\nend", "def process_ssg_results(filter=nil, exclusions=nil)\n self.class.process_ssg_results(\n File.join(@output_dir, @result_file) + '.xml',\n filter,\n exclusions\n )\n end", "def ViewStreamingResponseMixin_stream_response(line_reader_class, response, callback)\n non_row_body = ''\n row_idx = 0\n line_reader_class.read_body response do |line|\n line = line.strip\n if line.start_with? '{\"key\":' or line.start_with? '{\"id\":'\n # A result row; send to the callback\n callback.call JSON.parse(line.chomp(',')), row_idx\n row_idx += 1\n else\n # Not a row, it goes into the main return value\n non_row_body += line\n end\n end\n non_row_body\n end", "def save_result_with_timeout(timeout, query, file, qrserver_id=0)\n result = search_with_timeout(timeout, query, qrserver_id)\n File.open(file, \"w\") do |file|\n file.print(result.xmldata)\n end\n return result\n end", "def flush_to_file(hit_list)\n File.open($config[:output], 'a') do |file|\n file.puts(hit_list)\n end\nrescue => e\n puts \"Error writing to output file #{$config[:output]}\"\n raise e\nend", "def stream_response(couch_response)\n\n # Should be asked to read lines from mocked_response\n line_reader_class = Class.new do\n def self.read_body(response)\n response.each do |line|\n yield line\n end\n end\n end\n\n # Collect the rows found\n rows = []\n callback = lambda { |line, idx|\n rows.push line\n }\n\n # Finally, set up the mixin class\n view_mixin = Class.new do\n include ViewStreamingResponseMixin\n end.new\n view_mixin.row_callback = callback\n\n # Run the streaming method\n non_row_body = view_mixin.ViewStreamingResponseMixin_stream_response(\n line_reader_class, couch_response.lines, callback)\n\n return rows, non_row_body\n\n end", "def extract_the_data(skip)\n skip = skip\n success = true\n data_lines = 0\n data_records = []\n @array_of_lines.each_with_index do |line, n|\n next if n < skip\n\n @project.write_messages_to_all(\"Warning: line #{n} is empty.<br>\", true) if line[0..24].all?(&:blank?)\n next if line[0..24].all?(&:blank?)\n\n @record = CsvRecord.new(line, @csvfile, @project)\n success, message, result = @record.extract_data_line(n)\n if result[:birth_place_flag].present? || result[:deleted_flag].present? || result[:individual_flag].present? || result[:location_flag].present? ||\n result[:name_flag].present? || result[:occupation_flag].present? || result[:address_flag].present? || result[:deleted_flag].present?\n result[:flag] = true\n else\n result[:flag] = false\n end\n result[:record_valid] = 'true' unless result[:error_messages].present? || result[:warning_messages].present? || result[:flag]\n data_records << result\n @csvfile.total_errors = @csvfile.total_errors + 1 if result[:error_messages].present?\n @csvfile.total_warnings = @csvfile.total_warnings + 1 if result[:warning_messages].present?\n @csvfile.total_info = @csvfile.total_info + 1 if result[:info_messages].present?\n @project.write_messages_to_all(message, true) unless success\n success = true\n data_lines = data_lines + 1\n end\n [success, data_lines, data_records]\n end", "def make_call_with_query query, page\n search_id = query.gsub('+', '__').gsub(':', '_')\n result_dir = \"github_search_results/#{search_id}\"\n `mkdir -p #{result_dir}`\n result_path = \"#{result_dir}/#{page}.json\"\n command = \"curl -H \\\"Accept: application/vnd.github.mercy-preview+json\\\" \\\"https://api.github.com/search/repositories?q=#{query}+language:swift&page=#{page}&per_page=100\\\"\"\n puts command\n json_result = `#{command}`\n parsed_json = JSON.parse(json_result)\n File.open(result_path, 'w') do |file|\n file << json_result\n end\n parsed_json['total_count'].to_i\nend", "def write(mph, minutes, incline=\"\", date: Time.now)\n Dir.mkdir(File.dirname(filepath)) unless Dir.exist?(File.dirname(filepath))\n File.open(filepath, 'a+') do |file|\n unless(file.readlines.include?(header(date.month, date.day)))\n file.puts header(date.month, date.day)\n end\n file.puts query(mph, minutes, incline, date: date)\n end\n end", "def download_benchmark_output\n if !ApplicationController.fire_cloud_client.services_available?('GoogleBuckets')\n head 503 and return\n end\n\n requested_file = ApplicationController.gcs_client.execute_gcloud_method(:get_workspace_file, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename])\n if requested_file.present?\n @signed_url = ApplicationController.gcs_client.execute_gcloud_method(:generate_signed_url, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename], expires: 15)\n redirect_to @signed_url\n else\n redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),\n alert: 'The file you requested was unavailable. Please try again.' and return\n end\n\n end", "def execute!\n query_params = {}\n query_params[:skip_header] = true if config[:skip_column_names]\n Request.new(resources_path, :query_params => query_params, :sign => config[:my]).get(headers).print(config)\n end", "def assert_result_matches(query, expected_result_file, filter_exp=nil, sort=false, qrserver_id=0, regexp_matching=false)\n result_xml = search(query, qrserver_id).xmldata\n expected_lines = []\n File.open(expected_result_file) do |file|\n expected_lines = file.readlines\n end\n\n @current_assert_file = expected_result_file\n assert_resultsets_match(result_xml.split(\"\\n\", -1), expected_lines, filter_exp, sort, regexp_matching)\n @current_assert_file = nil\n end", "def mysql_lines\n File.open(file_name, \"r\") do |line|\n #File.open('./lib/databasers/fibered_files_output.txt') do |line|\n line.each do |x|\n puts \"('\" + \"#{x.strip}\" + \"')\"\n end\n end\n end", "def download_problematic_rows\n import_job = ImportJob.find(params[:import_job_id])\n @output_csv_string = import_job.problem_rows_csv_string\n respond_to do |format|\n format.csv do\n filename = \"#{File.basename(import_job.file_name, '.csv')}-problematic_rows-#{Time.now.strftime(\"%Y%m%d\")}.csv\"\n if request.env['HTTP_USER_AGENT'] =~ /msie/i\n headers['Pragma'] = 'public'\n headers[\"Content-type\"] = \"text/plain\"\n headers['Cache-Control'] = 'no-cache, must-revalidate, post-check=0, pre-check=0'\n headers['Content-Disposition'] = \"attachment; filename=\\\"#{filename}\\\"\"\n headers['Expires'] = \"0\"\n else\n headers[\"Content-Type\"] ||= 'text/csv'\n headers[\"Content-Disposition\"] = \"attachment; filename=\\\"#{filename}\\\"\"\n end\n end\n end\n end", "def communicate_results(directory, results, skip_zip_results)\n if !skip_zip_results\n zip_results(directory)\n end\n\n if results.is_a? Hash\n # DLM: don't we want this in the results zip?\n # DLM: deprecate in favor of out.osw\n File.open(\"#{@options[:output_directory]}/data_point_out.json\", 'w') do |f|\n f << JSON.pretty_generate(results)\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n else\n # puts \"Unknown datapoint result type. Please handle #{results.class}\"\n end\n end", "def get_output(options={})\n if io = options.delete(:io)\n options = options.merge :response_block => lambda {|chunk, remaining_bytes, total_bytes| io.write chunk}\n end\n options['Range'] = options.delete :range\n service.get_job_output(vault.id, id, options)\n end", "def write_out(rows)\n File.open(file_name, 'w') do |f|\n f.puts rows\n end\n end", "def file_end(file, output)\n end", "def execute(query)\n TD::Api.client_execute(@td_client, query)\n end", "def create_rows_and_query(number_rows, number_query, str_length)\n File.open(\"../benchmark/benchmark_#{number_query}_queries.sql\", 'a+') do |file|\n CSV.open(\"./#{number_rows}_rows_data.csv\", 'a+') do |csv|\n number_rows.times do |time|\n random_str1 = random_str(str_length)\n csv << [time + 1, random_str1]\n file.write(\"select * from test_data where random_str = '#{random_str1}';\") if time < number_query\n end\n end\n end\n puts \"CREATE #{number_rows} ROWS DONE\"\nend", "def output_to_csv\n if (@values[:result] != nil)\n @additions << calculate_worktime\n filename = get_entry(\"Specify output file: \")\n p = Menu.data_handler.find_person_by_id(@values[:id])\n CSVWriter.output(filename, p, @values[:result], @additions)\n else\n puts \"Nothing to write right now.\"\n end\n end", "def skipped_lines; end", "def skipped_lines; end", "def get_session_line(output_file)\n @fields.each_index do |row|\n\n (row.to_f/2) == (row.to_f/2).to_i ? background_colour = '' : background_colour = 'bgcolor=\"#FFFFCC\"'\n output_file.puts indent1 + \"<tr #{background_colour}>\"\n\n row_data = @fields[row]\n session_id = \"<a href=\\\"..\\\\approved\\\\#{row_data[0]}\\\">#{row_data[0][0..-5]}</a>\"\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{session_id}</font></td>\"\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[1]}</font></td>\"\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[2]}</font></td>\"\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[3]}</font></td>\" if @include_switch['Duration']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[4]}</font></td>\" if @include_switch['C vs O']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[5]}</font></td>\" if @include_switch['C vs O']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[6]}</font></td>\" if @include_switch['TBS']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[7]}</font></td>\" if @include_switch['TBS']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[8]}</font></td>\" if @include_switch['TBS']\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[9]}</font></td>\"\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[10]}</font></td>\"\n num_testers = row_data[11].to_i\n if num_testers == 1\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{num_testers}</font></td>\"\n else\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\"><font color=\\\"red\\\">#{num_testers}</font></font></td>\"\n end\n output_file.puts indent1 + '</tr>'\n end\n end", "def download\n # headers for streaming suggested by:\n # https://coderwall.com/p/kad56a/streaming-large-data-responses-with-rails\n # and\n # https://github.com/felixbuenemann/xlsxtream/issues/14\n response.headers.delete(\"Content-Length\") # See one line above\n response.headers['X-Accel-Buffering'] = 'no' # Stop NGINX from buffering\n response.headers['Cache-Control'] = 'no-cache'\n \n # Headers for browser-handling\n response.headers['Content-Type'] = 'application/marcxml+xml'\n response.headers['Content-Disposition'] = \"attachment; filename=#{download_filename('xml')}\" \n \n # Setup Blacklight / Solr params\n params['page'] = 1\n params['rows'] = 100\n # params['fl'] = 'id,marc_display'\n params['source'] = active_source\n\n extra_params = {\n 'fl' => 'id,marc_display',\n 'sort' => 'id asc',\n 'stats' => false,\n 'facet' => false,\n }\n \n # Stream response\n stream = response.stream\n\n begin\n # XML Header - MARC XML collection open tag\n stream.write marcxml_header\n\n total = 0\n hits = params['rows']\n while hits >= params['rows'] && total < 10_000\n # # CLIO-level query\n # # search_engine = blacklight_search(params.to_unsafe_h)\n # # hits = search_engine.documents.count\n # # search_engine = blacklight_search(params.to_unsafe_h)\n # # hits = search_engine.documents.count\n # # total += hits\n # \n # # Blacklight-level query\n # # - doesn't include marc_display\n # # - doesn't allow over-riding 'fl' param\n # # search, documents = search_results(params)\n # # hits = documents.count\n # \n # # unapproved lower-level querying..\n # # builder = search_builder.with(params)\n # # builder.page = 1\n # # builder.rows = 1000\n # # response = repository.search(builder)\n \n # Need to use lower-level \"search_builder\", so that we \n # can override 'fl' param, to include marc_display\n query = search_builder.with(params).merge(extra_params)\n solr_response = repository.search(query)\n \n hits = solr_response.documents.count\n total += hits\n\n solr_response.documents.each do |solr_doc|\n # stream.write solr_doc['marc_display']\n # pretty-print - does this make reporting too slow?\n stream.write solr_doc['marc_display'].\n gsub(/<leader/, \"\\n <leader\").\n gsub(/<controlfield/, \"\\n <controlfield\").\n gsub(/<datafield/, \"\\n <datafield\").\n gsub(/<\\/datafield/, \"\\n </datafield\").\n gsub(/<subfield/, \"\\n <subfield\").\n gsub(/<\\/record/, \"\\n</record\")\n stream.write \"\\n\"\n end\n\n # increment page\n # extra_params['page'] = (extra_params['page'].to_i + 1).to_s\n params['page'] = (params['page'].to_i + 1).to_s\n end\n\n # close collection tag\n stream.write marcxml_footer\n\n ensure\n stream.close\n end\n \n end", "def process \n return false if @file == false\n\t\t\n\t\ttime = File.mtime(@file)\n\n\t\tRDF::NQuads::Writer.open(@outfile) do |writer|\n\t\t\n\t\trecord = RDF::URI.new(\"http://bio2rdf.org/sider\")\n\n File.open(@file,\"r\").each do |line|\n row = line.strip.chomp.split(\"\\t\")\n \n # convert the STICH id to pubchem (see NOTES)\n pubchem = @pubchem_compound[row[1].to_i.abs.to_s]\n writer << [pubchem,RDF.type,@sider_vocabulary['Drug'],record]\n writer << [pubchem,DC.title,row[3],record]\n writer << [pubchem,DC.identifier,\"pubchem:#{row[1].to_i.abs.to_s}\",record]\n \n # these identifiers should in the future be linked \n # with proper ontology URIS retrieved from NCBO bioportal.\n side_effect = @umls[row[2]]\n writer << [side_effect,RDF.type,@sider_vocabulary['Side_Effect'],record]\n writer << [side_effect,DC.identifier,\"ulms:#{row[2]}\",record]\n writer << [side_effect,DC.title,row[4],record]\n writer << [pubchem,@sider_vocabulary['side_effect'],side_effect,record]\n end\n end\n end", "def save_report\n\n # Parse the result with Nokogiri\n response = connect\n\n # Add the column headers to the file\n write_column_headers\n\n # Append the first batch of data to the file\n write_batch_data\n\n # Save the token for successive calls\n token = \"&token=\" + response[:token] || \"\"\n\n # Loop until the end of the query\n until response[:is_finished] === \"true\"\n response = connect(token)\n write_batch_data\n end\n\n end", "def finish_output(error = nil)\n\t\t\t\t\t\ttrailer = @output&.trailer\n\t\t\t\t\t\t\n\t\t\t\t\t\t@output = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\tif error\n\t\t\t\t\t\t\tsend_reset_stream(::Protocol::HTTP2::Error::INTERNAL_ERROR)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t# Write trailer?\n\t\t\t\t\t\t\tif trailer&.any?\n\t\t\t\t\t\t\t\tsend_headers(nil, trailer, ::Protocol::HTTP2::END_STREAM)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tsend_data(nil, ::Protocol::HTTP2::END_STREAM)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend", "def proccess_lines(input)\n CSV.foreach(input, headers: true, header_converters: :symbol) do |row|\n line_parser = LineParser.new(row)\n\n if line_parser.valid?\n output_file << line_parser.to_csv\n elsif !line_parser.empty?\n error_file << line_parser.to_csv\n end\n end\n end", "def skip_footer_lines(lines, buffer_size)\n return enum_for(:skip_footer_lines, lines, buffer_size) unless block_given?\n\n buffer = []\n lines.each do |line|\n buffer.unshift(line)\n\n yield buffer.pop if buffer.length > buffer_size\n end\n end", "def run_query(symbols, query, filter_proc=nil, sort_proc=nil)\n results = []\n if symbols.size > 100\n # create batches so that the GET has less than 4096 chars\n batches = symbols.size / 100 + 1\n (1..batches).each { |batch_id|\n index_start = (batch_id - 1) * 100\n index_end = (batch_id * 100) - 1\n index_end = symbols.size - 1 if index_end > (symbols.size - 1)\n logger.info(\"Running batch: #{index_start} - #{index_end} of #{symbols.size}\")\n q = query + 'symbol in (\"' + symbols[index_start..index_end].join('\",\"') + '\")'\n logger.debug(q)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(q))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.debug(response)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n }\n else\n query = query + 'symbol in (\"' + symbols.join('\",\"') + '\")'\n logger.info(query)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(query))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.info(response.inspect)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if j_response and j_response.has_key?'query' and j_response['query'].has_key?'results' and j_response['query']['results']\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n end\n end\n results.flatten!\n logger.debug(\"Final results before sort: #{results}\")\n results.sort!{ |a,b| sort_proc.call(a,b) } if sort_proc\n logger.debug(\"Final results after sort: #{results}\")\n results\n end", "def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end", "def execute\n\t\tresult = execute_request(get_resultcount, @skip)\n\n\t\t@data_xml = result[0]\n\t\t@result = result[1]\n\t\treturn self\n\tend", "def log_and_stream(output)\n write_file output, @filename if @filename\n @block.call(output)\n end", "def write_csv filename, fields = nil\n\n # By default all fields present in every row of output_data will be incorporated.\n if fields.nil?\n # Transform each output struct into a list of its keys, then take the intersection of each Array of keys.\n # This ensures that only fields present for all rows will be incorporated.\n fields = output_data.map{|o| o.to_h.keys}.inject do |last_keys, this_keys|\n last_keys & this_keys\n end\n end\n\n CSV.open filename, \"wb\", row_sep: \"\\r\\n\" do |csv|\n # Header line\n csv << fields\n\n output_data.each do |out|\n output_row = []\n fields.each do |field|\n output_row << out[field]\n end\n csv << output_row\n end\n end\n end", "def cmd_sparql_query\n options={}\n optparse = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file\"\n opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|\n options[:service]=uri\n end\n opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|\n options[:file]=file\n end\n opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],\n 'Set the output argument') do |type|\n options[:output]=type\n end\n opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], \n 'Set the accept header type') do |type|\n options[:accept]=type\n end\n options[:verbose] = false\n opts.on( '--post', 'Force use of POST' ) do\n options[:post] = true\n end\n opts.on( '-v', '--verbose', 'Verbose' ) do\n options[:verbose] = true\n end\n opts.on( '--version', 'Print version and exit' ) do\n print \"#{SOH_NAME} #{SOH_VERSION}\\n\"\n exit\n end \n opts.on( '-h', '--help', 'Display this screen and exit' ) do\n puts opts\n exit\n end\n end\n\n begin optparse.parse! \n rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e\n warn e\n exit 1\n end\n\n $verbose = options[:verbose]\n $print_http = $verbose\n usePOST = options[:post]\n\n service = options[:service]\n warn_exit 'No service specified. Required --service=URI',1 if service.nil?\n\n # Query\n query=nil\n query_file=options[:file]\n if query_file.nil? && ARGV.size == 0\n then\n warn_exit 'No query specified.',1\n end\n if query_file.nil?\n query = ARGV.shift\n if query.match(/^@/)\n query_file = query[1..-1]\n query = nil\n end\n end\n\n # --output ==> output= (non-standard)\n args={}\n case options[:output]\n when nil\n when \"json\",\"xml\",\"text\",\"csv\",\"tsv\"\n args['output'] = options[:output]\n when :json,:xml,:text,:csv,:tsv\n args['output'] = options[:output].to_s\n else\n warn_exit \"Unrecognized output type: \"+options[:output],2\n end\n\n # --accept\n # options[:accept]\n\n print \"SPARQL #{service}\\n\" if $verbose\n #args={\"output\"=>\"text\"}\n SPARQL_query(service, query, query_file, usePOST, args)\n exit(0)\nend", "def log_and_stream(output)\n write_file output, runlog_filename if runlog_filename\n return @block.call(output) unless @block.nil?\n \"\"\n end", "def process_sql(sql)\n url = URL.dup\n api_key = API_URL\n\n if @token\n http.headers[\"Authorization\"] = \"GoogleLogin auth=#{@token}\"\n end\n\n if sql =~ /^select/i\n url.query = \"sql=#{URI.escape(sql)}&key=#{api_key}&alt=csv\"\n res = http.request(url)\n else\n req = Net::HTTP::Post.new(url.path)\n req.set_form_data({:sql => sql, :key => api_key, :alt => csv})\n res = http.request(url, req)\n end\n\n res\n end", "def download_job(uuid, out_fn, username, password)\n puts \"Downloading data from job #{uuid} to #{out_fn}\"\n fail \"Output file exists!\" if File.exist?(out_fn)\n\n job = get_job(uuid, username, password)\n puts \"Job info:\"\n puts summarise_job(job, 2)\n puts \"\"\n\n # Download stuff.\n puts \"Retrieving index...\"\n index = get_json(job['results']['dataURL'], username, password, '')\n\n num_files = index['urlCount']\n puts \"Retrieving #{num_files} files...\"\n \n i = 0\n File.open(out_fn, 'w') do |out|\n index['urlList'].each do |url|\n i += 1\n print \" #{i} / #{num_files} (#{((i.to_f / num_files.to_f) * 100.0).round(2)}%) \\r\"\n\n begin\n # RAW HTTP get request\n res = Net::HTTP.get(URI(url))\n zlibr = Zlib::GzipReader.new(StringIO.new(res.to_s))\n out.puts zlibr.read\n rescue StandardError => e\n print \"\\n*** ERR on file #{i}, URL: #{url}\\n\"\n end\n \n end # /url iteration\n end # /file handle\n\n print \"Done\\n\"\nend", "def stream\n 10_000_000.times do |i|\n response.stream.write \"This is line#{i}\\n\"\n end\n ensure\n response.stream.close\n end", "def OLDview_data db, sql, options\n outputfile = options[:output_to]\n formatting = options[:formatting]\n headers = options[:headers]\n #str = db.get_data sql\n rs = db.execute_query sql\n str = rs.content\n columns = rs.columns\n #puts \"SQL: #{sql}.\\nstr: #{str.size}\"\n data = []\n if headers\n data << columns.join(\"\\t\")\n end\n str.each {|line| data << line.join(\"\\t\"); }\n #puts \"Rows: #{data.size}\"\n require 'tempfile'\n tmpfile = Tempfile.new('SQL.XXXXXX')\n filename = tmpfile.path\n filename = Shellwords.escape(filename)\n #puts \"Writing to #{filename}\"\n tmpfile.write(data.join(\"\\n\"))\n tmpfile.close # need to flush, otherwise write is buffered\n headerstr=nil\n if formatting\n headerstr = \"-H\" unless headers\n # sometimes this can be slow, and it can fault on UTF-8 chars\n system(\"cat #{filename} | term-table.rb #{headerstr} | sponge #{filename}\")\n end\n if outputfile\n #puts \"comes here\"\n system(\"cp #{filename} #{outputfile}\")\n filename = outputfile\n end\n system \"wc -l #{filename}\" if $opt_debug\n \n #system \"$EDITOR #{filename}\"\n system \"vim -c ':set nowrap' #{filename}\"\n tmpfile.close\n tmpfile.unlink\nend", "def run_tuples(query, options = {})\n GRel::Debugger.debug \"QUERYING SELECT...\"\n GRel::Debugger.debug query\n GRel::Debugger.debug \"** LIMIT #{@last_query_context.limit}\" if @last_query_context.limit\n GRel::Debugger.debug \"** OFFSET #{@last_query_context.offset}\" if @last_query_context.offset\n GRel::Debugger.debug \"----------------------\"\n args = {}\n args[:accept] = options[:accept] if options[:accept]\n args[:offset] = @last_query_context.offset if @last_query_context.offset\n args[:limit] = @last_query_context.limit if @last_query_context.limit\n @connection.query(@db_name,query, args).body\n end", "def output_vs_header(output_file)\n if $verbose_mode == 1\n puts \"Creating:\\tVSphere file \"+output_file\n end\n file=File.open(output_file, 'w')\n $q_order.each do |key|\n if $q_struct[key].type == \"output\"\n if !$q_struct[key].parameter.match(/[A-z]/)\n output=$q_struct[key].value+\"\\n\"\n else\n output=$q_struct[key].parameter+\" \"+$q_struct[key].value+\"\\n\"\n puts output\n end\n file.write(output)\n end\n end\n file.close\n return\nend", "def cleanupOutput()\n\tlines_array = IO.readlines(\"outputList.txt\")\n\n\toutputFile = File.open(\"outputListFinal.txt\", 'w')\n\tlines_array.each do |line|\n\t\tif line =~ /file '(.*)'/\n\t\t\tfilename = $1.to_s\n\t\t\tif(File.exist?(filename))\n\t\t\t\toutputFile.write(\"file '\"+filename+\"'\\n\")\n\t\t\tend\n\t\tend\n\tend\n\n\toutputFile.close\nend", "def parse_output_data(filepath)\n # NOPE!\nend", "def qvalues(target_files, decoy_files, opts={})\n min_pep_len = opts[:min_peptide_length]\n\n # we only want the top hit per query title (which should ensure that we\n # get the top hit per scan)\n (target_hits, decoy_hits) = [target_files, decoy_files].map do |files|\n hits_by_query_title = Hash.new {|h,k| h[k] = [] }\n files.each do |file| \n base_no_ext = File.basename(file, '.*')\n Ms::Mascot::Dat.open(file) do |dat|\n dat.each_peptide_hit(:by => :top, :yield_nil => false, :with_query => true) do |hit,query|\n\n hit_as_struct = MascotPeptideHit.new(base_no_ext, query.title, query.charge, hit.sequence, hit.score)\n hits_by_query_title[hit_as_struct.query_title] << hit_as_struct\n end\n end\n end\n\n final_hits = []\n hits_by_query_title.each do |title, hits|\n best_hit = \n if hits.size == 1\n hits.first\n else\n hits.sort_by(&:mowse).last\n end\n # FILTER HERE:\n # ONLY TAKE the BEST HIT IF it passes any filters\n if min_pep_len\n next unless best_hit.sequence.size >= min_pep_len\n end\n final_hits << best_hit\n end\n final_hits\n end\n pairs = Ms::ErrorRate::Qvalue.target_decoy_qvalues(target_hits, decoy_hits, opts, &:mowse)\n pairs.map do |hit, qval| \n hit.qvalue = qval \n hit\n end\n end", "def queryCSV(query)\n#\turi = URI.parse(\"http://127.0.0.1:9200/vccpe/_search?pretty\")\n#\trequest = Net::HTTP::Get.new(uri)\n#\trequest.basic_auth(\"logserver\", \"logserver\")\n#\trequest.body = JSON.dump({\n# \t\"size\" => 1,\n#\t\"sort\" => [\n#\t{\n#\t\"@timestamp\" => {\n#\t\"order\" => \"desc\"\n#\t}\n#\t}\n#\t],\n# \t\"query\" => {\n# \t\"filtered\" => {\n# \t\"query\" => {\n# \"query_string\" => {\n# \t\"query\" => \"#{query}\",\n# \"analyze_wildcard\" => true\n# }\n# \t},\n# \t\"filter\" => {\n# \"bool\" => {\n# \t\"must\" => [\n#\t{\n#\t\"range\" => {\n#\t\"@timestamp\" => {\n#\t\"lte\" => \"#{timestamp_id}\",\n#\t\"gt\" => \"#{timestamp_id_minus6m}\"\n#\t}\n#\t}\n#\t}\n#\t],\n# \t\"must_not\" => []\n# \t}\n# \t}\n# \t}\n# \t},\n# \t\"aggs\" => {\n# \t\"index\" => {\n# \t\"terms\" => {\n# \"field\" => \"_index\",\n# \"size\" => 1\n# \t}\n# \t},\n# \t\"uid\" => {\n# \t\"terms\" => {\n# \"field\" => \"_uid\",\n# \"size\" => 1\n# \t}\n# \t}\n# \t}\n#\t})\n\n\turi = URI.parse(\"http://127.0.0.1:9200/vccpe/_search?pretty\")\n\trequest = Net::HTTP::Get.new(uri)\n\trequest.basic_auth(\"logserver\", \"logserver\")\n\trequest.body = JSON.dump({\n \t\"size\" => 0,\n \t\"query\" => {\n \t\"filtered\" => {\n \t\"query\" => {\n \"query_string\" => {\n \t\"query\" => \"#{query}\",\n \"analyze_wildcard\" => true\n }\n \t},\n \t\"filter\" => {\n \"bool\" => {\n \t\"must\" => [],\n \t\"must_not\" => []\n \t}\n \t}\n \t}\n \t},\n \t\"aggs\" => {\n \t\"index\" => {\n \t\"terms\" => {\n \"field\" => \"_index\",\n \"size\" => 0\n \t}\n \t},\n \t\"uid\" => {\n \t\"terms\" => {\n \"field\" => \"_uid\",\n \"size\" => 0\n \t}\n \t}\n \t}\n\t})\n\n\treq_options = {\n\t\tuse_ssl: uri.scheme == \"https\",\n\t}\n\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n\t\thttp.request(request)\n\tend\n\n\t#puts response.body\n\t#jsonResponse = JSON.parse(response.body)\n\t#return jsonResponse[\"hits\"][\"hits\"][0][\"_source\"][\"status\"]\n\n\n\t#puts response.body\n\tjsonResponse = JSON.parse(response.body)\n\t#puts jsonResponse\n\t#information about index\n\tindex = jsonResponse[\"aggregations\"][\"index\"][\"buckets\"][0][\"key\"]\n\t#information about number of documents in index\n\tdoc_count = jsonResponse[\"aggregations\"][\"index\"][\"buckets\"][0][\"doc_count\"]\n\t#puts doc_count\n\t#concatenated messages from multiple documents\n\tmessageResponse = []\n\t#messageResponse = \"\"\n\tfor i in 0...doc_count\n\t\t#information about documents in index\n\t\ttypeAndId = jsonResponse[\"aggregations\"][\"uid\"][\"buckets\"][i][\"key\"].split('#')\n\n\t\turi = URI.parse(\"http://127.0.0.1:9200/#{index}/#{typeAndId[0]}/#{typeAndId[1]}?pretty\")\n\t\trequest = Net::HTTP::Get.new(uri)\n\t\trequest.basic_auth(\"logserver\", \"logserver\")\n\t\treq_options = {\n\t\t\tuse_ssl: uri.scheme == \"https\",\n\t\t}\n\n\t\tresponse = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n\t\t\thttp.request(request)\n\t\tend\n\n\t\t#puts JSON.parse(response.body)[\"_source\"][\"message\"]\n\t\tmessageResponse.push(JSON.parse(response.body)[\"_source\"][\"message\"])\n\t\t#messageResponse << JSON.parse(response.body)[\"_source\"][\"message\"]\n\tend\n\n\treturn messageResponse\nend", "def getStats(srvyFilename,qzFilename,excFilename,excDupRespFilename,excludedIDs,out_statsFilename)\n\n\tsrvyFile = File.new(srvyFilename,'r')\n\tquizFile = File.new(qzFilename,'r')\n\texc1File = File.new(excFilename,'r')\n\texc2File = File.new(excDupRespFilename,'r')\n\tstatsFile = File.new(out_statsFilename,'w')\n\t\n\ttotalUserIDs = {}\n\ttotalEntries = 0\n\texcludedEntries = 0\n\t\n\tlines_srvy = srvyFile.each_line\n\tlines_srvy.next\n\tlines_srvy.each do |l|\n\t\tl_arr = l.split(',').map(&:strip)\n\t\ttotalUserIDs[l_arr[1]] = 1\n\tend\n\t\n\tlines_quiz = quizFile.each_line\n\tlines_quiz.next\n\tlines_quiz.each do |l|\n\t\tl_arr = l.split('\",\"').map(&:strip)\n\t\ttotalUserIDs[l_arr[1]] = 1\n\t\ttotalEntries = totalEntries+1\n\tend\n\t\n\tlines_exc1 = exc1File.each_line\n\tlines_exc1.each do |l|\n\t\texcludedEntries = excludedEntries+1\n\tend\n\t\n\tlines_exc2 = exc2File.each_line\n\tlines_exc2.each do |l|\n\t\texcludedEntries = excludedEntries+1\n\tend\n\t\n\tentryPercentage = ((1.0-(excludedEntries.to_f/totalEntries.to_f))*100)\n\tparticipantPercentage = ((1.0-(excludedIDs.length.to_f/totalUserIDs.length.to_f))*100)\n\t\n\tputs \"Total Entries: \"+totalEntries.to_s\n\tputs \"Total Participants: \"+totalUserIDs.length.to_s\n\tputs\n\tputs \"Total Excluded Entries: \"+excludedEntries.to_s\n\tputs \"Total Excluded Participants: \"+excludedIDs.length.to_s\n\tputs\n\tputs \"Percentage of Entries Remaining: %0.3f%\" % [entryPercentage]\n\tputs \"Percentage of Participants Remaining: %0.3f%\" % [participantPercentage]\n\tputs\n\t\n\tstatsFile.puts(\"Total Entries: \"+totalEntries.to_s)\n\tstatsFile.puts(\"Total Participants: \"+totalUserIDs.length.to_s)\n\tstatsFile.puts()\n\tstatsFile.puts(\"Total Excluded Entries: \"+excludedEntries.to_s)\n\tstatsFile.puts(\"Total Excluded Participants: \"+excludedIDs.length.to_s)\n\tstatsFile.puts()\n\tstatsFile.puts(\"Percentage of Entries Remaining: %0.3f%\" % [entryPercentage])\n\tstatsFile.puts(\"Percentage of Participants Remaining: %0.3f%\" % [participantPercentage])\n\t\n\tsrvyFile.close\n\tquizFile.close\n\texc1File.close\n\texc2File.close\n\tstatsFile.close\n\t\nend", "def execute_query(sparql_query)\n puts \"Executing SPARQL Query: #{sparql_query} ...\"\n \n if sparql_query.include? \"DESCRIBE\"\n response = @repository.query(sparql_query, :result_type => RubySesame::DATA_TYPES[:N3]) \n puts response if @verbose\n end\n\n if sparql_query.include? \"SELECT\" \t\n response = @repository.query(sparql_query)\t\n puts response if @verbose\n end\n\n end", "def test_export_on_service\n stream = @service.create_export(QUERY)\n results = ResultsReader.new(stream).to_a()\n assert_equal(3, results.length())\n end", "def write_druid_response_to_file(output_path, druid_output)\n output_filename = druid_path(output_path)\n ensure_containing_dir(output_filename)\n File.open(output_filename, 'w') do |file|\n file.write(druid_output)\n end\n output_filename\n rescue StandardError => e\n Rails.logger.error(\"Unexpected error trying to write druid response to file: #{Util.exception_msg_and_backtrace_str(e)}\")\n end", "def should_log_scrubbed_query(input:, output:)\n queries = sql(input)\n\n expect(queries.join(\"\\n\")).to_not include(input)\n expect(queries.join(\"\\n\")).to include(output)\n end", "def analysis(fin, fout, fhint, furls, fdefmaps, fskip, franges)\n sort_col = 'authors'\n forks = ENV.has_key? 'INCLUDE_FORKS'\n unless forks\n require 'json'\n require 'octokit'\n require './ghapi'\n gcs = octokit_init()\n hint = rate_limit(gcs)[0]\n fork_data = {}\n $g_forks_file = ENV['FORKS_FILE'] if ENV.key? 'FORKS_FILE'\n begin\n data = JSON.parse File.read $g_forks_file\n data.each do |row|\n repo = row[0]\n is_fork = row[1]\n fork_data[repo] = is_fork\n end\n rescue => err\n STDERR.puts [err.class, err]\n end\n Signal.trap('INT') do\n puts \"Caught signal, saving forks cache\"\n pretty = JSON.pretty_generate fork_data\n File.write $g_forks_file, pretty\n puts \"Saved\"\n exit 1\n end\n end\n # Repos, Orgs and Projects to skip\n skip_repos = {}\n skip_orgs = {}\n skip_projs = {}\n CSV.foreach(fskip, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n org = (h['org'] || '').strip\n repo = (h['repo'] || '').strip\n proj = (h['project'] || '').strip\n if org.length > 0\n orgs = org.split(',')\n orgs.each do |o|\n if skip_orgs.key?(o)\n puts \"Duplicate skip org entry: #{o}\"\n return\n end\n skip_orgs[o] = true\n end\n end\n if repo.length > 0\n reps = repo.split(',')\n reps.each do |r|\n if skip_repos.key?(r)\n puts \"Duplicate skip repo entry: #{r}\"\n return\n end\n skip_repos[r] = true\n end\n end\n if proj.length > 0\n projs = proj.split(',')\n projs.each do |p|\n if skip_projs.key?(p)\n puts \"Duplicate skip project entry: #{p}\"\n return\n end\n skip_projs[p] = true\n end\n end\n end\n\n # Min/Max ranges for integer columns (with exceptions)\n ranges = {}\n CSV.foreach(franges, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n key = h['key'].strip\n min = h['min'].strip\n max = h['max'].strip\n exc = (h['exceptions'] || '').strip\n rps = {}\n ors = {}\n excs = exc.split(',')\n excs.each do |ex|\n next if ex == ''\n if ex.include?('/')\n if rps.key?(ex)\n puts \"Duplicate exception repo entry: #{ex}\"\n return\n end\n rps[ex] = true\n else\n if ors.key?(ex)\n puts \"Duplicate exception org entry: #{ex}\"\n return\n end\n ors[ex] = true\n end\n end\n if ranges.key?(key)\n puts \"Duplicate ranges key: #{key}\"\n return\n end\n ranges[key] = [min.to_i, max.to_i, ors, rps]\n end\n\n # Repo --> Project mapping\n hints_comments = []\n File.readlines(fhint).each do |line|\n hints_comments << line if line[0] == '#'\n end\n\n projects = {}\n CSV.foreach(fhint, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n proj = (h['project'] || '').strip\n repo = (h['repo'] || '').strip\n if proj == '' || repo == ''\n puts \"Invalid hint: project='#{proj}' repo='#{repo}'\"\n return\n end\n if projects.key?(repo)\n if projects[repo] != proj\n puts \"Non unique entry: projects: projects['#{repo}'] = '#{projects[repo]}', new value: #{proj}\"\n else\n puts \"Duplicate entry: projects: projects['#{repo}'] = '#{projects[repo]}'\"\n end\n return\n end\n projects[repo] = proj\n end\n\n # Sort hints files on the fly (program user manually updates that file while working so it should be sorted all the time)\n hdr = ['repo', 'project']\n CSV.open(fhint, \"w\", headers: hdr) do |csv|\n csv << hdr\n projects.keys.sort.each do |repo|\n csv << [repo, projects[repo]]\n end\n end\n\n File.open(fhint, 'a') do |file|\n hints_comments.sort.each { |comment| file.write(comment) }\n end\n\n # Project --> URL mapping (it uses final project name after all mappings, including defmaps.csv)\n urls_comments = []\n File.readlines(furls).each do |line|\n urls_comments << line if line[0] == '#'\n end\n\n urls = {}\n CSV.foreach(furls, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n proj = (h['project'] || '').strip\n url = (h['url'] || '').strip\n if proj == '' || url == ''\n puts \"Invalid URL: project='#{proj}' url='#{url}'\"\n return\n end\n if urls.key?(proj)\n if urls[proj] != url\n puts \"Non unique entry: urls: urls['#{proj}'] = '#{urls[proj]}', new value: #{url}\"\n else\n puts \"Duplicate entry: urls: urls['#{proj}'] = '#{urls[proj]}'\"\n end\n return\n end\n urls[proj] = url\n end\n\n # Sort URLs files on the fly (program user manually updates that file while working so it should be sorted all the time)\n hdr = ['project', 'url']\n CSV.open(furls, \"w\", headers: hdr) do |csv|\n csv << hdr\n urls.keys.sort.each do |project|\n csv << [project, urls[project]]\n end\n end\n\n File.open(furls, 'a') do |file|\n urls_comments.sort.each { |comment| file.write(comment) }\n end\n\n # Final name --> new name mapping (defmaps)\n # Used to create better names for projects auto generated just from org or repo name\n # And/Or to group multiple orgs, repos, projects or combinations of all into single project\n # For example we can create \"XYZ\" project for sum of \"Kubernetes\" and \"dotnet\" via:\n # name,project\n # Kubernetes,XYZ\n # dotnet,XYZ\n defmaps_comments = []\n File.readlines(fdefmaps).each do |line|\n defmaps_comments << line if line[0] == '#'\n end\n\n defmaps = {}\n skip_group = {}\n CSV.foreach(fdefmaps, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n name = (h['name'] || '').strip\n project = (h['project'] || '').strip\n if project == '' || name == ''\n puts \"Invalid defmap: project='#{project}' name='#{name}'\"\n return\n end\n\n # Handle skip groupping this org\n if project.downcase == '=skip'\n project = project[1..-1]\n if skip_group.key?(name)\n puts \"Duplicate entry: defmaps: skip_group['#{name}']\"\n return\n end\n skip_group[name] = true\n next\n end\n\n if defmaps.key?(name)\n if defmaps[name] != project\n puts \"Non unique entry: defmaps: defmaps['#{name}'] = '#{defmaps[name]}', new value: #{project}\"\n else\n puts \"Duplicate entry: defmaps: defmaps['#{name}'] = '#{defmaps[name]}'\"\n end\n return\n end\n defmaps[name] = project\n end\n\n # Sort defmaps files on the fly (program user manually updates that file while working so it should be sorted all the time)\n hdr = ['name', 'project']\n CSV.open(fdefmaps, \"w\", headers: hdr) do |csv|\n csv << hdr\n skip_group.keys.sort.each do |name|\n csv << [name, '=SKIP']\n end\n defmaps.keys.sort.each do |name|\n csv << [name, defmaps[name]]\n end\n end\n\n File.open(fdefmaps, 'a') do |file|\n defmaps_comments.sort.each { |comment| file.write(comment) }\n end\n\n # Missing URLs: will abort program: if somebody care to define some project (via hints, defmaps or whatever) then let's force him/her to define project URL as well\n # This won't complain about autogenerated projects (like sum of org repos etc)\n urls_found = true\n projects.values.uniq.each do |project|\n unless urls.key? project\n puts \"Project '#{project}' have no URL defined, aborting\"\n urls_found = false\n end\n end\n defmaps.values.uniq.each do |project|\n unless urls.key? project\n puts \"Defmap Project '#{project}' have no URL defined, aborting\"\n urls_found = false\n end\n end\n return unless urls_found\n\n # Analysis:\n # Get repo name from CSV row\n # If repo found in projects set mode to \"project\" and groupping\n # If project not found and \"org\" is present set mode to \"org\" and groupping\n # If mode not determined yet set it to repo\n # Now check if final project key (project, org or repo) is in additional mapping\n # Additional mapping is used to:\n # create better name for data groupped by org (when default is enough) like org = \"aspnet\" --> ASP.net\n # group multiple orgs and orgs with repos into single project\n orgs = {}\n project_counts = {}\n all_repos = {}\n n_rows = CSV.foreach(fin, headers: true).count\n CSV.foreach(fin, headers: true).with_index do |row, i|\n next if is_comment row\n h = row.to_h\n\n # skip repos & orgs\n repo = h['repo']\n unless forks\n hint, is_fork = is_fork?(gcs, hint, fork_data, repo, i, n_rows)\n next if is_fork\n end\n all_repos[repo] = true\n next if skip_repos.key? repo\n org = h['org']\n next if skip_orgs.key? org\n\n a = h['authors']\n if a[0] == '=' && a[1..-1].to_i > 0\n n = a[1..-1].to_i\n h['authors'] = (1..n).to_a.join(',')\n end\n a = h['authors_alt1']\n if a[0] == '=' && a[1..-1].to_i > 0\n n = a[1..-1].to_i\n h['authors_alt1'] = (1..n).to_a.join(',')\n end\n\n # skip by values ranges\n skip = false\n ranges.each do |key, value|\n min_v, max_v, ors, rps = *value\n next if ors.key? org\n next if rps.key? repo\n\n unless key == 'authors'\n v = h[key].to_i\n else\n v = h[key].split(',').uniq.count\n end\n if min_v > 0 && v < min_v\n skip = true\n break\n end\n if max_v > 0 && v > max_v\n skip = true\n break\n end\n end\n next if skip\n\n k = h['project'] = projects[repo]\n mode = nil\n if k\n project_counts[k] = [0, []] unless project_counts.key?(k)\n project_counts[k][0] += 1\n project_counts[k][1] << repo\n mode = 'project'\n end\n\n # Is this org defined to skip groupping?\n org = nil if skip_group.key? org\n\n k = org unless k\n mode = 'org' if k && !mode\n k = h['repo'] unless k\n next unless k\n mode = 'repo' unless mode\n if defmaps.key? k\n k = defmaps[k]\n mode = 'defmap'\n end\n h['project'] = k\n h['mode'] = mode\n next if skip_projs.key?(k)\n\n orgs[k] = { items: [] } unless orgs.key? k\n h.each do |p, v|\n vi = v.to_i\n vis = vi.to_s\n h[p] = vi if vis == v\n end\n orgs[k][:items] << h\n end\n\n unless forks\n pretty = JSON.pretty_generate fork_data\n File.write $g_forks_file, pretty\n end\n\n orgs.each do |name, org|\n org[:sum] = {}\n org[:items].each do |repo|\n repo.each do |k, v|\n if ['authors', 'authors_alt1'].include? k\n if org[:sum].key? k\n org[:sum][k] += ',' + v.to_s\n else\n org[:sum][k] = v.to_s\n end\n next\n end\n if v.is_a?(String)\n if repo['org'] && k == 'repo' && v.include?('/')\n v = v.split('/')[1]\n end\n if org[:sum].key? k\n v = '' if v.nil?\n org[:sum][k] = '' if org[:sum][k].nil?\n org[:sum][k] += '+' + v\n else\n org[:sum][k] = v \n end\n elsif v.is_a?(Integer)\n org[:sum][k] = 0 unless org[:sum].key? k\n binding.pry if org[:sum][k].nil?\n org[:sum][k] += v\n else\n org[:sum][k] = nil\n end\n end\n end\n new_org = org[:sum]['org'].to_s\n org[:sum]['org'] = new_org.split('+').uniq.join('+') if new_org\n new_prj = org[:sum]['project'].to_s\n org[:sum]['project'] = new_prj.split('+').uniq.join('+') if new_prj\n new_mode = org[:sum]['mode']\n org[:sum]['mode'] = new_mode.split('+').uniq.join('+') if new_mode\n org[:sum]['authors'] = org[:sum]['authors'].split(',').uniq.count\n if org[:sum]['authors'] < 1\n puts \"WARNING: data from BigQuery truncated, no authors on current org: #{org[:sum]['project']}\"\n alt1 = org[:sum]['authors_alt1'].split(',').uniq.count\n if alt1 > 1\n puts \"Alternate value used: #{alt1}\"\n org[:sum]['authors'] = alt1\n else\n puts \"Very Alternate value used: #{org[:sum]['authors_alt2']}\"\n org[:sum]['authors'] = org[:sum]['authors_alt2']\n end\n binding.pry\n end\n end\n\n # Sort by sort_col desc to get list of top projects\n orgs_arr = []\n orgs.each do |name, org|\n orgs_arr << [name, org[:sum][sort_col], org]\n end\n\n res = orgs_arr.sort_by { |item| -item[1] }\n\n # now create list of projects missing URL (`miss` variable to be seen in debugger)\n # but only display and stop in debugger if any missing URL in top 50\n # so if no URL is missing in Top 50 projects, it won't stop at this point, but missing URLs\n # for projects >50th will still be in `miss` variable\n no_url = false\n miss = []\n unmapped = {}\n ract = {}\n rcomm = {}\n rauth = {}\n rauth1 = {}\n rauth2 = {}\n rprs = {}\n riss = {}\n rpush = {}\n res.each_with_index do |item, index|\n sum = item[2][:sum]\n project = sum['project']\n ract[project] = item[2][:items].map { |i| [i['activity'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rcomm[project] = item[2][:items].map { |i| [i['commits'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rauth[project] = item[2][:items].map { |i| [i['authors'].split(',').uniq.count, i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rprs[project] = item[2][:items].map { |i| [i['prs'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n riss[project] = item[2][:items].map { |i| [i['issues'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rpush[project] = item[2][:items].map { |i| [i['pushes'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rauth1[project] = item[2][:items].map { |i| [i['authors_alt1'].split(',').uniq.count, i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rauth2[project] = item[2][:items].map { |i| [i['authors_alt2'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n if !urls.key?(project)\n s = \"Project ##{index} (#{sum['mode']}, #{sum[sort_col]}) #{project} (#{sum['org']}) (#{sum['repo']}) have no URL defined\"\n if index <= 50\n unmapped[project] = item[2][:items].map { |i| [i['activity'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| (\"%-8d\" % i[0]) + \" #{i[1]}\" }\n puts s\n no_url = true\n end\n miss << s\n sum['url'] = ''\n else\n sum['url'] = urls[project]\n end\n end\n puts \"Use `unmapped` to see what needs to be defined\" if no_url\n binding.pry if no_url\n\n puts 'res[0..30].map { |it| it[0] }'\n puts \"Defined projects: \"\n prjs = []\n project_counts.keys.sort.each do |k|\n prjs << \"#{k}: #{project_counts[k][0]}\"\n end\n prjs = prjs.join(', ')\n puts prjs\n\n # This is pretty print of what was found, it is displayed and program stops in debugger\n # To see all projects use `all variable` if ok type \"quit\" to exit debugger and save results\n puts \"Top:\"\n tops = res[0..40].map.with_index { |it, idx| \"#{idx}) #{it[0]} (#{it[2][:sum]['mode']} #{it[2][:sum]['url']}): #{it[1]} (#{it[2][:sum]['org']}) (#{it[2][:sum]['repo']})\" }\n all = res.map.with_index { |it, idx| \"#{idx}) #{it[0]} (#{it[2][:sum]['mode']} #{it[2][:sum]['url']}): #{it[1]} (#{it[2][:sum]['org']}) (#{it[2][:sum]['repo']})\" }\n puts tops\n puts \"`all` to see all data, `miss` to see missing project's urls, `ract['key'] to see `key`'s repos sorted by activity desc (also rcomm, rauth, rprs, riss, rpush for commits, authors, PRs, issues, pushes)\"\n puts \"Use `rauth[res[N][0]]` to examine what creates N-th top project, actually to have a good Top N data, You should define all data correctly for 0-N\"\n puts \"Or by project name `rauth[res[res.map { |i| i[0] }.index('project_name')][0]]`\"\n puts \"Project's index is: `res.map { |i| i[0] }.index('project_name')`, top N: `res.map { |i| i[0] }[0..N]`\"\n puts \"List of 'Google' repos that have > 10 authors: `rauth[res[res.map { |i| i[0] }.index('Google')][0]].select { |i| i.split(',')[1].to_i > 10 }.map { |i| i.split(',')[0] }.join(',')`\"\n puts \"See indices of projects contain something in name: `res.map.with_index { |e, i| [e, i] }.select { |e| e[0][0].include?('OpenStack') }.map { |e| \\\"\\#{e[1]} \\#{e[0][0]}\\\" }`\"\n puts \"Nice view Top 50: `res.map.with_index { |e,i| \\\"\\#{i+1} \\#{e[0]}\\\" }[0..49]`\"\n puts \"Dan loves it: `res[res.map { |i| i[0] }.index('Google Cloud')][2][:items].map { |i| [i['repo'], i['commits'], i['issues'], i['prs'], i['authors'].split(',').count] }.sort_by { |i| -i[1] }.map { |i| \\\"\\#{i[0]}, commits: \\#{i[1]}, issues: \\#{i[2]}, PRs: \\#{i[3]}, authors: \\#{i[4]}\\\" }`\"\n puts \"See Project's specific repo: `res[res.map { |i| i[0] }.index('openSUSE')][2][:items].select { |i| i['repo'] == 'openSUSE/kernel' }`\"\n puts \"Project's Repo's real authors count: `res[res.map { |i| i[0] }.index('openSUSE')][2][:items].select { |i| i['repo'] == 'openSUSE/kernel' }.first['authors'].split(',').count`\"\n puts 'Projects matching regexp: `res.map.with_index { |e, i| [e, i] }.select { |e| e[0][0].match(\"/cloud/i\".to_regexp) }.map { |e| \"#{e[1]} #{e[0][0]}\" }`'\n puts 'Projects and authors: `res.each_with_index.map { |r, i| [i+1, r[0], r[1]] }`'\n puts 'OpenStack analysis: `res.select { |r| r[0][0..8] == \\'OpenStack\\' }.map { |r| [r[0], r[1]] }`'\n\n binding.pry\n\n ks = res[0][2][:sum].keys - %w(mode authors_alt1 authors_alt2)\n CSV.open(fout, \"w\", headers: ks) do |csv|\n csv << ks\n res.each do |row|\n csv_row = []\n ks.each do |key|\n csv_row << row[2][:sum][key]\n end\n csv << csv_row\n end\n end\n\n CSV.open('reports/all_repos.csv', \"w\", headers: ['repo']) do |csv|\n csv << ['repo']\n all_repos.keys.sort.each do |repo|\n csv << [repo]\n end\n end\n\n # All projects summed\n return if res.count < 1\n numeric_keys = []\n res[0][2][:sum].keys.each do |key|\n obj = res[0][2][:sum]\n numeric_keys << key if obj[key].to_i.to_s == obj[key].to_s\n end\n numeric_keys -= %w(authors_alt1 authors_alt2)\n\n sum_proj = {}\n res.each do |proj|\n numeric_keys.each do |key|\n sum_proj[key] = 0 unless sum_proj.key?(key)\n sum_proj[key] += proj[2][:sum][key].to_i\n end\n end\n numeric_keys.each do |key1|\n numeric_keys.each do |key2|\n next if key1 == key2\n key = \"#{key1}/#{key2}\"\n sum_proj[key] = sum_proj[key2] == 0 ? Float::NAN : (sum_proj[key1].to_f / sum_proj[key2].to_f).round(4)\n end\n end\n\n # Save all projects summed numeric values and their ratios\n hdr = %w(key value)\n CSV.open('reports/sumall.csv', \"w\", headers: hdr) do |csv|\n csv << hdr\n sum_proj.each do |key, value|\n csv << [key, value]\n end\n end\nend", "def filter_orig_by_output(orig:, output:)\n records_to_reject = output.\n map{|a| a[:name]}\n .select do |a|\n # matching_o = output.select do |b|\n # a == b[:name]\n # end\n\n # if matching_o.count > 1\n # flunk(\"something wrong, output_row contains the same record more than once\")\n # else\n # matching_o = matching_o.first\n # end\n\n # reject_this_one = matching_o[:req_id].present? &&\n # matching_o[:ritm_id].present? &&\n # matching_o[:task_id].present?\n end\n\n flunk(\"not implemented yet\")\n orig.reject{|b| records_to_reject.include? b[:short_description]}\n end", "def expect_no_output(output)\n if output.respond_to?(:~)\n @review.wont_match(output)\n else\n @review.wont_include(output)\n end\n end", "def build_output(query, ori_query, res, sim, offset)\n return { requested_query: query, \n original_query: ori_query, \n offset: offset,\n uri: res[:uri], \n label: res[:label], \n sim: sim,\n }\n\tend", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def streaming_statement cmd, hdfs, files\n puts 'Streaming statement:'\n stmt = \"#{@hadoop_cmd} jar #{@streaming_jar} \" <<\n \"-files #{files.map { |f| \"#{File.join @fs_default_name, hdfs, f}\" }.join ','} \" <<\n \"-input #{File.join @fs_default_name, hdfs, 'hadoop-samtools-streaming-input.txt'} \" <<\n \"-output \\\"#{File.join hdfs, 'hadoop-samtools-' + cmd.split(/\\s+/)[0] + '_' + Time.now.to_s.split(/\\s+/).first(2).join.chars.keep_if { |c| c=~ /\\d/ }.join}\\\" \" <<\n \"-mapper \\\"#{@samtools} #{cmd}\\\" \" <<\n \"-reducer NONE\"\n puts stmt\n stmt\n end", "def search_port(exploits_array, query)\n search_results=[]\n exploits_array.each do |line|\n line = line.unpack('C*').pack('U*') if !line.valid_encoding?\n if line =~ /(\\\".+,.+\\\")/ \n crappy_csv_line = $1\n not_as_crappy_csv_line = crappy_csv_line.sub(\",\", \"\")\n workable_csv_line = line.sub!(\"#{crappy_csv_line}\",\"#{not_as_crappy_csv_line}\").split(\",\")\n else\n workable_csv_line = line.split(\",\")\n end\n foo = workable_csv_line - workable_csv_line.slice(0,5)\n foobar = foo - workable_csv_line.slice(-1, 1) - workable_csv_line.slice(-2, 1)\n if query == 'nil'\n search_results << line\n else\n if not workable_csv_line[-1].nil?\n search_results << line if \"#{workable_csv_line[-1].downcase}\" =~ /#{query}/i\n end\n end\n end\n return search_results\nend", "def process_externals_lines\n File.open(file_name, \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n puts line.to_textual\n sleep(0.01)\n end\n end\n end", "def query(query_definition)\n return\n end", "def writeFile\n File.open(ARGV[1], \"w+\") do |f|\n $results.each{\n |result|\n f.puts(result)\n }\n end\nend", "def print_google_map_data(options={})\n options={ header: false,\n }.merge(options)\n \n puts CSV.generate_line(@output_fields.values) if options[:header]\n \n \n @final_data.each do |record|\n if @command_options[:elders_only]\n # remove spouse name if possible to make elder easier to find..\n name = record[:name].gsub(/& \\w+ /, \"\")\n # check against 2 lists of elders in case names don't match\n if [email protected]?(name) and [email protected]?(name)\n next\n end\n end\n if record[:name].nil?\n next\n end\n \n record_values=[]\n @output_fields.each_key do |field|\n record_values.push(record[field])\n end\n line = CSV.generate_line(record_values)\n \n # print line to output\n puts line\n end\nend", "def exec(query_hash)\n outputs[:exercises] = []\n OpenStax::Exercises::V1.exercises(query_hash)['items'].each do |wrapper|\n exercise = Content::Models::Exercise.find_or_initialize_by(url: wrapper.url)\n uid = wrapper.uid\n number_version = uid.split('@')\n exercise.number = number_version.first\n exercise.version = number_version.last\n exercise.title = wrapper.title\n exercise.content = wrapper.content\n exercise.save\n transfer_errors_from(exercise, {type: :verbatim}, true)\n\n lo_tags = wrapper.los\n non_lo_tags = wrapper.tags - lo_tags\n run(:tag, exercise, lo_tags, tag_type: :lo)\n run(:tag, exercise, non_lo_tags)\n\n outputs[:exercises] << exercise\n end\n end", "def output_ks_header(options,output_file)\n tmp_file = \"/tmp/ks_\"+options['name']\n file=File.open(tmp_file, 'w')\n options['q_order'].each do |key|\n if options['q_struct'][key].type.match(/output/)\n if not options['q_struct'][key].parameter.match(/[a-z,A-Z]/)\n output = options['q_struct'][key].value+\"\\n\"\n else\n output = options['q_struct'][key].parameter+\" \"+options['q_struct'][key].value+\"\\n\"\n end\n file.write(output)\n end\n end\n file.close\n message = \"Creating:\\tKickstart file \"+output_file\n command = \"cp #{tmp_file} #{output_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n return\nend", "def split_document_txt_by_line_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SplitDocumentApi.split_document_txt_by_line ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling SplitDocumentApi.split_document_txt_by_line\"\n end\n # resource path\n local_var_path = '/convert/split/txt/by-line'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SplitTextDocumentByLinesResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SplitDocumentApi#split_document_txt_by_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.6028171", "0.5739844", "0.5531127", "0.5428932", "0.5326213", "0.5306126", "0.53000873", "0.5140424", "0.51161087", "0.5101366", "0.50569564", "0.50442004", "0.50104123", "0.49411508", "0.4894905", "0.48860353", "0.48815703", "0.48299485", "0.4767706", "0.47452787", "0.47176626", "0.46891293", "0.4675471", "0.46609843", "0.46558073", "0.4649599", "0.4616919", "0.45994002", "0.45975336", "0.45246154", "0.45174268", "0.4508493", "0.45055628", "0.44887924", "0.44501397", "0.4439581", "0.4436829", "0.44225854", "0.44217998", "0.44168293", "0.44117537", "0.4401866", "0.43983713", "0.43969506", "0.43847406", "0.43842638", "0.43707547", "0.43586922", "0.4347963", "0.43409577", "0.4329212", "0.43239695", "0.43229482", "0.43003055", "0.43000966", "0.42969283", "0.42969283", "0.42779452", "0.42756823", "0.42554653", "0.4254438", "0.42520127", "0.42486063", "0.4248442", "0.4247509", "0.4236715", "0.4231451", "0.42160872", "0.421443", "0.4213307", "0.42124116", "0.421021", "0.42094126", "0.42073065", "0.42039818", "0.42013973", "0.4199725", "0.4197243", "0.41886115", "0.4187916", "0.41766042", "0.4173868", "0.41640207", "0.41636816", "0.41602337", "0.41590372", "0.4154728", "0.41516075", "0.41500655", "0.4148084", "0.41479954", "0.41479054", "0.4142558", "0.41356865", "0.41328892", "0.41313133", "0.4130379", "0.41298658", "0.41297445", "0.41256756" ]
0.81314886
0
Execute 'query' and return the response, reversed linebyline, as an array. 'skip_lines' specifies which lines to exclude, where skip_lines[1] indicates the first line of the (unreversed) response. precondition: query != nil && ! skip_lines.nil?
def reversed_response(skip_lines) if query then begin open(query) do |f| i = 1 f.each_line do |l| if i == 1 then if bad_data_match(l) or first_line.empty? then raise "Bad or no data [#{first_line}]" end end if ! skip_lines[i] then @response_lines << l.chomp end i += 1 end end rescue OpenURI::HTTPError => error @fatal_error = true response = error.io @error_message = "status: #{response.status}, error: #{response.string}" end end result = [] if ! @fatal_error then current_line_index = 1 if @filter_function != nil then (0 .. response_lines.count - 1).reverse_each do |i| result << @filter_function.call(response_lines[i], current_line_index) current_line_index += 1 end else (0 .. response_lines.count - 1).reverse_each do |i| result << response_lines[i] end end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_response(output_file, skip_lines = {})\n begin\n open(query) do |f|\n current_line_index = 1\n # Process (output, if appropriate) the first line:\n first_line = f.readline\n if bad_data_match(first_line) or first_line.empty? then\n raise \"Bad or no data [#{first_line}]\"\n end\n if first_line && ! skip_lines[current_line_index] then\n if @filter_function != nil then\n first_line << @filter_function.call(first_line, current_line_index)\n end\n if ! first_line.nil? then\n output_file.write(first_line)\n end\n end\n if ! f.eof? then\n current_line_index += 1\n f.each_line do |l|\n if @filter_function != nil then\n if ! skip_lines[current_line_index] then\n filtered_line = @filter_function.call(l, current_line_index)\n if ! filtered_line.empty? then\n output_file.write(filtered_line)\n end\n end\n else\n if ! skip_lines[current_line_index] then\n output_file.write(l)\n end\n end\n current_line_index += 1\n end\n end\n end\n rescue StandardError => error\n @fatal_error = true\n @error_message = error.to_s\n end\n end", "def output_reversed_response(output_file, skip_lines)\n output_file.write(reversed_response(skip_lines).join(\"\\n\") + \"\\n\")\n end", "def old_query # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n data = []\n\n query_result = generic_query(params: { 'source-id': 'datacite-usage', 'doi': @doi })\n data += query_result['data'] if query_result['data']\n\n while query_result['links']['next']\n query_result = make_reliable { RestClient.get query_result['links']['next'] }\n query_result = JSON.parse(query_result)\n data += query_result['data'] if query_result['data']\n end\n\n data\n rescue RestClient::ExceptionWithResponse => err\n logger.error(\"#{Time.new} Could not get response from DataCite event data source-id=datacite-usage&doi=#{CGI.escape(@doi)}\")\n logger.error(\"#{Time.new} #{err}\")\n []\n end", "def reverse_rows!\n @data = skip_headers &:reverse\n end", "def yield_skip_page_r(unit, total_rows, start_page=1, query_opts) # :yields: limit, skip, page, max_page, new_query_opts\n opts = query_opts.dup\n limit = unit\n\n # swaping +startkey+, +endkey+ and \"descending\" options.\n case \"#{opts.has_key?('startkey')}.#{opts.has_key?('endkey')}\"\n when \"true.true\"\n opts[\"startkey\"] = query_opts[\"endkey\"]\n opts[\"endkey\"] = query_opts[\"startkey\"]\n when \"true.false\"\n opts[\"endkey\"] = opts[\"startkey\"]\n opts.delete(\"startkey\")\n when \"false.true\"\n opts[\"startkey\"] = opts[\"endkey\"]\n opts.delete(\"endkey\")\n end\n if opts.has_key?(\"descending\")\n opts[\"descending\"] = (opts[\"descending\"].to_s == \"true\") ? \"false\" : \"true\"\n else\n opts[\"descending\"] = \"true\"\n end\n \n max_page = (total_rows.to_f / limit.to_f).ceil\n \n sanitized_start_page = start_page > 0 ? start_page : 1\n page = (max_page - sanitized_start_page + 1)\n page = 1 if page < 1 ## 'page' must be greater than one, even though max_page is zero.\n skip = total_rows - (limit * (max_page - page + 1))\n skip = total_rows if skip > total_rows\n skip = 0 if skip < 0\n \n $stderr.puts \"[debug] yield_skip_page_r() sanitized_start_page=#{sanitized_start_page},skip=#{skip},page=#{page}\" if @debug\n \n while page >= 1\n $stderr.puts \"[debug] yield_skip_page_r() skip=#{skip},page=#{page},max_page=#{max_page}\" if @debug\n if skip == 0\n tmp_limit = total_rows % limit\n tmp_limit = limit if tmp_limit == 0\n yield [tmp_limit, skip, page, max_page, opts]\n else\n yield [limit, skip, page, max_page, opts]\n end\n page -= 1\n # skip = limit * (page - 1)\n skip -= limit\n skip = 0 if skip < 0\n end\n end", "def get_results(query, conditions, order)\n query_call = \"select * from #{domain} \"\n query_call << \"where #{conditions.compact.join(' and ')}\" if conditions.length > 0\n query_call << \" #{order}\"\n if query.limit!=nil\n query_limit = query.limit\n query_call << \" limit #{query.limit}\" \n else\n #on large items force the max limit\n query_limit = 999999999 #TODO hack for query.limit being nil\n #query_call << \" limit 2500\" #this doesn't work with continuation keys as it halts at the limit passed not just a limit per query.\n end\n results = sdb.select(query_call)\n \n sdb_continuation_key = results[:next_token]\n while (sdb_continuation_key!=nil && results[:items].length < query_limit)do\n old_results = results\n results = sdb.select(query_call, sdb_continuation_key)\n results[:items] = old_results[:items] + results[:items]\n sdb_continuation_key = results[:next_token]\n end\n\n results = results[:items][0...query_limit]\n end", "def process_skipped_lines(lines); end", "def trim_results(results, line_prefix)\n return results unless line_prefix\n\n results.each_with_index do |row, i|\n return results.drop(i + 1) if row.start_with? line_prefix\n end\n\n results\n end", "def mqlread(query, options = {})\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end", "def skipped_records\n [\n \"1160682\", # Example for custom titles/authors\n \"345682\", # Example for custom rights.\n \"10068705\", # Example for 'parts' in 740 field.\n \"2068747\" # Example for Cicognara CSV ingest - has since changed from cico: to dcl: since it's done in production.\n ]\nend", "def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end", "def stream_response(couch_response)\n\n # Should be asked to read lines from mocked_response\n line_reader_class = Class.new do\n def self.read_body(response)\n response.each do |line|\n yield line\n end\n end\n end\n\n # Collect the rows found\n rows = []\n callback = lambda { |line, idx|\n rows.push line\n }\n\n # Finally, set up the mixin class\n view_mixin = Class.new do\n include ViewStreamingResponseMixin\n end.new\n view_mixin.row_callback = callback\n\n # Run the streaming method\n non_row_body = view_mixin.ViewStreamingResponseMixin_stream_response(\n line_reader_class, couch_response.lines, callback)\n\n return rows, non_row_body\n\n end", "def run_query(symbols, query, filter_proc=nil, sort_proc=nil)\n results = []\n if symbols.size > 100\n # create batches so that the GET has less than 4096 chars\n batches = symbols.size / 100 + 1\n (1..batches).each { |batch_id|\n index_start = (batch_id - 1) * 100\n index_end = (batch_id * 100) - 1\n index_end = symbols.size - 1 if index_end > (symbols.size - 1)\n logger.info(\"Running batch: #{index_start} - #{index_end} of #{symbols.size}\")\n q = query + 'symbol in (\"' + symbols[index_start..index_end].join('\",\"') + '\")'\n logger.debug(q)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(q))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.debug(response)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n }\n else\n query = query + 'symbol in (\"' + symbols.join('\",\"') + '\")'\n logger.info(query)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(query))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.info(response.inspect)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if j_response and j_response.has_key?'query' and j_response['query'].has_key?'results' and j_response['query']['results']\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n end\n end\n results.flatten!\n logger.debug(\"Final results before sort: #{results}\")\n results.sort!{ |a,b| sort_proc.call(a,b) } if sort_proc\n logger.debug(\"Final results after sort: #{results}\")\n results\n end", "def discard_results; end", "def query(query)\n raw_query(query).map do |row|\n row = row.map do |item| \n # If the row entry is a String, it is the result already, and not, as \n # Neo4j.build would expect, the URL of a Neo4j node or relationship. The\n # same is true for all non-hashes.\n next item unless item.is_a?(Hash)\n build_from_hash(item)\n end\n \n row = row.first if row.length == 1\n row\n end\n end", "def ViewStreamingResponseMixin_stream_response(line_reader_class, response, callback)\n non_row_body = ''\n row_idx = 0\n line_reader_class.read_body response do |line|\n line = line.strip\n if line.start_with? '{\"key\":' or line.start_with? '{\"id\":'\n # A result row; send to the callback\n callback.call JSON.parse(line.chomp(',')), row_idx\n row_idx += 1\n else\n # Not a row, it goes into the main return value\n non_row_body += line\n end\n end\n non_row_body\n end", "def skippable_rows\n @skip_table.values.select { |a| a.is_a?(Array) }.flatten\n end", "def skip_footer_lines(lines, buffer_size)\n return enum_for(:skip_footer_lines, lines, buffer_size) unless block_given?\n\n buffer = []\n lines.each do |line|\n buffer.unshift(line)\n\n yield buffer.pop if buffer.length > buffer_size\n end\n end", "def skip_rows!\n if skip > 0\n local_copy.in_place :tail, \"+#{skip + 1}\"\n end\n end", "def raw_query(query) #:nodoc:\n logger.benchmark \"cypher: #{query}\" do\n result = connection.execute_query(query)\n if result\n result[\"data\"]\n else\n []\n end\n end\n end", "def query(iText)\n rRows = []\n\n @CallsList << [ 'query', iText ]\n if (@DummyAnswers[@IdxAnswers] == nil)\n @CallsList << [ 'error', \"Query \\\"#{iText}\\\" was supposed to return rows, but none were prepared by the WEACE regression.\" ]\n else\n rRows = @DummyAnswers[@IdxAnswers]\n @IdxAnswers += 1\n end\n\n return rRows\n end", "def map_processed_lines(response)\n end", "def skipped_lines\n @skipped_lines ||= lines.select(&:skipped?)\n end", "def search_port(exploits_array, query)\n search_results=[]\n exploits_array.each do |line|\n line = line.unpack('C*').pack('U*') if !line.valid_encoding?\n if line =~ /(\\\".+,.+\\\")/ \n crappy_csv_line = $1\n not_as_crappy_csv_line = crappy_csv_line.sub(\",\", \"\")\n workable_csv_line = line.sub!(\"#{crappy_csv_line}\",\"#{not_as_crappy_csv_line}\").split(\",\")\n else\n workable_csv_line = line.split(\",\")\n end\n foo = workable_csv_line - workable_csv_line.slice(0,5)\n foobar = foo - workable_csv_line.slice(-1, 1) - workable_csv_line.slice(-2, 1)\n if query == 'nil'\n search_results << line\n else\n if not workable_csv_line[-1].nil?\n search_results << line if \"#{workable_csv_line[-1].downcase}\" =~ /#{query}/i\n end\n end\n end\n return search_results\nend", "def drillthrough(query)\n RowSet.new @connection.create_statement.execute_query(query.to_s)\n end", "def skipped_lines; end", "def skipped_lines; end", "def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend", "def query_multiple_results(query_string, provided_client = nil)\n results = with_client(provided_client) do |client|\n result = []\n result << client.query(query_string)\n result << client.store_result while client.next_result\n result.compact\n end\n\n results.map(&:to_a)\n end", "def query_wayback(query)\n url = \"http://web.archive.org/cdx/search/cdx?url=*.#{query}&output=json&fl=original&collapse=urlkey\"\n\n begin\n response = http_get_body(url)\n json = JSON.parse(response) # if nothing is parsed it returns an empty array\n rescue JSON::ParserError\n _log_error 'Unable to parse JSON response.'\n end\n\n json\n\n end", "def assert_not_result_matches(query, expected_result_file, filter_exp=nil, sort=nil, qrserver_id=0)\n result_xml = search(query, qrserver_id).xmldata\n expected_lines = []\n File.open(expected_result_file) do |file|\n expected_lines = file.readlines\n end\n @current_assert_file = expected_result_file\n assert_not_resultsets_match(result_xml.split(\"\\n\", -1), expected_lines, filter_exp, sort)\n @current_assert_file = nil\n end", "def uncovered_lines(results)\n results.fetch(:lines)\n .each_with_index\n .select { |c, _| c == 0 }\n .map { |_, i| i }\n .compact\n end", "def process_query\n @results = str_to_obj.flatten.collect do |url|\n doc = Mechanize.new.get(url)\n els = doc.search(CGI.unescape(@xpath))\n els.map { |el| [el.text] }\n end\n @results = @results.flatten.map { |r| [r] }\n end", "def unlines\n join $RS\n end", "def read(query)\n fields = query.fields\n types = fields.map { |property| property.primitive }\n\n statement, bind_values = select_statement(query)\n\n records = []\n\n with_connection do |connection|\n command = connection.create_command(statement)\n command.set_types(types)\n\n reader = command.execute_reader(*bind_values)\n\n begin\n while reader.next!\n records << fields.zip(reader.values).to_hash\n end\n ensure\n reader.close\n end\n end\n\n records\n end", "def get_text_lines(remotefile, &block) # :yield: line\n lines = []\n retrlines(\"RETR \" + remotefile) do |line|\n if block\n yield(line)\n else\n lines << line\n end\n end\n lines\n end", "def read_request(client)\n lines = []\n\n while (line = client.gets) # Read the request and collect it until it's empty\n break if !line\n line = line.chomp\n break if line.empty?\n lines << line\n end\n\n return lines\nend", "def get_query_batches(customer_po, \n count = 100000)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/queryBatches'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'customerPO' => customer_po,\n 'count' => count\n }\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 = @http_client.get _query_url, headers: _headers\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return QueryBatchesResponseModel.from_hash(decoded)\n end", "def skip()\n lines = send_message(\"SKIP\", message)\n end", "def ruling_lines\n get_ruling_lines!\n end", "def results(query, reverse = false)\n raise NotImplementedError.new\n end", "def skip(options)\n blank = options[:blank]\n max_blanks_to_skip = options[:number]\n # min = options[:min] # only valid if :blank\n # max = options[:max] # only valid if :blank\n row = options[:row] || @current_row\n column = options[:column] || @current_column\n \n return [nil, nil] if row.nil? or row < 1 or row > @document.lines.length\n line = @document.lines[row - 1] \n return nil if column < 1 or line.length < column \n \n if blank\n number_skipped = 0\n max_blanks_to_skip = 200 if max_blanks_to_skip.nil?\n while ((line.length >= column) && !(blank ^ BLANK_CHARS.include?(line[column - 1])) && number_skipped < max_blanks_to_skip)\n column += 1\n number_skipped += 1\n end\n end \n \n if line.length < column\n return nil\n else\n return [@current_row = row, @current_column = column]\n end\n \n end", "def stream_response_lines(response, &block)\n last_line = \"\"\n\n response.read_body do |chunk|\n chunk_lines = (last_line + chunk).lines\n # This could end with half a line, so save it for next time. If\n # chunk_lines is empty, pop returns nil, so this also ensures last_line\n # is always a string.\n last_line = chunk_lines.pop || \"\"\n chunk_lines.each(&block)\n end\n\n yield last_line unless last_line.empty?\n end", "def query_response(offset = 0)\n query = \"#{@query}&$offset=#{offset}\"\n return self.class.get(query).parsed_response\n end", "def skipped_lines\n to_a.map(&:skipped_lines).inject(:+)\n end", "def get_non_custom_lines\n message = Message.find(params[:message_id])\n\n # on landing page if custom line within distance then fetch all its non custom lines + All non custom lines created on Own custom line.\n # if not within distance then fetch only followed lines\n if params[:is_landing_page] == 'true'\n # check this message within 15 yards. if yes it means its all non custom lines are within distance\n # so fetch all non custom line messages\n # Get all non custom lines created on Own custom line.\n undercover_messages = [message]\n\n messages = Undercover::CheckNear.new(\n params[:post_code],\n params[:lng],\n params[:lat],\n current_user,\n undercover_messages\n ).perform\n\n if messages.length > 0 || message.user_id = current_user.id\n non_custom_lines = message.non_custom_lines\n\n non_custom_line_ids = non_custom_lines.map(&:id)\n non_custom_lines = Message.by_ids(non_custom_line_ids)\n .where.not('(public = false and locked = false)')\n else\n # Only get followed custom lines\n followed_messages = FollowedMessage.where(user_id: current_user)\n followed_message_ids = followed_messages.map(&:message_id)\n\n non_custom_line_messages = message.non_custom_lines\n custom_line_ids = non_custom_line_messages.map(&:id)\n\n # Get common elements from both array\n final_message_ids = followed_message_ids & custom_line_ids\n\n non_custom_lines = Message.by_ids(final_message_ids)\n .where.not('(public = false and locked = false)')\n end \n else\n non_custom_lines = message.non_custom_lines \n end\n\n render json: {\n messages: non_custom_lines.as_json(\n methods: %i[\n avatar_url image_urls video_urls like_by_user legendary_by_user user\n text_with_links post_url expire_at has_expired is_synced\n locked_by_user is_followed is_connected line_locked_by_user\n ],\n include: [\n :custom_line,:non_custom_lines\n ] \n )\n }\n end", "def fetch_all_portions(query, fields)\n portions = []\n loop do\n portion = ResponsePortion.new(fetch_json(query), fields)\n portions << portion\n return portions if portion.exhaustive_for?(query)\n\n query[:before] = portion.last_item_creation_time\n end\n end", "def read(query)\n return [] unless query.valid?\n query.model.load(adapter.read(query), query)\n end", "def parse_skipline\n s0 = @scanner.pos\n s1 = match_str('#')\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_nonls\n s3 = parse_newline\n s0 = if s3 == :failed\n @scanner.pos = s0\n :failed\n else\n [s1, s2, s3]\n end\n end\n s0\n end", "def get_all(*path, query: nil, api_v1: true)\n query = {} if query.nil?\n query[:limit] = 250\n body = {}\n\n [].tap do |body_values|\n until body[\"isLastPage\"] == true do\n url = encode_url(\n path: path,\n query: query,\n api_v1: api_v1\n )\n\n body = faraday_safe(:get, url).body\n body_values.concat(body[\"values\"])\n\n query[:start] = body[\"nextPageStart\"]\n end\n end\n end", "def fetch_parsed_response(query, reverse = false)\n if doc = fetch_raw_response(query, reverse)\n ActiveSupport::JSON.decode(doc)\n end\n end", "def paged_api_request(url, pages = config(:mirror_history_pages_back),\n last = nil)\n\n url = ensure_max_per_page(url)\n data = api_request_raw(url)\n\n return [] if data.nil?\n\n unless data.meta['link'].nil?\n links = parse_links(data.meta['link'])\n last = links['last'] if last.nil?\n\n if pages > 0\n pages = pages - 1\n if pages == 0\n return parse_request_result(data)\n end\n end\n\n if links['next'].nil?\n parse_request_result(data)\n else\n parse_request_result(data) | paged_api_request(links['next'], pages, last)\n end\n else\n parse_request_result(data)\n end\n end", "def cmd request, expected = /.*/, trys = DEFAULT_RETRYS\n\n # clear any old queued responses before we issue our request:\n\n self.drain\n self.write request\n\n while response = self.read\n trys -= 1\n return [] if trys <= 0 # could be thowing away a real response, but too bad, too late...\n matches = expected.match(response)\n next if matches.nil?\n return matches.to_a if matches.length == 1\n return matches.captures\n end\n return []\n end", "def execute_request(take, skip = nil)\n\t\tmessage = {\n\t\t\ttoken: Afasgem.get_token,\n\t\t\tconnectorId: @connectorname,\n\t\t\ttake: take\n\t\t}\n\n\t\tmessage[:skip] = skip if skip\n\t\tfilter_string = get_filter_string\n\t\tmessage[:filtersXml] = filter_string if filter_string\n\n\t\tresp = @client.call(:get_data, message: message)\n\t\txml_string = resp.hash[:envelope][:body][:get_data_response][:get_data_result]\n\t\treturn [xml_string, from_xml(xml_string)]\n\tend", "def isolate_test_results(where_clause=nil)\n erap_ids = assemblies(where_clause).select_map(pt_id_field(true)).uniq\n dataset = @db[:tIsolateTestResults]\n .left_join(:tIsolateTests, :test_ID => :tIsolateTestResults__test_ID)\n .left_join(:tOrganisms, :organism_ID => :tIsolateTestResults__organism_ID)\n .left_join(:tHospitals, :hospital_ID => :tIsolateTests__hospital_ID)\n .select(:tIsolateTestResults__test_ID,\n :eRAP_ID,\n :test_date,\n :hospital_abbreviation,\n :collection_unit,\n :procedure_name,\n :test_result,\n :description,\n :taxonomy_ID,\n :isolate_ID)\n .where(:eRAP_ID => erap_ids)\n dataset\n end", "def drop_lines(array)\n\t\tarray.each do |el|\n\t\t\tdbrows = @database.query <<-SQL\n\t\t\t\tDELETE FROM invoice_lines WHERE invoice_id = '#{el}';\n\t\t\tSQL\n\t\tend\n\tend", "def select_records(options)\n cursor = select_cursor(options)\n rows = []\n while cursor.next?\n rows << cursor.next_row\n end\n cursor.clear\n rows\n end", "def get_tradelines_except(user_id)\n filtered_tradelines = []\n\n trade_lines.each do |x|\n if x.inventory_own.user_id != user_id\n filtered_tradelines << x\n end\n end\n return filtered_tradelines \n end", "def get_oinks(user, line)\n connect_cassandra\n puts \"SELECT oink_id FROM #{line} WHERE user_id = '#{user}' and when > '#{30.days.ago}'\"\n rows = @client.execute(\"SELECT oink_id FROM #{line} WHERE user_id = '#{user}' and when > '#{2.days.ago}'\")\n ids = rows.map { |r| r[\"oink_id\"] }\n unless ids.empty? \n @client.execute(\"SELECT oink_id, dateOf(oink_id), user_id, body FROM oinks WHERE oink_id IN (#{ids.map {|e|\"#{e}\"}.join(\",\")})\")\n else\n []\n end\nend", "def remove_header_and_footer_rows(results_rows)\n results_rows[2..-4]\n end", "def drill_with_skip(skipped_selections=[])\n test.flexmock(AMEE::Data::DrillDown).\n should_receive(:get).\n with(connection,\n \"/data/#{path}/drill?#{selections.map{|k,v|\"#{k}=#{v}\"}.join('&')}\").\n at_least.once.\n and_return(test.flexmock(:choices=>choices,:selections=>Hash[selections].merge(skipped_selections),\n :data_item_uid=>dataitemuid))\n return self\n end", "def skip(value)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.skip(value.to_i)\n end", "def get_users_stops_by_line(line,origin_stop,destination_stop)\n # stop_list is an array which is line details\n stop_list = get_stop_details(line)\n origin_stop_index = stop_list.index(origin_stop)\n destination_stop_index = stop_list.index(destination_stop)\n\n if origin_stop_index < destination_stop_index\n stop_list[origin_stop_index + 1..destination_stop_index]\n\n else\n stop_list[destination_stop_index..origin_stop_index - 1].reverse()\n end\n end", "def run_tuples(query, options = {})\n GRel::Debugger.debug \"QUERYING SELECT...\"\n GRel::Debugger.debug query\n GRel::Debugger.debug \"** LIMIT #{@last_query_context.limit}\" if @last_query_context.limit\n GRel::Debugger.debug \"** OFFSET #{@last_query_context.offset}\" if @last_query_context.offset\n GRel::Debugger.debug \"----------------------\"\n args = {}\n args[:accept] = options[:accept] if options[:accept]\n args[:offset] = @last_query_context.offset if @last_query_context.offset\n args[:limit] = @last_query_context.limit if @last_query_context.limit\n @connection.query(@db_name,query, args).body\n end", "def list_runs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_runs_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::Lineage::V1::ListRunsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def li_request(n=nil,*_)\n ct = n ? convert_integer(n, \"line count\") : 1\n force_break\n ct.times do \n next_line = get_line\n put_line_paginated(next_line) if next_line\n end\n end", "def lines_without_concidering_versions(options={})\n render_without_concidering_versions(options.merge(:only => :lines)) unless @lines_rendered\n @lines\n end", "def get_from_cache(query, ori_query, offset, sim)\n\t\t@results_cache[query].collect do |res|\n\t\t\tbuild_output(query, ori_query, res, sim, offset)\n\t\tend\n\tend", "def clean_result_rows\n raise \"Missing data\" if result_rows.empty?\n result_rows.map do |result|\n next if is_header_row?(result) || is_bye_week?(result)\n result\n end.compact\n end", "def next\n\t\t@skip = (@skip || 0) + get_resultcount\n\t\t@result = nil\n\t\treturn self\n\tend", "def extract_the_data(skip)\n skip = skip\n success = true\n data_lines = 0\n data_records = []\n @array_of_lines.each_with_index do |line, n|\n next if n < skip\n\n @project.write_messages_to_all(\"Warning: line #{n} is empty.<br>\", true) if line[0..24].all?(&:blank?)\n next if line[0..24].all?(&:blank?)\n\n @record = CsvRecord.new(line, @csvfile, @project)\n success, message, result = @record.extract_data_line(n)\n if result[:birth_place_flag].present? || result[:deleted_flag].present? || result[:individual_flag].present? || result[:location_flag].present? ||\n result[:name_flag].present? || result[:occupation_flag].present? || result[:address_flag].present? || result[:deleted_flag].present?\n result[:flag] = true\n else\n result[:flag] = false\n end\n result[:record_valid] = 'true' unless result[:error_messages].present? || result[:warning_messages].present? || result[:flag]\n data_records << result\n @csvfile.total_errors = @csvfile.total_errors + 1 if result[:error_messages].present?\n @csvfile.total_warnings = @csvfile.total_warnings + 1 if result[:warning_messages].present?\n @csvfile.total_info = @csvfile.total_info + 1 if result[:info_messages].present?\n @project.write_messages_to_all(message, true) unless success\n success = true\n data_lines = data_lines + 1\n end\n [success, data_lines, data_records]\n end", "def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end", "def get_all(query_options={}, current_page=1, limit=15) # :yields: rows,page,next_page_flag\n opts = @default_query_options.merge(query_options)\n page = current_page.to_i\n page = 1 if page < 1\n while true\n opts[\"skip\"] = limit * (page - 1)\n opts[\"limit\"] = limit + 1\n uri = gen_view_uri(opts)\n $stderr.puts \"[debug] get_all() uri=#{uri}\" if @debug\n \n rows = YALTools::YaJsonRows.new(@couch, @dbname)\n json = @couch.get(uri)\n i=0\n next_row = nil\n next_page_flag = false\n json.has_key?(\"rows\") and yield_rows(json[\"rows\"]) do |r|\n if i == limit\n next_page_flag = true\n else\n rows << r\n end\n i += 1\n end\n break if rows.length == 0\n yield [rows, page, next_page_flag]\n break if next_page_flag == false\n page += 1\n end\n end", "def query_without_paging_sorting\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query_filter(query)\n end", "def switch_mysql_terms!(result)\n offset = result.delete(:offset)\n result[:skip] = offset if offset\n end", "def restFetchData(query, formatName='default', styleName='default')\n printDebugMessage('restFetchData', 'Begin', 1)\n partList = query.split(':')\n retVal = restFetchBatch(partList[0], partList[1], formatName, styleName)\n printDebugMessage('restFetchData', 'End', 1)\n return retVal\n end", "def old_get_lines\n lines = nil\n #$stdin.flush\n $stdin.each_line do |line|\n line.chomp!\n if line =~ /^bye$/\n break\n end\n if lines\n lines << \"\\n\" + line\n else\n lines = line\n end\n end\n return lines\n end", "def result_set\n klass.requestor.get(nil, { query: to_s })\n end", "def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end", "def fetch_billing_results\n previous_response = nil\n begin\n page = get_page_number\n\n response = Select.fetch_billing_results(@start_timestamp, @end_timestamp,\n page, @page_size)\n unless !response.is_a?(Array)\n process_response(response)\n previous_response = response\n end\n end until !response.is_a?(Array)\n reset_page_number\n\n set_empty_last_fetch_soap_id(response, previous_response)\n end", "def readline\n @buffer.rewind\n r = if @buffer.size > 0\n @buffer.readline\n else\n \"\"\n end\n\n if r[-1..-1] != \"\\n\"\n sec = \"\"\n\n begin\n protect do\n sec = @secondary.readline\n end\n rescue EOFError\n close\n end\n\n r << (sec || \"\")\n\n # Finally, if there's nothing at all returned then this is bad.\n if r.length == 0\n raise HTTPClientError, \"Server returned empty response.\"\n end\n end\n\n reset\n return r\n end", "def process_address_query_response(response_string = nil)\n response_string = $TestCheckoutWalletAddressLookup if response_string.nil?\n \n checkout_wallet_info = JSON.parse($TestCheckoutWalletAddressLookup)\n \n txs = checkout_wallet_info['txs']\n \n @string = \"\"\n @indent = 0\n \n plop_text \"Count of txs: #{txs.count}\\n\\n\"\n \n txs.each.with_index do |tx, i|\n @indent = 2\n \n outs = tx['out']\n inputs = tx['inputs']\n \n plop_text \"tx[#{i}]\\n\"\n \n inputs.each do |input|\n input = input[\"prev_out\"]\n @indent = 4\n \n plop_text \"Addr (input): #{input['addr']}\\n\"\n \n @indent += 2\n plop_text \"n: #{input['n']}\"\n plop_text \"value: #{input['value']}\\n\"\n end\n \n plop_text \"\\n\"\n \n outs.each do |out|\n @indent = 4\n plop_text \"Addr (out): #{out['addr']}\\n\"\n #binding.pry\n \n @indent += 2\n plop_text \"n: #{out['n']}\\n\"\n plop_text \"Value: #{out['value']}\\n\" # if unrecorded_valid_technical_bitcoin_payment?(tx, latest_height, out)\n # TODO: this is only partially finished...\n # create_bitcoin_payment_from_tx(tx, latest_height, out)\n end\n \n plop_text \"\\n\"\n end\n \n puts\n puts @string\n \n end", "def execute!(query)\n http_response = request.post(@url, params: @params, json: { query: query.to_gql })\n\n fail \"Error: #{http_response.reason}\\nBody: #{http_response.body}\" if http_response.status >= 300\n\n parsed_response = JSON.parse(http_response.to_s)\n data = parsed_response['data']\n errors = parsed_response['errors']\n\n Response.new(data, errors, query)\n end", "def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end", "def lines\n (1..buffer.length.to_i - 1).map { |ix| buffer[ix.to_i] }.flatten\n end", "def get_match_rows(query)\n fields = 'w0.url_id'\n tables = ''\n clauses = ''\n word_ids = []\n \n words = query.split(' ')\n table_number = 0\n \n words.each do |word|\n word_row = \n connection.execute(\"select rowid from word_list where word = '#{word}'\").first\n \n if word_row\n word_id = word_row[0]\n word_ids << word_id\n if table_number > 0\n tables << ','\n clauses << \" and w#{table_number - 1}.url_id = w#{table_number}.url_id and \"\n end\n fields << \", w#{table_number}.location\"\n tables << \"word_location w#{table_number}\"\n clauses << \"w#{table_number}.word_id = #{word_id}\"\n table_number += 1\n end\n end\n \n full_query = \"select #{fields} from #{tables} where #{clauses}\"\n rows = connection.execute(full_query)\n [rows, word_ids]\n end", "def lines(*args)\n #This is a stub, used for indexing\n end", "def get_query_results(query)\n hits = execute_query(query).hpath('hits.hits').first\n return [] unless hits && !hits.empty?\n hits.map do |hit|\n hit['_source'].expand.merge(hit.only('_id', '_type', '_index')).kmap do |key|\n key.to_s.gsub('@', '_').to_sym\n end\n end\n end", "def query(q)\n Timeout::timeout(1) {\n @queries += 1\n if @queries >= 999\n disconnect\n \t @sock = TCPSocket.new(@host, @port)\n \t @queries = 0\n end\n #puts \"querying...\"\n @sock.puts(\"query #{q} return all\")\n #puts \"getting response...\"\n resp = @sock.gets\n #puts resp\n while (resp.match(/^Connection\\sclosed\\sby\\sforeign\\host\\./))\n @sock = TCPSocket.new(@host, @port)\n \t @queries = 0\n @sock.puts(\"query #{q} return all\")\n #puts \"getting response...\"\n resp = @sock.gets\n end\n if (resp.match(/^501:.*/))\n # no matches\n return []\n elsif (resp.match(/^102:.*/))\n # go ahead\n # which of the results are we processing?\n result_num = 1\n # array of records to return\n records = Array.new\n record = Hash.new\n while (@sock.gets.match(/^-200:(\\d+):\\s*(\\w+):\\s(.*)$/))\n # $1 => the number person we're processing\n # $2 => the field name\n # $3 => the field contents\n #puts \"$1: #$1 $2: #$2 $3: #$3\"\n # if we're processing a new record now\n if (result_num.to_s != $1)\n # update the num of the record we're processing\n result_num = $1\n # save the previous record in the array\n records.push record\n # start a new record\n record = Hash.new\n end\n \n # save the field\n record[$2] = $3\n \n # handle the two-line address\n if ($2 == \"home_address\")\n @sock.gets.match(/-200:\\d+:\\s*:\\s(.*)$/)\n # $1 => field value\n record[\"home_address_2\"] = $1\n end\n end\n records.push record\n return records\n else\n # error\n @sock = TCPSocket.new(@host, @port)\n \t @queries = 0\n query(q)\n #raise \"Error talking to PH server\"\n end\n }\n end", "def each_without_conversion(sql, *args, into: nil)\n pg_result = exec_logged(sql, *args)\n\n column_info = collect_column_info(pg_result)\n rows = []\n pg_source_oid = nil\n\n if pg_result.ntuples > 0 && pg_result.nfields > 0\n decoder = Decoder.new(pg_result, into: (into ? Hash : nil), column_info: column_info)\n pg_source_oid = pg_result.ftable(0)\n\n pg_result.each_row do |row|\n rows << decoder.decode(row)\n end\n end\n\n [rows, pg_source_oid, column_info]\n ensure\n # optimization: If we wouldn't clear here the GC would do this later.\n pg_result.clear if pg_result && !pg_result.autoclear?\n end", "def seek(query = nil)\n @result = (@query = query) ? parsed.select { |hsh| present_in?(hsh.values) } : parsed\n end", "def lines\n # TODO: data should be required to be a String, no nils\n @lines ||= data ? data.split(\"\\n\", -1) : []\n end", "def readlines\n return nil unless __advance!\n\n lines = []\n while line = gets()\n lines << line\n end\n\n lines\n end", "def each_row(q, options = {}, &block)\n current_row = 0\n # repeatedly fetch results, starting from current_row\n # invoke the block on each one, then grab next page if there is one\n # it'll terminate when res has no 'rows' key or when we've done enough rows\n # perform query...\n res = query(q, options)\n job_id = res['jobReference']['jobId']\n # call the block on the first page of results\n if( res && res['rows'] )\n res['rows'].each(&block)\n current_row += res['rows'].size\n end\n # keep grabbing pages from the API and calling the block on each row\n while( current_row < res['totalRows'].to_i && ( res = get_query_results(job_id, :startIndex => current_row) ) && res['rows'] ) do\n res['rows'].each(&block)\n current_row += res['rows'].size\n end\n end", "def process_notations\n results = []\n @queries.each { |query| results << Result.new(query, @classifications) }\n results\n end", "def parse(query)\n @symbols = Tokenizer.symbols(query)\n @position = 0\n r = []\n r << read_maximal_term(0) until empty?\n r\n end", "def find_expired_orders_row\n\n orders = []\n row = nil\n offset = 0\n\n while row.nil? || row.size > 0\n row = Order.where(gateway_id: self.id).order(Sequel.desc(:keychain_id), Sequel.desc(:reused)).limit(Config.reuse_address_orders_threshold).offset(offset).to_a\n\n row.reject! do |o|\n reject = false\n row.each do |o2|\n reject = true if o.keychain_id == o2.keychain_id && o.reused < o2.reused\n end\n reject\n end\n\n row.sort! { |o1, o2| o2.id <=> o1.id }\n\n row.each do |o|\n if o.status == Order::STATUSES[:expired]\n orders.unshift(o)\n elsif o.status == Order::STATUSES[:new]\n next\n else\n return orders[0...Config.reuse_address_orders_threshold]\n end\n end\n offset += Config.reuse_address_orders_threshold\n end\n\n orders\n\n end", "def skip(value = 0)\n update_query(:skip => value)\n end", "def lines\n @lines[oy...(oy + height)] || []\n end", "def reverse_rows!\n data.reverse_rows!; self\n end" ]
[ "0.62689096", "0.6100934", "0.5325119", "0.51745105", "0.5120857", "0.511498", "0.5073157", "0.50579166", "0.49561867", "0.48449647", "0.4787308", "0.47579235", "0.47050315", "0.4702483", "0.46775198", "0.466473", "0.46353033", "0.46348712", "0.46332514", "0.46268523", "0.45990542", "0.45946038", "0.45805815", "0.4578847", "0.45707694", "0.45675084", "0.45675084", "0.4558694", "0.455482", "0.45326385", "0.45276463", "0.4520235", "0.45108113", "0.45001134", "0.44543284", "0.4449268", "0.4446912", "0.4446368", "0.4446024", "0.4439618", "0.44384763", "0.44375277", "0.44217274", "0.44111273", "0.44041845", "0.4397706", "0.4392071", "0.43827456", "0.43654042", "0.43559423", "0.43556556", "0.43532297", "0.43460736", "0.43443248", "0.43237028", "0.43209463", "0.43194744", "0.4313958", "0.42977113", "0.42949012", "0.42878383", "0.42862654", "0.42849258", "0.42758024", "0.42754576", "0.42695728", "0.42617428", "0.42589802", "0.42586944", "0.4252177", "0.424983", "0.4245822", "0.42451334", "0.42430353", "0.42426345", "0.42302376", "0.42247048", "0.42237672", "0.42142516", "0.42072797", "0.42027003", "0.41880736", "0.41858223", "0.4182982", "0.41803616", "0.4162207", "0.41591305", "0.41579616", "0.4144543", "0.4144516", "0.414352", "0.41379645", "0.41321215", "0.41306174", "0.4129954", "0.41254666", "0.4124257", "0.41223142", "0.4119576", "0.41185614" ]
0.8070327
0
Execute 'query' and output response, reversed, to 'output_file'. 'skip_lines' specifies which lines to exclude, where skip_lines[1] indicates the first line of the response. precondition: query != nil && ! output_file.closed? && ! skip_lines.nil?
def output_reversed_response(output_file, skip_lines) output_file.write(reversed_response(skip_lines).join("\n") + "\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_response(output_file, skip_lines = {})\n begin\n open(query) do |f|\n current_line_index = 1\n # Process (output, if appropriate) the first line:\n first_line = f.readline\n if bad_data_match(first_line) or first_line.empty? then\n raise \"Bad or no data [#{first_line}]\"\n end\n if first_line && ! skip_lines[current_line_index] then\n if @filter_function != nil then\n first_line << @filter_function.call(first_line, current_line_index)\n end\n if ! first_line.nil? then\n output_file.write(first_line)\n end\n end\n if ! f.eof? then\n current_line_index += 1\n f.each_line do |l|\n if @filter_function != nil then\n if ! skip_lines[current_line_index] then\n filtered_line = @filter_function.call(l, current_line_index)\n if ! filtered_line.empty? then\n output_file.write(filtered_line)\n end\n end\n else\n if ! skip_lines[current_line_index] then\n output_file.write(l)\n end\n end\n current_line_index += 1\n end\n end\n end\n rescue StandardError => error\n @fatal_error = true\n @error_message = error.to_s\n end\n end", "def reversed_response(skip_lines)\n if query then\n begin\n open(query) do |f|\n i = 1\n f.each_line do |l|\n if i == 1 then\n if bad_data_match(l) or first_line.empty? then\n raise \"Bad or no data [#{first_line}]\"\n end\n end\n if ! skip_lines[i] then\n @response_lines << l.chomp\n end\n i += 1\n end\n end\n rescue OpenURI::HTTPError => error\n @fatal_error = true\n response = error.io\n @error_message = \"status: #{response.status}, error: #{response.string}\"\n end\n end\n result = []\n if ! @fatal_error then\n current_line_index = 1\n if @filter_function != nil then\n (0 .. response_lines.count - 1).reverse_each do |i|\n result << @filter_function.call(response_lines[i], current_line_index)\n current_line_index += 1\n end\n else\n (0 .. response_lines.count - 1).reverse_each do |i|\n result << response_lines[i]\n end\n end\n end\n result\n end", "def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end", "def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.get_result.stream_each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end", "def extract_data(output_file, options = {})\n log.info \"Exporting #{@cube} data via report script...\"\n\n rep_script = generate_script(options)\n save_query_to_file(rep_script, options[:query_file], '.rep')\n\n # Submit the report\n iter = nil\n instrument 'report.extract', script: rep_script, output_file: output_file do\n iter = cube.report(rep_script, false, false, true, false)\n end\n\n # Write the returned data to the file\n log.fine \"Writing data to #{output_file}\"\n file = File.new(output_file, \"w\")\n count = 0\n begin\n # TODO: Handle header, non-tab delimiters\n while !try{ iter.is_end_of_data } do\n chunk = try{ iter.next_string }\n file.puts chunk\n count += chunk.lines.count\n end\n ensure\n file.close\n end\n log.fine \"Output #{count} records\"\n end", "def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end", "def query\n rdr = PostgresReader.new(@options)\n query = File.open(@sql_file, 'r', &:read)\n File.open(@output_file, 'w') do |file|\n rdr.query(query, file)\n end\n end", "def assert_not_result_matches(query, expected_result_file, filter_exp=nil, sort=nil, qrserver_id=0)\n result_xml = search(query, qrserver_id).xmldata\n expected_lines = []\n File.open(expected_result_file) do |file|\n expected_lines = file.readlines\n end\n @current_assert_file = expected_result_file\n assert_not_resultsets_match(result_xml.split(\"\\n\", -1), expected_lines, filter_exp, sort)\n @current_assert_file = nil\n end", "def execute(options={})\n build_headers\n write_data(@output)\n end", "def triple_output_to_file(graph_name, filename, prefix)\n base_query_addition = \"SELECT ?s ?p ?o FROM <#{graph_name}> WHERE { ?s ?p ?o }\"\n current_iteration = 0\n additions = query(base_query_addition + \" OFFSET #{(LINES_PER_EXTRACT * current_iteration).to_s} LIMIT #{LINES_PER_EXTRACT}\")\n while additions.length > 0\n additions.each_solution do |addition|\n log.info \"#{prefix} #{addition['s'].to_s} #{addition['p'].to_s} #{addition['o'].to_s}\"\n append_line_to_file(filename,\"#{prefix} #{addition['s'].to_s} #{addition['p'].to_s} #{addition['o'].to_s}\" + \"\\n\")\n end\n log.info additions.to_s\n current_iteration += 1\n additions = query(base_query_addition + \" OFFSET #{(LINES_PER_EXTRACT * current_iteration).to_s} LIMIT #{LINES_PER_EXTRACT}\")\n end\nend", "def process_skipped_lines(lines); end", "def execute\n rows = File.readlines(infile)\n\n skipped_rows = []\n\n unless headerless\n skipped_rows[0] = \"\"\n skipped_rows[0] = rows.shift while skipped_rows[0].chomp.strip.empty?\n end\n\n if start\n (0...start.to_i).each { |row| skipped_rows << rows.shift } \n end\n\n rows.each_with_index do |line, index|\n filtered = col_type_filter.process(row_filter.process(line, row: index))\n next if filtered.nil?\n sorted_rows << (filtered << index)\n end\n\n File.open(outfile, 'w') do |out|\n skipped_rows.each { |row| out.puts unstring(row) }\n\n if desc\n sorted_rows.compact.sort.reverse.each do |row|\n out.puts unstring(rows[row.last])\n end\n else\n sorted_rows.compact.sort.each do |row|\n out.puts unstring(rows[row.last])\n end\n end\n end\n end", "def perform\n $stdout.write \"Outputting file to #{filepath_string}\\n\"\n CSV.open(filepath_string, \"wb\") do |csv|\n csv << output_header_row\n orders.each do |order|\n csv << order.output_row\n end\n end\n end", "def process_page_results(output_file_name, result_items)\n file = output_file(output_file_name)\n\n result_items.each do |result|\n file.write(\"#{result['id']},#{result['full_name']},#{result['language']}\\n\")\n end\nend", "def run(query, options = {})\n options = { verbose: false }.merge(options)\n \n # Format the query for execution\n query_path = case\n when File.exists?(query) then query\n else\n # Write the query to a file.\n tempfile = Tempfile.new(\"#{@blast_command}_query\")\n tempfile.puts \">Query\"\n tempfile.puts query\n tempfile.close\n \n tempfile.path\n end\n \n # Execute the command\n CommandLine.run(prepare_command(query_path)) do |f|\n puts f.read\n end\n \n # Grab the output file\n output_file.rewind\n output_file\n end", "def run\n check_xhr unless params[:download]\n\n query = DataExplorer::Query.find(params[:id].to_i)\n query.last_run_at = Time.now\n\n if params[:id].to_i < 0\n query.created_by = Discourse::SYSTEM_USER_ID.to_s\n query.save_default_query\n else\n query.save\n end\n\n if params[:download]\n response.sending_file = true\n end\n\n params[:params] = params[:_params] if params[:_params] # testing workaround\n query_params = {}\n query_params = MultiJson.load(params[:params]) if params[:params]\n\n opts = { current_user: current_user.username }\n opts[:explain] = true if params[:explain] == \"true\"\n\n opts[:limit] =\n if params[:limit] == \"ALL\" || params[:format] == \"csv\"\n \"ALL\"\n elsif params[:limit]\n params[:limit].to_i\n end\n\n result = DataExplorer.run_query(query, query_params, opts)\n\n if result[:error]\n err = result[:error]\n\n # Pretty printing logic\n err_class = err.class\n err_msg = err.message\n if err.is_a? ActiveRecord::StatementInvalid\n err_class = err.original_exception.class\n err_msg.gsub!(\"#{err_class}:\", '')\n else\n err_msg = \"#{err_class}: #{err_msg}\"\n end\n\n render json: {\n success: false,\n errors: [err_msg]\n }, status: 422\n else\n pg_result = result[:pg_result]\n cols = pg_result.fields\n respond_to do |format|\n format.json do\n if params[:download]\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.json\"\n end\n json = {\n success: true,\n errors: [],\n duration: (result[:duration_secs].to_f * 1000).round(1),\n result_count: pg_result.values.length || 0,\n params: query_params,\n columns: cols,\n default_limit: DataExplorer::QUERY_RESULT_MAX_LIMIT\n }\n json[:explain] = result[:explain] if opts[:explain]\n\n if !params[:download]\n relations, colrender = DataExplorer.add_extra_data(pg_result)\n json[:relations] = relations\n json[:colrender] = colrender\n end\n\n json[:rows] = pg_result.values\n\n render json: json\n end\n format.csv do\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.csv\"\n\n require 'csv'\n text = CSV.generate do |csv|\n csv << cols\n pg_result.values.each do |row|\n csv << row\n end\n end\n\n render plain: text\n end\n end\n end\n end", "def run_query(query_file , exp , o = {})\n index_path = o[:index_path] || @index_path\n cmd = fwrite('cmd_galago_run_query.log' , \"#{$galago_path}/bin/galago batch-search --index=#{index_path} #{o[:param_query]} \\\n #{to_path(query_file)} |grep -e ^[0-9] > #{to_path(exp+'.res')}\" , :mode=>'a')\n `#{cmd}`\n end", "def sort_output_file\n FileUtils.rm_rf(order_result_filename)\n\n cmd = \"head -1 #{order_result_filename_temp} | rev | \" + \\\n \"cut -d ',' -f 2- | rev > #{order_result_filename}\"\n\n `#{cmd}`\n\n cmd = \"tail -n +2 #{order_result_filename_temp} | \" + \\\n \"awk -F ',' -v OFS=',' '{print $NF,$0}' | \" + \\\n \"sort -t ',' -k1,1 -n | cut -d ',' -f 2- | \" + \\\n \"rev | cut -d ',' -f 2- | rev >> #{order_result_filename}\"\n\n `#{cmd}`\n\n FileUtils.rm_rf(order_result_filename_temp)\n end", "def run\n headers = %w(id)\n @mappings.keys.each do |mapping|\n unless [:id, :sort_as].include?(mapping)\n headers << mapping\n end\n end\n puts CSV.generate_line(headers)\n\n Zip::ZipFile.open(open(@url)) do |zipfile|\n entry = zipfile.entries.find{|entry| File.extname(entry.name) == \".dbf\"}\n if entry\n DBF::Table.new(StringIO.new(zipfile.read(entry))).map do |record|\n ShapefileRecord.new(record, @mappings)\n end.select(&@filter).sort.each do |record|\n output(@prefix, *headers.map{|header| record.send(header)})\n end\n else\n raise \"DBF file not found!\"\n end\n end\n end", "def write_output\n rows = data_to_rows\n CSV.open(@filename, 'wb') do |csv|\n rows.each {|row| csv << row}\n end\n end", "def execute\n processed_header = false\n\n File.open(outfile, 'w') do |out|\n File.open(infile).each_with_index do |line, index|\n next if line.chomp.empty? || unstring(line).chomp.split(';').empty?\n\n unless processed_header\n header_row = header.process(line.chomp)\n header_row = @write_filter.process(header_row) unless @final_header\n out.puts header_row unless header_row.nil? or header_row.empty?\n processed_header = true\n next\n end\n\n next if row_filter.process(line, row: index).nil?\n\n @columns = unstring(line).chomp.split(';')\n formulae.each do |col, formula|\n @columns[col.to_i] = eval(formula)\n end\n out.puts @write_filter.process(@columns.join(';'))\n\n @columns.each_with_index do |column, index|\n column = 0 unless column.to_s =~ /^[\\d\\.,]*$/\n\n if @sum_row[index]\n @sum_row[index] += to_number column\n else\n @sum_row[index] = to_number column\n end\n end if add_sum_row\n\n end\n\n out.puts @write_filter.process(@sum_row.join(';')) if add_sum_row\n\n end\n end", "def load_outputs\n if File.exist?(@reciprocal_hits)\n # puts \"reciprocal output already exists\"\n else\n @query_results = Hash.new\n @target_results = Hash.new\n q_count=0\n t_count=0\n if !File.exists?(\"#{@output1}\")\n raise RuntimeError.new(\"can't find #{@output1}\")\n end\n if !File.exists?(\"#{@output2}\")\n raise RuntimeError.new(\"can't find #{@output2}\")\n end\n if File.exists?(\"#{@output1}\") and File.exists?(\"#{@output2}\")\n File.open(\"#{@output1}\").each_line do |line|\n cols = line.chomp.split(\"\\t\")\n hit = Hit.new(cols, @query_is_prot, @target_is_prot)\n @query_results[hit.query] = [] if !@query_results.has_key?(hit.query)\n @query_results[hit.query] << hit\n q_count += 1\n end\n File.open(\"#{@output2}\").each_line do |line|\n cols = line.chomp.split(\"\\t\")\n hit = Hit.new(cols, @target_is_prot, @query_is_prot)\n @target_results[hit.query] = [] if !@target_results.has_key?(hit.query)\n @target_results[hit.query] << hit\n t_count += 1\n end\n else\n raise \"need to run blast first\"\n end\n end\n [q_count, t_count]\n end", "def finish_output(error = nil)\n\t\t\t\t\t\ttrailer = @output&.trailer\n\t\t\t\t\t\t\n\t\t\t\t\t\t@output = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\tif error\n\t\t\t\t\t\t\tsend_reset_stream(::Protocol::HTTP2::Error::INTERNAL_ERROR)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t# Write trailer?\n\t\t\t\t\t\t\tif trailer&.any?\n\t\t\t\t\t\t\t\tsend_headers(nil, trailer, ::Protocol::HTTP2::END_STREAM)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tsend_data(nil, ::Protocol::HTTP2::END_STREAM)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend", "def output lines\n nil\n end", "def work_received(results)\n # write results to disk\n @@output_file.puts results\n end", "def yield_skip_page_r(unit, total_rows, start_page=1, query_opts) # :yields: limit, skip, page, max_page, new_query_opts\n opts = query_opts.dup\n limit = unit\n\n # swaping +startkey+, +endkey+ and \"descending\" options.\n case \"#{opts.has_key?('startkey')}.#{opts.has_key?('endkey')}\"\n when \"true.true\"\n opts[\"startkey\"] = query_opts[\"endkey\"]\n opts[\"endkey\"] = query_opts[\"startkey\"]\n when \"true.false\"\n opts[\"endkey\"] = opts[\"startkey\"]\n opts.delete(\"startkey\")\n when \"false.true\"\n opts[\"startkey\"] = opts[\"endkey\"]\n opts.delete(\"endkey\")\n end\n if opts.has_key?(\"descending\")\n opts[\"descending\"] = (opts[\"descending\"].to_s == \"true\") ? \"false\" : \"true\"\n else\n opts[\"descending\"] = \"true\"\n end\n \n max_page = (total_rows.to_f / limit.to_f).ceil\n \n sanitized_start_page = start_page > 0 ? start_page : 1\n page = (max_page - sanitized_start_page + 1)\n page = 1 if page < 1 ## 'page' must be greater than one, even though max_page is zero.\n skip = total_rows - (limit * (max_page - page + 1))\n skip = total_rows if skip > total_rows\n skip = 0 if skip < 0\n \n $stderr.puts \"[debug] yield_skip_page_r() sanitized_start_page=#{sanitized_start_page},skip=#{skip},page=#{page}\" if @debug\n \n while page >= 1\n $stderr.puts \"[debug] yield_skip_page_r() skip=#{skip},page=#{page},max_page=#{max_page}\" if @debug\n if skip == 0\n tmp_limit = total_rows % limit\n tmp_limit = limit if tmp_limit == 0\n yield [tmp_limit, skip, page, max_page, opts]\n else\n yield [limit, skip, page, max_page, opts]\n end\n page -= 1\n # skip = limit * (page - 1)\n skip -= limit\n skip = 0 if skip < 0\n end\n end", "def query(sql, file)\n return if sql.nil? || file.nil?\n sql.strip!\n get_copy_data(sql.chomp(';'), file)\n end", "def process_output(file=nil)\n output = if file\n File.new(file.to_s,'w')\n else\n STDOUT\n end\n\n yield output if block_given?\n\n output.flush\n output.close\n return nil\n end", "def file_end(file, output)\n end", "def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end", "def download_csv\n query = params[:query]\n company_id = params[:company_id]\n file = Operation.create_csv(query, company_id) \n send_file file\n end", "def get_output(options={})\n if io = options.delete(:io)\n options = options.merge :response_block => lambda {|chunk, remaining_bytes, total_bytes| io.write chunk}\n end\n options['Range'] = options.delete :range\n service.get_job_output(vault.id, id, options)\n end", "def create_export(query, args={})\n args[\"search\"] = query\n # Suppress segmentation (<sg> tags in the XML response) by default:\n if !args.has_key?(:segmentation)\n args[:segmentation] = \"none\"\n end\n response = @service.request(:method => :GET,\n :resource => @resource + [\"export\"],\n :query => args)\n return ExportStream.new(response.body)\n end", "def processRequest\n # retrieve the requests with data\n \n req = DSRequest.new(@request, @model) \n # set the response variable\n res = req.execute\n File.open('kris.txt', 'w') { |file| file.write(res) }\n # safeguard, if was null, create an empty response with failed status\n if res.nil?\n res = DSResponse.new\n res.status=-1\n end \n return res \n end", "def save_result(query, file, qrserver_id=0)\n result = search(query, qrserver_id)\n File.open(file, \"w\") do |file|\n file.print(result.xmldata)\n end\n return result\n end", "def SPARQL_query(service, query, query_file, forcePOST=false, args2={})\n if ! query_file.nil?\n query = open(query_file, 'rb'){|f| f.read}\n end\n if forcePOST || query.length >= 2*1024 \n SPARQL_query_POST(service, query, args2)\n else\n SPARQL_query_GET(service, query, args2)\n end\nend", "def skip_footer_lines(lines, buffer_size)\n return enum_for(:skip_footer_lines, lines, buffer_size) unless block_given?\n\n buffer = []\n lines.each do |line|\n buffer.unshift(line)\n\n yield buffer.pop if buffer.length > buffer_size\n end\n end", "def download_benchmark_output\n if !ApplicationController.fire_cloud_client.services_available?('GoogleBuckets')\n head 503 and return\n end\n\n requested_file = ApplicationController.gcs_client.execute_gcloud_method(:get_workspace_file, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename])\n if requested_file.present?\n @signed_url = ApplicationController.gcs_client.execute_gcloud_method(:generate_signed_url, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename], expires: 15)\n redirect_to @signed_url\n else\n redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),\n alert: 'The file you requested was unavailable. Please try again.' and return\n end\n\n end", "def download_job(uuid, out_fn, username, password)\n puts \"Downloading data from job #{uuid} to #{out_fn}\"\n fail \"Output file exists!\" if File.exist?(out_fn)\n\n job = get_job(uuid, username, password)\n puts \"Job info:\"\n puts summarise_job(job, 2)\n puts \"\"\n\n # Download stuff.\n puts \"Retrieving index...\"\n index = get_json(job['results']['dataURL'], username, password, '')\n\n num_files = index['urlCount']\n puts \"Retrieving #{num_files} files...\"\n \n i = 0\n File.open(out_fn, 'w') do |out|\n index['urlList'].each do |url|\n i += 1\n print \" #{i} / #{num_files} (#{((i.to_f / num_files.to_f) * 100.0).round(2)}%) \\r\"\n\n begin\n # RAW HTTP get request\n res = Net::HTTP.get(URI(url))\n zlibr = Zlib::GzipReader.new(StringIO.new(res.to_s))\n out.puts zlibr.read\n rescue StandardError => e\n print \"\\n*** ERR on file #{i}, URL: #{url}\\n\"\n end\n \n end # /url iteration\n end # /file handle\n\n print \"Done\\n\"\nend", "def execute(db_client)\n query_file = @query_options['file']\n query_file_path = \"./config/queries/#{query_file}\"\n query_content = File.read(query_file_path)\n\n if @query_options.has_key?('params') || @params\n query_params = @query_options['params'] ? @query_options['params'] : @params.split(',')\n query_params.each_with_index do |p, i|\n query_content = query_content.gsub(/@@#{i}@@/, p)\n end\n end\n\n return db_client.query(query_content)\n end", "def add_to_all_results_file(filename,output)\n self.add_to_file(filename,output)\n end", "def cleanupOutput()\n\tlines_array = IO.readlines(\"outputList.txt\")\n\n\toutputFile = File.open(\"outputListFinal.txt\", 'w')\n\tlines_array.each do |line|\n\t\tif line =~ /file '(.*)'/\n\t\t\tfilename = $1.to_s\n\t\t\tif(File.exist?(filename))\n\t\t\t\toutputFile.write(\"file '\"+filename+\"'\\n\")\n\t\t\tend\n\t\tend\n\tend\n\n\toutputFile.close\nend", "def ViewStreamingResponseMixin_stream_response(line_reader_class, response, callback)\n non_row_body = ''\n row_idx = 0\n line_reader_class.read_body response do |line|\n line = line.strip\n if line.start_with? '{\"key\":' or line.start_with? '{\"id\":'\n # A result row; send to the callback\n callback.call JSON.parse(line.chomp(',')), row_idx\n row_idx += 1\n else\n # Not a row, it goes into the main return value\n non_row_body += line\n end\n end\n non_row_body\n end", "def execute!(query)\n http_response = request.post(@url, params: @params, json: { query: query.to_gql })\n\n fail \"Error: #{http_response.reason}\\nBody: #{http_response.body}\" if http_response.status >= 300\n\n parsed_response = JSON.parse(http_response.to_s)\n data = parsed_response['data']\n errors = parsed_response['errors']\n\n Response.new(data, errors, query)\n end", "def flush_to_file(hit_list)\n File.open($config[:output], 'a') do |file|\n file.puts(hit_list)\n end\nrescue => e\n puts \"Error writing to output file #{$config[:output]}\"\n raise e\nend", "def communicate_results(directory, results, skip_zip_results)\n if !skip_zip_results\n zip_results(directory)\n end\n\n if results.is_a? Hash\n # DLM: don't we want this in the results zip?\n # DLM: deprecate in favor of out.osw\n File.open(\"#{@options[:output_directory]}/data_point_out.json\", 'w') do |f|\n f << JSON.pretty_generate(results)\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n else\n # puts \"Unknown datapoint result type. Please handle #{results.class}\"\n end\n end", "def download_problematic_rows\n import_job = ImportJob.find(params[:import_job_id])\n @output_csv_string = import_job.problem_rows_csv_string\n respond_to do |format|\n format.csv do\n filename = \"#{File.basename(import_job.file_name, '.csv')}-problematic_rows-#{Time.now.strftime(\"%Y%m%d\")}.csv\"\n if request.env['HTTP_USER_AGENT'] =~ /msie/i\n headers['Pragma'] = 'public'\n headers[\"Content-type\"] = \"text/plain\"\n headers['Cache-Control'] = 'no-cache, must-revalidate, post-check=0, pre-check=0'\n headers['Content-Disposition'] = \"attachment; filename=\\\"#{filename}\\\"\"\n headers['Expires'] = \"0\"\n else\n headers[\"Content-Type\"] ||= 'text/csv'\n headers[\"Content-Disposition\"] = \"attachment; filename=\\\"#{filename}\\\"\"\n end\n end\n end\n end", "def discard_results; end", "def save_result_with_timeout(timeout, query, file, qrserver_id=0)\n result = search_with_timeout(timeout, query, qrserver_id)\n File.open(file, \"w\") do |file|\n file.print(result.xmldata)\n end\n return result\n end", "def build_output(query, ori_query, res, sim, offset)\n return { requested_query: query, \n original_query: ori_query, \n offset: offset,\n uri: res[:uri], \n label: res[:label], \n sim: sim,\n }\n\tend", "def OLDview_data db, sql, options\n outputfile = options[:output_to]\n formatting = options[:formatting]\n headers = options[:headers]\n #str = db.get_data sql\n rs = db.execute_query sql\n str = rs.content\n columns = rs.columns\n #puts \"SQL: #{sql}.\\nstr: #{str.size}\"\n data = []\n if headers\n data << columns.join(\"\\t\")\n end\n str.each {|line| data << line.join(\"\\t\"); }\n #puts \"Rows: #{data.size}\"\n require 'tempfile'\n tmpfile = Tempfile.new('SQL.XXXXXX')\n filename = tmpfile.path\n filename = Shellwords.escape(filename)\n #puts \"Writing to #{filename}\"\n tmpfile.write(data.join(\"\\n\"))\n tmpfile.close # need to flush, otherwise write is buffered\n headerstr=nil\n if formatting\n headerstr = \"-H\" unless headers\n # sometimes this can be slow, and it can fault on UTF-8 chars\n system(\"cat #{filename} | term-table.rb #{headerstr} | sponge #{filename}\")\n end\n if outputfile\n #puts \"comes here\"\n system(\"cp #{filename} #{outputfile}\")\n filename = outputfile\n end\n system \"wc -l #{filename}\" if $opt_debug\n \n #system \"$EDITOR #{filename}\"\n system \"vim -c ':set nowrap' #{filename}\"\n tmpfile.close\n tmpfile.unlink\nend", "def reverse_rows!\n @data = skip_headers &:reverse\n end", "def risearch query, options = {}\n request_params = { :dt => 'on', :format => 'CSV', :lang => 'sparql', :limit => nil, :query => query, :type => 'tuples' }.merge(options)\n\n self.client['risearch'].post request_params\n end", "def download\n # headers for streaming suggested by:\n # https://coderwall.com/p/kad56a/streaming-large-data-responses-with-rails\n # and\n # https://github.com/felixbuenemann/xlsxtream/issues/14\n response.headers.delete(\"Content-Length\") # See one line above\n response.headers['X-Accel-Buffering'] = 'no' # Stop NGINX from buffering\n response.headers['Cache-Control'] = 'no-cache'\n \n # Headers for browser-handling\n response.headers['Content-Type'] = 'application/marcxml+xml'\n response.headers['Content-Disposition'] = \"attachment; filename=#{download_filename('xml')}\" \n \n # Setup Blacklight / Solr params\n params['page'] = 1\n params['rows'] = 100\n # params['fl'] = 'id,marc_display'\n params['source'] = active_source\n\n extra_params = {\n 'fl' => 'id,marc_display',\n 'sort' => 'id asc',\n 'stats' => false,\n 'facet' => false,\n }\n \n # Stream response\n stream = response.stream\n\n begin\n # XML Header - MARC XML collection open tag\n stream.write marcxml_header\n\n total = 0\n hits = params['rows']\n while hits >= params['rows'] && total < 10_000\n # # CLIO-level query\n # # search_engine = blacklight_search(params.to_unsafe_h)\n # # hits = search_engine.documents.count\n # # search_engine = blacklight_search(params.to_unsafe_h)\n # # hits = search_engine.documents.count\n # # total += hits\n # \n # # Blacklight-level query\n # # - doesn't include marc_display\n # # - doesn't allow over-riding 'fl' param\n # # search, documents = search_results(params)\n # # hits = documents.count\n # \n # # unapproved lower-level querying..\n # # builder = search_builder.with(params)\n # # builder.page = 1\n # # builder.rows = 1000\n # # response = repository.search(builder)\n \n # Need to use lower-level \"search_builder\", so that we \n # can override 'fl' param, to include marc_display\n query = search_builder.with(params).merge(extra_params)\n solr_response = repository.search(query)\n \n hits = solr_response.documents.count\n total += hits\n\n solr_response.documents.each do |solr_doc|\n # stream.write solr_doc['marc_display']\n # pretty-print - does this make reporting too slow?\n stream.write solr_doc['marc_display'].\n gsub(/<leader/, \"\\n <leader\").\n gsub(/<controlfield/, \"\\n <controlfield\").\n gsub(/<datafield/, \"\\n <datafield\").\n gsub(/<\\/datafield/, \"\\n </datafield\").\n gsub(/<subfield/, \"\\n <subfield\").\n gsub(/<\\/record/, \"\\n</record\")\n stream.write \"\\n\"\n end\n\n # increment page\n # extra_params['page'] = (extra_params['page'].to_i + 1).to_s\n params['page'] = (params['page'].to_i + 1).to_s\n end\n\n # close collection tag\n stream.write marcxml_footer\n\n ensure\n stream.close\n end\n \n end", "def download_handoff_report_old\n \t\tsearch_parm = search_csv(params)\n \t\tbu = search_parm[0]\n \t\tl1 = search_parm[1]\n \t\tl2 = search_parm[2]\n \t\tl3 = search_parm[3]\n\t\t\n\t\tif params[:report_include_canceled] == \"report_include_canceled\"\n \t\tinclude_cancel = true\n \telse\n \t\tinclude_cancel = false\n \tend\n \tif params[:report_include_onhold] == \"report_include_onhold\"\n \t\tinclude_onhold = true\n \telse\n \t\tinclude_onhold = false\n \tend\n\t\tif params[:report_include_completed] == \"report_include_completed\"\n \t\tinclude_completed = true\n \telse\n \t\tinclude_completed = false\n \tend\t\n\n\t\tputs \"----:#{bu}---: #{l1}---:#{l2}---:#{l3}----can: #{include_cancel}----on: :#{include_onhold}----comp: #{include_completed}\"\n \t\treport_result = WorkFlow.handoff_report_stored_procedure(bu, l1, l2, l3, include_completed, include_cancel, include_onhold)\n \t\tcsv_file = WorkFlow.to_csv(report_result)\n\n \t\tsend_data csv_file, :filename => 'HAND-OFF-Report.csv'\n\n \tend", "def cmd_sparql_query\n options={}\n optparse = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$cmd} [--query QUERY] [--service URI] [--post] 'query' | @file\"\n opts.on('--service=URI', '--server=URI', 'SPARQL endpoint') do |uri|\n options[:service]=uri\n end\n opts.on('--query=FILE','--file=FILE', 'Take query from a file') do |file|\n options[:file]=file\n end\n opts.on('--output=TYPE', [:json,:xml,:text,:csv,:tsv],\n 'Set the output argument') do |type|\n options[:output]=type\n end\n opts.on('--accept=TYPE', [:json,:xml,:text,:csv,:tsv], \n 'Set the accept header type') do |type|\n options[:accept]=type\n end\n options[:verbose] = false\n opts.on( '--post', 'Force use of POST' ) do\n options[:post] = true\n end\n opts.on( '-v', '--verbose', 'Verbose' ) do\n options[:verbose] = true\n end\n opts.on( '--version', 'Print version and exit' ) do\n print \"#{SOH_NAME} #{SOH_VERSION}\\n\"\n exit\n end \n opts.on( '-h', '--help', 'Display this screen and exit' ) do\n puts opts\n exit\n end\n end\n\n begin optparse.parse! \n rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e\n warn e\n exit 1\n end\n\n $verbose = options[:verbose]\n $print_http = $verbose\n usePOST = options[:post]\n\n service = options[:service]\n warn_exit 'No service specified. Required --service=URI',1 if service.nil?\n\n # Query\n query=nil\n query_file=options[:file]\n if query_file.nil? && ARGV.size == 0\n then\n warn_exit 'No query specified.',1\n end\n if query_file.nil?\n query = ARGV.shift\n if query.match(/^@/)\n query_file = query[1..-1]\n query = nil\n end\n end\n\n # --output ==> output= (non-standard)\n args={}\n case options[:output]\n when nil\n when \"json\",\"xml\",\"text\",\"csv\",\"tsv\"\n args['output'] = options[:output]\n when :json,:xml,:text,:csv,:tsv\n args['output'] = options[:output].to_s\n else\n warn_exit \"Unrecognized output type: \"+options[:output],2\n end\n\n # --accept\n # options[:accept]\n\n print \"SPARQL #{service}\\n\" if $verbose\n #args={\"output\"=>\"text\"}\n SPARQL_query(service, query, query_file, usePOST, args)\n exit(0)\nend", "def execute!\n query_params = {}\n query_params[:skip_header] = true if config[:skip_column_names]\n Request.new(resources_path, :query_params => query_params, :sign => config[:my]).get(headers).print(config)\n end", "def stream_response(couch_response)\n\n # Should be asked to read lines from mocked_response\n line_reader_class = Class.new do\n def self.read_body(response)\n response.each do |line|\n yield line\n end\n end\n end\n\n # Collect the rows found\n rows = []\n callback = lambda { |line, idx|\n rows.push line\n }\n\n # Finally, set up the mixin class\n view_mixin = Class.new do\n include ViewStreamingResponseMixin\n end.new\n view_mixin.row_callback = callback\n\n # Run the streaming method\n non_row_body = view_mixin.ViewStreamingResponseMixin_stream_response(\n line_reader_class, couch_response.lines, callback)\n\n return rows, non_row_body\n\n end", "def process_outputs(args)\n @input = @generator = @window = @fill_value = nil # Cover our tracks.\n\n if (name = args[:out_file])\n IO.write(name, @output, mode: \"wb\")\n elsif (out_str = args[:out_str])\n out_str << @output\n end\n\n (_, @output = @output, nil)[0] # Return output and erase it.\n end", "def make_call_with_query query, page\n search_id = query.gsub('+', '__').gsub(':', '_')\n result_dir = \"github_search_results/#{search_id}\"\n `mkdir -p #{result_dir}`\n result_path = \"#{result_dir}/#{page}.json\"\n command = \"curl -H \\\"Accept: application/vnd.github.mercy-preview+json\\\" \\\"https://api.github.com/search/repositories?q=#{query}+language:swift&page=#{page}&per_page=100\\\"\"\n puts command\n json_result = `#{command}`\n parsed_json = JSON.parse(json_result)\n File.open(result_path, 'w') do |file|\n file << json_result\n end\n parsed_json['total_count'].to_i\nend", "def separateZyanteVsTextbookEntries(excludedIDs,zyanteIDs,textbookIDs,in_qzFilename,out_zyFilename,out_txtFilename,out_excFilename,out_excLogFilename)\n\t\n\tinFile = File.new(in_qzFilename,'r')\n\tzFile = File.new(out_zyFilename,'w')\n\ttFile = File.new(out_txtFilename,'w')\n\texcFile = File.new(out_excFilename,'w')\n\texcLogFile = File.new(out_excLogFilename,'a')\n\t\n\tnoSurveyEntryIDs = []\n\t\n\tinFileLines = inFile.each_line\n\tinFileLines.next\n\n\tinFileLines.each do |l|\n\t\tl_arr = l.split('\",\"').map(&:strip)\n\t\tif zyanteIDs.include? l_arr[1]\n\t\t\tzFile.puts(l)\n\t\telsif textbookIDs.include? l_arr[1]\n\t\t\ttFile.puts(l)\n\t\telsif !(excludedIDs.include? l_arr[1])\n\t\t\tnoSurveyEntryIDs.push(l_arr[1])\n\t\t\texcFile.puts(l)\n\t\telse\n\t\t\texcFile.puts(l)\n\t\tend\n\tend\n\n\tnoSurveyEntryIDs = noSurveyEntryIDs.uniq\n\tnoSurveyEntryIDs = noSurveyEntryIDs.sort\n\t\n\texcLogFile.puts(\"\\n\\nExcluded the following IDs for not having a survey entry:\")\n\texcLogFile.puts()\n\tif noSurveyEntryIDs.length == 0\n\t\texcLogFile.puts(\"NONE\")\n\telse\n\t\tnoSurveyEntryIDs.each do |x|\n\t\t\texcludedIDs.push(x)\n\t\t\texcLogFile.puts(x)\n\t\tend\n\tend\n\t\n\tinFile.close\n\tzFile.close\n\ttFile.close\n\texcFile.close\n\texcLogFile.close\n\t\nend", "def skipped_lines; end", "def skipped_lines; end", "def write_out(rows)\n File.open(file_name, 'w') do |f|\n f.puts rows\n end\n end", "def output_vs_header(output_file)\n if $verbose_mode == 1\n puts \"Creating:\\tVSphere file \"+output_file\n end\n file=File.open(output_file, 'w')\n $q_order.each do |key|\n if $q_struct[key].type == \"output\"\n if !$q_struct[key].parameter.match(/[A-z]/)\n output=$q_struct[key].value+\"\\n\"\n else\n output=$q_struct[key].parameter+\" \"+$q_struct[key].value+\"\\n\"\n puts output\n end\n file.write(output)\n end\n end\n file.close\n return\nend", "def process_ssg_results(filter=nil, exclusions=nil)\n self.class.process_ssg_results(\n File.join(@output_dir, @result_file) + '.xml',\n filter,\n exclusions\n )\n end", "def output_vs_post_list(post_list,output_file)\n file=File.open(output_file, 'a')\n post_list.each do |line|\n output=line+\"\\n\"\n file.write(output)\n end\n file.close\n return\nend", "def output_vs_post_list(post_list,output_file)\n file=File.open(output_file, 'a')\n post_list.each do |line|\n output=line+\"\\n\"\n file.write(output)\n end\n file.close\n return\nend", "def output_file\n @output_file ||= Tempfile.new(\"#{@blast_command}_out\")\n end", "def saveOutput\r\n tmpFile = \"#{@responseDir}/#{@fileName}.response\"\r\n if File.exists?(tmpFile)\r\n File.delete(tmpFile)\r\n end\r\n \r\n file = File.open(tmpFile, \"w\")\r\n file.write printXml\r\n file.close\r\n \r\n lstFile = \"listfile.txt\"\r\n if File.exists? lstFile\r\n File.delete(lstFile)\r\n end\r\n \r\n file = File.open(lstFile, \"w\")\r\n file.write tmpFile\r\n file.close\r\n end", "def write_druid_response_to_file(output_path, druid_output)\n output_filename = druid_path(output_path)\n ensure_containing_dir(output_filename)\n File.open(output_filename, 'w') do |file|\n file.write(druid_output)\n end\n output_filename\n rescue StandardError => e\n Rails.logger.error(\"Unexpected error trying to write druid response to file: #{Util.exception_msg_and_backtrace_str(e)}\")\n end", "def mysql_lines\n File.open(file_name, \"r\") do |line|\n #File.open('./lib/databasers/fibered_files_output.txt') do |line|\n line.each do |x|\n puts \"('\" + \"#{x.strip}\" + \"')\"\n end\n end\n end", "def filter_orig_by_output(orig:, output:)\n records_to_reject = output.\n map{|a| a[:name]}\n .select do |a|\n # matching_o = output.select do |b|\n # a == b[:name]\n # end\n\n # if matching_o.count > 1\n # flunk(\"something wrong, output_row contains the same record more than once\")\n # else\n # matching_o = matching_o.first\n # end\n\n # reject_this_one = matching_o[:req_id].present? &&\n # matching_o[:ritm_id].present? &&\n # matching_o[:task_id].present?\n end\n\n flunk(\"not implemented yet\")\n orig.reject{|b| records_to_reject.include? b[:short_description]}\n end", "def run_query(symbols, query, filter_proc=nil, sort_proc=nil)\n results = []\n if symbols.size > 100\n # create batches so that the GET has less than 4096 chars\n batches = symbols.size / 100 + 1\n (1..batches).each { |batch_id|\n index_start = (batch_id - 1) * 100\n index_end = (batch_id * 100) - 1\n index_end = symbols.size - 1 if index_end > (symbols.size - 1)\n logger.info(\"Running batch: #{index_start} - #{index_end} of #{symbols.size}\")\n q = query + 'symbol in (\"' + symbols[index_start..index_end].join('\",\"') + '\")'\n logger.debug(q)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(q))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.debug(response)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n }\n else\n query = query + 'symbol in (\"' + symbols.join('\",\"') + '\")'\n logger.info(query)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(query))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.info(response.inspect)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if j_response and j_response.has_key?'query' and j_response['query'].has_key?'results' and j_response['query']['results']\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n end\n end\n results.flatten!\n logger.debug(\"Final results before sort: #{results}\")\n results.sort!{ |a,b| sort_proc.call(a,b) } if sort_proc\n logger.debug(\"Final results after sort: #{results}\")\n results\n end", "def removeDuplicates(in_filename,out_filename,out_excDupRespFilename)\n\t\n\tinFile = File.new(in_filename,'r')\n\toutFile = File.new(out_filename,'w')\n\texcFile = File.new(out_excDupRespFilename,'a')\n\t\n\tresponsesHash = {}\n\tresponsesArray = []\n\t\n\tlines = inFile.each_line\n\t\n\tlines.each do |l|\n\t\tl_arr = l.split(',').map(&:strip)\n\t\t\n\t\tif !responsesHash[l_arr[1]+l_arr[3]].nil?\n\t\t\texcFile.puts(responsesHash[l_arr[1]+l_arr[3]])\n\t\tend\n\t\t\n\t\tresponsesHash[l_arr[1]+l_arr[3]] = l\n\tend\n\t\n\tresponsesHash.each { |id,line| responsesArray.push(line) }\n\tresponsesArray = responsesArray.sort\n\t\n\tresponsesArray.each { |x| outFile.puts(x) }\n\t\n\tinFile.close\n\toutFile.close\n\t\nend", "def extract_the_data(skip)\n skip = skip\n success = true\n data_lines = 0\n data_records = []\n @array_of_lines.each_with_index do |line, n|\n next if n < skip\n\n @project.write_messages_to_all(\"Warning: line #{n} is empty.<br>\", true) if line[0..24].all?(&:blank?)\n next if line[0..24].all?(&:blank?)\n\n @record = CsvRecord.new(line, @csvfile, @project)\n success, message, result = @record.extract_data_line(n)\n if result[:birth_place_flag].present? || result[:deleted_flag].present? || result[:individual_flag].present? || result[:location_flag].present? ||\n result[:name_flag].present? || result[:occupation_flag].present? || result[:address_flag].present? || result[:deleted_flag].present?\n result[:flag] = true\n else\n result[:flag] = false\n end\n result[:record_valid] = 'true' unless result[:error_messages].present? || result[:warning_messages].present? || result[:flag]\n data_records << result\n @csvfile.total_errors = @csvfile.total_errors + 1 if result[:error_messages].present?\n @csvfile.total_warnings = @csvfile.total_warnings + 1 if result[:warning_messages].present?\n @csvfile.total_info = @csvfile.total_info + 1 if result[:info_messages].present?\n @project.write_messages_to_all(message, true) unless success\n success = true\n data_lines = data_lines + 1\n end\n [success, data_lines, data_records]\n end", "def populate(options = {})\n opts = options.merge(\n suppress_missing: @suppress_missing,\n output_handler: lambda{ |data, chunk|\n if file_name = options[:response_file]\n data.to_file(file_name,\n file_mode: chunk == 0 ? 'w' : 'a',\n include_col_headers: chunk == 0)\n end\n process_data(data, chunk)\n }\n )\n extract_specs = [extract_specs] unless extract_specs.is_a?(Array)\n @data = []\n extract_specs.each do |extract_spec|\n @layout_mapped = false\n @extract.extract_data(nil, opts)\n end\n sort_data if @sort_required\n filter_data if @filter_required\n @data\n end", "def process \n return false if @file == false\n\t\t\n\t\ttime = File.mtime(@file)\n\n\t\tRDF::NQuads::Writer.open(@outfile) do |writer|\n\t\t\n\t\trecord = RDF::URI.new(\"http://bio2rdf.org/sider\")\n\n File.open(@file,\"r\").each do |line|\n row = line.strip.chomp.split(\"\\t\")\n \n # convert the STICH id to pubchem (see NOTES)\n pubchem = @pubchem_compound[row[1].to_i.abs.to_s]\n writer << [pubchem,RDF.type,@sider_vocabulary['Drug'],record]\n writer << [pubchem,DC.title,row[3],record]\n writer << [pubchem,DC.identifier,\"pubchem:#{row[1].to_i.abs.to_s}\",record]\n \n # these identifiers should in the future be linked \n # with proper ontology URIS retrieved from NCBO bioportal.\n side_effect = @umls[row[2]]\n writer << [side_effect,RDF.type,@sider_vocabulary['Side_Effect'],record]\n writer << [side_effect,DC.identifier,\"ulms:#{row[2]}\",record]\n writer << [side_effect,DC.title,row[4],record]\n writer << [pubchem,@sider_vocabulary['side_effect'],side_effect,record]\n end\n end\n end", "def execute\n @response ||= begin\n Config[:instrumenter].instrument(\"request.search_flip\", index: target, request: request) do |payload|\n response = execute!\n\n payload[:response] = response\n\n response\n end\n end\n end", "def print_google_map_data(options={})\n options={ header: false,\n }.merge(options)\n \n puts CSV.generate_line(@output_fields.values) if options[:header]\n \n \n @final_data.each do |record|\n if @command_options[:elders_only]\n # remove spouse name if possible to make elder easier to find..\n name = record[:name].gsub(/& \\w+ /, \"\")\n # check against 2 lists of elders in case names don't match\n if [email protected]?(name) and [email protected]?(name)\n next\n end\n end\n if record[:name].nil?\n next\n end\n \n record_values=[]\n @output_fields.each_key do |field|\n record_values.push(record[field])\n end\n line = CSV.generate_line(record_values)\n \n # print line to output\n puts line\n end\nend", "def get_session_line(output_file)\n @fields.each_index do |row|\n\n (row.to_f/2) == (row.to_f/2).to_i ? background_colour = '' : background_colour = 'bgcolor=\"#FFFFCC\"'\n output_file.puts indent1 + \"<tr #{background_colour}>\"\n\n row_data = @fields[row]\n session_id = \"<a href=\\\"..\\\\approved\\\\#{row_data[0]}\\\">#{row_data[0][0..-5]}</a>\"\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{session_id}</font></td>\"\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[1]}</font></td>\"\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[2]}</font></td>\"\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[3]}</font></td>\" if @include_switch['Duration']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[4]}</font></td>\" if @include_switch['C vs O']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[5]}</font></td>\" if @include_switch['C vs O']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[6]}</font></td>\" if @include_switch['TBS']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[7]}</font></td>\" if @include_switch['TBS']\n output_file.puts indent2 + \"<td><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[8]}</font></td>\" if @include_switch['TBS']\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[9]}</font></td>\"\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{row_data[10]}</font></td>\"\n num_testers = row_data[11].to_i\n if num_testers == 1\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\">#{num_testers}</font></td>\"\n else\n output_file.puts indent2 + \"<td ALIGN=\\\"center\\\"><font face=\\\"Courier New\\\" size=\\\"2\\\"><font color=\\\"red\\\">#{num_testers}</font></font></td>\"\n end\n output_file.puts indent1 + '</tr>'\n end\n end", "def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search_id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end", "def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search.id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end", "def download_raw_data\n sql = \"select \"\n if self.has_regions?\n sql << \"`region`,\"\n end\n sql << \" `district_id`,\"\n if self.has_district_names?\n sql << \"`district_name`,\"\n end\n if self.is_local_majoritarian?\n sql << \"`major_district_id`, \"\n end\n\n sql << \"`precinct_id`,\n `num_possible_voters`,\n `num_special_voters`,\n `num_at_12`,\n `num_at_17`,\n `num_votes`,\n `num_ballots`,\n `num_invalid_votes`,\n `num_valid_votes`,\n `logic_check_fail`,\n `logic_check_difference`,\n `more_ballots_than_votes_flag`,\n `more_ballots_than_votes`,\n `more_votes_than_ballots_flag`,\n `more_votes_than_ballots`,\n `supplemental_documents_flag`,\n `supplemental_document_count`,\n `amendment_flag`,\n `explanatory_note_flag`,\n `is_annulled`, \"\n\n parties = Party.hash_for_analysis(self.id, true)\n if parties.present?\n party_sql = []\n parties.each do |party|\n party_sql << \"`#{party[:id]} - #{party[:name]}`\"\n end\n end\n sql << party_sql.join(', ')\n sql << \" from `#{@@analysis_db}`.`#{self.analysis_table_name} - raw`\n order by district_id, precinct_id \"\n results = @@client.exec_query(sql)\n\n if results.present?\n csv_data = CSV.generate(col_sep: ',', force_quotes: true) do |csv|\n # add header\n csv << results.columns\n\n # data\n # - each row is a hash so just need to get values\n results.each do |row|\n csv << row.values\n end\n end\n end\n\n return csv_data\n end", "def output_to_csv\n if (@values[:result] != nil)\n @additions << calculate_worktime\n filename = get_entry(\"Specify output file: \")\n p = Menu.data_handler.find_person_by_id(@values[:id])\n CSVWriter.output(filename, p, @values[:result], @additions)\n else\n puts \"Nothing to write right now.\"\n end\n end", "def write_csv filename, fields = nil\n\n # By default all fields present in every row of output_data will be incorporated.\n if fields.nil?\n # Transform each output struct into a list of its keys, then take the intersection of each Array of keys.\n # This ensures that only fields present for all rows will be incorporated.\n fields = output_data.map{|o| o.to_h.keys}.inject do |last_keys, this_keys|\n last_keys & this_keys\n end\n end\n\n CSV.open filename, \"wb\", row_sep: \"\\r\\n\" do |csv|\n # Header line\n csv << fields\n\n output_data.each do |out|\n output_row = []\n fields.each do |field|\n output_row << out[field]\n end\n csv << output_row\n end\n end\n end", "def assert_result_matches(query, expected_result_file, filter_exp=nil, sort=false, qrserver_id=0, regexp_matching=false)\n result_xml = search(query, qrserver_id).xmldata\n expected_lines = []\n File.open(expected_result_file) do |file|\n expected_lines = file.readlines\n end\n\n @current_assert_file = expected_result_file\n assert_resultsets_match(result_xml.split(\"\\n\", -1), expected_lines, filter_exp, sort, regexp_matching)\n @current_assert_file = nil\n end", "def stream\n 10_000_000.times do |i|\n response.stream.write \"This is line#{i}\\n\"\n end\n ensure\n response.stream.close\n end", "def dump_records!\n file = Tempfile.new(\"danbooru-export-dump-\", binmode: true)\n file = Zlib::GzipWriter.new(file)\n\n CurrentUser.scoped(User.anonymous) do\n records.find_each(batch_size: 5_000) do |record|\n file.puts(record.to_json)\n end\n end\n\n file.close # flush zlib footer\n file\n end", "def load_file(view_option)\r\n\t# Strip .tsv file from input if present\r\n\tif (ARGV[0] != nil)\r\n\t\toutput_file = ARGV.shift\r\n\t\t# Ensure outfile is of type .tsv\r\n\t\tunless (output_file.end_with?(\".tsv\"))\r\n\t\t\tabort \"<outfile> file format must be .tsv!\"\r\n\t\tend\t\t\r\n\tend\r\n\r\n\t# Create database connection handle\r\n\tdb = load_database\r\n\r\n\t# Generate query string\r\n\tquery_string = \"SELECT * FROM items\"\r\n\r\n\t# Append query string to check only for quantity = 0\r\n\t# if -z was given (view_option == false)\r\n\tif (view_option == false)\r\n\t\tquery_string << \" WHERE quantity = 0\"\r\n\tend\r\n\r\n\t# Run the query and store the data\r\n\tdb.query(query_string)\r\n\trows = db.data\r\n\r\n\t# If no rows returned (typically only when specified with -z but none exist)\r\n\tif (db.get_length < 1)\r\n\t\tputs \"No database records found.\"\r\n\telse\r\n\t\t# If user didn't enter outfile, print to screen\r\n\t\tif (output_file == nil)\r\n\t\t\tformat_output\r\n\t\t\t# Loop through the rows and output data\r\n\t\t\trows.each do |a|\r\n\t\t\t\tprint \"| #{a[0]}\".ljust(23)\r\n\t\t\t\tprint \"| #{a[1]}\".ljust(43)\r\n\t\t\t\tprint \"| #{a[2]}\".ljust(23)\r\n\t\t\t\tprint \"| #{a[3]}\".ljust(11)\r\n\t\t\t\tprint \"| #{a[4]}\".ljust(10)\r\n\t\t\t\tprint \"| #{a[5]}\".ljust(43) << \" |\"\r\n\t\t\t\tprint \"\\n\"\r\n\t\t\tend\r\n\t\t\tputs \"+----------------------+------------------------------------------+----------------------+----------+---------+-------------------------------------------+\"\r\n\t\t# If user specified an outfile, print to outfile\r\n\t\telse\r\n\t\t\t# Write to file by first opening file and writing over it\r\n\t\t\tCSV.open(output_file, \"w\", {:col_sep => \"\\t\"}) do |csv|\r\n\t\t\t\trows.each do |a|\r\n\t\t\t\t csv << [a[0], a[1], a[2], a[3], a[4], a[5]]\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\tputs \"File was successfully updated!\"\r\n\t\t# If user specified file was not .tsv\r\n\t\tend\r\n\tend\r\n\t# Close database connection\r\n\tdb.close\r\nend", "def handle_output(row)\n\t\t\[email protected](row) unless @outgoing == nil || row == nil\n\t\tend", "def compile_output(out)\r\n head.each { |ln| out.puts ln }\r\n\r\n # Add new line between import statements and output\r\n out.puts ln_ending\r\n\r\n tmp_files.each do |tmp|\r\n last = copy_lines(tmp, out)\r\n\r\n out.puts ln_ending unless last.chomp.empty?\r\n File.delete(tmp)\r\n end\r\n end", "def file_query_edis_rev\n self.class.get(\"/aldebaran-tippler/tippler/notfis/#{@id_data['id_sequential_rev']}/edis\", :basic_auth => @auth)\n end", "def handle_output(transformed_row)\n outgoing.puts(transformed_row)\n end", "def process_request req, res\n req_headers = req.header\n req_query = req.query\n req_body = Oaf::HTTPServer.get_request_body req\n file = Oaf::Util.get_request_file(@options[:path], req.path,\n req.request_method, @options[:default_response])\n out = Oaf::Util.get_output(file, req.path, req_headers, req_body,\n req_query)\n res_headers, res_status, res_body = Oaf::HTTPServer.parse_response out\n Oaf::HTTPServer.set_response! res, res_headers, res_body, res_status\n end", "def writeFinalSequenceFrag()\n outFile = File.new(@seqNameRead1, \"w\")\n\n @read1FileList.each do |file|\n reader = Zlib::GzipReader.open(file)\n while(line = reader.gets)\n line.strip!\n\n if line.match(/^@/)\n @numReadsRead1 = @numReadsRead1 + 1\n\n # Read next 3 lines to complete reading 1 Fastq record\n readString = reader.gets.strip\n qualHeader = reader.gets.strip\n qualString = reader.gets.strip\n\n if line.match(/\\s\\d:N:/)\n @numFilteredRead1 = @numFilteredRead1 + 1\n writeFastqRecordToFile(outFile, line, readString, qualHeader,\n qualString)\n end\n end\n end\n reader.close\n end\n outFile.close\n end", "def test_result_download\n T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|\n assert_nothing_raised(T2Server::AttributeNotFoundError) do\n file = run.upload_file(FILE_STRS)\n run.input_port(\"IN\").remote_file = file\n run.generate_provenance(true)\n end\n\n if run.server.version >= \"2.5.4\"\n assert(run.generate_provenance?)\n else\n refute(run.generate_provenance?)\n end\n\n run.start\n run.wait\n\n # Get total data size (without downloading the data).\n assert_equal(run.output_port(\"OUT\").total_size, 100)\n assert_equal(run.output_port(\"OUT\").size, 100)\n\n # Stream just the first 10 bytes.\n stream = \"\"\n run.output_port(\"OUT\").value(0...10) do |chunk|\n stream += chunk\n end\n assert_equal(stream, \"123456789\\n\")\n\n # Get just the second 10 bytes.\n assert_equal(run.output_port(\"OUT\").value(10...20),\n \"223456789\\n\")\n\n # Stream the first 20 bytes.\n stream = \"\"\n run.output_port(\"OUT\").value(0...20) do |chunk|\n stream += chunk\n end\n assert_equal(stream, \"123456789\\n223456789\\n\")\n\n # Get a bad range - should return the first 10 bytes.\n assert_equal(run.output_port(\"OUT\").value(-10...10),\n \"123456789\\n\")\n\n # Stream the lot and check total length. There should be two chunks.\n stream = \"\"\n run.output_port(\"OUT\").value do |chunk|\n stream += chunk\n end\n assert_equal(stream.length, 100)\n\n # Now get the lot and check its size.\n out = run.output_port(\"OUT\").value\n assert_equal(out.length, 100)\n\n # test streaming provenance data\n if run.server.version >= \"2.5.4\"\n assert_nothing_raised(T2Server::AccessForbiddenError) do\n prov_cache = TestCache.new\n prov_size = run.provenance(prov_cache)\n assert_not_equal(prov_size, 0)\n assert_not_equal(prov_cache.data, \"\")\n end\n else\n assert_raise(T2Server::AccessForbiddenError) do\n prov_cache = TestCache.new\n prov_size = run.provenance(prov_cache)\n assert_equal(prov_size, 0)\n assert_equal(prov_cache.data, \"\")\n end\n end\n\n assert(run.delete)\n end\n end", "def write(mph, minutes, incline=\"\", date: Time.now)\n Dir.mkdir(File.dirname(filepath)) unless Dir.exist?(File.dirname(filepath))\n File.open(filepath, 'a+') do |file|\n unless(file.readlines.include?(header(date.month, date.day)))\n file.puts header(date.month, date.day)\n end\n file.puts query(mph, minutes, incline, date: date)\n end\n end", "def execute\n\t\tresult = execute_request(get_resultcount, @skip)\n\n\t\t@data_xml = result[0]\n\t\t@result = result[1]\n\t\treturn self\n\tend", "def discard\n FileUtils.rm options.output\n end" ]
[ "0.7910778", "0.66135293", "0.5318729", "0.52248454", "0.5138868", "0.5112188", "0.5058764", "0.5006289", "0.49882725", "0.4909226", "0.48741266", "0.48708925", "0.48606223", "0.48233008", "0.48045418", "0.47964084", "0.46586055", "0.46293446", "0.46200824", "0.45876616", "0.45813203", "0.45706254", "0.4551586", "0.45502758", "0.45454445", "0.4532584", "0.45303315", "0.44715095", "0.44520897", "0.44506016", "0.44409928", "0.44334307", "0.44257027", "0.43604603", "0.43563795", "0.43557817", "0.43396783", "0.43381378", "0.4336817", "0.43248442", "0.43198872", "0.43158564", "0.43144226", "0.42916283", "0.42812473", "0.42621833", "0.42616206", "0.4246106", "0.424279", "0.42410678", "0.42373085", "0.42277843", "0.42250744", "0.4211407", "0.42069644", "0.4202834", "0.42025396", "0.4202394", "0.4182623", "0.4172772", "0.41650102", "0.41602468", "0.41602468", "0.4151522", "0.41458964", "0.4139415", "0.41384375", "0.41384375", "0.41322115", "0.41321373", "0.41273677", "0.41264817", "0.4121234", "0.40970182", "0.40938112", "0.40930742", "0.4087227", "0.40847978", "0.4078126", "0.4076385", "0.40738997", "0.40685135", "0.40665254", "0.40645075", "0.40606058", "0.40557617", "0.40557498", "0.4054402", "0.4049266", "0.404795", "0.40440506", "0.40436313", "0.40397358", "0.40351582", "0.4026812", "0.4017462", "0.40167785", "0.40164414", "0.4015811", "0.40101248" ]
0.7085524
1
Initialize with 'the_query' and, if supplied, the 'filter' function. postcondition: query() != nil
def initialize(the_query, bad_data_expr = nil, filter = nil) if the_query.nil? then raise "Invalid (nil) constructor query arg" end @response_lines = [] @fatal_error = false # Function to call on each line after scanning: @filter_function = filter @bad_data_expr = bad_data_expr @query = the_query end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_filters(query)\n query\n end", "def apply_filter(query)\n query\n end", "def apply_filter(query)\n query\n end", "def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end", "def initialize(options={})\n super options\n if query.nil? && filter.nil?\n raise \"Must give a query or a filter\"\n end\n end", "def prepare_search query\n receive!(filter: event_filter(query))\n self\n end", "def query_filter(query)\n if has_filter_params?\n conditions = @build.parse(@filter)\n apply_conditions(query, conditions)\n else\n query\n end\n end", "def initialize(&block)\n @filter = (block || method(:filter))\n super()\n end", "def initialize(query)\n @query = query\n end", "def initialize(query)\n @query = query \n end", "def initial_query=(_arg0); end", "def initialize(query={})\n @query = query\n end", "def filter(filter)\n @query[:q] << \"filter:#{filter}\"\n self\n end", "def searchUsing(filter)\n @zqlQuery = filter\n end", "def initialize(parameters, query, model, filter_settings)\n # might need this at some point: Rack::Utils.parse_nested_query\n @key_prefix = 'filter_'\n key_partial_match = :filter_partial_match\n\n @default_page = 1\n @default_items = 25\n @max_items = 500\n @table = relation_table(model)\n\n # `.all' adds 'id' to the select!!\n @initial_query = !query.nil? && query.is_a?(ActiveRecord::Relation) ? query : relation_all(model)\n # the check for an active record relation above can lead to some subtle\n # bugs when you pass some non-nil query like thing.\n # temporarily throwing here to see what breaks. All tests pass so\n # we'll make the check below a validation that always runs\n unless query.is_a?(ActiveRecord::Relation)\n raise ArgumentError, \"query was not an ActiveRecord::Relation. Query: #{query}\"\n end\n\n validate_filter_settings(filter_settings)\n @valid_fields = filter_settings[:valid_fields].map(&:to_sym)\n @text_fields = filter_settings.include?(:text_fields) ? filter_settings[:text_fields].map(&:to_sym) : []\n @render_fields = filter_settings[:render_fields].map(&:to_sym)\n @filter_settings = filter_settings\n @default_sort_order = filter_settings[:defaults][:order_by]\n @default_sort_direction = filter_settings[:defaults][:direction]\n @custom_fields2 = filter_settings[:custom_fields2] || {}\n @capabilities = filter_settings[:capabilities] || {}\n\n @build = Build.new(@table, filter_settings)\n\n @parameters = CleanParams.perform(parameters)\n validate_hash(@parameters)\n\n @parameters = decode_payload(@parameters)\n\n @filter = @parameters.include?(:filter) && !@parameters[:filter].blank? ? @parameters[:filter] : {}\n @projection = parse_projection(@parameters)\n\n # remove key_partial_match key from parameters hash\n parameters_for_generic = @parameters.dup\n parameters_for_generic.delete(key_partial_match) if parameters_for_generic.include?(key_partial_match)\n\n # merge filters from qsp partial text match into POST body filter\n partial_match_filters = parse_qsp_partial_match_text(@parameters, key_partial_match, @text_fields)\n @filter = add_qsp_to_filter(@filter, partial_match_filters, :or)\n\n # merge filters from qsp generic equality match into POST body filter\n qsp_generic_filters = parse_qsp(nil, parameters_for_generic, key_prefix)\n @filter = add_qsp_to_filter(@filter, qsp_generic_filters, :and)\n\n # populate properties with qsp filter spec\n @qsp_text_filter = @parameters[key_partial_match]\n @qsp_generic_filters = {}\n qsp_generic_filters.each do |key, value|\n @qsp_generic_filters[key] = value[:eq]\n end\n\n @paging = parse_paging(@parameters, @default_page, @default_items, @max_items)\n @sorting = parse_sorting(@parameters, @default_sort_order, @default_sort_direction)\n end", "def Filter=(arg0)", "def retrieve_query\r\n if !params[:query_id].blank?\r\n cond = \"project_id IS NULL\"\r\n cond << \" OR project_id = #{@project.id}\" if @project\r\n @query = Query.find(params[:query_id], :conditions => cond)\r\n @query.project = @project\r\n session[:query] = {:id => @query.id, :project_id => @query.project_id}\r\n else\r\n if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\")\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = {:project_id => @query.project_id, :filters => @query.filters}\r\n else\r\n @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]\r\n @query ||= Query.new(:name => \"_\", :project => @project, :filters => session[:query][:filters])\r\n @query.project = @project\r\n end\r\n end\r\n end", "def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end", "def initialize\n super(\"query\")\n end", "def initialize(query)\n raise ArgumentError, 'Query should be string' unless query.is_a? String\n @raw_query = query\n end", "def filter\n @filter ||= filter_class.new default_filter\n end", "def filter\n @filter = params[:q]\n end", "def initial_query; end", "def filter( *filterspec )\n\t\tif filterspec.empty?\n\t\t\topts = self.options\n\t\t\topts[:filter] = Treequel::Filter.new(opts[:filter]) unless\n\t\t\t\topts[:filter].is_a?( Treequel::Filter )\n\t\t\treturn opts[:filter]\n\t\telse\n\t\t\tself.log.debug \"cloning %p with filterspec: %p\" % [ self, filterspec ]\n\t\t\tnewfilter = Treequel::Filter.new( *filterspec )\n\t\t\treturn self.clone( :filter => self.filter + newfilter )\n\t\tend\n\tend", "def filter(query_type, options = {})\n bool.filter(query_type, options)\n self\n end", "def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end", "def initial_query(arg)\n query = Hash.new\n return query\n end", "def retrieve_query\n store_query_params if is_new_query?\n reset_query_params if reset_new_query?\n @timesheet_query = TimesheetQuery.new({:monitoring_projects => @monitoring_projects,\n :monitoring_members => @monitoring_members,\n :timesheet_user => @timesheet_user})\n query = restore_query_params\n if query[:fields] and query[:fields].is_a? Array\n query[:fields].each do |field|\n @timesheet_query.add_filter(field,query[:operators][field], query[:values][field])\n end\n else\n @timesheet_query.available_filters.keys.each do |field|\n @timesheet_query.add_short_filter(field, params[field]) if params[field]\n end\n end\n @timesheet_query.validate\n end", "def initialize(base, &filter)\n @base = base\n @filter = filter\n end", "def query(*args, &block)\n @query = block ? @query = Query.new(*args, &block) : args.first\n self\n end", "def initialize(search_params)\n @search_params = search_params\n @query = formatted_query.presence || \"*\"\n end", "def initialize(*query)\n @query = parse_query_list(query)\n end", "def process_query(query)\n # Nothing in default\n end", "def query(query)\n init\n @query = @query_vars = Railspress::Functions.wp_parse_args(query)\n get_posts\n end", "def initialize(filter_select:)\n @filter_select = filter_select\n end", "def filter(*args, &block)\n @filter = block ? Filter.new(*args, &block) : args.first\n self\n end", "def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def initialize(results)\n @term = results[:term]\n @cpvs = results[:cpvs]\n @filter = results[:filter].presence || NullFilter.new\n end", "def initialize\n @all_filters = []\n @errors = []\n @conditions = nil\n filters\n reset\n end", "def initialize(filter_type, &block)\n if FILTER_TYPES.include?(filter_type)\n @filter_type = filter_type\n else\n raise ArgumentError, \"invalid type #{filter_type}, allowed: #{FILTER_TYPES.join(', ')}\"\n end\n @block = block\n end", "def query(hash = nil)\n hash ? @query = hash : @query\n end", "def query ; @query ||= Waves::Request::Query.new( request.query ) ; end", "def create_filter(filter)\n return nil,nil if filter.nil?\n\n db_adapter = MongoDBConv.new(@current_var, true) #do push 'or'\n\n db_expr,hop_expr = filter.db_conv(@parent, db_adapter) \n end", "def initialize(user, query_params)\n @query_params = query_params\n @entries = user_id_param ? user_entries : user.entries\n end", "def filter_clause\n @filters[filter % @filters.size] unless @filters.size.zero?\n end", "def set_query\n\t\t@query = Query.find(params[:id])\n\tend", "def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end", "def buil_must_query_filter\n query_filter = [{ 'range' => date_range_filter }]\n query_filter | @raw_query\n end", "def query(query, phrase=false)\n if phrase\n q = %q[]\n params['q'] = query.gsub(\" \",\"+\").gsub('\"',\"'\")\n else\n params['q'] = CGI.escape(query)\n end\n params.merge!({'fq' => query_filters.uniq.join(\"+AND+\")}) unless query_filters.empty?\n self\n end", "def initialize()\n @filters ||= []\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def create\n \t@query = current_user.queries.find(params[:query_id])\n @filter = current_user.queries.find(params[:query_id]).filters.new(params[:filter])\n\n respond_to do |format|\n if @filter.save\n format.html { redirect_to @query, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(include_query = nil)\n @include_query = include_query\n end", "def global_filter=(_arg0); end", "def prepare_query\n if @taxon_concept && TaxonData.is_clade_searchable?(@taxon_concept)\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, nil, limit_clause)\n end", "def initialize( filter_phrase=//, options={} )\r\n validate_arguments binding()\r\n @filter_phrase = filter_phrase\r\n @negate = options[ :negate ]\r\n end", "def initialize\n @filters = []\n end", "def filter(sparql)\n raise \"Must be overridden\"\n end", "def initialize(attributes={})\n self.filters ||= {}\n super\n end", "def initialize(query, options = {})\n @query = query\n @options = options\n end", "def default!\n if filter.blank?\n self.filter = name\n end\n end", "def filter\n query = build_query()\n @lancamentos = query\n\n\n render :layout => nil\n end", "def apply_filter(query, filter, value)\n return [query] if query.blank? || filter.blank? || value.blank?\n return [query] if filter.noop?\n\n klass = filter.klass || query.klass\n column = filter.column\n value = filter.values.call(value) if filter.values.present?\n\n queries = []\n\n if column.present?\n target_column = \"#{klass.table_name}.#{column}\"\n\n if filter.data_type == DateTime\n target_column = \"date_trunc('second', #{target_column})\"\n end\n\n vals = Array(value)\n value = []\n q = []\n\n vals.each do |val|\n if klass.columns_hash[column.to_s] && klass.columns_hash[column.to_s].type == :integer && !(val.to_s.strip =~ /\\A\\d+\\Z/)\n q << '0 = 1'\n else\n q << \"LOWER(#{target_column}::varchar) LIKE LOWER(?)\"\n value << \"%#{val}%\"\n end\n end\n\n queries << \"(#{q.join(' OR ')})\" if q.any?\n elsif filter.query.present?\n query, query_list, value_list = filter.query.call(query, value)\n queries = Array(query_list)\n value = Array(value_list)\n elsif filter.having.present?\n query = query.having(\"LOWER((#{filter.having})::varchar) LIKE ?\", \"%#{Array(value).first}%\")\n end\n\n [query, queries, value]\n end", "def initialize(*)\n super\n @predicate = Function.optimize_operand(operation.predicate)\n end", "def initialize(query, reference)\n @query = query\n @reference = reference\n end", "def query(&block)\n Query.new(self, &block)\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def initialize_available_filters\n @@available_filters ||= {}\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def normalize_query(query, filters)\n filter = normalize_filters filters\n query ||= {match_all: {}}\n return query unless filter\n {filtered: {\n query: query,\n filter: filter,\n }}\n end", "def initialize(filters={}, conn=:and)\n if filters.kind_of?(Hash)\n @filters = SolveBio::Filter.\n normalize(filters.keys.sort.map{|key| [key, filters[key]]})\n elsif filters.kind_of?(Array)\n @filters = filters\n elsif filters.kind_of?(SolveBio::Filter)\n @filters = SolveBio::Filter.deep_copy(filters.filters)\n return self\n else\n raise TypeError, \"Invalid filter type #{filters.class}\"\n end\n @filters = [{conn => @filters}] if filters.size > 1\n self\n end", "def filter\r\n q = self.query\r\n return nil if q.nil?\r\n filter_name = q.ole_methods.detect{|m| m.to_s =~ /Filter\\Z/}\r\n return nil if filter_name.nil?\r\n q.send(filter_name.to_s.to_sym)\r\n end", "def initialize(raw_criteria = {})\n validated_criteria = validate_filter_criteria(raw_criteria)\n fetch_from_backend(validated_criteria)\n end", "def initialize_query\n # Fix some strange request environments.\n env_table['REQUEST_METHOD'] ||= 'GET'\n\n # POST assumes missing Content-Type is application/x-www-form-urlencoded.\n if env_table['CONTENT_TYPE'].blank? && env_table['REQUEST_METHOD'] == 'POST'\n env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'\n end\n\n @cookies = CGI::Cookie::parse(env_table['HTTP_COOKIE'] || env_table['COOKIE'])\n @params = {}\n end", "def filter(expression = {}, &block)\n case expression\n when SPARQL::Algebra::Expression\n filter_without_expression do |solution|\n expression.evaluate(solution).true?\n end\n filter_without_expression(&block) if block_given?\n self\n else filter_without_expression(expression, &block)\n end\n end", "def filtered_dataset\n filter_args_from_query.inject(@dataset) do |filter, cond|\n filter.filter(cond)\n end\n end", "def initialize(type = nil, item = nil)\n super type\n query << item if item\n end", "def initialize(directory, &block)\n # Set root object\n @data = directory\n\n # Populate configurables from DSL block\n instance_eval(&block)\n\n\n raise(ArgumentError, \"A query must specify a 'select' clause\") unless @what\n raise(ArgumentError, \"A query must specify a 'from' clause\") unless @from\n\n warn(\"Multiple selections made without using an 'as' clause\") unless @name_transforms || (@what.count == @what.uniq.count)\n\n # Gather relevant objects from root object and filters\n @data = CQL::MapReduce.gather_objects(@data, @from, @filters)\n\n # Extract properties from gathered objects\n @data = format_output(@data)\n end", "def initialize(query, records = nil, options = {})\n super(query, records)\n @time = options[:time]\n @total_found = options[:total_found]\n @count = options[:count]\n @keywords = options[:keywords]\n @docs = options[:docs]\n @facets = options.fetch(:facets, {})\n @pager = options[:pager]\n end", "def set_filter(val)\n @filter = val\n build_path_query\n @filter\n end", "def filter(filt = nil, *args, **opts)\n @filter = if filt.nil? && !defined?(@filter)\n Filters.default\n elsif filt\n Filters.resolve(filt, *args, **opts)\n else\n @filter\n end\n\n aggregator.filter = @filter\n\n @filter\n end", "def initialize(query, whitelist = nil, split = true)\n @query = query\n @parts = {}\n @whitelist = whitelist\n @split = split\n parse_query!\n end", "def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end", "def apply_narrowing_filters\n @filters[:narrowing].each do |filter|\n @query = @query.where(filter => @options[filter])\n end\n @query\n end", "def initialize_query\r\n # Fix some strange request environments.\r\n env_table['REQUEST_METHOD'] ||= 'GET'\r\n\r\n # POST assumes missing Content-Type is application/x-www-form-urlencoded.\r\n if env_table['CONTENT_TYPE'].blank? && env_table['REQUEST_METHOD'] == 'POST'\r\n env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'\r\n end\r\n\r\n @cookies = CGI::Cookie::parse(env_table['HTTP_COOKIE'] || env_table['COOKIE'])\r\n @params = {}\r\n end", "def prepare_query\n if @taxon_concept\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, inner_order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, inner_order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, outer_order_clause, limit_clause)\n end", "def apply_global_filters(query, filter_params)\n value = filter_params[:filter][999.to_s] rescue nil\n\n return query if value.blank?\n\n queries = []\n values = []\n\n # iterate over all filter inputs\n ajax_filters.each do |filter|\n next if filter.blank?\n next if filter.having.present?\n\n query, q, v = apply_filter(query, filter, value)\n\n next if q.blank?\n\n queries += Array(q)\n values += Array(v) unless v.nil?\n end\n\n query.where(queries.join(' OR '), *values)\n end" ]
[ "0.70675766", "0.7058405", "0.7058405", "0.67657757", "0.67077416", "0.66206855", "0.6616937", "0.6594497", "0.65907794", "0.65654206", "0.6564716", "0.6517352", "0.6356355", "0.62802786", "0.62757814", "0.62329704", "0.61897224", "0.618001", "0.6154256", "0.6136374", "0.6118201", "0.60821307", "0.6071512", "0.6067775", "0.6055987", "0.6046582", "0.6039101", "0.60296106", "0.601317", "0.60111123", "0.59948236", "0.59940606", "0.59931374", "0.59826165", "0.58925223", "0.5875023", "0.5874457", "0.58585286", "0.58585286", "0.5847642", "0.5842659", "0.5838362", "0.5821111", "0.58158064", "0.57996017", "0.5798006", "0.57858557", "0.5777004", "0.57697624", "0.57648844", "0.576005", "0.57327574", "0.57234555", "0.57234555", "0.57234555", "0.57234555", "0.57234555", "0.57234555", "0.5695572", "0.56930697", "0.56852823", "0.5677332", "0.56766486", "0.56606555", "0.5657722", "0.5649614", "0.56487346", "0.5635805", "0.56217456", "0.56074446", "0.5601805", "0.55990344", "0.5598458", "0.55932325", "0.55932325", "0.55932325", "0.5591133", "0.557983", "0.557983", "0.557983", "0.557983", "0.557983", "0.5577685", "0.55749696", "0.5560831", "0.55500394", "0.55466837", "0.5543579", "0.5528518", "0.55224097", "0.5519329", "0.55115294", "0.5501271", "0.54996943", "0.5495424", "0.5493537", "0.54908097", "0.5488564", "0.5488383", "0.5482879" ]
0.7177048
0
we create new instance of the AddressBook model and assign it to the variable named "book" using the "let" syntax provided by RSpec. This lets us use "book" in all our tests, removing the duplication of having to instantiate a new "AddressBook" for each test. commented out all "book = AddressBook.new" let means the code runs only when called! over the instiante it method "before do" video example in the classwork ass. why let is the appropriate way to remove code duplication we create a helper method named check_entry which consolidates the redundant code. We can now pass in the particular name, number, and email address we want into this reusable helper method.
def check_entry(entry, expected_name, expected_number, expected_email) expect(entry.name).to eq expected_name expect(entry.phone_number).to eq expected_number expect(entry.email).to eq expected_email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_entry(entry, expected_name, expected_number, expected_email) #helper method used to consildate redundant code\n expect(entry.name).to eq expected_name\n expect(entry.phone_number).to eq expected_number\n expect(entry.email).to eq expected_email\n end", "def check_entry(entry, expected_name, expected_number, expected_email)\n expect(entry.name).to eq expected_name\n expect(entry.phone_number).to eq expected_number\n expect(entry.email).to eq expected_email\n end", "def check_entry(entry, expected_name, expected_number, expected_email)\n\t\texpect(entry.name).to eq expected_name\n\t\texpect(entry.phone_number).to eq expected_number\n\t\texpect(entry.email).to eq expected_email\n\tend", "def check_entry(entry, expected_name, expected_number, expected_email)\n expect(entry.name).to eq expected_name\n expect(entry.phone_number).to eq expected_number\n expect(entry.email).to eq expected_email\n end", "def check_entry(entry, expected_name, expected_phone, expected_email)\n expect(entry.name).to eq(expected_name)\n expect(entry.phone_number).to eq(expected_phone)\n expect(entry.email).to eq(expected_email)\n end", "def check_in(book)\n @book = book\n end", "def test_book_lookup__book_found\n book_found = {title: \"eyre_affair\",\n rental_details: {\n student_name: \"Mary\",\n date: \"04/05/16\"}\n }\n assert_equal(book_found, @main_library.book_lookup(\"eyre_affair\"))\n end", "def test_address_validation\n response = nil\n assert_nothing_raised do\n #response = @carrier_prod.validate_addresses({'address_from' => @locations[:ottawa], 'address_to' => @locations[:beverly_hills]}, :test=>false)\n @carrier_prod.validate_addresses({'address_from' => Location.new(\n :country => 'US',\n :state => 'TX',\n :city => 'Houston',\n :address1 => '11811 North Freeway',\n :address2 => 'suite 500',\n :zip => '77060'), \n 'address_to' => Location.new(:country => 'US',\n :state => 'NY',\n :city => 'Brooklyn',\n :address1 => '7 Balfour pl',\n :address2 => 'Apt E3',\n :zip => '11225')})\n end\n end", "def manual_add_entry\n address_book.add_entry(enter_name, enter_phone, enter_email)\n end", "def test_find_book__found\n\n single_book = @library1.find_book(\"animal_farm\")\n expected_book = {\n title: \"animal_farm\",\n rental_details: {\n student_name: \"Bob\",\n date: \"05/11/15\"\n }\n }\n\n assert_equal(expected_book, single_book)\n\n end", "def init() \n\n address_create()\n\n employee_create(\"Nicolas\", \"Genest\", \"CEO\", 'roc-kets', \"[email protected]\")\n employee_create(\"Nadya\", \"Fortier\", \"Director\", \"roc-kets\", \"[email protected]\")\n employee_create(\"Martin\", \"chantal\", \"Director Assistant\", \"roc-kets\", \"[email protected]\")\n employee_create(\"Mathieu\", \"Houde\", \"Captain\", \"roc-kets\", \"[email protected]\")\n employee_create(\"David\", \"Boutin\", \"Engineer\", \"roc-kets\", \"[email protected]\")\n employee_create(\"Mathieu\", \"Lortie\", \"Engineer\", \"roc-kets\", \"[email protected]\")\n employee_create(\"Thomas\", \"Carrier\", \"Engineer\", \"roc-kets\", \"[email protected]\")\n employee_create(\"Admin1\", \"Admin1\", \"Admin1\", \"roc-kets\", \"[email protected]\")\n employee_create(\"Admin\", \"Admin\", \"Admin\", \"roc-kets\", \"[email protected]\")\n\n\n 25.times do \n customer_create(\n Faker::Company.name,\n Faker::Name.name,\n Faker::PhoneNumber.cell_phone,\n Faker::Internet.email,\n \"Description\",\n Faker::Name.name,\n Faker::PhoneNumber.cell_phone,\n Faker::Internet.email\n ) \n end\n\n 40.times do\n intervention_create(\n Faker::Number.between(from: 1, to: 9),\n Faker::Number.between(from: 1, to: 25),\n Faker::Number.between(from: 1, to: 40),\n Faker::Number.between(from: 1, to: 40),\n Faker::Number.between(from: 1, to: 40),\n Faker::Number.between(from: 1, to: 200),\n Faker::Number.between(from: 1, to: 9),\n Faker::Date.between(from: '2019-02-23', to: '2020-2-25'),\n Faker::Date.between(from: '2020-02-25', to: '2021-3-15'),\n ['Success', 'Failure', 'Incomplete'].sample,\n \"Nothing to report\",\n ['Pending', 'InProgress', 'Interrupted' , 'Resumed', 'Complete'].sample\n )\n end\n\n\n 50.times do\n pl = [\"Standard\", \"Premium\", \"Excelium\"]\n bt = [\"Residential\", \"Commercial\", \"Corporate\", \"Hybrid\"]\n Quote.create(\n install_fees: Faker::Number.between(from: 500, to: 2000),\n total_price: Faker::Number.between(from: 50000, to: 200000),\n product_line: (pl.sample),\n number_of_apartments: Faker::Number.between(from: 50, to: 200),\n number_of_floors: Faker::Number.between(from: 10, to: 70),\n number_of_basements: Faker::Number.between(from: 1, to: 10),\n number_of_corporations: Faker::Number.between(from: 1, to: 100),\n elevator_amount: Faker::Number.between(from: 1, to: 100),\n quotes_name: Faker::Name.name,\n quotes_email: Faker::Internet.email,\n quotes_company_name: Faker::Company.name,\n building_type: (bt.sample),\n final_price: Faker::Number.between(from: 50000, to: 800000),\n number_of_companies: Faker::Number.between(from: 1, to: 5),\n number_of_parking: Faker::Number.between(from: 50, to: 200),\n maximum_occupancy: Faker::Number.between(from: 50, to: 200),\n business_hours: Faker::Number.between(from: 0, to: 24),\n number_of_elevators: Faker::Number.between(from: 1, to: 15),\n unit_price: Faker::Number.between(from: 11000, to: 15000),\n # updated_at: dateCreationUpdate,\n created_at:Faker::Date.between(from: '2018-02-23', to: '2021-2-25')\n )\n end\nend", "def test_address_auth \n c = customers(:bob)\n assert_equal(addresses(:address1), c.find_address(1))\n assert_equal(addresses(:address2), c.find_address(2))\n assert_nil(c.find_address(3))\n assert_nil(c.find_address(100000))\n end", "def check_in(book)\n end", "def create_entry\n system \"clear\"\n puts \"New AddressBloc Entry\"\n print \"Name: \"\n name = gets.chomp\n print \"Phone number: \"\n phone = gets.chomp\n print \"Email: \"\n email = gets.chomp\n\n address_book.add_entry(name, phone, email)\n\n system \"clear\"\n puts \"New entry created\"\n end", "def create_entry\n\t#creates initial address entry\n\tputs \"Please enter first name: \"\n\tfname = gets.chomp.to_s\n\n puts \"Please enter last name: \"\n \tlname = gets.chomp.to_s \n\n \tentry = Addressentry.create({first_name: fname, last_name: lname})\n\n \t\t#phone number entry\n \tputs \"Would you like to give this entry a phone number? Enter Y or N \\n\"\n \tphone_response = gets.chomp.upcase\n \t\n\t\t#loops until user inputs N\n \tuntil phone_response == \"N\" do\n \t\tp = create_phone()\n \t\tentry.phonenumbers.push p\n \t\tputs \"Would you like to add another number?\"\n \t\tphone_response = gets.chomp.upcase\n \tend\n\n \t\t#email entry\n \tputs \"Would you like to add an email? Enter Y or N\\n\"\n \temail_response = gets.chomp.upcase\n\n \tuntil email_response == \"N\" do \n \t\te = create_email()\n \t\tentry.emails.push e\n \t\tputs \"Would you like to add another email?\"\n \t\temail_response = gets.chomp.upcase\n \tend\n\n \tentry.save!\n \tputs \"entry saved!\"\nend", "def test_get_rental_details__book_found\n details_found = {student_name: \"Mary\", date: \"04/05/16\"}\n assert_equal(details_found, @main_library.get_rental_details(\"eyre_affair\"))\n end", "def enter_address_plus_email(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number, email_address)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n enter_address(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number)\n chkout_email_address_field.value = email_address\n chkout_confirm_email_address_field.should_exist\n chkout_confirm_email_address_field.value = email_address\n end", "def test_add_book\n\t\tassert_equal 1, @new_driver.book(1)\n\tend", "def test_find_book\n found_book = @compiled_library.find_book(\"Lord Of The Rings\")\n p found_book\n assert_equal({title: \"Lord Of The Rings\",\n rental_details: {\n student_name: \"Richard\",\n date: \"01/12/16\"}}, found_book)\n end", "def test_change_rental_details__book_found\n book_modified ={title:\"eyre_affair\", rental_details: {student_name:\"Ewa\", date:\"10/08/2018\"}}\n @main_library.change_rental_details(\"eyre_affair\", \"Ewa\", \"10/08/2018\")\n assert_equal(book_modified, @main_library.book_lookup(\"eyre_affair\"))\n end", "def test_book(book)\n expect(book).to be_persisted\n expect(book.title).not_to be_blank\n expect(book.child_books.to_a + book.pages.to_a).not_to be_empty\n\n book.child_books.each do |cb|\n next if cb == book\n test_book(cb)\n end\n\n book.pages.each do |page|\n expect(page).to be_persisted\n expect(page.title).not_to be_blank\n end\n end", "def create_some_bogus_benign_database_entries\n s = FactoryGirl.create(:sale_with_1_book_unpaid)\n line_item = s.line_items.first\n line_item.update_attributes(qty: 90)\n # FactoryGirl.create(:line_item)\n FactoryGirl.create(:address)\n \n @expectedly_unassociated_address_id = Address.last.id\n \n @spoof_address_count = Address.count - @retailer_address_count\n \n Sale.find_by_address_id(@expectedly_unassociated_address_id).should be_nil\n @expectedly_unassociated_address_id\n end", "def test_add_new_book\n @library.add_new_book(\"catch_22\")\n expected = {\n title: 'catch_22',\n rental_details: {\n student_name: '',\n date: ''\n }\n }\n assert_equal(expected, @library.get_book('catch_22'))\n end", "def test_house_address\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St',lights: true, safe_mode:true)\n actual = house.address\n assert_equal('274 Baker St', actual, \"'274 Baker St' as a string should be returned\")\n\n house.address = \"274 Cheese St\"\n actual = house.address\n assert_equal('274 Cheese St', actual, \"'274 Cheese S' as a string should be returned\")\n end", "def test_add_book\n @library = Library.new(@books_array)\n new_book = {\n title: \"lord_of_the_fading_lands\",\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n\n @library.add_book(\"lord_of_the_fading_lands\")\n\n assert_equal(new_book, @library.book_info(\"lord_of_the_fading_lands\"))\n assert_equal(4, @books_array.count)\n end", "def test_validate_name_and_account_number_by_giving_valid_data\n balance_record_config = BalanceRecordConfig.new\n balance_record_config.first_name = \"RAJ.jk-9\"\n balance_record_config.last_name = \"CC.9-\"\n balance_record_config.account_number = \"gh.gh-89\"\n balance_record_config.save\n assert balance_record_config.valid?, balance_record_config.errors.full_messages.to_s\n end", "def test_add_to_library\n @main_library.add_to_library(\"mervyn_peake\")\n book_added = {title:\"mervyn_peake\", rental_details: {student_name:\"\", date:\"\"}}\n assert_equal(book_added, @main_library.book_lookup(\"mervyn_peake\"))\n end", "def test_validations\n a = Address.new\n a.first_name = 'X'\n a.last_name = 'Y'\n a.address_1 = 'Z'\n a.city = 'C'\n a.postcode = '1'\n assert !a.valid?\n # assert a.errors.invalid?(:first_name)\n # assert a.errors.invalid?(:last_name)\n # assert a.errors.invalid?(:address_1)\n # assert a.errors.invalid?(:city)\n # assert a.errors.invalid?(:postcode)\n # assert a.errors.invalid?(:state)\n # assert a.errors.invalid?(:country)\n a.first_name = 'Xavier'\n a.last_name = 'Yellownose'\n a.address_1 = 'Zero Fool St.'\n a.city = 'Cumberbund'\n a.postcode = '10000'\n a.state = states(:state1)\n a.country = countries(:canada)\n assert a.valid?\n end", "def test_fetch_email\n contacts = Contacts.new(:hotmail, @account.username, @account.password).contacts\n @account.contacts.each do |contact|\n assert contacts.any?{|book_contact| book_contact.last == contact.last }, \"Could not find: #{contact.inspect} in #{contacts.inspect}\"\n end\n end", "def test_get_book_instance\n book_by_title = @library1.get_book_instance(\"catch_22\")\n assert_equal(@book2, book_by_title)\n end", "def check_addresses\n\n if location = @found_params.entities.detect {|entity| entity.name == \"from\"} || @ride.start_address\n if @ride.start_address\n address = @ride.start_address\n else\n address = geocode(location.value)\n end\n\n @ride.start_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @start_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n @time = UberService.new(@ride).time_estimates\n @time = @time / 60 if @time.class == Fixnum\n\n end\n\n if location = @found_params.entities.detect {|entity| entity.name == \"to\"} || @ride.end_address\n if @ride.end_address\n address = @ride.end_address\n else\n address = geocode(location.value)\n end\n\n @ride.end_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @end_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n end\n\n if (location = @found_params.entities.detect {|entity| entity.name == \"address\"}) && (@ride.end_address || @ride.start_address)\n\n address = geocode(location.value)\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n nice_address = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n if @ride.start_address\n @ride.end_address = address\n @end_address_nice = nice_address\n else\n @ride.end_address = address\n @start_address_nice = nice_address\n end\n\n @ride.save\n end\n\n if [email protected]_address.nil? && [email protected]_address.nil?\n @price = UberService.new(@ride).price_estimates\n end\n end", "def enter_address(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n chkout_first_name_field.value = first_name\n chkout_last_name_field.value = last_name\n chkout_address_1_field.value = address1\n chkout_city_field.value = city\n chkout_select_state.value = state_province\n chkout_zip_code_field.value = zip_postal_code\n chkout_phone_number_field.value = phone_number\n end", "def test_add_address_helper\n contact = create_test_contact\n assert_equal(1, contact.addresses.size)\n\n new_values = {\n :address_type => 'POBOX',\n :line_1 => 'NEW LINE 1',\n :line_2 => 'NEW LINE 2',\n :line_3 => 'NEW LINE 3',\n :line_4 => 'NEW LINE 4',\n :city => 'NEW CITY',\n :region => 'NEW REGION',\n :post_code => '5555',\n :country => 'Australia'\n }\n contact.add_address(new_values)\n\n assert_equal(2, contact.addresses.size)\n assert_kind_of(XeroGateway::Address, contact.addresses.last)\n new_values.each { |k,v| assert_equal(v, contact.addresses.last.send(\"#{k}\")) }\n end", "def test_book_rental_details__book_found\n @library = Library.new(@books_array)\n book_rental = @library.book_rental(\"lord_of_the_flies\")\n expected = {\n student_name: \"Joe\",\n date: \"11/12/17\"\n }\n assert_equal(expected, book_rental)\n end", "def create_new_entry()\n\tputs \"You are adding a new entry.\"\n\tentry = {}\n\tputs \"First name:\"\n\tentry[:first_name] = gets().chomp\n\tputs \"Last name:\"\n\tentry[:last_name] = gets().chomp\n\tputs \"Phone number:\"\n\tentry[:phone_number] = gets().chomp\n\tputs \"Email:\"\n\tentry[:email] = gets().chomp\n\t# entry.each do |entry_field, value|\n\t# \tputs \"Enter the person's #{entry_field}:\"\n\t# \tvalue = gets.chomp\n\t# \tputs entry.inspect\n\t# \tputs \"---\"\n\t# end\n\tentry_name = entry[:last_name] + \", \" + entry[:first_name]\n\tAddr_book[entry_name] = entry\n\tputs Addr_book.inspect\n\t# Exit workflow and return to main menu.\nend", "def test_book_info__book_in_library\n @library = Library.new(@books_array)\n book_details = @library.book_info(\"lord_of_the_dance\")\n\n expected = {\n title: \"lord_of_the_dance\",\n rental_details: {\n student_name: \"Jack\",\n date: \"21/12/17\"\n }\n }\n\n assert_equal(expected, book_details)\n\n end", "def fake_address\n {\n first_name: 'Jack',\n last_name: 'Macdowall',\n company_name: 'Macdowalls',\n line_1: '1225 Invention Avenue',\n line_2: 'Birmingham',\n postcode: 'B21 9AF',\n county: 'West Midlands',\n country: 'UK'\n }\n end", "def test_email_with_valid_examples\n person = @valid_person\n valid_endings = %w{com org net edu es jp info}\n valid_emails = valid_endings.collect do |ending|\n \"[email protected].#{ending}\"\n end\n valid_emails.each do |email|\n person.email = email\n assert person.valid?, \"#{email} must be a valid email address\"\n end\n end", "def test_address \n c = customers(:bob)\n assert_equal(addresses(:address1), c.shipping_address)\n assert_equal('Shipping Address', c.shipping_address.display_type)\n assert_equal(addresses(:address2), c.billing_address)\n assert_equal('Billing Address', c.billing_address.display_type)\n end", "def prompt_for_address()\n person = Tutorial::Person.newlD()\n\n puts \"Enter person ID number:\"\n person.id = STDIN.gets.chomp.to_i\n puts \"Enter name:\"\n person.name = STDIN.gets.chomp\n\n puts \"Enter email address (blank for none):\"\n email = STDIN.gets.chomp\n\n if email != \"\"\n person.email = email\n end\n\n loop do\n puts \"Enter a phone number (or leave blank to finish):\"\n number = STDIN.gets.chomp\n\n if number == \"\"\n break\n end\n\n phone_number = Tutorial::Person::PhoneNumber.new(number: number)\n puts \"Is this a mobile, home or work phone?\"\n type = STDIN.gets.chomp\n\n case type\n when \"mobile\"\n phone_number.type = :MOBILE\n when \"home\"\n phone_number.type = :HOME\n when \"work\"\n phone_number.type = :WORK\n else\n puts \"Unknown phone type; leaving as default value.\"\n end\n person.phones.push(phone_number)\n end\n person\nend", "def create_address\n \"#{Faker::Address.street_address}, #{Faker::Address.city}, #{Faker::Address.state} #{Faker::Address.zip}\"\nend", "def test_truth\n assert_kind_of Address, @address\n end", "def fill_in_checkout_address!\n expect(page).to have_content(IDENTITY)\n\n fill_in 'address[fname]', with: '薇'\n fill_in 'address[lname]', with: '李'\n fill_in 'address[mobile]', with: '13802049742'\n fill_in 'address[pid]', with: '11000019790225207X'\n\n # loop until page.all(:css, '#address_province option')[1]\n # page.all(:css, '#address_province option')[1].select_option\n # loop until page.all(:css, '#address_city option')[1]\n # page.all(:css, '#address_city option')[1].select_option\n # loop until page.all(:css, '#address_district option')[1]\n # page.all(:css, '#address_district option')[1].select_option\n\n fill_in 'address[full_address]', with: STREET\n\n # fill_in 'address[zip]', with: '300222'\n\n page.first('input[type=submit]').trigger('click')\n\n expect(page).to have_content(CHOOSE_EXISTING)\n end", "def add_contacts\n \tap \"adding contacts\"\n # asking whether we are already authorized\n AddressBook.request_authorization unless AddressBook.authorized?\n\n \n if AddressBook.authorized?\n 25.times do\n person = AddressBook::Person.create(\n :first_name => Forgery::Name.first_name, \n :last_name => Forgery::Name.last_name, \n :email => [{ :value => Forgery(:internet).email_address , :label => 'Home'}], :phones => [{ :value => rand(10 ** 10).to_s, :label => 'Mobile'}])\n end\n else\n #ap \"This app is not authorized to access the address book.\"\n end\n #enVd\n end", "def test_find_book_rental_info\n rental_info = @compiled_library.find_book_rental_info(\"Lord Of The Rings\")\n assert_equal({\n student_name: \"Richard\",\n date: \"01/12/16\"}, rental_info)\n end", "def test_person_create\n\t\tres = DB.exec(\"SELECT * FROM person_create('\tMiles Davis\t', ' [email protected]')\")\n\t\tx = res[0]\n\t\tassert_equal '9', x['id']\n\t\tassert_equal 'Miles Davis', x['name']\n\t\t# address auto-created from first word of name\n\t\tassert_equal 'Miles', x['address']\n\t\tassert_equal '[email protected]', x['email']\n\t\tassert_nil x['hashpass']\n\t\t# INSERT creates default values\n\t\tassert_equal 4, x['lopass'].size\n\t\tassert_nil x['newpass']\n\t\tassert_equal '0', x['email_count']\n\t\tassert_equal Time.now.to_s[0,10], x['created_at']\n\t\t# if cleaned email exists in db already, returns that row\n\t\tres = DB.exec(\"SELECT * FROM person_create(' Miles Davis III', ' [email protected]')\")\n\t\tassert_equal '9', res[0]['id']\n\t\tres = DB.exec(\"SELECT * FROM person_create('Name Ignored if Email Matches', '[email protected]')\")\n\t\tassert_equal '1', res[0]['id']\n\t\tassert_equal 'Derek Sivers', res[0]['name']\n\t\t# can't create new person with NULL email, empty or invalid email\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec(\"SELECT * FROM person_create('Valid Name', NULL)\")\n\t\tend\n\t\tassert err.message.include? 'missing_email'\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec(\"SELECT * FROM person_create('Valid Name', '\t')\")\n\t\tend\n\t\tassert err.message.include? 'missing_email'\n\t\terr = assert_raises PG::CheckViolation do\n\t\t\tDB.exec(\"SELECT * FROM person_create('Valid Name', 'bad@email')\")\n\t\tend\n\t\tassert err.message.include? 'valid_email'\n\tend", "def add_book\n\tputs \"\\nTo add a new book please enter the following requested information:\\n\"\n\tprint \"Book Title \"\n\ttitle = gets.chomp\n\tprint \"Book Author \"\n\tauthor = gets.chomp\n\tprint \"Book ISBN \"\n\tisbn = gets.chomp\n\tprint \"Book Home Library \"\n\tlibrary_id = gets.chomp.to_i\n\tlibrary_id = verify_library_exists(library_id)\n\tBook.create(title: title, author: author, isbn: isbn, library_id: library_id)\nend", "def validateaddress(coinaddress)\n coind.validateaddress\n end", "def make_address(street, city, state, zip)\nend", "def confirm_existing_address()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n chkout_select_existing_address.should_exist\n existing_address= chkout_select_existing_address.inner_text\n # innerText.should != \"\"\n existing_address.should match(\"Review\")\n end", "def create_location(address, rent)\n # binding.pry\n Location.new(address, rent, self)\n # binding.pry\n end", "def fill_in_address_non_apartment_order\n # if not on the cart page, go there\n (URI.parse(current_url).path == '/cart') ? nil : (visit '/cart')\n # click checkout to start address process\n all(:xpath, '//button[@id=\"checkout-link\"]')[0].click # \"Checkout\"\n #check for absence of apartment order form\n apartment_order_form_not_present?\n # fill in billing/contact info\n fill_in_billing_info_macro(FactoryGirl.create(:bill_address))\n #use same shipping as billing address\n check 'order_use_billing'\n # continue to shipping\n click_button I18n.t('actions.save_and_continue_to_delivery') # \"Continue to Shipping\"\nend", "def get_info\n print \"Please enter your full name: \"\n name = gets.chomp.upcase\n @name = name\n print \"Please enter your full address: \"\n address = gets.chomp.upcase\n @address = address\n\n #Calls check_info method\n check_info\n end", "def make_reservation_address(first_name, last_name, street_address, zip, city, country_code, house_number = nil)\n # {\n # :fname => first_name,\n # :lname => last_name,\n # :street => street_address,\n # :zip => zip,\n # :city => city,\n # :country => ::Klarna::API.id_for(:country, country_code),\n # :house_number => house_number\n # }.with_indifferent_access\n raise NotImplementedError\n end", "def test_book_getter\n\n assert_equal([{title: \"Lord Of The Rings\",\n rental_details: {\n student_name: \"Richard\",\n date: \"01/12/16\"}},\n {title: \"His Dark Materials\",\n rental_details: {\n student_name: \"Campbell\",\n date: \"01/12/17\"}},\n {title: \"Fahrenheit 451\",\n rental_details: {\n student_name: \"Craig\",\n date: \"01/12/18\"}}], Library.new(@library_setup).books) #The full, proper way to create a class instance, then to use a getter to pull the data. compiled_library used from now on for ease.\n end", "def account_address(address_details)\n self.address = Address.new(\n address_line1: address_details[:address_line1], address_line2: address_details[:address_line2],\n address_line3: address_details[:address_line3], address_line4: address_details[:address_line4],\n town: address_details[:address_town_or_city], county: address_details[:address_county_or_region],\n postcode: address_details[:address_postcode_or_zip], country: address_details[:address_country_code]\n )\n end", "def filling_address_info\n\t#find and select address type=House\n find(:id, 'Address_Type_Select').click\n find(\"option[value='House']\").click\n\t#find and fill out Street Address\n find(:id, 'Street').click\n fill_in('Street Address', :with => '9750 Jones Branch Dr')\n\t#find and fill out City\n\tfind(:id, 'City').click\n\tfill_in('City', :with => 'McLean')\n\t#find and select State=VA\n\tselect('VA', from: 'Region')\n\tfind(:id, 'Postal_Code').click\n\tfill_in('Zip Code', :with => '22107-0002')\nend", "def check_in(book, user)\n # Check if book is already checked out\n if book.status == \"checked out\" || book.status == \"overdue\"\n book.status = \"available\"\n\n # Remove from user's checked out book array\n user.checked_out_books.delete_if { |e| e == book }\n user.overdue_books.delete_if {|e| e == book }\n \n # Reset the check out and due dates to nothing\n book.check_out_date = nil\n book.due_date = nil\n \n # Remove from the library's checked out and overdue arrays.\n @checked_out.delete_if { |e| e == book }\n @overdue.delete_if { |e| e == book }\n\n # Remove the user who checked out the book\n book.who_checked = nil\n \n # Error message for book that is not checked out.\n elsif book.status == \"available\"\n puts \"This book is not checked out\"\n \n # Allows lost books to be returned.\n elsif book.status == \"lost\"\n book.status = \"available\"\n puts \"Thanks for bringing #{book.title} back!\"\n \n # Malformed input or malfunctioning method error message.\n else\n puts \"There is something wrong with the book you've tried to check out. This is an error message. Sorry.\"\n end\n end", "def test_find_rental__found\n\n single_book = @library1.find_rental(\"animal_farm\")\n expected_rental = {\n student_name: \"Bob\",\n date: \"05/11/15\"\n }\n\n assert_equal(expected_rental, single_book)\n\n end", "def test_update_rental_details #THIS IS A BAD TEST!\n library_plus_updated_book = @compiled_library.update_rental_details(\"His Dark Materials\", \"Pete\", \"01/12/18\")\n assert_equal(@compiled_library.books, library_plus_updated_book)\n end", "def check_owner_and_address\n check_owner\n check_address\n check_access\n end", "def test_validate_name_and_account_number_by_giving_invalid_data\n balance_record_config = BalanceRecordConfig.new\n balance_record_config.first_name = \"RAJ*\"\n balance_record_config.last_name = \"CC.j)\"\n balance_record_config.account_number = \"gh.gh_89\"\n balance_record_config.save\n assert !balance_record_config.valid?, balance_record_config.errors.full_messages.to_s\n end", "def address_book_params\n params.require(:address_book).permit(:contact_fname, :contact_lname, :email, :phone, :address, :city, :state, :zip)\n end", "def test_save\n # Create the user with a unique email.\n email = @user.email_address\n at_ndx = email.index('@')\n modifier = \"_#{Jinx::UID.generate}\"\n @user.email_address = email.insert(at_ndx, modifier)\n @user.login_name = nil\n verify_save(@user)\n \n # Update the address.\n logger.debug { \"#{self} updating the #{@user} address...\" }\n @user.address.street = \"#{Jinx::UID.generate} Elm St.\"\n verify_save(@user)\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def enter_billing_address_plus_email(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number, email_address)\n enter_address(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number)\n chkout_email_address_field.value = email_address\n chkout_billing_confirm_email_address_field.value = email_address\n end", "def test_add_new_book\n library_plus_new_book = @compiled_library.add_new_book(\"Nineteen Eighty Four\")\n assert_equal(@compiled_library.books, library_plus_new_book)\n end", "def business_details_page_enter_ltd_business_details_postcode_lookup_and_submit(companyNo: '10926928',\n companyName: 'Test Company', postcode: 'BS1 5AH',\n address: 'NATURAL ENGLAND, HORIZON HOUSE, DEANERY ROAD, BRISTOL, BS1 5AH')\n\n fill_in 'registration_company_no', with: companyNo\n fill_in 'registration_companyName', with: companyName\n fill_in 'sPostcode', with: postcode\n click_button 'find_address'\n select address\n business_details_page_submit_business_details_page\n end", "def valid_address?(address)\n all_addresses = get_all_addresses\n all_addresses.include? address\nend", "def billing_address\n Address.new(\n email_address: email_address,\n company: billing_company,\n full_name: billing_full_name,\n address_line_1: billing_address_line_1,\n address_line_2: billing_address_line_2,\n address_line_3: billing_address_line_3,\n town_city: billing_town_city,\n county: billing_county,\n postcode: billing_postcode,\n country_id: billing_country_id,\n phone_number: billing_phone_number\n )\n end", "def address(opts = {})\n address = {}\n\n address[:city] = opts[:city] if opts[:city]\n address[:state] = opts[:state] if opts[:state]\n address[:state_abbr] = opts[:state_abbr] if opts[:state_abbr]\n address[:zip_code] = opts[:zip_code] if opts[:zip_code]\n address[:zip] = opts[:zip] if opts[:zip]\n address[:postcode] = opts[:postcode] if opts[:postcode]\n address[:country] = opts[:country] if opts[:country]\n\n\n address[:city] = Faker::Address.city unless opts[:city]\n address[:street_name] = Faker::Address.street_name\n address[:street_address] = Faker::Address.street_address\n address[:secondary_address] = Faker::Address.secondary_address\n address[:building_number] = Faker::Address.building_number\n address[:zip_code] = Faker::Address.zip_code unless opts[:zip_code]\n address[:zip] = Faker::Address.zip unless opts[:zip]\n address[:postcode] = Faker::Address.postcode unless opts[:postcode]\n\n address[:time_zone] = Faker::Address.time_zone\n address[:street_suffix] = Faker::Address.street_suffix\n address[:city_suffix] = Faker::Address.city_suffix\n address[:city_prefix] = Faker::Address.city_prefix\n address[:state_abbr] = Faker::Address.state_abbr unless opts[:state_abbr]\n address[:state] = Faker::Address.state unless opts[:state]\n address[:country] = Faker::Address.country unless opts[:country]\n address[:latitude] = Faker::Address.latitude\n address[:longitude] = Faker::Address.longitude\n address\n end", "def test_vaildEmail\n File.open(\"testing/input_tests/inputValidEmail\", 'w'){|file| file.write(\"email: [email protected]\")}\n a = Job_mail.new(\"testing/input_tests/inputValidEmail\")\n assert_equal(\"[email protected]\", a.email, \"email should be accepted\")\n File.open(\"testing/input_tests/inputValidEmail\", 'w'){|file| file.write(\"email: [email protected]\")}\n b = Job_mail.new(\"testing/input_tests/inputValidEmail\")\n assert_equal(\"[email protected]\", b.email, \"email should be accepted\")\n File.open(\"testing/input_tests/inputValidEmail\", 'w'){|file| file.write(\"email: [email protected]\")}\n c = Job_mail.new(\"testing/input_tests/inputValidEmail\")\n assert_equal(\"[email protected]\", c.email, \"email should be accepted\")\n\n end", "def populate_contact_details\n last_booking = Bookings::Booking.last_accepted_booking_by(bookings_school)\n\n return false if last_booking.blank?\n\n assign_attributes(\n contact_name: last_booking.contact_name,\n contact_email: last_booking.contact_email,\n contact_number: last_booking.contact_number,\n location: last_booking.location,\n )\n\n true\n end", "def test_validate_fields\n ba = BillingAddress.new\n assert_equal [:name, :address1, :city, :state, :zip, :country, :phone, :email], ba.validate_fields\n end", "def add_new_contact\nprint \"Contact first name:\"\nfirst_name = gets.chomp\n\nprint \"Contact last name:\"\nlast_name = gets.chomp\n\nprint \"Enter Contact's Email Address\"\nemail = gets.chomp\n\nprint \"Enter Note\"\nnote = gets.chomp\n\nContact.create(first_name, last_name, email, note)\n end", "def test_state_and_country\n a = Address.find(1)\n assert_equal('AL', a.state_code)\n assert_equal('Alabama', a.state_name)\n assert_equal('United States', a.country_name)\n end", "def test_change_rental_details\n @library.change_rental_details(\"elantris\", \"Rick\", \"22/05/19\")\n expected = {\n title: 'elantris',\n rental_details: {\n student_name: 'Rick',\n date: '22/05/19'\n }\n }\n assert_equal(expected, @library.get_book(\"elantris\"))\n end", "def test_update_rental_details\n @library.add_new_book(@new_book)\n rental_details = {\n student_name: \"Dave\",\n date: \"01/11/17\"\n }\n new_details = {\n title: \"to kill a mockingbird\",\n rental_details: {\n student_name: \"Dave\",\n date: \"01/11/17\"\n }\n }\n assert_equal(new_details, @library.update_rental_details(\"to kill a mockingbird\", rental_details))\n end", "def test_check_in()\n @new_guest = Guest.new(\"Bill\", 20, \"Regulate\", \"Good Juice\")\n assert_equal(@new_guest.name(), @room.check_in(@new_guest))\n assert(@guests.length() > 3)\n end", "def test_add_guests_to_bar()\n # @karaokeBar.check_in(@guest1)\n # @karaokeBar.check_in(@guest2)\n @karaokeBar.check_in(@guest3)\n # assert_equal(3 , @karaokeBar.total_guests_in_rooms())\n assert_equal( 50 , @room1.revenue())\n # assert_equal( 70 , @room2.revenue())\n assert_equal( 100 , @room3.revenue())\n assert_equal(1, @room1.spaces_available())\n assert_equal(1220 , @karaokeBar.bar_revenue())\n end", "def address_book_name\n end", "def test_02_createEinLessORG_NPOdetails_audit()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 2 ----------------------\"\n\t\tcreateEinLessOrg($admincon_url, $new_einlessorgname, $org_city, $org_state)\n\t\teditNpoDetails($einlessorg_url, $org_firstname, $org_lastname, $org_address1, $org_address2, $org_emailId, $org_phonenum)\n\t\tauditVerifyOrg(\"Verified this ORG\", $einlessorg_url)\n\t\tverifyNpoDetails()\n\t\tbecomeFan()\n\t\tputs \"---------------------- END OF SCENARIO 2 --------------------------\"\n\tend", "def business_details_page_enter_business_or_organisation_details_manual_postcode_and_submit(companyName: 'Test Company',\n houseNumber: '12', line1: 'Deanery Road',\n line2: 'EA Building', townCity: 'Bristol', postcode: 'BS1 5AH')\n\n click_link 'manual_uk_address'\n fill_in 'registration_companyName', with: companyName\n fill_in 'address_houseNumber', with: houseNumber\n fill_in 'address_addressLine1', with: line1\n fill_in 'address_addressLine2', with: line2\n fill_in 'address_townCity', with: townCity\n fill_in 'address_postcode', with: postcode\n business_details_page_submit_business_details_page\n end", "def test_books\n assert_equal(@books, @library.books())\n end", "def can_enter_mentee(name:, email:)\n click_link 'Add New Mentee'\n\n expect(body).not_to include(email)\n\n fill_in 'Email', with: email\n fill_in 'Name', with: name\n click_button('Save')\n\n visit current_path # reload\n\n expect(body).to include(email)\n end", "def check_values(entry_hash)\n flag = 0\n feedback = \"\"\n detail = \"\"\n flag = 1 if duplicate_entry?(entry_hash)\n entry_hash.each do |column, value|\n flag = 2 if column == \"fname\" && value.length < 2\n flag = 3 if column == \"lname\" && value.length < 2\n flag = 4 if column == \"addr\" && value.split(\" \").length < 3\n (flag = 5; detail = column) if column =~ /fname|lname|addr/ && value.length > 50\n (flag = 5; detail = column) if column == \"city\" && value.length > 25\n flag = 6 if column == \"city\" && value.length < 2\n flag = 7 if column == \"zip\" && value.length != 5\n (flag = 8; detail = column) if column =~ /mobile|home|work/ && value.length.to_s !~ /0|10/\n flag = 9 if column == \"state\" && (!state_array.include? value.upcase)\n flag = 10 if column =~ /fname|lname/ && value =~ /[^a-zA-Z.\\- ]/\n flag = 11 if column == \"addr\" && value =~ /[^0-9a-zA-z.\\- ]/\n flag = 12 if column == \"city\" && value =~ /[^a-zA-Z.\\- ]/\n (flag = 13; detail = column) if column =~ /zip|mobile|home|work/ && value =~ /[^0-9]/\n end\n case flag\n when 1 then feedback = \"That entry already exists - please enter details for another entry.\"\n when 2 then feedback = \"The first name is too short - please enter at least two letters for the first name.\"\n when 3 then feedback = \"The last name is too short - please enter at least two letters for the last name.\"\n when 4 then feedback = \"Please specify a house number and a street name for the address.\"\n when 5 then feedback = \"The value for '#{detail}' is too long - please use a shorter value.\"\n when 6 then feedback = \"The city name is too short - please enter at least two letters for the city name.\"\n when 7 then feedback = \"Please enter five digits for the zip code.\"\n when 8 then feedback = \"Please enter ten digits for the #{detail} phone number.\"\n when 9 then feedback = \"Please use a valid two-letter abbreviation for the state name.\"\n when 10 then feedback = \"The name should only contain letters, hyphens or periods.\"\n when 11 then feedback = \"The street address should only contain numbers, letters, hyphens or periods.\"\n when 12 then feedback = \"The city name should only contain letters, hyphens or periods.\"\n when 13 then feedback = \"The value for '#{detail}' should only have numbers.\"\n end\n return feedback\nend", "def fill_in_address_personal_order\n # if not on the cart page, go there\n (URI.parse(current_url).path == '/cart') ? nil : (visit '/cart')\n # click checkout to start address process\n all(:xpath, '//button[@id=\"checkout-link\"]')[0].click # \"Checkout\"\n #select personal order\n choose 'order_retail_staff_order_detail_attributes__destroy_1'\n # fill in billing/contact info\n fill_in_billing_info_macro(FactoryGirl.create(:bill_address))\n #use same shipping as billing address\n check 'order_use_billing'\n # continue to shipping\n click_button I18n.t('actions.save_and_continue_to_delivery') # \"Continue to Shipping\"\nend", "def test_change_rental_details\n @library1.change_rental_details(\"catch_22\", \"Steve\", \"05/06/19\")\n expected_hash = {\n title: \"catch_22\",\n rental_details: {\n student_name: \"Steve\",\n date: \"05/06/19\"\n }\n }\n assert_equal(expected_hash, @library1.books[1])\n end", "def create_email \n puts \"Please enter email category:\"\n \tcat = gets.chomp\n puts \"Please enter email: \"\n \tad = gets.chomp\n email = Email.create({category: cat, address: ad})\nend", "def create_and_verify(params = {})\n wrapped_params = {}\n wrapped_params[:address] = params\n\n @client.make_request(:post, 'addresses/create_and_verify', MODEL_CLASS, wrapped_params).address\n end", "def test_email_with_valid_examples\n user = @valid_user\n valid_endings = %w{com org net edu es jp info}\n valid_emails = valid_endings.collect do |ending|\n \"[email protected].#{ending}\"\n end\n \n valid_emails.each do |email|\n user.email = email\n assert user.valid?, \"#{email} must be correct\"\n end\n end", "def business_details_page_enter_ltd_business_details_manual_postcode_and_submit(companyNo: '10926928',\n companyName: 'Test Company', houseNumber: '12', line1: 'Deanery Road',\n line2: 'EA Building', townCity: 'Bristol', postcode: 'BS1 5AH')\n\n click_link 'manual_uk_address'\n fill_in 'registration_company_no', with: companyNo\n fill_in 'registration_companyName', with: companyName\n fill_in 'address_houseNumber', with: houseNumber\n fill_in 'address_addressLine1', with: line1\n fill_in 'address_addressLine2', with: line2\n fill_in 'address_townCity', with: townCity\n fill_in 'address_postcode', with: postcode\n business_details_page_submit_business_details_page\n end", "def create_address_book(principal_uri, url, properties)\n end", "def add_book(book)\n if book.is_a? Book # This test does not work as intended. I get a NameError undefined local variable.\n @books << book\n puts \"#{book.title} by #{book.author} has been added to the library.\"\n else\n puts \"That is not a book. Try again.\"\n end\n end", "def create_book( bookinfo_hash )\r\n name = bookinfo_hash[:name]\r\n author = bookinfo_hash[:author]\r\n\r\n puts \"#{name}, written by #{author}\"\r\nend", "def test_rental_details_for_title\n rental_details = @library1.rental_details_for_title(\"lord_of_the_rings\")\n assert_equal({student_name: \"Jeff\", date: \"25/05/19\"}, rental_details)\n end", "def test_find_by_title\n book_info = {\n title: \"lord of the rings\",\n rental_details: {\n student_name: \"Jeff\",\n date: \"01/12/16\"\n }\n }\n assert_equal(book_info, @library.find_by_title(\"lord of the rings\"))\n end", "def generate_address(user_id)\n a = Address.new\n a[:user_id] = user_id\n a[:street_address] = Faker::Address.street_address\n a[:city_id] = City.pluck(:id).sample\n a[:state_id] = State.pluck(:id).sample\n a[:zip_code] = Faker::Address.zip.to_i\n a.save! #just to check if anything fails here\nend" ]
[ "0.6847821", "0.6577647", "0.65682316", "0.65462273", "0.63722837", "0.5821735", "0.58070284", "0.5804971", "0.58046925", "0.5754864", "0.57307976", "0.5725659", "0.5664572", "0.56587064", "0.5658354", "0.5572273", "0.55511546", "0.5549308", "0.55173546", "0.5499889", "0.5488375", "0.5475918", "0.546834", "0.54473853", "0.5443325", "0.54255074", "0.5423412", "0.54212916", "0.5416645", "0.54094833", "0.54037", "0.5381983", "0.53740263", "0.53655297", "0.5365267", "0.53647375", "0.53631854", "0.53459907", "0.5345611", "0.5332655", "0.53279006", "0.5321813", "0.53189474", "0.53047293", "0.5287874", "0.5275959", "0.52568704", "0.52481186", "0.5241982", "0.52399004", "0.523107", "0.52257323", "0.52248967", "0.52189755", "0.5213515", "0.52121025", "0.52086586", "0.5207704", "0.520554", "0.51830804", "0.5160276", "0.51406896", "0.5132367", "0.5127061", "0.5112546", "0.5112546", "0.5112546", "0.51124537", "0.5099192", "0.50895685", "0.50878", "0.5079925", "0.5079738", "0.50742525", "0.50723076", "0.506267", "0.5052647", "0.50497746", "0.50382066", "0.5036492", "0.5033303", "0.502906", "0.5006362", "0.50056314", "0.5001422", "0.49980757", "0.49967813", "0.4986146", "0.49828005", "0.49726135", "0.4969711", "0.49632737", "0.49563456", "0.49499062", "0.49498576", "0.49441892", "0.4941678", "0.4939156", "0.49361414", "0.49327725" ]
0.6500354
4
def show begin artwork = Artwork.find(params[:id]) render json: artwork rescue render text: "artwork not found" end end
def create new_artwork_share = ArtworkShare.new(artwork_share_params) if new_artwork_share.save render json: new_artwork_share else render( json: new_artwork_share.errors.full_messages, status: :unprocessable_entity ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @art = Art.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @art }\n end\n end", "def show\n \n @artist = Artist.where(id: params[:id]).first\n if @artist \n render json: @artist, status: 200\n else\n #render error: {error: 'Artist not found'}, status: 404\n return_not_found\n # format.any { render :json => {:response => 'Artista not found' }, :status => 404 }\n \n end\n end", "def show\n @artwork_share = ArtworkShare.find_by(id: params[:id])\n render json: @artwork_share\n end", "def show\n @artigo = Artigo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artigo }\n end\n end", "def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist }\n end\n end", "def show\n @art_piece = ArtPiece.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @art_piece }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @articuloind = Articuloind.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @articuloind }\n end\n end", "def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end", "def show\n @content = Content.find(params[:id]) \n rescue ActiveRecord::RecordNotFound\n render :json=>{:response=>\"The record can't be found\"}\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end", "def show\n @album = Album.where(id: params[:id]).first\n if @album\n render json: @album, status: 200\n else\n return_not_found \n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def create\n artwork = Artwork.new(artwork_params)\n if artwork.save\n render json: artwork\n else\n render json: artwork.errors.full_messages, status: :unprocessable_entity\n end\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @music = Music.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end", "def show\n @art = Art.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @art }\n end\n end", "def show\n @music = Music.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @music }\n end\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end", "def show\n @musician = Musician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musician }\n end\n end", "def show\n @cart = Cart.find( params[\"id\"] )\n # raise\n\n respond_to :html, :json\n\n\n end", "def show\n @something = Something.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @something }\n end\n end", "def show\n @artist_tag = ArtistTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist_tag }\n end\n end", "def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def show\n render json: Alien.find(params[\"id\"])\n end", "def show\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trick }\n end\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def show\n #note = Note.find(params[:id])\n begin\n @note = Note.find(params[:id])\n rescue Exception => e\n @a = '{\n \"error\" : \"not found\"\n }'\n @data = JSON.parse(@a)\n render json: @data, status: 404\n return\n end\n end", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end", "def show\n @part = Part.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part }\n end\n end", "def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end", "def show \n bird = Bird.find_by(id: params[:id])\n if bird \n render bird.json: {id: bird.id, name: bird.name, species: bird.species}\n else \n render {\"Bird not found\"}\n end\nend", "def show\n \t\n @json_data = Need.find(params[:id])\n render_json\n end", "def show\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end", "def show\n story = Story.find(params[:id])\n render json: story\n end", "def show\n @mark = Mark.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mark }\n end\n end", "def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end", "def show\n @articulocomp = Articulocomp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @articulocomp }\n end\n end", "def show\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stuff }\n end\n end", "def show\n @autopart = Autopart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @autopart }\n end\n end", "def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @work = Work.find(params[:id])\n render :json => {:name => @work.name, :desc => @work.description}\n end", "def show\n\t@artwork = Artwork.find(params[:id])\n\t@pictures = @artwork.pictures\n\t@page = 'artShow'\nend", "def show\n exercise_illustration = case @exercise.blank?\n when true\n ExerciseIllustration.where(token: params[:exercise_id], id: params[:id])\n when false\n @exercise.exercise_illustrations.find(params[:id])\n end\n\n render json: exercise_illustration\n end", "def show\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @theoretical_part }\r\n end\r\n end", "def show\n render json: Item.find(params[:id])\n end", "def show\n @amenity = Amenity.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render :json=>{:response=>\"The record can't be found\"}\n end", "def show\n @query = params[:id].gsub('+', ' ')\n @autoplay = params[:autoplay]\n \n begin\n @artist = LastfmArtist.new(@query, @lastfm, true)\n rescue\n @artist = nil\n end\n \n unless @artist\n not_found\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @artist }\n end\n end", "def show\n my_dream = Dream.find params[:id]\n render json: {dream: my_dream}\n end", "def set_artwork\n @artwork = Artwork.find(params[:id])\n end", "def set_artwork\n @artwork = Artwork.find(params[:id])\n end", "def show\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @stuff }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\r\n marker = Marker.find(params[:id])\r\n render json: marker\r\n end", "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @song }\n end\n end", "def show\n if recipe\n render json: recipe\n else \n render json: {message: 'Recipe not found'}\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end", "def show\n @mistake = Mistake.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mistake }\n end\n end", "def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end", "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def show\n @artist = Artist.find params[:id]\n end", "def show\n @album = Album.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @homework_item = HomeworkItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homework_item }\n end\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n @study = Study.find(params[:id])\n render json: @study\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n format.js\n end\n end", "def show\n @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end", "def show\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interesting }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n end", "def show\n\n recipe = Recipe.find(params[:id])\n render :json => recipe.to_json\n\n end", "def show\n @play = Play.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @play }\n end\n end", "def show\n @work_id = params[:id]\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work }\n end\n end", "def show\n render json: @todo\n end", "def show\n render json: @todo\n end", "def show\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio_mp3 }\n end\n end", "def show\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio_mp3 }\n end\n end", "def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end" ]
[ "0.85059524", "0.8366392", "0.8175893", "0.8080685", "0.8070809", "0.78263795", "0.7744503", "0.7744503", "0.7744503", "0.7696021", "0.7682267", "0.7533115", "0.74949116", "0.74949116", "0.74949116", "0.74949116", "0.74949116", "0.74936175", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.7454687", "0.74530566", "0.7442294", "0.7438254", "0.7422945", "0.7421746", "0.74195886", "0.74076426", "0.740621", "0.74053884", "0.73962307", "0.7386645", "0.7385676", "0.73842984", "0.7382906", "0.7376936", "0.7371299", "0.73630285", "0.73528546", "0.7345892", "0.73351645", "0.7327656", "0.73271275", "0.7316857", "0.7315132", "0.7313547", "0.73126465", "0.7303164", "0.7303133", "0.7296245", "0.7293955", "0.7290858", "0.7289472", "0.7285172", "0.7283768", "0.72824013", "0.7273845", "0.72732145", "0.7268548", "0.72652066", "0.72652066", "0.72628725", "0.72578", "0.72578", "0.7256273", "0.7251485", "0.72511244", "0.7242225", "0.7240834", "0.723555", "0.7233591", "0.72308886", "0.722776", "0.72251266", "0.7222151", "0.72218823", "0.72206795", "0.7219624", "0.72150326", "0.72146994", "0.72048926", "0.7202155", "0.7198964", "0.71962315", "0.7192623", "0.7192623", "0.7192172", "0.7192172", "0.7191827", "0.7189239" ]
0.0
-1
def update updated_artwork = ArtworkShare.find(params[:id]).update(artwork_params) render json: updated_artwork end
def destroy begin found_artwork_share = find_artwork_shares found_artwork_share.destroy render json: found_artwork_share rescue render text: "Sharing not found" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @artwork.update(update_artwork_params)\n format.json { render :show, status: :ok, location: @artwork }\n else\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork.update(art_work_params)\n format.html { redirect_to @artwork, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork }\n else\n format.html { render :edit }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork.update(artwork_params)\n format.html { redirect_to @artwork, notice: 'Artwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @new_artwork.update(new_artwork_params)\n format.html { redirect_to @new_artwork, notice: 'New artwork was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_artwork }\n else\n format.html { render :edit }\n format.json { render json: @new_artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork_share.update(artwork_share_params)\n format.html { redirect_to @artwork_share, notice: 'Artwork share was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_share }\n else\n format.html { render :edit }\n format.json { render json: @artwork_share.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instagram_arts.update(instagramt_art_params)\n track_activity @instagram_arts\n format.html { redirect_to @instagram_arts, notice: 'Art was successfully updated.' }\n format.json { render :show, status: :ok, location: @instagram_arts }\n else\n format.html { render :edit }\n format.json { render json: @instagram_arts.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art.update(art_params)\n format.html { redirect_to art_path(@art), notice: 'Art was successfully updated.' }\n format.json { render :show, status: :ok, location: @art }\n else\n format.html { render :edit }\n format.json { render json: @art.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art.update(art_params)\n format.html { redirect_to moment_art_path(@art.moment, @art), notice: 'Your art is uploaded now.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @art.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to @artist, :notice => 'Artist 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 => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to @artist, :notice => 'Artist 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 => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork_image_map.update(artwork_image_map_params)\n format.html { redirect_to @artwork_image_map, notice: 'Artwork image map was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_image_map }\n else\n format.html { render :edit }\n format.json { render json: @artwork_image_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n forbidden unless current_catalog_user.read_artwork\n @artwork.update(artwork_params)\n redirect_to catalog_account_catalog_artworks_path(@account, @catalog)\n end", "def update\n respond_to do |format|\n if @art.update(art_params)\n format.html { redirect_to @art, notice: 'Art was successfully updated.' }\n format.json { render :show, status: :ok, location: @art }\n else\n format.html { render :edit }\n format.json { render json: @art.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @art = Art.find(params[:id])\n\n respond_to do |format|\n if @art.update_attributes(params[:art])\n format.html { redirect_to @art, notice: 'Art was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @art.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art_item.update(art_item_params)\n format.html { redirect_to @art_item, notice: 'Art item was successfully updated.' }\n format.json { render :show, status: :ok, location: @art_item }\n else\n format.html { render :edit }\n format.json { render json: @art_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: \"Artist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t@artwork = Artwork.find(params[:id])\n\n\trespond_to do |format|\n\t\tif @artwork.update_attributes(artwork_params)\n\t\t\tif params[:images]\n\t\t\t\tparams[:images].each { |image| \n\t\t\t\t\[email protected](image: image)\n\t\t\t\t}\n\t\t\tend\n\n\t\t\tredirect_to @artwork, notice: \"Artwork submitted successfully\"\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend\nend", "def update\n respond_to do |format|\n #if @artist_data.id == current_artist.id\n #@current_id = params[:id]\n @artist_data.update(artist_data_params) \n format.js {render :create }\n end\n #end\n #end\n end", "def update\n respond_to do |format|\n if @artist_medium.update(artist_medium_params)\n format.html { redirect_to @artist_medium, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist_medium }\n else\n format.html { render :edit }\n format.json { render json: @artist_medium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: t(:update_notice) }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to organization_artist_url(organization_id: @organization.id, id: @artist.id), notice: 'Artist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n find_asset\n @asset.update!(asset_params)\n\n render json: @asset, adapter: :json\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artist.update(artist_params)\n\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n\n format.json { render :show, status: :ok, location: @artist }\n\n else\n\n format.html { render :edit }\n\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork_symbol.update(artwork_symbol_params)\n format.html { redirect_to @artwork_symbol, notice: 'Artwork symbol was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_symbol }\n else\n format.html { render :edit }\n format.json { render json: @artwork_symbol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @g4_dongal_board_art.update(g4_dongal_board_art_params)\n format.html { redirect_to @g4_dongal_board_art, notice: 'G4 dongal board art was successfully updated.' }\n format.json { render :show, status: :ok, location: @g4_dongal_board_art }\n else\n format.html { render :edit }\n format.json { render json: @g4_dongal_board_art.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_art.update(list_art_params)\n format.html { redirect_to list_arts_url, notice: 'List art was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_art }\n else\n format.html { render :edit }\n format.json { render json: @list_art.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artwork = Artwork.find(params[:artwork_id])\n @picture = @artwork.pictures.find(params[:id])\n end", "def update\n @autopart = Autopart.find(params[:id])\n\n respond_to do |format|\n if @autopart.update_attributes(autopart_params)\n format.html { redirect_to @autopart, notice: 'Autopart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @autopart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artwork_created_by = ArtworkCreatedBy.find(params[:id])\n\n respond_to do |format|\n if @artwork_created_by.update_attributes(params[:artwork_created_by])\n format.html { redirect_to @artwork_created_by, notice: 'Artwork created by was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @artwork_created_by.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artist = Artist.find(params[:id])\n\n\n\n # @file_name = params[:artist][:image].filename\n # @image_location = \"/Sites/music3/public/uploads/artist/image/\"[email protected]+\"/\"+@file_name\n\n\tlayout(\"artist\")\n\n respond_to do |format|\n if @artist.update_attributes(artist_params)\n image_upload_prep(@artist)\n format.html {redirect_to(artist_admin_path(@artist.url_slug), :notice => 'Artist was successfully updated.') }\n format.xml { head :ok }\n format.json {\n render :json => {\n :success => true,\n :\"url\" => artist_link_url(@artist.url_slug),\n :admin => true,\n }\n\t\t }\n else\n format.html {redirect_to profile_edit_path(@artist.url_slug), :error => @artist.errors.full_messages.to_sentence }\n format.json {\n render :json => {\n :success => false,\n :\"url\" => profile_edit_url(@artist.url_slug),\n :admin => true,\n :errors => @artist.errors.full_messages,\n },\n :status => 422 #ajax error message\n }\n end\n end\n end", "def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to artist_url(@artist), notice: 'Artist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @workshare.update(workshare_params)\n format.html { redirect_to @workshare, notice: 'Workshare was successfully updated.' }\n format.json { render :show, status: :ok, location: @workshare }\n else\n format.html { render :edit }\n format.json { render json: @workshare.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @figure.update(figure_params)\n format.html { redirect_to @figure, notice: 'Figure was successfully updated.' }\n format.json { render :show, status: :ok, location: @figure }\n else\n format.html { render :edit }\n format.json { render json: @figure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n record = Asset.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n respond_to do |format|\n if @artista.update(artista_params)\n format.html { redirect_to @artista, notice: 'Artista was successfully updated.' }\n format.json { render :show, status: :ok, location: @artista }\n else\n format.html { render :edit }\n format.json { render json: @artista.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n respond_to do |format|\n if @spotify_artist.update(spotify_artist_params)\n format.html { redirect_to @spotify_artist, notice: 'Spotify artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @spotify_artist }\n else\n format.html { render :edit }\n format.json { render json: @spotify_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @announcement = Announcement.find(params[:id])\n @announcement.title = params[:title]\n @announcement.description = params[:description]\n @announcement.price = params[:price]\n @announcement.photo = params[:photo]\n @announcement.latitude = params[:latitude]\n @announcement.longitude = params[:longitude]\n @announcement.subcategory_id = params[:subcategory_id]\n @announcement.place = params[:place]\n @announcement.save\n render json:@announcement\n end", "def update\n # @picture = Picture.find_by_id(params[:id])\n respond_to do |format|\n # binding.pry\n if @share.update(share_params)\n format.html { redirect_to @share, notice: 'Successfully updated.' }\n format.json { render :show, status: :ok, location: @share }\n else\n format.html { render :edit }\n format.json { render json: @share.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @artwork_share = ArtworkShare.find_by(id: params[:id])\n render json: @artwork_share\n end", "def update\n if @track.update(edit_track_params)\n render json: @track\n else\n render json: @track.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to artist_album_url(@artist,@album), notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asset_scrapping_entry.update(asset_scrapping_entry_params)\n format.html { redirect_to @asset_scrapping_entry, notice: 'Asset scrapping entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_scrapping_entry }\n else\n format.html { render :edit }\n format.json { render json: @asset_scrapping_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result_figure.update(result_figure_params)\n format.html { redirect_to @result_figure, notice: 'Result figure was successfully updated.' }\n format.json { render :show, status: :ok, location: @result_figure }\n else\n format.html { render :edit }\n format.json { render json: @result_figure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @similar_artist.update(similar_artist_params)\n format.html { redirect_to @similar_artist, notice: 'Similar artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @similar_artist }\n else\n format.html { render :edit }\n format.json { render json: @similar_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @art = Art.find(params[:id])\n\n respond_to do |format|\n if @art.update_attributes(params[:art])\n format.html { redirect_to(@art, :notice => 'Art was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @art.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @awesome_stuff.update(awesome_stuff_params)\n format.html { redirect_to @awesome_stuff, notice: 'Awesome stuff was successfully updated.' }\n format.json { render :show, status: :ok, location: @awesome_stuff }\n else\n format.html { render :edit }\n format.json { render json: @awesome_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @record = Asset.find(params[:id])\n @record.update_attributes(params[:@record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to [@asset.org, @asset], notice: 'Asset was successfully updated.' }\n format.json { render :show, status: :ok, location: [@asset.org, @asset] }\n else\n format.html { render :edit }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artefact = Artefact.find(params[:artefact_id])\n\n @asset = @artefact.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(asset_params)\n format.html { redirect_to artefact_path(@artefact), notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @share.update(share_params)\n format.html { redirect_to @share, notice: 'Share was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @share.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 @song.artist = get_artist(params)\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anyshare.update(anyshare_params)\n format.html { redirect_to @anyshare, notice: 'Anyshare was successfully updated.' }\n format.json { render :show, status: :ok, location: @anyshare }\n else\n format.html { render :edit }\n format.json { render json: @anyshare.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @artigo = Artigo.find(params[:id])\n\n respond_to do |format|\n if @artigo.update_attributes(params[:artigo])\n format.html { redirect_to @artigo, notice: 'Artigo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @artigo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { render :show, status: :ok, location: @part }\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to artist_album_song_url(@artist,@album,@song), notice: 'song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n respond_to do |format|\n if @share.update(share_params)\n format.html { redirect_to @share, notice: 'Share was successfully updated.' }\n format.json { render :show, status: :ok, location: @share }\n else\n format.html { render :edit }\n format.json { render json: @share.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @share.update(share_params)\n format.html { redirect_to @share, notice: 'Share was successfully updated.' }\n format.json { render :show, status: :ok, location: @share }\n else\n format.html { render :edit }\n format.json { render json: @share.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @share.update(share_params)\n format.html { redirect_to @share, notice: 'Share was successfully updated.' }\n format.json { render :show, status: :ok, location: @share }\n else\n format.html { render :edit }\n format.json { render json: @share.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset }\n else\n format.html { render :edit }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article_of_clothing.update(article_of_clothing_params)\n format.html { redirect_to @article_of_clothing, notice: \"Article of clothing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @article_of_clothing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @article_of_clothing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Like.update(params[\"id\"], params[\"like\"])\n end", "def update\n respond_to do |format|\n if @work_article.update(work_article_params)\n format.html { redirect_to @work_article, notice: t('notifications_masc.success.resource.updated',\n resource: t('work_articles.form.resource')) }\n format.json { render :show, status: :ok, location: @work_article }\n else\n format.html { render :edit }\n format.json { render json: @work_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n # @track.json_response = nil\n if @track.valid?\n set_track_json\n end\n\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story_part.update(story_part_params)\n format.html { redirect_to @story_part, notice: 'Story part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story_part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @art = Art.find(params[:id])\n\n respond_to do |format|\n if @art.update_attributes(params[:art])\n flash[:notice] = 'Art was successfully updated.'\n format.html { redirect_to(@art) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @art.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @air_quality = AirQuality.find(params[:id])\n\n if @air_quality.update(air_quality_params)\n head :no_content\n else\n render json: @air_quality.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n respond_to do |format|\n if @aneart.update(aneart_params)\n format.html { redirect_to anearts_path, notice: 'Aneart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aneart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n new_artwork_share = ArtworkShare.new(artwork_share_params)\n\n if new_artwork_share.save\n render json: new_artwork_share\n else\n render(\n json: new_artwork_share.errors.full_messages, status: :unprocessable_entity\n )\n end\n end", "def update\n @art_piece = ArtPiece.find(params[:id])\n\n respond_to do |format|\n if @art_piece.update_attributes(params[:art_piece])\n format.html { redirect_to @art_piece, notice: 'Art piece was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @art_piece.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to edit_asset_path(@asset), notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feed_item.update(feed_item_params)\n format.json { render :show, status: :ok, location: @feed_item }\n else\n format.json { render json: @feed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to root_path, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing_asset.update(listing_asset_params)\n format.html { redirect_to @listing_asset, notice: 'Listing asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing_asset }\n else\n format.html { render :edit }\n format.json { render json: @listing_asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n \n respond_to do |format|\n updated_params = song_params\n if (@song.artist != song_params[:artist] || @song.songname != song_params[:songname])\n uri = 'http://developer.echonest.com/api/v4/song/search?api_key=6XUOAXHJOW28GGGRH&format=json&results=1&artist=' + Rack::Utils.escape(song_params[:artist]) + '&title=' + Rack::Utils.escape(song_params[:songname]) + '&bucket=audio_summary'\n result = open(uri).read\n parsed = JSON.parse(result)\n if parsed[\"response\"][\"songs\"].length > 0\n updated_params[:bpm] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"tempo\"]\n updated_params[:key] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"key\"]\n notice = \"Song found on EchoNest!\"\n else\n notice = \"Could not find updated song on EchoNest.\"\n end\n \n end\n if @song.update(updated_params)\n format.html { redirect_to @song, notice: \"#{notice} #{updated_params} \" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @articicle.update(articicle_params)\n format.html { redirect_to @articicle, notice: \"Articicle was successfully updated.\" }\n format.json { render :show, status: :ok, location: @articicle }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @articicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booksmarks = Booksmark.all.order(updated_at: :desc)\n respond_to do |format|\n if @booksmark.update(booksmark_params)\n format.js {render nothing: true} \n format.html { redirect_to @booksmark, notice: \"Booksmark was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booksmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_artwork_params\n params.require(:artwork).permit(:published)\n end", "def update\n respond_to do |format|\n if @pub_art_type.update(pub_art_type_params)\n format.html { redirect_to @pub_art_type, notice: 'Pub art type was successfully updated.' }\n format.json { render :show, status: :ok, location: @pub_art_type }\n else\n format.html { render :edit }\n format.json { render json: @pub_art_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series].merge({:version_attributes=>{},:thumbnail_attributes=>{:name=>params[:series][:name],:original_link=>params[:series][:thumbnail_link],:remote_image_url=>params[:series][:thumbnail_link]} }))\n format.html { redirect_to @series, :notice => 'Series was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n respond_to do |format|\n if @asset_stock.update(asset_stock_params)\n format.html { redirect_to @asset_stock, notice: 'Asset stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_stock }\n else\n format.html { render :edit }\n format.json { render json: @asset_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @share = Share.find(params[:id])\n\n respond_to do |format|\n if @share.update_attributes(params[:share])\n format.html { redirect_to @share, notice: 'Share was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @share.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pic.update(part_update_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { render :show, status: :ok, location: @pic }\n else\n format.html { render :edit }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n artist = Artist.find(params[:id])\n artist.update_attributes(artist_params)\n redirect_to artist\n end", "def update\n respond_to do |format|\n if @track_painter_item.update(track_painter_item_params)\n format.html { redirect_to @track_painter_item, notice: 'Track painter item was successfully updated.' }\n format.json { render :show, status: :ok, location: @track_painter_item }\n else\n format.html { render :edit }\n format.json { render json: @track_painter_item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.88644284", "0.84564495", "0.84221727", "0.84146965", "0.83546954", "0.83195406", "0.82671034", "0.7829537", "0.7751965", "0.7698267", "0.76660085", "0.76660085", "0.763793", "0.76301897", "0.7619327", "0.7564934", "0.7486118", "0.7475587", "0.74569345", "0.7455977", "0.745445", "0.74491656", "0.74402946", "0.74397314", "0.7435704", "0.7435704", "0.7435704", "0.7435704", "0.7433246", "0.74177927", "0.7404183", "0.7398415", "0.7369429", "0.7359829", "0.733777", "0.7336866", "0.73256713", "0.7315798", "0.72747386", "0.72705084", "0.72487503", "0.7237775", "0.72319865", "0.72239584", "0.7197394", "0.7196146", "0.7171592", "0.7164763", "0.712652", "0.7114913", "0.71148944", "0.7112503", "0.7094802", "0.7081664", "0.7079509", "0.70624554", "0.7059297", "0.7052081", "0.70336753", "0.7030263", "0.7025968", "0.7022233", "0.7019542", "0.7007191", "0.7005936", "0.6997745", "0.6986739", "0.6981722", "0.6981722", "0.6981722", "0.69796085", "0.6978745", "0.69779193", "0.69719076", "0.69681925", "0.6961868", "0.69613594", "0.6961297", "0.695783", "0.6957818", "0.695748", "0.69527423", "0.6952493", "0.69501334", "0.6946534", "0.6944053", "0.69433093", "0.69347566", "0.6925366", "0.69214803", "0.69178826", "0.6917776", "0.69153637", "0.6911653", "0.690731", "0.69000477", "0.6894943", "0.6894769", "0.6892931", "0.6891399", "0.68901134" ]
0.0
-1
ACK01 Id: 668 Name: Line Item Status Code Type: ID Min/Max: 2/2 Description: Code specifying the action taken by the seller on a line item requested by the buyer
def ACK01=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def item_type_with_status_code\n :thesis\n end", "def exchange_code; end", "def display_status(item_status_code)\n case item_status_code\n when 'I' # Initiated (Assigned)\n 'incomplete'\n when 'A', 'R' # Active (Processing) / Received\n 'beingProcessed'\n when 'C', 'W' # Completed / Waived\n 'completed'\n when 'Z' # Incomplete\n 'furtherActionNeeded'\n else\n 'incomplete'\n end\n end", "def codes; end", "def item_id\n params['VendorTxCode']\n end", "def code\n self[:code]&.inquiry\n end", "def elb_status_code\n self[:elb_status_code].to_i\n end", "def status_code\n e = nil\n each_element('status') { |xe| e = xe }\n if e and e.attributes['code'].size == 3 and e.attributes['code'].to_i != 0\n e.attributes['code'].to_i\n else\n nil\n end\n end", "def update_item_receipt(code, id, new_value, old_value)\n if new_value != old_value && !$game_switches[MARW_CONFIGURATION[:manual_switch]]\n add_to_receipt([code, id, new_value - old_value])\n end\n end", "def activity(changed_quantity, line_item)\n if (changed_quantity > 0 && changed_quantity == line_item.quantity)\n :add\n elsif (changed_quantity < 0 && line_item.quantity == 0)\n :remove\n elsif changed_quantity\n :update\n end\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def acknowledge(authcode = nil)\n string = [params['_raw_action'],\n params['_raw_orderSumAmount'],\n params['_raw_orderSumCurrencyPaycash'],\n params['_raw_orderSumBankPaycash'],\n params['_raw_shopId'],\n params['_raw_invoiceId'],\n params['_raw_customerNumber'],\n authcode\n ].join(';')\n\n digest = Digest::MD5.hexdigest(string)\n res = params['_raw_md5'] == digest.upcase\n if res\n @response_code = '0'\n else\n @response_code = '1'\n end\n end", "def code\n if [email protected]_key? 'RESPONSE'\n if has_errors? \n raise PayTrace::Exceptions::ValidationError, get_error_response\n else\n raise PayTrace::Exceptions::ValidationError, \"missing response field\"\n end\n end\n code = parse_code(@values[\"RESPONSE\"])\n code.first\n end", "def item_code( seqno )\n \"#{ code }-#{ seqno ? seqno : '?' }\"\n end", "def code\n '202'\n end", "def ACK04=(arg)", "def add_line_item(params)\r\n # Creates line items counter necessary for prefix.\r\n @LINE_ITEMS = 0 if !@LINE_ITEMS \r\n @LINE_ITEMS += 1 # VALUE REQUIRED IN:\r\n prefix = \"LV3_ITEM#{@LINE_ITEMS}_\" # USA | CANADA\r\n @PARAM_HASH[prefix + 'UNIT_COST'] = params[:unit_cost] # * *\r\n @PARAM_HASH[prefix + 'QUANTITY'] = params[:quantity] # * *\r\n @PARAM_HASH[prefix + 'ITEM_SKU'] = params[:item_sku] || '' # *\r\n @PARAM_HASH[prefix + 'ITEM_DESCRIPTOR'] = params[:descriptor] || '' # * *\r\n @PARAM_HASH[prefix + 'COMMODITY_CODE'] = params[:commodity_code] || '' # * *\r\n @PARAM_HASH[prefix + 'PRODUCT_CODE'] = params[:product_code] || '' # * \r\n @PARAM_HASH[prefix + 'MEASURE_UNITS'] = params[:measure_units] || '' # * *\r\n @PARAM_HASH[prefix + 'ITEM_DISCOUNT'] = params[:item_discount] || '' # *\r\n @PARAM_HASH[prefix + 'TAX_RATE'] = params[:tax_rate] || '' # * \r\n @PARAM_HASH[prefix + 'GOODS_TAX_RATE'] = params[:goods_tax_rate] || '' # *\r\n @PARAM_HASH[prefix + 'TAX_AMOUNT'] = params[:tax_amount] || '' # * \r\n @PARAM_HASH[prefix + 'GOODS_TAX_AMOUNT'] = params[:goods_tax_amount] || '' # *\r\n @PARAM_HASH[prefix + 'CITY_TAX_RATE'] = params[:city_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'CITY_TAX_AMOUNT'] = params[:city_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'COUNTY_TAX_RATE'] = params[:county_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'COUNTY_TAX_AMOUNT'] = params[:county_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'STATE_TAX_RATE'] = params[:state_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'STATE_TAX_AMOUNT'] = params[:state_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'CUST_SKU'] = params[:cust_sku] || '' #\r\n @PARAM_HASH[prefix + 'CUST_PO'] = params[:cust_po] || '' #\r\n @PARAM_HASH[prefix + 'SUPPLEMENTAL_DATA'] = params[:supplemental_data] || '' #\r\n @PARAM_HASH[prefix + 'GL_ACCOUNT_NUMBER'] = params[:gl_account_number] || '' #\r\n @PARAM_HASH[prefix + 'DIVISION_NUMBER'] = params[:division_number] || '' #\r\n @PARAM_HASH[prefix + 'PO_LINE_NUMBER'] = params[:po_line_number] || '' #\r\n @PARAM_HASH[prefix + 'LINE_ITEM_TOTAL'] = params[:line_item_total] || '' # * \r\n end", "def ACK05=(arg)", "def op_code\n 2002\n end", "def op_code\n 2004\n end", "def response_line\n \"#{Protocol::NAME}/#{@version} #{@code} #{@message}#{Protocol::CRLF}\"\n end", "def qsi_response\r\n code = digital_reciept_info('DigitalReceipt.QSIResponseCode')\r\n return @no_error ? QSI_RESPONSE_CODE_MESSAGES[code.chomp!] : code\r\n end", "def translate_status_code(code)\n {\n '00' => :success,\n '40' => :neutral,\n '59' => :waiting_bank,\n '60' => :rejected_bank,\n '64' => :waiting_risk,\n '65' => :rejected_risk,\n '70' => :rejected_validation,\n '80' => :waiting,\n '90' => :new\n }[code]\n end", "def primary_response_code\r\n params['prc']\r\n end", "def ACK02=(arg)", "def ACK08=(arg)", "def consume_item(type, id)\n action = eval(type + '_Need_Items.dup')\n equipment = eval(type + '_Need_Equiped.dup')\n if action.include?(id)\n for need in action[id]\n $game_party.lose_item(need[1], need[2]) if need[0] == 'i' \n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a' \n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w' \n end\n end\n if equipment.include?(id)\n if $atoa_script['Atoa Multi Slot']\n for need in equipment[id]\n equipments = armors.dup if need[0] == 'a'\n equipments = weapons.dup if need[0] == 'w'\n for i in 0...equips.size\n if action_id(equip[i]) == need[1]\n equip(i, 0)\n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a'\n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w'\n equip(i, equip[i].id)\n end\n end\n end\n else\n for need in equipment[id]\n equipments = armors.dup if need[0] == 'a'\n equipments = weapons.dup if need[0] == 'w'\n for equip in equipments\n if equip.type_name == 'Weapon'\n type = 0\n else\n type = 1 if equip.id == @armor1_id\n type = 2 if equip.id == @armor2_id\n type = 3 if equip.id == @armor3_id\n type = 4 if equip.id == @armor4_id\n end\n if action_id(equip) == need[1]\n equip(type, 0)\n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a'\n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w'\n equip(type, equip.id)\n end\n end\n end\n end\n end\n end", "def command_126(*args, &block)\n old_value = $game_party.marw_item_number_plus_equips($data_items[@params[0]])\n marw_command126_8qu7(*args, &block) # Call Original Method\n # Add to receipt if the possessed number of this item has changed\n new_value = $game_party.marw_item_number_plus_equips($data_items[@params[0]])\n update_item_receipt(:I, @params[0], new_value, old_value)\n end", "def create_item_pack_product_code\n puts \"IN RETAIL CREATE IPC\"\n cosmetic_code = \"\"\n if self.label_code == \"U\" \n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"UL\"\n else\n cosmetic_code = \"WX\"\n end\n else\n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"LB\"\n else\n cosmetic_code = \"LW\"\n end\n \n end\n \n \n class_code = self.carton_setup.product_class_code\n puts \"prod sched: \" + self.production_schedule_code\n commodity = RmtSetup.find_by_production_schedule_name(self.production_schedule_code).commodity_code\n grade_code = self.carton_setup.grade_code\n \n std_count = StandardSizeCount.find_by_standard_size_count_value_and_commodity_code_and_basic_pack_code(self.carton_setup.standard_size_count_value,commodity,self.basic_pack_code)\n \n if !std_count\n err = \"An IPC could not be found or created, because no standard_size_count record exists for the following field values: <br>\"\n err += \"standard_size_count_value: \" + self.carton_setup.standard_size_count_value.to_s + \"<br>\"\n err += \"commodity: \" + commodity + \"<br>\"\n err += \"basic_pack_code: \" + self.basic_pack_code\n raise err\n \n end\n actual_count = std_count.actual_count\n \n variety = self.carton_setup.marketing_variety_code\n \n item_pack = ItemPackProduct.find_by_product_class_code_and_commodity_code_and_grade_code_and_actual_count_and_marketing_variety_code_and_cosmetic_code_name_and_size_ref_and_basic_pack_code(class_code,commodity,grade_code,actual_count,variety,cosmetic_code,self.size_ref,self.basic_pack_code)\n \n if ! item_pack\n \n item_pack = ItemPackProduct.new\n item_pack.product_class_code = class_code\n item_pack.commodity_code = commodity\n item_pack.commodity_group_code = std_count.commodity.commodity_group_code\n item_pack.cosmetic_code_name = cosmetic_code\n item_pack.grade_code = grade_code\n item_pack.basic_pack_code = self.basic_pack_code\n \n item_pack.treatment_code = self.carton_setup.treatment_code\n item_pack.treatment = Treatment.find_by_treatment_code_and_treatment_type_code(item_pack.treatment_code,\"PACKHOUSE\")\n item_pack.grade = Grade.find_by_grade_code(grade_code)\n item_pack.standard_size_count = std_count\n item_pack.standard_size_count_value = std_count.standard_size_count_value\n item_pack.marketing_variety_code = variety\n item_pack.actual_count = actual_count\n item_pack.size_ref = self.size_ref\n puts item_pack.size_ref\n item_pack.create\n \n \n end\n \n \n if ! self.new_record?\n old_ri = RetailItemSetup.find(self.id)\n old_ipc = old_ri.item_pack_product_code \n old_mark = old_ri.mark_code\n end\n \n self.item_pack_product = item_pack\n \n \n self.item_pack_product_code = item_pack.item_pack_product_code\n \n if ! self.new_record? && self.carton_setup.fg_setup\n \n if old_ipc != self.item_pack_product_code||old_mark != self.mark_code\n @update_fg = true\n end\n end\n \n end", "def ACK07=(arg)", "def status_code\n @data[:status_code].to_i\n end", "def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end", "def determine_status(mfhd_status)\n\n unavailable_count = 0\n mfhd_status.each do |item_id, item|\n statusCode = item[:statusCode].to_i\n unavailable_count += 1 if statusCode > 1 && statusCode != 11\n end\n\n case\n when unavailable_count == 0\n return 'available'\n when unavailable_count == mfhd_status.size\n return 'not_available'\n else\n return 'some_available'\n end\n\n\n # # assume available\n # status = 'available'\n # unavailable = 0\n # # if statusCode > 1 some item status is set so some item may not be available; 11 (returned) is the exception\n # records.each { |record| unavailable += 1 if record[:statusCode].to_i > 1 && record[:statusCode].to_i != 11 }\n # unless unavailable == 0\n # if unavailable == item_count.to_i\n # status = 'not_available'\n # else\n # status = 'some_available'\n # end\n # end\n # \n # status\n\n end", "def status_line\n\t\tst = self.status || self.derived_status_code\n\t\treturn STATUS_LINE_FORMAT % [ st, HTTP::STATUS_NAME[st] ]\n\tend", "def code\n @response_attributes['Code'];\n end", "def update_code(code, valid_source_codes)\n unless valid_source_codes.include?(@code)\n raise \"Changing the status code from :#{@code} to :#{code} is forbidden\"\n end\n @code = code\n self\n end", "def ACK09=(arg)", "def parser_received(line)\n\t\tif line.include? MailHeader.received\n @count=@count+1\n # fields=line.split(MailHeader.key_separator)\n if line.length>1\n @received_value=@received_value+line\n end #end fields.length\n else\n if line.include? MailHeader.key_separator\n if received_value.start_with? MailHeader.received\n #get the received value\n # puts @received_value\n end\n @received_value=\"\"\n else\n @received_value=@received_value+line\n end\n end #end line include?\n\n # parser the received from the mail header\n if received_value.include? MailHeader.smtp_code_550 or received_value.include? MailHeader.smtp_code_551 or received_value.include? MailHeader.smtp_code_553 or received_value.include? MailHeader.smtp_code_554\n mail_header_output.correct_email_format=MailHeader.unknown\n elsif received_value.include? MailHeader.smtp_code_552\n #the address is correct\n end\n\tend", "def Action(code) # Sends a raw Action ID (see key.h)\n success?(parse(cmd(with_args(code))))\n end", "def generate_message(item)\n short_message = ''\n long_message = ''\n code = ''\n\n # status patron message otherwise regular message\n if item[:statusPatronMessage].present?\n code = 'sp'\n long_message = item[:statusPatronMessage]\n short_message = long_message.gsub(/(Try|Place).+/, '').strip\n short_message = short_message.gsub(/\\W$/, '')\n # if record[:patronGroupCode].strip.match(/^(IND|MIS|ACO)/)\n # code = 'sp'\n # long_message = record[:lastName].strip + ' ' + record[:firstName].strip\n # # done in two steps in case ending puctuation is missing\n # short_message = long_message.gsub(/(Try|Place).+/, '').strip\n # short_message = short_message.gsub(/\\W$/, '')\n else\n code = item[:statusCode].to_s\n # append suffix to indicate whether there are requests - n = no requests, r = requests\n item[:requestCount] == 0 ? code += 'n' : code += 'r'\n\n # get parms for the message being processed\n parms = ITEM_STATUS_CODES[code]\n\n raise \"Status code not found in config/item_status_codes.yml\" unless parms\n\n short_message = make_substitutions(parms['short_message'], item)\n long_message = make_substitutions(parms['long_message'], item)\n\n end\n\n # add labels\n short_message = add_label(short_message, item)\n long_message = add_label(long_message, item)\n\n if Rails.env != 'clio_prod'\n short_message = short_message + \" (#{code}/short)\"\n long_message = long_message + \" (#{code}/long)\"\n end\n\n return { :status_code => code,\n :short_message => short_message,\n :long_message => long_message }\n end", "def process_inv_status_response(raw_data)\n results = []\n raw_data.map do |inv_status|\n\n begin\n mapped = response_mapper(inv_status, {\n 'Inv_Status.Warehouse' => 'warehouse',\n 'Inv_Status.ProdCode' => 'sku',\n 'Inv_Status.Available' => 'quantity',\n })\n\n if (mapped['warehouse'] === 'Main Warehouse')\n results << mapped\n end\n rescue => error\n issue_error(AcumenAgentError.new(\n 'process_inv_status_response',\n 'Failed while processing Prod_Mkt record',\n { sku: get_field_value(inv_status, 'Inv_Status.ProdCode') },\n error,\n ))\n end\n end\n\n results\n end", "def prescriptively_ok=(status)\n self.acceptance = (acceptance & DESCRIPTIVE) | (status.to_i * PRESCRIPTIVE) \n end", "def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end", "def status_code\n attributes[:status_code]\n end", "def status_code\n params['Status']\n end", "def applied_line_params\n params.require(:applied_line).permit(:code)\n end", "def ot_voucher_code\n end", "def command_128(*args, &block)\n old_value = $game_party.marw_item_number_plus_equips($data_armors[@params[0]])\n marw_command128_8qu7(*args, &block) # Call Original Method\n # Add to receipt if the possessed number of this armor has changed\n new_value = $game_party.marw_item_number_plus_equips($data_armors[@params[0]])\n update_item_receipt(:A, @params[0], new_value, old_value)\n end", "def command_127(*args, &block)\n old_value = $game_party.marw_item_number_plus_equips($data_weapons[@params[0]])\n marw_command127_8qu7(*args, &block) # Call Original Method\n # Add to receipt if the possessed number of this weapon has changed\n new_value = $game_party.marw_item_number_plus_equips($data_weapons[@params[0]])\n update_item_receipt(:W, @params[0], new_value, old_value)\n end", "def parse_status_packet(packet)\n { :code => packet.read_long }\n end", "def extract_status_line(line)\n line =~ /RTSP\\/(\\d\\.\\d) (\\d\\d\\d) ([^\\r\\n]+)/\n @rtsp_version = $1\n @code = $2.to_i\n @message = $3\n\n if @rtsp_version.nil?\n raise RTSP::Error, \"Status line corrupted: #{line}\"\n end\n end", "def parse_command(raw_code)\n code, subcode = raw_code.split\n @expected = structure_with_code(code)\n @response = response_with_code(code, subcode)\n end", "def Com6 # Recuperation Info\n \n end", "def identifier_code\n 'QuestionnaireResponseID'\n end", "def change_order_status_on_qsm(mp)\n orders = Spree::Order.where(\"market_place_id=? AND fulflmnt_state IN (?)\", mp.id, ['rfp', 'picked_up'])\n orders.each do |order|\n smp = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=?\", order.seller.id, mp.id) rescue nil\n if smp.present?\n uri = URI(mp.domain_url+'/ShippingBasicService.api/SetSendingInfo')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>smp.first.api_secret_key,'OrderNo'=>order.market_place_order_no,'ShippingCorp'=>'Fulfillment By Anchanto','TrackingNo'=>order.fulflmnt_tracking_no})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n end\n return res && res.code == \"200\" ? \"success\" : \"failed\"\n end\n end", "def parse_response_line\n if @headers.first =~ /\\AHTTP\\/1\\.[01] ([\\d]{3})/\n @status = $1.to_i\n else\n set_deferred_status :failed, {\n :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this.\n }\n close_connection\n end\n end", "def ACK10=(arg)", "def status(*code)\n self.status_code = code.first if code.first.present?\n self.status_code\n end", "def ACK03=(arg)", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def acknowledge_wire(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/acknowledge_wire\", options).body)\n @attributes = response['items']\n true\n end", "def acknowledge_wire(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/acknowledge_wire\", options).body)\n @attributes = response['items']\n true\n end", "def item_status!(item)\n item['status'] = item_status(item.fetch('loc_current', ''), item['loc_n'])\n if item['status'] == 'Available'\n if offsite?(item)\n item['status'] = 'Available upon request'\n elsif reserve?(item)\n item['status'] = 'Available - On Reserve'\n elsif kindle?(item)\n item['status'] = 'Available - Libraries Kindle only'\n end\n end\n item['status'] = item['status'] + ' (Library use only)' if library_use_only?(item)\n end", "def web_order_line_item_id\n read('web_order_line_item_id')\n end", "def line_code\n @attrs['Line']\n end", "def create_item(item_code)\n \t\txero = XeroConnection.new.connect\n\n \t\tif xero.Item.all(where: 'code == \"%s\"' % item_code).empty?\n \t\t\tnew_item = xero.Item.build(code: item_code)\n \t\t\tnew_item.save\n \t\tend\n \tend", "def status_line\n @response_impl.status_line\n end", "def status_code(*)\n end", "def mcode_set(code)\n item = read\n item['mcode'] = code\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end", "def status_line\n content[0]\n end", "def request\n if Pending.approved.include? @@item.attach\n 'unapprove'\n elsif Pending.unapproved.include? @@item.attach\n 'approve'\n elsif @@item.approved and @@item.approved.include? User.initials\n 'unapprove'\n else\n 'approve'\n end\n end", "def status_text\n case @state\n when 0\n H87Enchant::ST1\n when 1\n H87Enchant::ST2\n when 2\n H87Enchant::STQ\n when 3\n H87Enchant::ST3\n when 4\n H87Enchant::ST4\n when 5\n H87Enchant::ST5\n else\n ; 'ERRORE 01'\n end\n end", "def status_type_char; end", "def get_code\n\t\tdata = []\n\t\tis_manaul = false\n\t\tcode =\"\"\n\n\t\tif !params[:n_type].nil?\n\t\t\tdata = NextVersion.find_by n_type:params[:n_type]\n\t\t\tif data.is_manaul #check condition if this menu no need generate form system\n\t\t\t\tis_manaul = true\n\t\t\tend\n\t\t\tcode = @@common.getCode(params[:n_type])\n\t\tend\n\t\trender json:{ code:code,is_manaul:is_manaul , success:true}\n\tend", "def status\n if status_code.present?\n if status_code['HL7 ActStatus']\n status_code['HL7 ActStatus'].first()\n elsif status_code['SNOMED-CT']\n case status_code['SNOMED-CT'].first()\n when '55561003'\n 'active'\n when '73425007'\n 'inactive'\n when '413322009' \n 'resolved'\n end\n end\n end\n end", "def client_code(crosswalk_record)\n rcc_log.debug \"Obtaining CLIENT CODE.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category != 'DENIED' or rcfsc.category == nil}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n client_code = client_code_record.adjustment_code\n rcc_log.debug \"CLIENT CODE : #{client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n client_code.to_s.upcase\n end", "def msg_code\n return @critical, 2 if @critical\n return @warning, 1 if @warning\n return @unknown, 3 if @unknown\n [@ok, 0]\n end", "def sell_pending\n end", "def redeem\n @app = App.find_by_app_id(params[:app_key])\n\n user_codes = PromoCode.where(\"app_id = #{@app.id} and invalidated = ? and claimed_by_ip = ?\", false,request.remote_ip)\n if(!user_codes.empty?)\n @warning = \"It appears you have already gotten a promo code. If you have not redeemed it, please click the link below.\"\n @code = user_codes.first\n else\n codes = PromoCode.where(\"app_id = #{@app.id} and invalidated = ? and claimed_by_ip is null\", false)\n @code = codes.first\n if(@code)\n @code.claimed_by_ip = request.remote_ip\n @code.save!\n end\n end\n end", "def denied_client_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied CLIENT CODE for zero payment.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category == 'DENIED'}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n denied_client_code = client_code_record.adjustment_code\n rcc_log.debug \"Denied CLIENT CODE : #{denied_client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n denied_client_code.to_s.upcase\n end", "def update\n @line_item = current_member.seller.line_items.find(params[:id])\n action = params[:aasm]\n \n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n unless action.blank?\n @line_item.send(action) if @line_item.respond_to?(action)\n end\n format.html { redirect_to line_item_url(@line_item) }\n format.xml { render :nothing => true }\n format.js #tracking info added in place\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors.to_xml } \n end\n end\n end", "def order_statuses_integer(opt)\n if opt == 'pending'\n osi = 0\n elsif opt == 'rejected'\n osi = 1\n elsif opt == 'in_route'\n osi = 2\n elsif opt == 'deliver'\n osi = 3\n end\n osi\n end", "def find_match_and_decrement_available(line_item)\n gs = Orders::LineItemPresenter.new(line_item).global_sku\n if rii = ReturnInventoryItem.where([\"upc= ? and active = true and available > 0\", gs&.id]).first\n rii.available -= 1\n rii.save\n elsif gs\n #do this check since global skus are jacked up and can't be trusted\n gs = GlobalSku.where(\n style_number: gs.style_number,\n product_name: gs.product_name,\n size: gs.size,\n color_id: gs.color_id,\n customisation_id: gs.customisation_id,\n height_value: gs.height_value,\n product_id: gs.product_id,\n ).first\n\n if rii = ReturnInventoryItem.where([\"upc = ? and active = true and available > 0\", gs&.id]).first\n rii.available -= 1\n rii.save\n end\n end\n rii\n end", "def ACK06=(arg)", "def scode(thing)\n\t\treturn StatusCodes[thing] || ''\n\tend", "def acknowledge(authcode)\n return_authcode = [params[\"ORDER_NUMBER\"], params[\"TIMESTAMP\"], params[\"PAID\"], params[\"METHOD\"], authcode].join(\"|\")\n Digest::MD5.hexdigest(return_authcode).upcase == params[\"RETURN_AUTHCODE\"]\n end", "def describe_history_item( item )\n case item.action_type\n when MaintenanceRequestHistoryItem::TYPE_ADD_REMARK:\n # nothing to do\n return \"\";\n when MaintenanceRequestHistoryItem::TYPE_ASSIGNEE_CHANGE:\n return \"העברת אחריות ל-#{item.new_state_data}\";\n when MaintenanceRequestHistoryItem::TYPE_STATE_CHANGE: \n return \"שינוי מצב ל-#{mt_state(item.new_state_data.to_i)}\";\n when MaintenanceRequestHistoryItem::TYPE_TITLE_CHANGE:\n return \"שינוי כותרת מ-'#{h(item.old_state_data)}' ל-'#{h(item.new_state_data)}'\";\n when MaintenanceRequestHistoryItem::TYPE_URGENCY_CHANGE:\n return \"שינוי דחיפות ל-\" + pp_urgency(item.new_state_data.to_i);\n when MaintenanceRequestHistoryItem::TYPE_PLACE_CHANGE:\n return \"שינוי מיקום מ-\" + item.old_state_data + \" ל-\" + item.new_state_data;\n when MaintenanceRequestHistoryItem::TYPE_BODY_CHANGE:\n return \"שינוי תאור\";\n when MaintenanceRequestHistoryItem::TYPE_SERVICE_TYPE_CHANGE: \n return \"שינוי סוג שירות מ-\" + mt_req_service_type(item.old_state_data.to_i) + \" ל-\" + mt_req_service_type(item.new_state_data.to_i) + \".\";\n when MaintenanceRequestHistoryItem::TYPE_ADD_COST_DATA:\n ret_str = [];\n ret_str << \"הוספו נתוני עלות:<br/><ul>\";\n item.new_state_data.split(\"|\").each do | pair |\n vals = pair.split(\"=\");\n case vals[0]\n when \"hrs\":\n ret_str << \"<li>#{vals[1]} שעות</li>\" unless vals[1].blank?\n when \"pph\":\n ret_str << \"<li>מחיר לשעה: #{vals[1]} #{self.currency()}</li>\" unless vals[1].blank?\n when \"pc\":\n ret_str << \"<li>מחיר חלקים: #{vals[1]} #{self.currency()}</li>\" unless vals[1].blank?\n when \"fp\":\n ret_str << \"<li>מחיר קבוע: #{vals[1]} #{self.currency()}</li>\" unless vals[1].blank?\n end\n end\n ret_str << \"</ul>\";\n return ret_str.join();\n when MaintenanceRequestHistoryItem::TYPE_HOURS_OF_FIX_CHANGE:\n return \"מספר שעות העבודה שונה מ-\" + safe_str(item.old_state_data) + \" \" + \" ל-\" + item.new_state_data + \".\";\n when MaintenanceRequestHistoryItem::TYPE_PRICE_PER_HOUR_CHANGE:\n return \"מחיר לשעה שונה מ-\" + safe_str(item.old_state_data) + \" \" + self.currency() + \" ל-\" + item.new_state_data + \" \" + self.currency(); \n when MaintenanceRequestHistoryItem::TYPE_PARTS_COST_CHANGE: \n return \"מחיר החלקים שונה מ-\" + safe_str(item.old_state_data) + \" \" + self.currency() + \" ל-\" + item.new_state_data + \" \" + self.currency();\n when MaintenanceRequestHistoryItem::TYPE_FIXED_PRICE_CHANGE:\n return \"המחיר הקבוע שונה מ-\" + safe_str(item.old_state_data) + \" \" + self.currency() + \" ל-\" + item.new_state_data + \" \" + self.currency();\n when MaintenanceRequestHistoryItem::TYPE_BUILDING_CHANGE:\n return \"הבניין שונה מ-#{safe_str(item.old_state_data)} ל-#{safe_str(item.new_state_data)}\";\n when MaintenanceRequestHistoryItem::TYPE_ADD_FILES:\n return \"צירוף קבצים: #{item.new_state_data}\";\n when MaintenanceRequestHistoryItem::TYPE_REMOVE_FILES:\n return \"מחיקת קבצים: #{item.new_state_data}\";\n when MaintenanceRequestHistoryItem::TYPE_BUDGET_CHANGE:\n return \"הוספת תקציב: #{item.new_state_data}\" if item.old_state_data.nil?\n return \"שינוי תקציב מ-#{item.old_state_data} ל-#{item.new_state_data}\";\n end\n end\n \n # return human readable form of the value\n def pp_boolean(value)\n if value\n return \"כן\";\n else\n return \"לא\";\n end\n end\n \n def pp_flat( a_flat )\n return \"דירה #{a_flat.number} קומה #{a_flat.floor}\";\n end\n \nend", "def process_data_line line\n if line == \".\"\n begin\n if receive_message\n reply 250, \"Message accepted\"\n else\n reply 550, \"Message rejected\"\n end\n rescue => exception\n reply 550, exception.to_s\n end\n # do not allow another DATA with same sender and recipients\n # allow another transaction without requiring RSET\n @state -= [:data, :mail_from, :rcpt]\n else\n # slice off leading . if any\n line.slice!(0...1) if line[0] == ?.\n receive_data_line(line)\n end\n end", "def get_require(code)\n # return (code[0][2][1][0][1][1][1])\n return (code[2][1][0][1][1][1])\n end", "def status_code\n self.status.to_i\n end", "def add_product(item_id,user_id,line_item_type)\n\tcurrent_item = line_items.where(:item_id => item_id,:user_id=>user_id,:line_item_type => line_item_type).first\n item = Item.find(item_id)\n if line_item_type.to_i!=0\n -1\n elsif current_item\n if(item.availability<=current_item.quantity && current_item.line_item_type.to_i==0)\n -1\n else\n current_item.quantity += 1\n current_item\n end\n else\n if(item.availability<=0 && line_item_type.to_i==0)\n -1\n else\n current_item = LineItem.new(:item_id=>item_id,:user_id=>user_id,:line_item_type => line_item_type)\n line_items << current_item\n current_item\n end\n end\n end", "def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end", "def response_close_code code\n case code\n when 1000,1001,1002,1003,1007,1008,1009,1010,1011\n 1000\n when 3000..3999\n 1000\n when 4000..4999\n 1000\n when nil\n 1000\n else\n 1002\n end\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @return_codes << shift_byte(buffer) while buffer.bytesize > 0\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def line_item(item)\n {\n Name: item.product.name,\n Number: item.variant.sku,\n Quantity: item.quantity,\n Amount: {\n currencyID: item.order.currency,\n value: item.price\n },\n ItemCategory: 'Physical'\n }\n end", "def generate_add_status(user)\n PurchaseRequisition::LEVEL_ONE\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def change_status\n\n res = RResponse.new\n\n order = Order.find_by_id(params[:id])\n order.shipping_status_id = params[\"shipping_status_id\"]\n begin\n order.save\n res.success = true\n res.msg = 'Changed order status to \"' + order.status.name + '\"'\n\n # log this\n type = OrderLogType.find_by_name('status')\n log = OrderLog.create(:account_id => current_user.account.id, :order_log_type_id => type.id, :order_id => order.id, :subject => 'Order Status', :msg => res.msg)\n res.add_action(RAction.new({\n :component_id => 'order-log-' + params[:id],\n :success => true,\n :data => {:log => log.to_a}\n })) \n end\n\n respond(res)\n\n end" ]
[ "0.5701915", "0.5555529", "0.5385378", "0.53127086", "0.5277006", "0.52588254", "0.5243664", "0.5235464", "0.5217895", "0.5211837", "0.5201202", "0.51469094", "0.51326954", "0.5120543", "0.5110281", "0.50990105", "0.50856054", "0.508221", "0.5068412", "0.505626", "0.50545245", "0.50422186", "0.50297445", "0.5029019", "0.50259364", "0.49962774", "0.49943998", "0.49931565", "0.49834073", "0.49831524", "0.4977097", "0.49749184", "0.49730355", "0.49647218", "0.49491757", "0.4947122", "0.49456316", "0.49340063", "0.49313512", "0.49196908", "0.49179026", "0.49172643", "0.49100208", "0.48870337", "0.48866573", "0.4883665", "0.48808795", "0.48780584", "0.4859619", "0.48588732", "0.48547402", "0.48547113", "0.48451623", "0.4843997", "0.482416", "0.4823405", "0.48231542", "0.4821183", "0.48197028", "0.48146826", "0.48042655", "0.4803183", "0.4803183", "0.47951096", "0.4794278", "0.47926715", "0.4786867", "0.4773129", "0.4772388", "0.477083", "0.47702512", "0.477011", "0.476394", "0.47589222", "0.47553724", "0.4750764", "0.47485283", "0.47477353", "0.47413823", "0.4739831", "0.47347426", "0.4733002", "0.4732442", "0.47249758", "0.47248855", "0.47233295", "0.4720629", "0.47198656", "0.47114414", "0.47033536", "0.47013482", "0.47002852", "0.46970204", "0.46944886", "0.4691476", "0.46718284", "0.46704698", "0.46691394", "0.466836", "0.46682444" ]
0.4919293
40
ACK02 Id: 380 Name: Quantity Type: R Min/Max: 1/15 Description: Numeric value of quantity
def ACK02=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantity\n return @ucItemNumber.value\n end", "def quantity\n read_integer('quantity')\n end", "def sell_quantity\r\n 100000000000\r\n end", "def qty()\n 1\n end", "def getValue(quantity)\n if self.name.include?(\"BALDOSA\")\n self.value*quantity\n else\n self.value*1\n end\n end", "def quantity_description\n data[:quantity_description]\n end", "def quantity\n @quantity ||= DEFAULT_QUANTITY\n end", "def quantity\n hash[\"Quantity\"]\n end", "def quantity\n 1\n end", "def capacity_type\n\t\t\t\t\t:integer\n\t\t\t\tend", "def quantity\n 1\n end", "def qty_to_add\n 0\n end", "def qty_to_add\n 0\n end", "def display_quantity\n product.allow_fractional_quantity? ? quantity : quantity.to_i\n end", "def inventory_quantity\n return @cItemPossess.text.to_i\n end", "def quantity_field\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-wis-quantity\")), __method__)\n end", "def quantity_max_available_for_amend\n quantity + quantity_rejected\n end", "def quantity_extractor(quantity)\n { units: quantity[:unit], scalar: quantity[:value].to_s }\n end", "def quantity\n quantity_initial - quantity_consumed\n end", "def query_quantity\n puts \"Quantity? Enter to keep unchanged at #{@amount}\"\n r = gets.strip\n if r != \"\" && r.to_i != 0\n @amount = r.to_i\n end\n end", "def supp_quantity \n\n supp_quantity = 0.0\n \n self.receptions.each do |mr|\n supp_quantity += mr.quantity ? mr.quantity : 0.0 # en caso de que no se haya definido el quantity\n end\n\n return supp_quantity\n\n end", "def describe\n physical_quantity or get_description\n end", "def updateNewAvaible(quantity)\n \n if self.unit_type != \"KG\" \n #Solo puede acceptar numeros naturales o enteros xq es Unidad\n naturalN = quantity.to_i # convierte numero float a integer \n newAvaible= self.avaible- naturalN\n #self.update_column(:avaible, newAvaible.to_f)# se convierte numero entero a float de nuevo para que se pueda actualizar\n else\n newAvaible= self.avaible- quantity\n #self.update_column(:avaible, newAvaible) \n end\n\n end", "def add_sign_to_quantity\n end", "def inventory_for_longitudinal_presentation_unit_type_measurement\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * packing_material.quantity\n end", "def net_quantity\n @net_qty ||= (opening_stock_quantity + purchase_quantity + stock_received_quantity + sales_return_quantity) - (sales_quantity + stock_issued_quantity + fetch_stock_wasted_quantity + purchase_return_quantity)\n end", "def quantity\n @quantity ||= 1\n end", "def validate_quantity(input)\n return input.to_i > 0 ? input.to_i : nil\nend", "def show_quantity(options = {})\n quantity_packed.to_s + 'boxes + ' + quantity_unpacked.to_s + 'pcs available'\n end", "def stock_level()\n\n if @quantity >= 10\n return \"high\"\n elsif @quantity >= 5 && @quantity <= 9\n return \"medium\"\n elsif @quantity <= 4\n return \"low\"\n end\n end", "def maximum_quantity_allowed\n if sku.purchase_limiting? and sku.purchase_limit < sku.stock_level\n sku.purchase_limit\n else\n sku.stock_level\n end\n end", "def quantity_based_on_stock\n if self.quantity > self.item.stock\n errors.add(:quantity, \"should not exceed what's available in stock\")\n end\n end", "def new_quantity args={}\n SY::Quantity.new args.merge( composition: self )\n end", "def adjust_quantity\n self.quantity = quantity.ceil unless product.allow_fractional_quantity?\n end", "def formula_for(qty, desired_element)\n el = @elements[desired_element]\n qty += 1 while (qty % el.min_qty).positive? # Have to create in min quantity multiples\n scale = [qty / el.min_qty, 1].max # Then see if we need to multiply\n\n el.building_blocks.sort { |b, a| a[0].max_reactions <=> b[0].max_reactions }.map do |component, component_qty|\n [component.name, component_qty * scale]\n end\n end", "def set_quantity(qty) #should be quantity=(), but then calling from child doesn't work?\n @stall_current *= qty / @quantity\n @stall_torque *= qty / @quantity\n @max_power *= qty / @quantity\n @quantity = qty\n end", "def quantity_needed=( quantity )\n\t\tif quantity.is_a? String\n\t\t\t@quantity_needed = Integer( quantity )\n\t\telsif quantity.is_a? Fixnum\n\t\t\t@quantity_needed = quantity\n\t\telse\n\t\t\traise ArgumentError\n\t\tend\t\n\tend", "def amount_multiplier\n 1000\n end", "def consume_numeric; end", "def quantity\n @options['quantity'] || 1\n end", "def update_quantity token, cart_id, product_code, qty = 1\n\tend", "def quantity_field()\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.input.className(create_ats_regex_string('ats-qty')), format_method(__method__))\n end", "def amount_required\n @data['amountRequired'].to_f\n end", "def capacity_to_demand_multiplier\n 8760.0\n end", "def stock_level()\n if @quantity >= 10\n return \"high\"\n elsif @quantity >= 5 && @quantity <= 9\n return \"medium\"\n elsif @quantity <= 4\n return \"low\"\n end\nend", "def quantity_and_measurement\n result = \"#{self.quantity_in_stock} #{self.unit_of_measurement}\"\n if self.quantity_in_stock > 1\n result += \"s\"\n end\n result\n end", "def bulk(quantity, _)\n quantity >= @quantity ? quantity * value : 0\n end", "def convert(to)\n Quantity.new({:unit => @unit.convert(to), :reference_value => @reference_value})\n end", "def find_value_for(resource, quantity)\n quantity * resources[resource]\n end", "def price (quantity)\n if quantity >= 100\n price_per_unit = 8\n elsif quantity >= 50\n price_per_unit = 9\n else\n price_per_unit = 10\n end\n quantity * price_per_unit\n end", "def get_update_qty(requested_qty)\n update_qty = requested_qty\n\n if self.product_size.quantity < requested_qty\n update_qty = self.product_size.quantity\n end\n\n update_qty\n end", "def map_to_best_quantity_type\n # convert the food items into the highest logical quantity type, then\n # round to the nearest whole number for the sake of list generation\n reduced_to_tsp.transform_values do |value|\n convert_measurement(value)\n end\n end", "def fleet_value\n @fleet_value ||= quantity * resale_value\n end", "def price(quantity)\n\tif quantity >= 100 \n\t\tprice_per_item = 8\n\t\n\telsif quantity >= 50\n\t\tprice_per_item = 9\n\t\n\telse quantity < 50\n\t\tprice_per_item = 10\n\tend\n\tquantity * price_per_item\nend", "def inventory_for_superficie_presentation_unit_type_measurement\n surface = packing_material.presentation_unit_type_measure.side_dimension_x * packing_material.presentation_unit_type_measure.side_dimension_y\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * surface\n end", "def subamount unit_price , quantity\n unit_price.to_f * quantity.to_i\n end", "def suitable_quaters\n required_amount * 2\n end", "def getBaseSystemCapacity( elements, sysType1Arr )\n capValue = 0\n locationText = \"HouseFile/House/HeatingCooling/Type1\"\n\n sysType1Arr.each do |sysType1Name|\n if ( elements[locationText + \"/#{sysType1Name}\"] != nil )\n if ( sysType1Name != \"P9\" )\n capValue = elements[locationText + \"/#{sysType1Name}\" + \"/Specifications/OutputCapacity\"].attributes[\"value\"]\n else\n capValue = elements[locationText + \"/#{sysType1Name}\"].attributes[\"spaceHeatingCapacity\"]\n end\n end\n end\n\n return capValue.to_f * 1000 # Always returns Watts!\nend", "def receive(n)\r\n\t if n > 0 then\r\n\t\t @quantity = @quantity + n\r\n\t end\r\n end", "def to_quantity args={}\n # All the work is delegated to the quantity table:\n QUANTITY_TABLE[ args.merge( self ) ]\n end", "def amount; end", "def band_a\n 1000\n end", "def quantity=(q)\n delta = quantity - q\n self.quantity_consumed += delta\n save\n end", "def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity.to_i\n\tlist\nend", "def total_item_number\n @quantity * product.result_n\n end", "def value_with_units(value, units, usage_factor)\n raise \"Error: value must convert to an integer.\" unless value.to_i\n raise \"Error: units must be k, m, g\" unless units =~ /[KMG]/i\n factor = usage_factor.to_f\n raise \"Error: usage_factor is 1.0 Value used: #{usage_factor}\" if factor > 1.0 || factor <= 0.0\n (value * factor).to_i.to_s + units\nend", "def available_units\n return 0 if status == NO_SPACE\n\n 999\n end", "def qty_update_field\n $tracer.trace(__method__)\n #unit_test_no_generate: qty_update_field, input.className(create_ats_regex_string(\"ats-qty\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-qty\")), __method__, self)\n end", "def round\n Quantity.new(@value.round, @unit)\n end", "def getBasicValue\n minBonus\n end", "def qty_range_params\n params.require(:qty_range).permit(:name, :value)\n end", "def value\n @items.map{ |x| x.price * x.quantity}.inject(:+)\n end", "def pick_from_magazine(quantity)\r\n end", "def add_quantity(number)\n @quantity += number\n end", "def update_value(quantity)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# quantity == crypto value NOT USD\n\t\t# debugger\n\n\t\tif quantity > 0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# BUY \n\t\t\tself.total_value = self.total_value + quantity\t\t\t# increment wallet value by quantity\n\t\telse \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# SELL\n\t\t\tself.total_value = self.total_value + quantity\t\t\t# quantity is Negative!! so adding, will decrement\n\t\tend\n\n\t\tsave!\n\tend", "def transform_quantity(t)\n @quantity = t.apply_to_quantity(@quantity)\n end", "def casted_minimum\n minimum.blank? ? nil : (qtype_name == \"decimal\" ? minimum : minimum.to_i)\n end", "def capacity_reservation_specification\n data[:capacity_reservation_specification]\n end", "def main()\n puts \"Enter Unit:\"\n consumed_unit = gets.to_i\n return 0 if consumed_unit <= 0\n bill = 0\n unit_details = { 1..50 => 0.5, 51..150 => 0.75, 151..250 => 1.2, 251..Float::INFINITY => 1.5 }\n unit_details.each_pair do |unit, rate|\n break if consumed_unit < 0\n units = unit.max == Float::INFINITY ? consumed_unit : unit.count\n if consumed_unit > units\n bill += rate * units\n else\n bill += rate * consumed_unit\n end\n consumed_unit -= units\n end\n bill += bill * 0.2\n return bill.to_i\nend", "def update_quantity(list, string, integer)\n\tlist[string]=integer\n\treturn list\nend", "def update_quantity(list, string, integer)\n\tlist[string]=integer\n\treturn list\nend", "def ip_to_si(number, ip_unit_string, si_unit_string) \n ip_unit = OpenStudio::createUnit(ip_unit_string, \"IP\".to_UnitSystem).get\n si_unit = OpenStudio::createUnit(si_unit_string, \"SI\".to_UnitSystem).get\n #puts \"#{ip_unit} --> #{si_unit}\"\n ip_quantity = OpenStudio::Quantity.new(number, ip_unit)\n si_quantity = OpenStudio::convert(ip_quantity, si_unit).get\n puts \"#{ip_quantity} = #{si_quantity}\" \n return si_quantity.value\n end", "def showValue(quantity)\n ActionController::Base.helpers.number_to_currency(self.getValue(quantity), precision: 0, delimiter: \".\")\n end", "def sip_amount\n 5\n end", "def sip_amount\n 5\n end", "def sip_amount\n 5\n end", "def sip_amount\n 5\n end", "def set_value_total_presentation_unit_type_to_use\n result = product.presentation_unit_type_quantity_to_use(self.quantity,:side_dimension_x => self.side_dimension_x,:side_dimension_y => self.side_dimension_y)\n# quantity_by_presentation_unit_type = product.finished_product.quantity_by_presentation_unit_type(self.side_dimension_x, self.side_dimension_y)\n# div = self.quantity / quantity_by_presentation_unit_type\n# mod = self.quantity % quantity_by_presentation_unit_type\n# result = div + (mod.zero? ? 0 : 1)\n self.total_presentation_unit_type_to_use = result\n end", "def set_value_total_presentation_unit_type_to_use\n result = product.presentation_unit_type_quantity_to_use(self.quantity,:side_dimension_x => self.side_dimension_x,:side_dimension_y => self.side_dimension_y)\n# quantity_by_presentation_unit_type = product.finished_product.quantity_by_presentation_unit_type(self.side_dimension_x, self.side_dimension_y)\n# div = self.quantity / quantity_by_presentation_unit_type\n# mod = self.quantity % quantity_by_presentation_unit_type\n# result = div + (mod.zero? ? 0 : 1)\n self.total_presentation_unit_type_to_use = result\n end", "def counting_quantity\n product.allow_fractional_quantity? ? 1 : quantity.to_i\n end", "def quantity\n map(&:quantity).sum\n end", "def set_quantity\n @quantity = Quantity.find(params[:id])\n end", "def get_Amount()\n \t return @outputs[\"Amount\"]\n \tend", "def render_quantity scale=1.0\n if quantity\n rounding_multiplier = 1/quantity_step\n scaled_quantity = (quantity * scale)\n transformed = ((scaled_quantity * rounding_multiplier).round / rounding_multiplier).prettify\n\n transformed == 1 ? 'One' : transformed\n end\n end", "def total_quantity\n line_items.sum(:quantity)\n end", "def floor\n Quantity.new(@value.floor, @unit)\n end", "def quantity\n @quantity ||= sold_out ? 0 : rand(100)\n end", "def capacity_to_demand_multiplier\n 1.0\n end", "def suitable_halfs\n required_amount\n end", "def ext_effective_price\n (effective_list_price || 0) * (qty || 0)\n end", "def getSpecialValue\n maxBonus\n end" ]
[ "0.6809836", "0.6775975", "0.6690085", "0.64319664", "0.63662946", "0.6348344", "0.6330754", "0.6315505", "0.6189523", "0.6114082", "0.610348", "0.6098476", "0.6098476", "0.59895706", "0.59608895", "0.59427977", "0.5929411", "0.5920596", "0.58081454", "0.5807811", "0.5768504", "0.57399076", "0.5737341", "0.57120204", "0.5666974", "0.56415725", "0.5635254", "0.56190044", "0.5600627", "0.55914897", "0.55905974", "0.55782485", "0.5556494", "0.55560285", "0.5549876", "0.55319303", "0.5531201", "0.5529781", "0.55233234", "0.5517361", "0.5510054", "0.54833764", "0.5481591", "0.5478978", "0.54585785", "0.54478323", "0.5441789", "0.5436064", "0.5433125", "0.54100096", "0.5397875", "0.5395194", "0.53779024", "0.5353531", "0.5348389", "0.5342513", "0.5342063", "0.5328116", "0.53264016", "0.5323531", "0.53094465", "0.52884847", "0.5271293", "0.52673036", "0.5247673", "0.5235677", "0.5234928", "0.5234507", "0.5232282", "0.52306205", "0.5229411", "0.52289844", "0.5224929", "0.52237046", "0.52166396", "0.5213528", "0.5212985", "0.52005774", "0.5200273", "0.5196957", "0.5196957", "0.5196375", "0.5187406", "0.5184009", "0.5184009", "0.5184009", "0.5184009", "0.5179981", "0.5179981", "0.51698893", "0.516832", "0.51616216", "0.51612395", "0.515781", "0.51537496", "0.5151228", "0.5141807", "0.5141538", "0.51409054", "0.5139377", "0.5131505" ]
0.0
-1
ACK03 Id: 355 Name: Unit or Basis for Measurement Code Type: ID Min/Max: 2/2 Description: Code specifying the units in which a value is being expressed, or manner in which a measurement has been taken
def ACK03=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value\n if eng_unit_type\n \"#{data} #{eng_unit_type.tag}\"\n else\n data.to_s\n end\n end", "def unit\n parts[3]\n end", "def base_unit\n units[0]\n end", "def convertUnitValue(value,unit)\n if (unit.present?)\n unit.strip!\n else\n return value\n end\n unitRegEx=/^([afpnu\\xC2\\xB5\\316\\274mcdhkMGTPE]?)[ ]*(.+)/\n matchSet=unitRegEx.match(unit)\n if (matchSet.nil?)\n return value\n else\n prefix=matchSet[1]\n baseUnit=matchSet[2]\n case prefix\n when \"a\"\n mult=1.0E-18\n when \"f\"\n mult=1.0E-15\n when \"p\"\n mult=1.0E-12\n when \"n\"\n mult=1.0E-9\n when \"u\",\"\\316\\274\",\"\\xC2\\xB5\"\n mult=1.0E-6\n when \"m\"\n mult=1.0E-3\n when \"c\"\n mult=1.0E-2\n when \"d\"\n mult=1.0E-1\n when \"\"\n mult=1.0\n when \"h\"\n mult=1.0E2\n when \"k\"\n mult=1.0E3\n when \"M\"\n mult=1.0E6\n when \"G\"\n mult=1.0E9\n when \"T\"\n mult=1.0E12\n when \"P\"\n mult=1.E15\n when \"E\"\n mult=1.0E18\n else\n mult=1.0\n end\n return value*mult\n end\n end", "def band_a\n 1000\n end", "def content\n [ppux, ppuy, unit == :meters ? 1 : 0].pack(\"NNC\")\n end", "def unit=(value)\n @unit = value\n end", "def channel_unit(num)\n\t\tregexp = /^DIM#{num}=\"(.*)\"\\s*/\n\t\t@input_ary.each { |e| \n\t\t\treturn \"(\" + $1.to_s.gsub(/\\s+/,\"_\").strip + \")\" if e =~ regexp\n\t\t}\n\t\tputs \"WARNING: Cannot find channel #{num} name. Assigning a default value\"\n\t\treturn \"(unknown)\"\n\tend", "def unit(auth_name, code)\r\n out_name = FFI::MemoryPointer.new(:string)\r\n out_conv_factor = FFI::MemoryPointer.new(:double)\r\n out_category = FFI::MemoryPointer.new(:string)\r\n\r\n result = Api.proj_uom_get_info_from_database(self.context, auth_name, code,\r\n out_name, out_conv_factor , out_category)\r\n\r\n if result == 1\r\n name_ptr = out_name.read_pointer\r\n conv_factor_ptr = out_conv_factor\r\n category_ptr = out_category.read_pointer\r\n\r\n name = name_ptr.read_string_to_null\r\n conv_factor = conv_factor_ptr.read_double\r\n category = category_ptr.read_string_to_null\r\n\r\n Unit.new(auth_name, code, name, category, conv_factor, nil, false)\r\n else\r\n Error.check_context(self.context)\r\n end\r\n end", "def format_uflex_dc_spec(data, options = {})\n options = {\n spec: nil\n }.update(options)\n\n case options[:spec]\n when /(voh|vol|vt|vcl|vch|vdd)/i\n spec_type = 'volt'\n when /(ioh|iol)/i\n spec_type = 'curr'\n else\n spec_type = nil\n end\n\n case data\n when NilClass\n data_new = 0\n when Fixnum, Float\n case\n when data == 0\n data_new = data.to_s\n when data.abs < 1e-6\n data_new = (data * 1_000_000_000).round(4).to_s + '*nV' if spec_type == 'volt'\n data_new = (data * 1_000_000_000).round(4).to_s + '*nA' if spec_type == 'curr'\n data_new = data.to_s if spec_type.nil?\n when data.abs < 1e-3\n data_new = (data * 1_000_000).round(4).to_s + '*uV' if spec_type == 'volt'\n data_new = (data * 1_000_000).round(4).to_s + '*uA' if spec_type == 'curr'\n data_new = data.to_s if spec_type.nil?\n when data.abs < 1\n data_new = data.to_s + '*V' if spec_type == 'volt'\n data_new = (data * 1_000).round(4).to_s + '*mA' if spec_type == 'curr'\n data_new = data.to_s if spec_type.nil?\n else\n data_new = data.to_s + '*V' if spec_type == 'volt'\n data_new = data.to_s + '*A' if spec_type == 'curr'\n data_new = data.to_s if spec_type.nil?\n end\n data_new = data_new.gsub(/^/, '=')\n when String\n data_new = data.gsub(/^/, '=').gsub(/(\\W)([a-zA-Z])/, '\\1_\\2')\n # Remove underscores from unit designations\n data_new.gsub!(/(\\W)_(nV|uV|mV|V|nA|uA|mA|A)(\\W)/i, '\\1\\2\\3')\n data_new.gsub!(/(\\W)_(nV|uV|mV|V|nA|uA|mA|A)$/i, '\\1\\2')\n else\n Origen.log.error \"Unknown class type (#{data.class}) for spec value: #{data}\"\n fail\n end\n data_new\n end", "def pulse_code\n # 64 is just the max number of entries which maybe in there times two\n length = usb_get_pulse_code_length(dataIn:1).unpack('C').first # find out the length of the currently loaded pulse code\n usb_get_pulse_code(dataIn: length * 2).unpack('v*')\n end", "def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end", "def get_quantitative_value(value, unit)\n {\n '@type' => 'QuantitativeValue',\n 'value' => value,\n 'unitText' => unit,\n 'unitCode' => (UNIT_MAP[unit] if unit),\n } if value\n end", "def mambo_no_5; end", "def presentation_unit_type_measure\n packing_material.presentation_unit_type_measure\n end", "def calibr_49\n\t\t\tprop = Property.new(offset: get_ph_offset, address: CALIBR_49, type: :short)\n\t\t\tget_data(prop.to_s)\n\t\tend", "def unified_genotyper_strand_call_conf(data)\n \"30.0\"\nend", "def presentation_unit_type_measurement\n packing_material.presentation_unit_type_measurement\n end", "def read_trim_params\n # compensation parameter register mapping\n Calibration = Struct.new(\n # Register Address Register content Data type\n :dig_T1, # 0x88 / 0x89 dig_T1 [7:0] / [15:8] unsigned short\n :dig_T2, # 0x8A / 0x8B dig_T2 [7:0] / [15:8] signed short\n :dig_T3, # 0x8C / 0x8D dig_T3 [7:0] / [15:8] signed short\n :dig_P1, # 0x8E / 0x8F dig_P1 [7:0] / [15:8] unsigned short\n :dig_P2, # 0x90 / 0x91 dig_P2 [7:0] / [15:8] signed short\n :dig_P3, # 0x92 / 0x93 dig_P3 [7:0] / [15:8] signed short\n :dig_P4, # 0x94 / 0x95 dig_P4 [7:0] / [15:8] signed short\n :dig_P5, # 0x96 / 0x97 dig_P5 [7:0] / [15:8] signed short\n :dig_P6, # 0x98 / 0x99 dig_P6 [7:0] / [15:8] signed short\n :dig_P7, # 0x9A / 0x9B dig_P7 [7:0] / [15:8] signed short\n :dig_P8, # 0x9C / 0x9D dig_P8 [7:0] / [15:8] signed short\n :dig_P9, # 0x9E / 0x9F dig_P9 [7:0] / [15:8] signed short\n :dig_H1, # 0xA1 dig_H1 [7:0] unsigned char\n :dig_H2, # 0xE1 / 0xE2 dig_H2 [7:0] / [15:8] signed short\n :dig_H3, # 0xE3 dig_H3 [7:0] unsigned char\n :dig_H4, # 0xE4 / 0xE5[3:0] dig_H4 [11:4] / [3:0] signed short\n :dig_H5, # 0xE5[7:4] / 0xE6 dig_H5 [3:0] / [11:4] signed short\n :dig_H6, # 0xE7 dig_H6 signed char\n :t_fine\n )\n calib = [] \n\n # data addresses\n dig_t_reg = 0x88\n dig_p_reg = 0x8E\n dig_h_reg1 = 0xA1\n dig_h_reg2 = 0xE1\n \n data = read(dig_t_reg, 6)\n calib << ((data[1] << 8) | data[0]) # uint16_t dig_T1 [1][0] \n calib << int16(data[3], data[2]) # int16_t dig_T2 [3][2]\n calib << int16(data[5], data[4]) # int16_t dig_T3 [5][4]\n\n data = read(dig_p_reg, 18)\n calib << ((data[1] << 8) | data[0]) # uint16_t dig_P1 [1][0]\n calib << int16(data[3], data[2]) # int16_t dig_P2 [3][2]\n calib << int16(data[5], data[4]) # int16_t dig_P3 [5][4]\n calib << int16(data[7], data[6]) # int16_t dig_P4 [7][6]\n calib << int16(data[9], data[8]) # int16_t dig_P5 [9][8]\n calib << int16(data[11], data[10]) # int16_t dig_P6 [11][10]\n calib << int16(data[13], data[12]) # int16_t dig_P7 [13][12]\n calib << int16(data[15], data[14]) # int16_t dig_P8 [15][14]\n calib << int16(data[17], data[16]) # int16_t dig_P9 [17][16]\n\n data = read(dig_h_reg1, 1)\n calib << data[0] # uint8_t dig_H1 [0]\n \n data = read(dig_h_reg2, 7)\n calib << int16(data[1], data[0]) # int16_t dig_H2 [1],[0]\n calib << data[2] # uint8_t dig_H3 [2] \n\n # 109876543210 bit[11:0]\n # xxxxxxxx.... dig_H4_msb [11:4] [3]\n # ....xxxx dig_H4_lsb [3:0] [4]\n # xxxxxxxxxxxx dig_H4 [11:0] \n dig_H4_msb = (data[3] >> 4) & 0x0F\n dig_H4_lsb = ((data[3] << 4) & 0xF0) | (data[4] & 0x0F) \n calib << int16(dig_H4_msb, dig_H4_lsb) # int16_t dig_H4 [3][4]\n \n # 109876543210 bit[11:0]\n # xxxxxxxx.... dig_H5_msb [11:4] [5]\n # xxxx.... dig_H5_lsb [7:4] [4]\n # xxxxxxxxxxxx dig_H5 [11:0]\n dig_H5_msb = (data[5] >> 4) & 0x0F\n dig_H5_lsb = ((data[5] << 4) & 0xF0) | (data[4] >> 4) \n calib << int16(dig_H5_msb, dig_H5_lsb) # int16_t dig_H5 [4][5]\n \n calib << int8(data[6]) # int8_t dig_H6 [6]\n\n @calib = Calibration.new(*calib)\n end", "def band\n\t\tdata = query(\"AT+WMBS?\")\n\t\tif m = data.match(/^\\+WMBS: (\\d+),/)\n\t\t\treturn Bands[m.captures[0].to_i]\n\t\t\t\n\t\telse\n\t\t\t# Todo: Recover from this exception\n\t\t\terr = \"Not WMBS data: #{data.inspect}\"\n\t\t\traise RuntimeError.new(err)\n\t\tend\n\tend", "def value_cardtype_code\n :\"#{value_type_code}_value\"\nend", "def unit=(a_unit)\n self[:unit] = a_unit.to_s\n end", "def modeler_description\n return \"This measure takes the user selected standards space type and sets the interior lighting and equipment load definitions subcategory to match the space type name. \"\n end", "def unit(n)\n\t\ta, b = n.split('_')\n\t\treturn a, Dim_Hash[b]\n\tend", "def si_unit\n return Unit.steridian if describe == 'solid angle'\n return Unit.radian if describe == 'plane angle'\n\n val = si_base_units\n return nil unless val\n return val[0] if val.length == 1\n val = val.inject(Unit.unity) do |compound,unit|\n compound * unit\n end\n val = val.or_equivalent unless val.acts_as_equivalent_unit\n end", "def test_raw_range_1\r\n r = GerbilCharts::Models::RawRange.new\r\n\r\n \t[10,20,10,0,0,1001,19920,882991.22].each do |v|\r\n\t\tr.update v\r\n\tend\r\n\r\n\tr.min_max do |mn,mx|\r\n \tassert mn==0\r\n\t\tassert mx==882991.22\r\n\tend\r\n end", "def unit_of_measure_params\n params.require(:unit_of_measure).permit(:name, :description, :code, :uom_type, :ratio, :uom_category_id)\n end", "def unit_formats(type)\n #find statements\n #if sales[0]< 1000 and tot assets[0] < 1000\n #$xxx,xxx.x\n #else\n #$xxx,xxx\n #end\n end", "def value_with_units(value, units, usage_factor)\n raise \"Error: value must convert to an integer.\" unless value.to_i\n raise \"Error: units must be k, m, g\" unless units =~ /[KMG]/i\n factor = usage_factor.to_f\n raise \"Error: usage_factor is 1.0 Value used: #{usage_factor}\" if factor > 1.0 || factor <= 0.0\n (value * factor).to_i.to_s + units\nend", "def available_units\n return 0 if status == NO_SPACE\n\n 999\n end", "def test_change_system_yd\n range = Class.new(Metric)\n range.dimension = Dimension::L\n m0 = range.new(1, @yard_us)\n assert m1 = m0.change_system(:SI)\n assert_same @meter, m1.unit\n end", "def magnification\n 1300\n end", "def op_code\n 2004\n end", "def band10\n @ole.Band10\n end", "def get_resource_dimension(entry_datatype, entry_data)\n unit_type = (entry_data & 0xF)\n case unit_type\n when COMPLEX_UNIT_PX\n unit_name = \"px\"\n when COMPLEX_UNIT_DIP\n unit_name = \"dp\"\n when COMPLEX_UNIT_SP\n unit_name = \"sp\"\n when COMPLEX_UNIT_PT\n unit_name = \"pt\"\n when COMPLEX_UNIT_IN\n unit_name = \"in\"\n when COMPLEX_UNIT_MM\n unit_name = \"mm\"\n else\n unit_name = \"\"\n end\n\n return complex_to_float(entry_data).to_s + unit_name\n #return ((entry_data >> 8) & 0xFFFFFF).to_s + unit_name\n end", "def band9(value)\n @ole.Band9 = value\n nil\n end", "def base_unit_cf(params)\n measurement = Measurement.where(:name => params[:mtype]).first\n measurement_sub_type_id = measurement.measurement_sub_types.where(:name => params[:msub_type]).first.id\n uom = self.unit_of_measurements.where(:measurement_id => measurement.id, :measurement_sub_type_id => measurement_sub_type_id).first\n previous = MeasureUnit.find(uom.measure_unit_id).conversion_factor.to_f\n return {:factor => previous, :decimals => uom.decimal_places}\n end", "def unit_helper(number, from_unit_string, to_unit_string)\n OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end", "def band; end", "def band; end", "def convert_to_measured\n converter = 1\n case self.cost_unit\n when \"tsp\"\n converter = 0.16667 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n when \"tbsp\"\n converter = 0.5 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n when \"cup\"\n converter = 8 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n end\n self.cost_size *= converter\n end", "def unit_mappings\n {\n ApiUnitSystem.US => { :duration => \"milliseconds\", :distance => \"miles\", :elevation => \"feet\", :height => \"inches\", :weight => \"pounds\", :measurements => \"inches\", :liquids => \"fl oz\", :blood_glucose => \"mg/dL\" },\n ApiUnitSystem.UK => { :duration => \"milliseconds\", :distance => \"kilometers\", :elevation => \"meters\", :height => \"centimeters\", :weight => \"stone\", :measurements => \"centimeters\", :liquids => \"mL\", :blood_glucose => \"mmol/l\" },\n ApiUnitSystem.METRIC => { :duration => \"milliseconds\", :distance => \"kilometers\", :elevation => \"meters\", :height => \"centimeters\", :weight => \"kilograms\", :measurements => \"centimeters\", :liquids => \"mL\", :blood_glucose => \"mmol/l\" }\n }\n end", "def unitid_elements(marc)\n elements = []\n elements << {\n name: 'unitid',\n attrs: { type: 'clio', repositorycode: repository_code(marc), encodinganalog: '001' },\n value: marc['001'].value\n }\n marc.fields('852').each do |field|\n next unless field['h'].present?\n elements << {\n name: 'unitid',\n attrs: { type: 'call_num', repositorycode: repository_code(marc) },\n value: field['h']\n }\n end\n elements\n end", "def band10(value)\n @ole.Band10 = value\n nil\n end", "def band5\n @ole.Band5\n end", "def quality_indicator_name\n \"code complexity\"\n end", "def parse_rxnorm_code(fhir_drug)\n\t\tif (code = fhir_drug.code).present?\n\t\t\tif (coding = code.coding).present?\n\t\t\t\tvalue = code_list(coding)\n\t\t\telse\n\t\t\t\tvalue = \"code.coding not specified\" \n\t\t\tend\n\t\telse\n\t\t\tvalue = \"RxNorm code not specified\"\n\t\tend\n\n\t\treturn value\n\tend", "def battery_type; end", "def modeler_description\n return \"Reads the Boiler Nominal Capacity from an EnergyPlus .eio file and hardsizes the Nominal Capacity of the Boiler to this value.\"\n end", "def value_helper_code(type, code, system, display)\n value_el = Ox::Element.new(:value)\n value_el['xsi:type'] = type\n value_el['code'] = code\n value_el['codeSystem'] = system\n value_el['displayName'] = display\n value_el\n end", "def event(code, value)\n case code\n when Parser_code_asic_eeg_power_int\n @log.info(\"#{code_s(code)}\")\n value.each do |signal, value|\n @log.info(\"#{signal} -> #{value}\") \n end\n when Parser_code_attention, Parser_code_meditation\n @log.info(\"#{code_s(code)} -> #{value} (#{esense_s(value)})\")\n else\n if code == Parser_code_poor_quality and value == 200\n @log.info(\"#{code_s(code)} -> #{value} (not touching skin)\")\n else\n @log.info(\"#{code_s(code)} -> #{value}\")\n end\n end\n end", "def get_data\n xd = @data[0..3].unpack(\"C*\")\n xd = Shared::interpret_bytes_4(xd)\n yd = @data[4..7].unpack(\"C*\")\n yd = Shared::interpret_bytes_4(yd)\n unit = @data[8].unpack(\"C*\")[0]\n\n if !(unit == 0 || unit == 1)\n warn \"Unrecognised unit value for pHYs chunk: #{unit}.\"\n end\n\n return [xd, yd, unit]\n end", "def band1(value)\n @ole.Band1 = value\n nil\n end", "def human_code(code)\n case code\n when 'ADM1' then :region\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end", "def len_1\n cns = Length\n h_units = Hash.new('Unit Unknown')\n h_format = Hash.new('Format Unknown')\n\n h_units[cns::Centimeter] = 'cm'\n h_units[cns::Feet] = 'ft'\n h_units[cns::Inches] = 'in'\n h_units[cns::Meter] = 'm'\n h_units[cns::Millimeter] = 'mm'\n\n h_format[cns::Architectural] = 'Architectural'\n h_format[cns::Decimal] = 'Decimal'\n h_format[cns::Engineering] = 'Engineering'\n h_format[cns::Fractional] = 'Fractional'\n\n om = Sketchup.active_model.options # OptionManager\n op = om['UnitsOptions'] # OptionsProvider\n units = h_units[ op['LengthUnit'] ]\n format = h_format[ op['LengthFormat'] ]\n puts \"Current model units are #{units}\"\n puts \"Current model format is #{format}\"\n end", "def mobilisation\n @mobilisation =\n if @supplier_name\n @subtotal3 * @rate_card.data['Variances'][@supplier_name]['Mobilisation Cost (DA %)'].to_f\n else\n @subtotal3 * @framework_rates['M5']\n end\n end", "def decode_mic_e(to, message)\n\t\tputs \"mic e\"\n\t\tmic_e = Hash.new\n\t\tmic_e['format'] = 'Mic-E'\t\t\n\n\t\tif (message.size < 9)\n\t\t\tmic_e['error'] = 'Invalid Mic-E packet'\n\t\t\treturn(mic_e)\n\t\tend\n\n\t\tlat = ''\n\t\tlon = ''\n\t\tn_s = nil\n\t\tw_e = nil\n\t\tlon_offset = 0\n\n\n\n\t\tto.chars.each_with_index do |c, i|\n\t\t\tdata = MIC_E_ADDRESS[c]\n\t\t\tlat << data[0].to_s\n\t\t\t# puts data.join(',')\n\t\t\tcase i\n\t\t\t\twhen 3\n\t\t\t\t\tn_s = data[2]\n\t\t\t\twhen 4\n\t\t\t\t\tlon_offset = data[3]\n\t\t\t\twhen 5\n\t\t\t\t\tw_e = data[4]\n\t\t\tend\t\t\t\n\t\tend\n\n\t\tdeg = lat[0..1]\n\t\tmin = \"#{lat[2..3]}.#{lat[4..5]}\"\n\t\t\n\n\t\tlatitude = deg.to_f + (min.to_f / 60.0)\n\t\tlatitude = -latitude if n_s == 'S'\n\n\t\tmic_e['latitude'] = latitude\n\n\t\tdata = message[0..8]\n\n\n\t\tdeg = message[1].ord - 28\n\t\tdeg += lon_offset\n\n\t\tif deg >= 180 and deg <= 189\n\t\t\tdeg -= 80\n\t\telsif deg >= 190 and deg <= 199\n\t\t\tdeg -= 190\n\t\tend\n\n\t\tmin = message[2].ord - 28\n\t\tmin -= 60 if min >= 60\n\n\t\thun = message[3].ord - 28\n\n\t\tlongitude = deg.to_f + (\"#{min}.#{hun}\".to_f / 60.0)\n\t\tlongitude = -longitude if w_e == 'W'\n\n\t\tmic_e['longitude'] = longitude \n\n\t\tmic_e['symbol_code'] = message[7]\n\t\tmic_e['symbol_table_id'] = message[8]\n\n\t\tmic_e['message'] = message[9..-1]\n\n\t\t# TODO: Decode speed and course\n\t\t# TODO: Decode Mic-E status\n\t\t# TODO: Decode device type\n\n\t\treturn(mic_e)\n\tend", "def set_Units(value)\n set_input(\"Units\", value)\n end", "def set_Units(value)\n set_input(\"Units\", value)\n end", "def eng_unit_user_tag; eng_unit_type.tag rescue \"\"; end", "def to(units)\n unless self.zero?\n case units\n when Hash\n @[email protected](units[:mineral]) if Unit.new(units[:mineral]).kind == :mass\n @[email protected](units[:ore]) if Unit.new(units[:ore]).kind == :mass\n @[email protected](units[:grade]) if Unit.new(units[:grade]).kind == :unitless\n when String\n unit=Unit.new(units)\n case unit.kind\n when :mass\n @[email protected](units)\n @[email protected](units)\n when :unitless\n @[email protected](units)\n else\n raise ArgumentError, \"Incorrect units given, cannot convert!\"\n end\n end\n return self\n else\n return ResourceCode.new\n end\n end", "def modeler_description\n return \"This measure will replicate the functionality described in the EnergyPlus Energy Management System Application Guide, Example 2., based on user input.\"\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def band9\n @ole.Band9\n end", "def sol\n '341'\n end", "def unit\n self[:unit].to_s.empty? ? :piece : self[:unit].to_sym\n end", "def fuel_type; end", "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to override specified thermostat control logic and set alternate modes of operation. This EMS measure sets a specific (user defined) indoor VRF terminal unit to operate at a specific (user-defined) part load ratio, constrained by operate minimum and maximum outdoor temperature limits of the paired condenser unit. The main input objects that implement this example are the variable refrigerant flow actuators that control the VRF system and specific terminal unit. Note that the terminal unit PLR can be controlled without controlling the mode of the VRF condenser, however, the specific terminal unit will operate in whatever mode the existing operation control scheme chooses. This example program simply “sets” the operating mode and PLR, other more complex control algorithms can be developed by the user as needed\"\n end", "def get_band()\n return(get_cmd('BN;',0.1,0.5,3).gsub(/^BN/,'').gsub(/;$/,'').to_i)\nend", "def emission_units\n data['emission_units']\n end", "def handle_u\n @unit = @tokens[@index].get_tag(Unit).type\n @index += 1\n @precision = :unit\n end", "def ip_to_si(number, ip_unit_string, si_unit_string) \n ip_unit = OpenStudio::createUnit(ip_unit_string, \"IP\".to_UnitSystem).get\n si_unit = OpenStudio::createUnit(si_unit_string, \"SI\".to_UnitSystem).get\n #puts \"#{ip_unit} --> #{si_unit}\"\n ip_quantity = OpenStudio::Quantity.new(number, ip_unit)\n si_quantity = OpenStudio::convert(ip_quantity, si_unit).get\n puts \"#{ip_quantity} = #{si_quantity}\" \n return si_quantity.value\n end", "def inventory_for_longitudinal_presentation_unit_type_measurement\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * packing_material.quantity\n end", "def initialize(code)\n\t\t@value = Face_values[code[0]]\n\t\t@suit = code[1]\n\tend", "def band1\n @ole.Band1\n end", "def quality\n s = ( @step > 0 and semitones - (12 * @step) ) || semitones\n n = ( @step > 0 and number - (7 * @step) ) || number\n QUALITIES[n][s]\n end", "def voltage(code, gain=0.4936)\n\t return (code.to_f / @max.to_f) * (2.048 / gain.to_f) * (180.0 / 33.0)\n\tend", "def measurement_weight\n [\n ['ounce'],\n ['pounds']\n ]\n end", "def inventory_for_superficie_presentation_unit_type_measurement\n surface = packing_material.presentation_unit_type_measure.side_dimension_x * packing_material.presentation_unit_type_measure.side_dimension_y\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * surface\n end", "def sample_type(sample_type_byte)\n ((sample_type_byte & 0b1000) >> 3).zero? ? 8 : 16\n end", "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end", "def incode\n sector && unit && [sector, unit].join\n end", "def area_code\n number[0..2]\n end", "def systemOfUnits \n \"systemOfUnits\" \n end", "def unit_s\n self.unit.to_s if self.unit\n end", "def MTX01=(arg)", "def parse_unit!\n begin\n parse_alpha_unit!\n rescue InvalidFormat\n parse_numeric_unit!\n end\n end", "def iso_code; end", "def iso_code; end", "def unit\n self[:unit] ? self[:unit].to_sym : :piece\n end", "def quality\n return self.sendcmd(\"modem.get_quality\")\n end", "def resolve_measurement_values str\n if MeasurementValueHintRx.match? str\n str.gsub(InsetMeasurementValueRx) { to_pt $1.to_f, $2 }\n else\n str\n end\n end", "def short\n quality + number.to_s \n end", "def get_metals_value(space_units_array, metal, credits)\n\tnumeral = get_numeral_from_space_unit(space_units_array)\n\t@metals_values[metal] = credits.to_i / numeral.to_f\nend", "def units=(value)\n @units = value\n end", "def band5(value)\n @ole.Band5 = value\n nil\n end", "def ndp_code=(i); typecast i; end", "def parse_alpha_unit!\n matchdata = unit.match(ALPHA_UNIT_FORMAT)\n raise InvalidFormat if matchdata.nil?\n\n @alpha_unit = matchdata[1]\n @numeric_unit = matchdata[2].to_i\n end", "def code\n '202'\n end", "def description\n description = super\n if description.blank?\n if quantity.blank? || measure.blank?\n description\n else\n measure = self.measure.dup\n if quantity == '1'\n measure.slice!(measure.index('(')..-1)\n else\n measure.gsub!(/[()]/, '')\n end\n \"#{quantity} #{measure} #{variety}\".strip\n end\n else\n description\n end\n end", "def codes\n [@attrs['Code'], @attrs['StationTogether1'], @attrs['StationTogether2']].compact\n end" ]
[ "0.563207", "0.5570383", "0.546565", "0.54535824", "0.53640985", "0.534949", "0.53433055", "0.53088784", "0.52860063", "0.5267539", "0.52592987", "0.52484906", "0.5242789", "0.5224872", "0.5222251", "0.5215271", "0.5141634", "0.5099529", "0.5090693", "0.5089259", "0.50868446", "0.50866497", "0.50740916", "0.50737953", "0.5052733", "0.5009581", "0.500899", "0.50047034", "0.50003713", "0.49898577", "0.4984491", "0.49829227", "0.4970995", "0.49618822", "0.496168", "0.49614188", "0.49474522", "0.49421665", "0.49368465", "0.49368465", "0.49339277", "0.49303216", "0.49147514", "0.49138454", "0.49131414", "0.49121892", "0.49071455", "0.49067995", "0.4905286", "0.49043423", "0.4901444", "0.48991022", "0.48956046", "0.48839673", "0.48788357", "0.4878369", "0.4862376", "0.48533154", "0.48533154", "0.4851461", "0.4850616", "0.4850039", "0.48498634", "0.48493874", "0.48451775", "0.4843376", "0.48295236", "0.4824543", "0.48210907", "0.48166063", "0.48012125", "0.47959688", "0.47908923", "0.47883707", "0.47872934", "0.47852466", "0.47830427", "0.4780702", "0.4780166", "0.47782063", "0.47752324", "0.4772675", "0.47693267", "0.47692558", "0.4768274", "0.47661847", "0.47633165", "0.4760307", "0.4760307", "0.47565806", "0.47554263", "0.4753202", "0.4744158", "0.47361806", "0.4733799", "0.4727785", "0.47260776", "0.4725265", "0.47243932", "0.47211835", "0.47208798" ]
0.0
-1
ACK04 Id: 374 Name: Date/Time Qualifier Type: ID Min/Max: 3/3 Description: Code specifying type of date or time, or both date and time
def ACK04=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entry_time_type_code\n entry_time_type ? entry_time_type.code : 'M'\n end", "def type_code \n 4\n end", "def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end", "def subtype\n self.datetime_type\n end", "def code\n return \"#{\"%04d\" % @t_year}#{\"%02d\" % @t_month}#{\"%02d\" % @t_day}#{\"%02d\" % @t_hour}#{\"%02d\" % @t_min}#{\"%02d\" % @t_sec}#{\"%05d\" % @t_usec}\"\n end", "def metadataCompareDate(type_id, value, tempArray)\n comparison = \"=\"\n if value[-1..-1] == '>' # bigger\n value = value[0..-2]\n comparison = \">\"\n \n elsif value[-1..-1] == '<' # smaller\n value = value[0..-2]\n comparison = \"<\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '>=' # min\n value = value[0..-3]\n comparison = \">=\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '<=' # max\n value = value[0..-3]\n comparison = \"<=\"\n \n end\n\n # If value is full datetime, use it as it is\n if QueryController::check_datetime(value)\n datetimeOrDate = \"CONVERT(value, DATETIME)#{comparison}'#{value}'\"\n else\n\n # If searching with year and month\n if value =~ /^\\d{4}\\-\\d{1,2}$/\n # First day of month\n valueFirst = value+'-01'\n \n # Date in this exact month\n if comparison == '='\n datetimeOrDate = \"CONVERT(value, DATE)>='#{valueFirst}' AND CONVERT(value, DATE)<=LAST_DAY('#{valueFirst}')\"\n \n # Date bigger than this month\n elsif comparison == '>'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n\n # Date max this month\n elsif comparison == '<='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n \n # Date smaller than this month\n elsif comparison == '<'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n \n # Date min this month\n elsif comparison == '>='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n end\n \n\n \n # If searching with only year\n elsif value =~ /^\\d{4}$/\n datetimeOrDate = \"YEAR(value)#{comparison}'#{value}'\"\n else\n\n # Check if value_number is date and convert it if needed\n valueNew = QueryController::transform_date(value)\n if valueNew == false\n raise Exception.new(\"Invalid date value\")\n end\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueNew}'\"\n end\n \n \n end\n\n sql = \"SELECT id, value, devfile_id, metadata_type_id\" +\n \" FROM metadatas\" +\n \" WHERE metadata_type_id = #{type_id} AND #{datetimeOrDate}\"\n puts sql\n tmps = Metadata.find_by_sql(sql) \n \n if tmps != nil\n tmps.each do |x|\n tempArray.push(x.devfile_id)\n end\n end\n end", "def time_class; end", "def type\n 'Edm.Time'\n end", "def test_rfc6351_value_time_with_hour_minute\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>1353</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:1353\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def slot_type(slot)\n type = 0\n day_mult = 1\n time_mult = 1\n case slot.day\n when \"Montag\"\n day_mult = 0\n when \"Dienstag\"\n day_mult = 1\n when \"Mittwoch\"\n day_mult = 2\n when \"Donnerstag\"\n day_mult = 3\n when \"Freitag\"\n day_mult = 4\n end\n\n case slot.start\n when 8\n time_mult = 0\n when 10\n time_mult = 1\n when 12\n time_mult = 2\n when 14\n time_mult = 3\n end\n return time_mult + 4 * day_mult\n\n end", "def test_rfc6351_value_date_time_with_year_month_day_hour\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>20150128T13</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:20150128T13\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def test_rfc6351_value_time_with_minute\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>-53</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:-53\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def data_element_time\n return relevantPeriod.low if respond_to?(:relevantPeriod) && relevantPeriod&.low\n return relevantDatetime if respond_to?(:relevantDatetime) && relevantDatetime\n return prevalencePeriod.low if respond_to?(:prevalencePeriod) && prevalencePeriod&.low\n return authorDatetime if respond_to?(:authorDatetime) && authorDatetime\n return resultDatetime if respond_to?(:resultDatetime) && resultDatetime\n return sentDatetime if respond_to?(:sentDatetime) && sentDatetime\n return participationPeriod.low if respond_to?(:participationPeriod) && participationPeriod&.low\n\n nil\n end", "def test_rfc6351_value_date_time_with_day_hour_minute\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28T1353</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28T1353\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def test_rfc6351_value_date_time_with_month_day_hour\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>--0128T13</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:--0128T13\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def specific_time\n parse_calendar_date if self.bucket == \"specific_time\" and self.calendar\n rescue ArgumentError\n errors.add(:calendar, :invalid_date)\n end", "def process_claim_start_and_end_dates(c,date_qualifier)\n if date_qualifier == \"434\" or date_qualifier == \"472\"\n service_dates = c[1].split(\"-\")\n @claim_information[\"claim_statement_period_start_date\"] = service_dates[0].to_s if @claim_information.claim_statement_period_start_date.nil?\n @claim_information[\"claim_statement_period_end_date\"] = service_dates.length == 2 ? service_dates[1].to_s : service_dates[0].to_s if @claim_information.claim_statement_period_end_date.nil?\n elsif date_qualifier == \"435\" or date_qualifier == \"096\"\n if date_qualifier == \"435\"\n @claim_information[\"claim_statement_period_start_date\"] = c[1] if @claim_information.claim_statement_period_start_date.nil?\n @service_from_date = @claim_information.claim_statement_period_start_date\n else\n @claim_information[\"claim_statement_period_end_date\"] = c[1] if @claim_information.claim_statement_period_end_date.nil?\n @service_to_date = @claim_information.claim_statement_period_end_date\n end\n end\n end", "def exp_code(date, kind)\n _date = date.delete(\"-/\")\n return \"%s%s\" % [ _date[5,1], _date[2,2] ] if kind.nil?\n case kind[0,1].upcase\n when \"C\": return \"%s%s\" % [ CALL_CODES[_date[4,2].to_i], _date[2,2] ]\n when \"P\": return \"%s%s\" % [ PUT_CODES[_date[4,2].to_i], _date[2,2] ]\n when \"F\": return \"%s%s\" % [ FUT_CODES[_date[4,2].to_i], _date[2,2] ]\n else\n return \"%s%s\" % [ _date[5,1], _date[2,2] ]\n end\n end", "def data_match_field_type field\n\t\tfield = field.to_s\n\t\tif field[-2,2] == 'id'\n\t\t\ttype = Scfg[:field_number][0]\n\t\telsif Scfg[:field_fixnum].include? field\n\t\t\ttype = 'Fixnum'\n\t\telsif Scfg[:field_time].include? field\n\t\t\ttype = 'Time'\n\t\telse\n\t\t\ttype = 'String'\n\t\tend\n\t\ttype\n\tend", "def test_rfc6351_value_time_with_hour_minute_second\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>135301</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:135301\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def test_rfc6351_value_date_time_with_day_hour_minute_second\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28T135301</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28T135301\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def test_rfc6351_value_time_with_hour\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>13</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:13\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def parse_cs_exam_slot(exam)\n time = exam[:exam_start_time]\n date = exam[:exam_date]\n\n if exam[:finalized] != 'Y'\n if exam[:exam_exception] == 'Y'\n return 'none'\n else\n if exam[:exam_type] == 'N' || exam[:exam_type] == 'A'\n return 'none'\n end\n end\n end\n if time && date\n Time.parse(\"#{date.strftime '%y-%m-%d'} #{time.strftime '%H:%M'}\")\n elsif date\n Time.parse(date.strftime '%y-%m-%d')\n else\n 'none'\n end\n end", "def check_elsewhere(field264c, field260c)\n date = field264c || field260c\n # Take the first four digits.\n match = /(\\d{4})/.match(date)\n match[1].to_i if match\n end", "def test_rfc6351_value_date_time_with_day_hour\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28T13</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28T13\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def test_rfc6351_value_time_with_minute_second\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>-5301</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:-5301\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def processField008(field)\n return nil if field.nil?\n field = field.value[6..15]\n if field[0] == \"p\" or field[0] == \"r\"\n \n first_date = field[1..4]\n second_date = field[5..9]\n start_date = first_date.gsub(\"u\", \"9\").to_i\n end_date = second_date.gsub(\"u\", \"9\").to_i\n \n if ( start_date > end_date && !second_date.include?(\"u\") )\n # if the secondDate is lower and there was not a \"u\" in the date field.\n return MARC::DataField.new('980', '', ' ', ['a', end_date], ['b', \"008\"], ['c', field[0] ])\n elsif ( start_date > end_date && second_date.include?(\"u\") ) \n # if the 2nd date is lower and there was a 'u', this means we need to add a date range.\n start_date = end_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n elsif ( first_date.include?(\"u\") )\n # first date is larger, but there's a 'u' so, it needs a range. \n end_date = start_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n else\n # at this point, we assume first date was larger and no 'u' so we just add the first date\n return MARC::DataField.new('980', '', ' ', ['a', start_date], ['b', \"008\"], ['c', field[0] ])\n end\n\n end\n end", "def test_rfc6351_value_time_with_second\n assert(true)\n\n # According to the Relax NG Schema, there is a conflict between\n # value-date and value-time. The --01 syntax can only match a\n # value-date because of the higher priority set in\n # value-date-and-or-time. So we basically skip this test.\n #\n # xml = <<XML\n # <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n # <vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n # <vcard>\n # <bday>\n # <date-and-or-time>--01</date-and-or-time>\n # </bday>\n # </vcard>\n # </vcards>\n # XML\n # vobj = <<VOBJ\n # BEGIN:VCARD\n # VERSION:4.0\n # BDAY:--01\n # END:VCARD\n # VOBJ\n # assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def date; raw_changeset.time; end", "def type_literal_generic_only_time(column)\n :time\n end", "def test_rfc6351_value_date_time_with_day_hour_z\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28T13Z</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28T13Z\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def qualified_id\n qualified_code + \"-\" + \"%04d\" % self.code\n end", "def status_type_char; end", "def data_type\n\t\tend", "def data_type\n\tend", "def read_date; end", "def iso_code; end", "def iso_code; end", "def due_at(part=:datetime)\n case part\n when :date\n\n when :time\n\n when :datetime\n\n end\n end", "def out_of_bounds_time_format; end", "def is_valid_timecode(timecode)\n\n if timecode.size != 11\n #raise ArgumentError.new('Error: Invalid timecode. Incorrect length.')\n raise \"\\nERROR: Invalid timecode length found in [\" + timecode + \"].\"\n\n\n elsif timecode[8, 1] != ';' and timecode[8, 1] != ':'\n #raise ArgumentError.new('Error: Invalid timecode. Timecodes must be formatted as hh:mm:ss:ff or hh:mm:ss;ff (for NTSC dropframe)')\n raise \"\\nERROR: Invalid delimiter found in [\" + timecode + \"].\"\n\n else\n true\n end\n\n\nend", "def o_type\n 8 \n end", "def type\n attr_val('./@typeCode')\n end", "def type_code\n type.try(:code)\n end", "def immersive_start_date\n @p0_start_date + 63\n end", "def get_data_type key\n\t\tdata_type = Hash.new \n\t\tdata_type[\"int\"] = \"INTEGER\"\n\t\tdata_type[\"mobile\"] = \"BIGINT(20)\"\n\t\tdata_type[\"string\"] = \"VARCHAR(50)\"\n\t\tdata_type[\"float\"] = \"INTEGER(20,5)\" \n\t\tdata_type[\"integer\"] = \"INTEGER\" \n\t\tdata_type[\"text\"] = \"TEXT\" \n\t\tdata_type[\"date\"] = \"DATE\" \n\t\t \n\t\ttdata = data_type[key]\n\tend", "def spec_type(desc, *additional); end", "def audio_types\n ldr6 = record.leader[6]\n\n types = []\n\n # Get the 8524* fields\n f8524 = record.fields('852').select{|f| f.indicator1 == '4'}\n\n # RC\n if %w[i j].include?(ldr6) && (bib_format == 'MU') \n @record.fields('007').map{|f| f.value}.each do |f|\n if f[1] == 'd' && f[12] == 'e'\n types << 'RC'\n break\n end\n end\n end\n\n f8524.each do |f|\n if (f['b'].upcase == 'MUSIC') && (f['j'] =~ /\\ACD/i)\n types << 'RC'\n break\n end\n end\n\n # RL\n\n if (bib_format == 'MU') && %w[i j].include?(ldr6) && self['007[1]'].include?('d')\n record.fields('300').each do |f|\n str = f.subfields.collect {|s| s.value}.join(' ')\n if (str =~ /DISC/i) && str =~ /33 1\\/3 RPM/i\n types << 'RL'\n break\n end\n end\n end\n\n\n f8524.each do |f|\n if (f['j'] =~ /\\ALP/i) &&\n ((f['b'].upcase == 'MUSIC') || (f['c'].upcase == 'MUSI'))\n types << 'RL'\n break\n end\n end\n\n # RM\n types << 'RM' if (ldr6 == 'j') && (bib_format == 'MU')\n\n # RS\n types << 'RS' if (ldr6 == 'i') && (bib_format == 'MU')\n\n # RU\n types << 'RU' if %w[i j].include?(ldr6) && (bib_format == 'MU')\n\n types.uniq!\n return types\n end", "def retrieve_entry_time_by_type(entry_time_type_code, meeting, event_type, pool_type)\n best_mir = nil\n\n case entry_time_type_code\n when 'U' # Last swam\n best_mir = get_last_mir_for_event(event_type, pool_type)\n when 'G' # Goggle Cup or last swam\n best_mir = nil # TODO: - Use Google cup standard\n best_mir ||= get_last_mir_for_event(event_type, pool_type)\n when 'A' # Previous meeting edition (or Goggle Cup or last swam)\n best_mir = get_best_mir_for_meeting(meeting, event_type, pool_type)\n # TODO: goggle cup if nil\n best_mir ||= get_last_mir_for_event(event_type, pool_type)\n else # Personal best\n best_mir = get_best_mir_for_event(event_type, pool_type)\n end\n\n best_mir\n end", "def range_description\n if respond_to?(\"range_description_for_#{time_frame}\")\n return send(\"range_description_for_#{time_frame}\")\n end\n \n start_date.to_s(:long)\n end", "def test_rfc6351_value_time_with_second_z\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>--01Z</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:--01Z\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def set_time_entry_activity_type\n data=params\n @i = TneInvoiceTimeEntry.find(data[:id])\n f = current_company.company_activity_types.find(data[:value])\n @i.update_attribute( :activity_type, data[:value])\n render :text => f.lvalue\n end", "def prep_time_end\n return \"1545\";\n end", "def test_rfc6351_value_date_time_with_day_hour_tz\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28T13+1234</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28T13+1234\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def message_type\n data_type[2..-1]\n end", "def casted_value\n case qtype.name\n when 'date' then date_value\n when 'time' then time_value\n when 'datetime' then datetime_value\n when 'integer' then value.blank? ? nil : value.to_i\n when 'decimal' then value.blank? ? nil : value.to_f\n else value.blank? ? nil : value\n end\n end", "def get_code(partner, pdate, ptype)\n \n @codegen = \"\"\n \n if partner.nil? and not signed_in_and_master?\n return \"P??\"\n end\n \n @pid = 1\n \n unless partner.nil?\n @pid = partner.id \n @codegen += \"P\"\n @codegen += \"%02d\" % partner.fp7_Number\n @codegen += \"-\"\n \n else\n \n if signed_in_and_master?\n @codegen += \"ADM\"\n else\n @codegen += \"P??\"\n end\n \n end\n\n if pdate.nil?\n #only for generate sample code in the new view (but it is hide)\n pdate = Date.today\n end\n\n unless pdate.nil?\n \n @codegen += pdate.strftime(\"%y%m%d\")\n @codegen += \"-\"\n end\n\n @cnt_objs = Sampling.all(:select => \"DISTINCT code\", :conditions => ['code LIKE ? ', '%'+@codegen+'%'], :order => 'code DESC')\n @cnt = 1 \n if not @cnt_objs.nil? \n @cnt_obj = @cnt_objs[0] \n if not @cnt_obj.nil? \n #P03-110129-xx\n if not @cnt_obj.code.nil? \n @end_str = @cnt_obj.code[11..12]\n if not @end_str.nil? \n @end = @end_str.to_i\n @cnt = @end + 1\n else \n @cnt = '0'\n end\n else \n @cnt = '0'\n end\n end\n end\n\n @codegen += \"%02d\" % @cnt\n\n unless ptype.nil?\n @codegen += ptype.to_s\n end\n\n return @codegen\n end", "def date; end", "def date; end", "def date; end", "def date; end", "def read_date=(_); end", "def simple_value_type_code\n value_type_code\nend", "def map_types\n types = []\n if (bib_format == 'MP') || %w[e f].include?(record.leader[6]) || self['007[0]'].include?('a')\n types << 'MN'\n end\n return types\n end", "def pre_initiation_date_status\n 'Pre-announcement'\n end", "def dd_imei_field\n\t $tracer.trace(__method__)\n\t return ToolTag.new(input.className(create_ats_regex_string(\"ats-rcmddimeifld\")), __method__, self)\n\tend", "def time_class=(_arg0); end", "def musical_score_types\n types = []\n types << 'MS' if %w[c d].include?(record.leader[6])\n return types\n end", "def slots_based_on_type(staff:, type:, date:)\n case type\n when HearingDay::REQUEST_TYPES[:central]\n 11\n when HearingDay::REQUEST_TYPES[:video]\n staff.stc4\n when HearingDay::REQUEST_TYPES[:travel]\n (date.monday? || date.friday?) ? staff.stc2 : staff.stc3\n end\n end", "def rfc3339(*args)\n #This is a stub, used for indexing\n end", "def usable?\n codes.present? && (start_time.present? || end_time.present? || time.present?)\n end", "def nonregular_type; end", "def check_time_constraints_payload(record, resp_data)\n # We never return time_constraints = null\n assert_equal record.time_constraints.count, resp_data[\"time_constraints\"].count\n for i in 0..record.time_constraints.count-1 do\n #puts record.time_constraints[i].to_json\n #puts resp_data[\"time_constraints\"][i]\n check_payload(resp_data[\"time_constraints\"][i],\n record.time_constraints[i],\n [:key_id, :start_time, :end_time, :start_offset, :end_offset], nil, nil)\n end\n end", "def op_code\n 2004\n end", "def test_complete_timeInstant_object\n\n hIn = Marshal::load(Marshal.dump(@@hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n metadata = @@NameSpace.unpack(hIn, hResponse)\n\n assert_equal 'id', metadata[:timeId]\n assert_equal 'description', metadata[:description]\n refute_empty metadata[:identifier]\n assert_equal 2, metadata[:instantNames].length\n assert_equal 'instantName0', metadata[:instantNames][0]\n assert_equal 'instantName1', metadata[:instantNames][1]\n refute_empty metadata[:timeInstant]\n assert_kind_of DateTime, metadata[:timeInstant][:dateTime]\n assert_equal 'YMDhms', metadata[:timeInstant][:dateResolution]\n refute_empty metadata[:geologicAge]\n assert hResponse[:readerExecutionPass]\n assert_empty hResponse[:readerExecutionMessages]\n\n end", "def get_event_type(code, params)\n type = EVENT_COMMAND_CODES[code]\n\n # Control variables can be assigned scripts:\n if code == 122 and params[3] == 4 then\n type[1] = true\n end\n\n type.nil? ? [code, false] : type\nend", "def q_and_a_codes\n\t\t\tq_code = self.question.data_export_identifier\n\n\t\t\tunless %w( answer string integer float\n\t\t\t\t\ttext datetime\n\t\t\t\t).include?(self.answer.response_class)\n\t\t\t\traise InvalidResponseClass\n\t\t\tend\n\n\t\t\ta_code = if self.answer.response_class == \"answer\"\n\t\t\t\tself.answer.data_export_identifier\n\t\t\telse\n\t\t\t\tself.send(\"#{self.answer.response_class}_value\")\n\t\t\tend\n\t\t\t[ q_code, a_code ]\n\t\tend", "def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end", "def time_only(person_or_type = nil)\n time_detail(:time_only => true, :audience => person_or_type)\n end", "def part_type=(value)\n\n end", "def get_record_type_code\n @record_type_code\n end", "def battery_type; end", "def parse_cs_exam_time(exam)\n if exam[:finalized] != 'Y'\n if exam[:exam_exception] == 'Y' || (exam[:exam_type] != 'Y' && exam[:exam_type] != 'C')\n return nil\n end\n end\n start = exam[:exam_start_time]\n ending = exam[:exam_end_time]\n if start && ending\n start_time = (start.strftime '%l:%M').strip\n start_time_meridian_indicator = single_letter_meridian_indicator(start.strftime '%p')\n end_time = (ending.strftime '%l:%M').strip\n end_time_meridian_indicator = single_letter_meridian_indicator(ending.strftime '%p')\n return \"#{start_time}#{start_time_meridian_indicator} - #{end_time}#{end_time_meridian_indicator}\"\n end\n nil\n end", "def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end", "def title_attachment_type_value_id\n\t\t\tTypeValue.find_by_name(type_values[4]).code rescue '0'\n\t\tend", "def mediatype; end", "def get_event_type_for_csi_entry\n event_type ? get_event_type_separated.gsub('MI', 'MX') : '?'\n end", "def time_tag(date_or_time, *args, &block); end", "def type() end", "def kp_get_modid(data)\n return data.map{|d| d.scan(/(?<m>M\\d{5})/)}.flatten.sort\nend", "def data_timezone_identifiers; end", "def data_timezone_identifiers; end", "def data_timezone_identifiers; end", "def data_timezone_identifiers; end", "def data_timezone_identifiers; end", "def data_timezone_identifiers; end", "def opportunity_date_ini_type_friendly(opportunity)\n if opportunity.date_ini_type == 0\n 'Indefinido'\n elsif opportunity.date_ini_type == 1\n 'Lo antes posible'\n else\n 'Fijar fecha'\n end\n end", "def pro_rata_start_date\n # \n # Tue Nov 23 00:53:04 IST 2010, ramonrails\n # * we will never use \"installation_datetime\"\n # * installation_datetime is the \"desired\" installation datetime\n # * Pro-rata is charged from the date a panic button is received making user ready to install\n #\n # * check panic button press\n _date = panic_received_at\n # * no panic? check shipping date\n _date ||= (shipped_at + 7.days) unless shipped_at.blank? # if ( _date.blank? && !shipped_at.blank? )\n # * no panic or shipping? nothing returned\n # # \n # # Wed Mar 30 03:46:04 IST 2011, ramonrails\n # # * https://redmine.corp.halomonitor.com/issues/4253\n # # * pick local values that were copied\n # # * when missing?, pick from device_model_prices\n # unless (order.blank? || order.product_cost.blank? || _date.blank?)\n # _date += ( order.cc_monthly_recurring || order.product_cost.recurring_delay).to_i.months\n # end\n # # \n # # Tue May 24 20:07:41 IST 2011, ramonrails\n # # * https://redmine.corp.halomonitor.com/issues/4486\n # # * https://redmine.corp.halomonitor.com/attachments/3294/invalid_prorate_start_dates.jpg\n # _date ||= Date.today\n # _date = Date.today if _date > Date.today\n # \n # Thu May 26 19:32:15 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4486#note-47\n _date = _date.to_date unless _date.blank?\n _date\n end", "def code\n\t\tself.AsArray[0].type_code\n\tend", "def type_cast_code( var_name )\n case type \n when :datetime then \"#{self.class.name}.datetime_to_time(#{var_name})\"\n else\n super\n end\n end", "def getRecordType(fte)\n if fte > 0 && fte < 20 then\n return \"Consumer\"\n elsif fte > 19 && fte < 200 then\n return \"Mid Market\"\n elsif fte > 199 then\n return \"Enterprise Solutions\"\n end\n end" ]
[ "0.59769195", "0.5396606", "0.5353971", "0.53273356", "0.5122766", "0.51031023", "0.50942683", "0.5035734", "0.50207156", "0.501616", "0.5006013", "0.49989507", "0.49770126", "0.49764395", "0.49650824", "0.49599096", "0.49510604", "0.49273527", "0.49157703", "0.4914556", "0.49110076", "0.48890445", "0.4885314", "0.48335826", "0.48326725", "0.4829592", "0.4809024", "0.47733667", "0.47707435", "0.47655052", "0.47629285", "0.47519577", "0.4745044", "0.4739253", "0.47152698", "0.47090074", "0.4703467", "0.4703467", "0.46936974", "0.46678004", "0.46647868", "0.46573612", "0.46300572", "0.4625604", "0.46245983", "0.46231085", "0.46184212", "0.4611851", "0.46048716", "0.46038052", "0.4601365", "0.45846388", "0.45829123", "0.45810214", "0.45742452", "0.4573988", "0.45734343", "0.45723242", "0.45723242", "0.45723242", "0.45723242", "0.45716384", "0.4567095", "0.45665705", "0.45604846", "0.45594388", "0.4549415", "0.4545404", "0.4536266", "0.45362428", "0.4534333", "0.45303777", "0.4528045", "0.4527096", "0.45117083", "0.45112917", "0.4499582", "0.4499474", "0.4488243", "0.44858152", "0.44711122", "0.44710064", "0.44709763", "0.44696352", "0.4469396", "0.44692782", "0.4466804", "0.44666135", "0.44593886", "0.44591817", "0.44554406", "0.44554406", "0.44554406", "0.44554406", "0.44554406", "0.44554406", "0.44533655", "0.44516012", "0.44501203", "0.44493437", "0.44492647" ]
0.0
-1
ACK05 Id: 373 Name: Date Type: DT Min/Max: 8/8 Description: Date expressed as CCYYMMDD
def ACK05=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_date; end", "def read_date=(_); end", "def date; end", "def date; end", "def date; end", "def date; end", "def date() self[:date]; end", "def date(input, format); end", "def claim_from_date\n unless eob.claim_from_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_from_date = \"00000000\"\n else\n claim_from_date = eob.claim_from_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim From Date:#{claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_from_date\n claim_date_elements.join(@element_seperator)\n end\n end", "def parse_date(input, msg = T.unsafe(nil)); end", "def easy_date; date; end", "def statement_to_date\n end", "def statement_to_date\n end", "def statement_to_date\n end", "def entity_date(str)\n Time.at(str[/\\d{6,}/].to_i / 1000)\n end", "def crdt\n @pubmed['CRDT'].strip # in the form 2005/06/10\n end", "def date_time_reference\n ['DTM', '405', @batch.date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end", "def manufacture_date\n bf = data['ManufactureDate']\n day = bf & ((2**5)-1)\n month = (bf & (((2**4)-1) << 5)) >> 5\n year = ((bf & (((2**7)-1) << 9)) >> 9) + 1980\n\n # Ruby 1.8 lacks Time#strptime\n Time.parse Date.new(year, month, day).to_s\n end", "def warn_invalid_date; end", "def get_object_sortable_date\n\t\tdate = nil\n if descMetadata.origin_info && (descMetadata.origin_info.date_issued || descMetadata.origin_info.date_valid)\n\t\t\tbegin\n\t\t\t\tdate_valid = descMetadata.origin_info.date_valid.first.to_s\n\t\t\t\tdate_issued = descMetadata.origin_info.date_issued.first.to_s\n\t\t\t\t\t\n\t\t\t\tif date_valid.size > 0\n\t\t\t\t\tdate_valid = descMetadata.origin_info.date_valid.first\n\t\t\t\t\tif date_valid.include? \"/\"\n\t\t\t\t\t\t\tval = to_long_date(date_valid[date_valid.index('/')+1..date_valid.size])\n\t\t\t\t\telse\n\t\t\t\t\t\t\tval = to_long_date(date_valid) \n\t\t\t\t\tend\n\t\t\t\telsif\tdate_issued.size > 0\n\t\t\t\t\tif date_issued.include? \"/\"\n\t\t\t\t\t\t\tval = to_long_date(date_issued[date_issued.index('/')+1..date_issued.size])\n\t\t\t\t\telse\t\t\t\n\t\t\t\t\t\tval = to_long_date(descMetadata.origin_info.date_issued.first)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\t\t\tif val\n\t\t\t\t\tdate = Time.parse val\n\t\t\t\tend\n\t\t\trescue ArgumentError => e\n #nop\n end\n\t\tend\n\tend", "def claim_to_date\n if @eob.claim_to_date.present? && can_print_service_date(@eob.claim_to_date.strftime(\"%Y%m%d\"))\n ['DTM', '233', @eob.claim_to_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end", "def claim_to_date\n if @eob.claim_to_date.present? && can_print_service_date(@eob.claim_to_date.strftime(\"%Y%m%d\"))\n ['DTM', '233', @eob.claim_to_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end", "def claim_to_date\n unless eob.claim_to_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_to_date = \"00000000\"\n else\n claim_to_date = eob.claim_to_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << claim_to_date\n claim_date_elements.join(@element_seperator)\n end\n end", "def claim_from_date\n if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime(\"%Y%m%d\"))\n [ 'DTM', '232', @eob.claim_from_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end", "def date\n @date\n end", "def date\n @date\n end", "def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end", "def to_date()\n #This is a stub, used for indexing\n end", "def extention_valid_date\n if service_learning_risk_date_extention?\n if service_learning_risk_date > DateTime.new(service_learning_risk_date.year, 9, 1) \n DateTime.new(service_learning_risk_date.year.next, 9, 1)\n else \n DateTime.new(service_learning_risk_date.year, 9, 1)\n end\n end\n end", "def claim_to_date\n unless eob.claim_to_date.blank?\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << eob.claim_to_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end", "def data_upload_date\n formatted_timestamp(data['modifyDate'])\n end", "def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end", "def to_date string\n \n end", "def rolls_date= date\n return super(date) unless date.is_a? String\n\n date = Date.strptime(date, \"%m%d%Y\") if date =~ /\\d{8}/\n date = Date.strptime(date, \"%m/%d/%Y\") if date =~ /\\d{1,2}\\/\\d{1,2}\\/\\d{4}/\n date = Date.parse(date) if date =~ /\\d{4}-\\d{1,2}-\\d{1,2}/\n\n super date\n end", "def released_on=date\n super DateTime.strptime(date, '%m/%d/%Y')\n end", "def date\n Date.parse(@data['date'])\n end", "def creation_date=(_); end", "def test_rfc6351_value_date_with_year_month_day\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>20150128</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:20150128\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def date\n @date\n end", "def date\n @date\n end", "def departureDate = (value)", "def test_rfc6351_value_date_with_year_month\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>2015-01</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:2015-01\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def cfexdatetemplateparams(data)\n date_op, _ = data.unpack('vC*')\n\n {\n _type: :CFExDateTemplateParams,\n dateOp: date_op # dateOp (2 bytes): An unsigned integer that specifies the type of date comparison.\n }\n end", "def test_rfc6351_value_date_with_month_day\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>--0128</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:--0128\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def modification_date; end", "def updated_date\n extractor = MarcExtractor.new(\"907b\", :first => true)\n lambda do |record, acc|\n datestr = extractor.extract(record).first\n begin\n date = Date.strptime(datestr, \"%m-%d-%y\")\n acc << solr_date(date)\n rescue ArgumentError\n yell.debug \"Unable to parse datestr #{datestr}\"\n end\n end\n end", "def date; raw_changeset.time; end", "def date_str\n Util::Date.token_bill_date(created_at)\n end", "def dates\n end", "def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end", "def test_rfc6351_value_date_with_month\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>--01</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:--01\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def modification_date=(_); end", "def date(date)\n @datee = Date.new(date[:year],date[:month],date[:day])\n end", "def get_date()\n @date\n end", "def get_date()\n @date\n end", "def date\n Date.parse(@obj['date'])\n end", "def value\n self.class.get_date(@bits)\n end", "def metadataCompareDate(type_id, value, tempArray)\n comparison = \"=\"\n if value[-1..-1] == '>' # bigger\n value = value[0..-2]\n comparison = \">\"\n \n elsif value[-1..-1] == '<' # smaller\n value = value[0..-2]\n comparison = \"<\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '>=' # min\n value = value[0..-3]\n comparison = \">=\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '<=' # max\n value = value[0..-3]\n comparison = \"<=\"\n \n end\n\n # If value is full datetime, use it as it is\n if QueryController::check_datetime(value)\n datetimeOrDate = \"CONVERT(value, DATETIME)#{comparison}'#{value}'\"\n else\n\n # If searching with year and month\n if value =~ /^\\d{4}\\-\\d{1,2}$/\n # First day of month\n valueFirst = value+'-01'\n \n # Date in this exact month\n if comparison == '='\n datetimeOrDate = \"CONVERT(value, DATE)>='#{valueFirst}' AND CONVERT(value, DATE)<=LAST_DAY('#{valueFirst}')\"\n \n # Date bigger than this month\n elsif comparison == '>'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n\n # Date max this month\n elsif comparison == '<='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n \n # Date smaller than this month\n elsif comparison == '<'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n \n # Date min this month\n elsif comparison == '>='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n end\n \n\n \n # If searching with only year\n elsif value =~ /^\\d{4}$/\n datetimeOrDate = \"YEAR(value)#{comparison}'#{value}'\"\n else\n\n # Check if value_number is date and convert it if needed\n valueNew = QueryController::transform_date(value)\n if valueNew == false\n raise Exception.new(\"Invalid date value\")\n end\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueNew}'\"\n end\n \n \n end\n\n sql = \"SELECT id, value, devfile_id, metadata_type_id\" +\n \" FROM metadatas\" +\n \" WHERE metadata_type_id = #{type_id} AND #{datetimeOrDate}\"\n puts sql\n tmps = Metadata.find_by_sql(sql) \n \n if tmps != nil\n tmps.each do |x|\n tempArray.push(x.devfile_id)\n end\n end\n end", "def ruby_value\n ::Date.parse(@date_time_value.strftime(\"%Y%m%d\"))\n end", "def date\n @match_buffer[\"date\"]\n end", "def air_date\n release_date\n end", "def test_rfc6351_value_date_with_day\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def original_purchase_date\n read_datetime_from_string('original_purchase_date')\n end", "def get_date(row_data)\n values = row_data.to_s.chomp.split(' ')\n month = values.map { |token| MONTHS[token.downcase] }.compact.first\n year = values.find { |token| /\\d{4}/ =~ token }\n date = Date.new(year.to_i, month)\n @latest_date = date if latest_date < date\n date\n end", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def immersive_start_date\n @p0_start_date + 63\n end", "def date\n request Net::NNTP::Date.new\n end", "def statement_from_date\n claim_date = claim_start_date\n if claim_date && can_print_service_date(claim_date.strftime(\"%Y%m%d\"))\n ['DTM', '232', claim_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end", "def date \n params['date']\n end", "def more_advanced_date\n \tnil\n end", "def getDateStr\n return \"\" if @line.length < 15\n tmpStr = @line[0..14]\n begin\n DateTime.strptime(tmpStr, \"%b %d %H:%M:%S\")\n out = tmpStr\n rescue\n out = \"\"\n end\n return out \n end", "def warn_invalid_date=(_arg0); end", "def date\n dreport.date_format\n end", "def set_date(date)\n param = date[:year]\n if date.key? :month\n param << \":\" << date[:month]\n param << \":\" << date[:day] if date.key? :day\n end\n Jhead.call(\"-ds\" << param, @match, @pattern)\n end", "def comparable_payload_date_now\n DateTime.now.utc.iso8601(3)\n end", "def date\n node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRdate[@name=\"Generation\"]', a: NS)\n node && node['date']\n end", "def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end", "def arrivalDate = (value)", "def initialize(input)\n @date = to_date(input)\n end", "def type_literal_generic_date(column)\n :date\n end", "def make_date(_input, _starts_at, _ends_at, elements)\n value = elements.first\n\n case value\n when String\n _date_from_string(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end", "def intiation_date\n self.initiation\n end", "def date\n result_hash['dte']\n end", "def released_on=date\n super Date.strptime(date, '%m/%d/%Y') #Converts the string entered in the form to be formatted to a date\n end", "def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end", "def date(name)\n input(name + \"_m\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_d\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_y\", 4, 4)\n end", "def date\n set_function_and_argument(:date, nil)\n end", "def gettransactiondate\r\n SVUtils::getdate(@transactiondate, SVUtils::QC_DATE_FORMAT)\r\n end", "def get_date_receipt\n unless date_receipt.blank?\n Format.a_short_datetime( date_receipt )\n else\n ''\n end\n end", "def verify_date_requested(test_data)\n verify_values_match(test_data[UseOfCollections::DATE_REQUESTED.name], element_value(date_requested_input))\n end", "def date\n date_parser(self[:date])\n end", "def date\n date_parser(self[:date])\n end", "def rfc_date(datetime)\n datetime.strftime(\"%Y-%m-%dT%H:%M:%SZ\") # 2003-12-13T18:30:02Z\n end", "def create_date\n data.create_date\n end", "def create_date\n data.create_date\n end", "def create_date\n data.create_date\n end", "def literal_date(v)\n v.strftime(\"DATE '%Y-%m-%d'\") \n end", "def statement_from_date\n unless claim_start_date.blank?\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_start_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end", "def read_date(taglib, **opts)\n v10_year = taglib.id3v1_tag.year.to_s if taglib.id3v1_tag.year > 0\n v24_date = read_first_tag(taglib, ['TDRC'])\n\n # check variables in order of importance\n date_str = v24_date || v10_year\n puts \"MP3#date: date_str = \\\"#{date_str}\\\"\" if $DEBUG\n\n date_str\n end", "def parse_date(date)\n Icalendar::Values::DateOrDateTime.new(date)\n end", "def create_date\n return DateTime.iso8601(@doc.xpath('//mets:metsHdr/@CREATEDATE').to_s)\n end" ]
[ "0.687373", "0.6756421", "0.6490232", "0.6490232", "0.6490232", "0.6490232", "0.62341404", "0.6076975", "0.6044691", "0.60063", "0.5970772", "0.5939975", "0.5939975", "0.5939975", "0.5909674", "0.5901575", "0.5861703", "0.5848714", "0.5848606", "0.58441675", "0.58201116", "0.58201116", "0.58005446", "0.5784136", "0.5782201", "0.5782201", "0.5776416", "0.57503265", "0.57468283", "0.5740086", "0.5707862", "0.57077026", "0.56853646", "0.56837916", "0.5671946", "0.5669764", "0.56630707", "0.5642279", "0.5640605", "0.5640605", "0.5640166", "0.56361014", "0.562943", "0.5623727", "0.5620818", "0.56106484", "0.55981237", "0.55926526", "0.5592002", "0.5589741", "0.5586616", "0.5586233", "0.5578224", "0.5576321", "0.5576321", "0.55716264", "0.55707115", "0.556544", "0.556336", "0.5555891", "0.5554611", "0.5552581", "0.55430377", "0.5539594", "0.5537632", "0.55307734", "0.552892", "0.55283606", "0.5501297", "0.54934824", "0.54896253", "0.5480846", "0.54797024", "0.5478337", "0.5467389", "0.5459025", "0.54589635", "0.545751", "0.54538226", "0.5453425", "0.544607", "0.5438158", "0.5431629", "0.54283077", "0.5427066", "0.54255277", "0.54244065", "0.541811", "0.5417541", "0.54160833", "0.54080814", "0.54080814", "0.54047334", "0.54045177", "0.54045177", "0.54045177", "0.54017", "0.53961986", "0.5396027", "0.539599", "0.5391548" ]
0.0
-1
ACK06 Id: 326 Name: Request Reference Number Type: AN Min/Max: 1/45 Description: Reference number or RFQ number to use to identify a particular transaction set and query (additional reference number or description which can be used with contract number)
def ACK06=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acknowledgement_reference_id\r\n\t\tacknowledgement_message.split(\":\")[1].gsub(/\\s/,\"\")\r\n\tend", "def Com6 # Recuperation Info\n \n end", "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def transaction_id\n params['PNREF']\n end", "def paybox_transaction_number\n return unless accepted_payment.present? && accepted_payment.paybox_transaction.present?\n \"Num Appel : #{accepted_payment.paybox_transaction[0..9]} | Ref Paybox : #{accepted_payment.paybox_transaction[10..19]}\"\n end", "def enter_acquisition_ref_num(data_set)\n acquis_ref_num = data_set[CoreAcquisitionData::ACQUIS_REF_NUM.name]\n logger.debug \"Entering reference number '#{acquis_ref_num}'\"\n ref_num_options_locator = input_options_locator([], CoreAcquisitionData::ACQUIS_REF_NUM.name)\n wait_for_options_and_type(ref_num_input_locator, ref_num_options_locator, acquis_ref_num)\n end", "def ACK05=(arg)", "def build_transaction_refund_request(money, reference)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :method, TRANSACTION_REFUND_TYPE\n end\n unless money.nil?\n xml.tag! :TxnDetails do\n xml.tag! :amount, amount(money)\n end\n end\n end\n end\n xml.target!\n end", "def build_purchase_or_authorization_request_with_continuous_authority_reference_request(type, money, authorization, options)\n reference, auth_code, ca_reference = authorization.to_s.split(';')\n raise ArgumentError, \"The continuous authority reference is required for continuous authority transactions\" if ca_reference.blank?\n\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n xml.tag! :Transaction do\n xml.tag! :ContAuthTxn, :type => 'historic'\n xml.tag! :HistoricTxn do\n xml.tag! :reference, ca_reference\n xml.tag! :method, type\n end\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n xml.tag! :capturemethod, 'cont_auth'\n end\n end\n end\n xml.target!\n end", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def ref\n @messaging['optin']['ref']\n end", "def acknum\n @binhdr[8, 4].unpack(\"N\").pop\n end", "def reference_number_prefix\n nil\n end", "def coup_num()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::CoupNum::CoupNumRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def reassociation_trace\n simple_client_array_for_1000000009 = [\"NAVICURE\", \"ASCEND CLINICAL LLC\"]\n trn_elements = ['TRN', '1', ref_number]\n if simple_client_array_for_1000000009.include? (@client_name)\n trn_elements << '1000000009'\n elsif @check_amount.to_f > 0 && @check.payment_method == \"EFT\"\n trn_elements << '1' + @facility.facility_tin if @facility.facility_tin.present?\n else\n trn_elements << '1999999999'\n end\n trn_elements.trim_segment.join(@element_seperator)\n end", "def enter_ref_num(data_set)\n ref_num = data_set[Acquisition::ACQUIS_REF_NUM.name]\n wait_for_element_and_type(acquis_ref_num_input(0), ref_num) if ref_num\n end", "def transaction_id\r\n params['PayRef'] \r\n end", "def receive_nacknowledgement sequence_number\n @stats[:naks_received] += 1\n\n if @buffer[sequence_number] == \"\"\n return\n end\n\n # resend frame\n\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n min_frame = @options[:window_size] * ((@window % 2))\n\n if sequence_number >= max_frame or sequence_number < min_frame\n return\n end\n\n if @options[:implementation] == :go_back\n next_frame = ((@window * @options[:window_size]) + (sequence_number % @options[:window_size]))\n @next_frame = [next_frame, @next_frame].min\n @current_frame = @next_frame\n\n # Undo work done\n \n max_frame = @options[:window_size] * ((@window % 2) + 1)\n else\n send_frame sequence_number\n end\n end", "def build_tokenize_request(credit_card, merch_ref)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n\n xml.tag! :Transaction do\n xml.tag! :TokenizeTxn do\n xml.tag! :method, 'tokenize'\n xml.tag! :Card do\n xml.tag! :pan, credit_card.number\n end\n end\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(merch_ref)\n end\n end\n end\n end", "def select_auto_reference_nbr(test_data)\n hide_notifications_bar\n ref_nbr = select_id_generator_option(reference_nbr_input, reference_nbr_options)\n test_data.merge!({ UseOfCollections::REFERENCE_NBR.name => ref_nbr})\n end", "def inquiry_type_description\n ClearinghouseRequest::InquiryTypes[inquiry_type]\n end", "def ref_number\n batch = check.batch\n facility_name = facility.name.upcase\n if (facility_name == 'AHN' || facility_name == 'SUBURBAN HEALTH' ||\n facility_name == 'UWL' || facility_name == 'ANTHEM')\n file_number = batch.file_name.split('_')[0][3..-1] rescue \"0\"\n date = batch.date.strftime(\"%Y%m%d\")\n \"#{date}_#{file_number}\"\n else\n (batch.batchid.include?(\"AH\") ? batch.batchid : batch.date.strftime(\"%Y%m%d\"))\n end\n end", "def ref_number\n if ['AHN', 'SUBURBAN HEALTH', 'UWL', 'ANTHEM'].include?(@facility_name)\n file_number = @batch.file_name.split('_')[0][3..-1] rescue \"0\"\n date = @batch.date.strftime(\"%Y%m%d\")\n \"#{date}_#{file_number}\"\n else\n (@batch.batchid.include?(\"AH\") ? @batch.batchid : @batch.date.strftime(\"%Y%m%d\"))\n end\n end", "def create_request\n raise AttributeMissing.new \"(2500) TransactionReference or OrderReference need to be present.\" if (transaction_reference.nil? && order_reference.nil?)\n raise AttributeMissing.new \"(2500) SiteReference must be present.\" if (site_reference.nil? && (REXML::XPath.first(@request_xml, \"//SiteReference\").text.blank? rescue true))\n REXML::XPath.first(@request_xml, \"//Request\").attributes[\"Type\"] = \"TRANSACTIONQUERY\"\n ops = REXML::XPath.first(@request_xml, \"//Operation\")\n [\"TermUrl\", \"MerchantName\", \"Currency\", \"SettlementDay\"].each { |e| ops.delete_element e }\n (ops.elements[\"SiteReference\"] || ops.add_element(\"SiteReference\")).text = self.site_reference if self.site_reference\n (ops.elements[\"TransactionReference\"] || ops.add_element(\"TransactionReference\")).text = self.transaction_reference if self.transaction_reference\n order = REXML::XPath.first(@request_xml, \"//Operation\")\n (order.elements[\"OrderReference\"] || order.add_element(\"OrderReference\")).text = self.order_reference if self.order_reference\n root = @request_xml.root\n (root.elements[\"Certificate\"] || root.add_element(\"Certificate\")).text = self.site_alias if self.site_alias\n end", "def ACK10=(arg)", "def ACK09=(arg)", "def transaction_reference\n @xml.xpath('//OperationResponse/TransactionReference').text\n end", "def ACK08=(arg)", "def reference_signal_params\n params.require(:reference_signal).permit(:reference_value, :manual_mode)\n end", "def credit_card_number; end", "def ACK04=(arg)", "def create_request\r\n request = @svc.createRequest(\"ReferenceDataRequest\")\r\n\r\n @identifiers.each {|identifier| request.append(\"securities\", identifier) }\r\n \r\n @options.each do |key, value|\r\n next if key == :fields or key == :overrides\r\n request.set(key.to_s, convert_value_to_bberg(value))\r\n end\r\n \r\n @options[:fields].each {|f| request.append(\"fields\", f) }\r\n \r\n overrides = request.getElement(\"overrides\")\r\n @options[:overrides].each do |field_id, value|\r\n new_override = overrides.appendElement()\r\n new_override.setElement(\"fieldId\", field_id.to_s)\r\n new_override.setElement(\"value\", convert_value_to_bberg(value))\r\n end\r\n @request = request\r\n end", "def to_reference\n \"#{@sender},#{@identifier},#{RCAP.to_s_for_cap(@sent)}\"\n end", "def job_opening_number(query)\n @form['579'] = query\n end", "def query_def; @seq1.definition; end", "def m_transaction_params\n params.require(:m_transaction).permit(:reference_no, :amount, :transaction_type, :type)\n end", "def ACK07=(arg)", "def reference_credit_note\n object.credit_note_ref.to_s\n end", "def pay_ref\n params['PayRef']\n end", "def customer_credit_card_capture_rq(amount, authorization, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n \n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardCaptureRq') do\n xml.tag!('TransRequestID', options[:order_id])\n xml.tag!('CreditCardTransID', authorization)\n xml.tag!('Amount', amount)\n end\n }\n \n xml.target!\n end", "def bank_reference\r\n params['Ord']\r\n end", "def ACK03=(arg)", "def order\n params[\"RefNo\"]\n end", "def transaction_set_header\n ['ST', '835' ,(@check_index + 1).to_s.rjust(4, '0')].join(@element_seperator)\n end", "def crossref_query\n CrossrefQuery.generate_query_from_text( ref_apa_6 )\n end", "def enter_reference_nbr(test_data)\n hide_notifications_bar\n wait_for_options_and_type(reference_nbr_input, reference_nbr_options, test_data[UseOfCollections::REFERENCE_NBR.name])\n end", "def request_type; \"RequestType\"; end", "def request_id; end", "def transaction_set_header\n ['ST', '835', '0001'].join(@element_seperator)\n end", "def transaction_acknowledgement\n generic_transaction_acknowledgement(OrangeMoneyCiBasket, params[:transaction_id])\n end", "def select_auto_reference_nbr(test_data)\n hide_notifications_bar\n ref_nbr = select_id_generator_option(reference_nbr_input, reference_nbr_options)\n logger.info \"Selected auto-generated reference number '#{ref_nbr}'\"\n test_data.merge!({CoreUseOfCollectionsData::REFERENCE_NBR.name => ref_nbr})\n end", "def reassociation_trace\n trn_elements = ['TRN', '1', ref_number]\n if @check_amount.to_f > 0 && @check.payment_method == \"EFT\"\n trn_elements << '1' + @facility.facility_tin if @facility.facility_tin.present?\n else\n trn_elements << '1999999999'\n end\n trn_elements.join(@element_seperator)\n end", "def payer_reason_codes_for_nyu\n (facility.sitecode.to_s.strip == '00549' && eob.patient_account_number.to_s[0..2] == 'SAL') ? {0 => 'REF'} : nil\n end", "def polish_taxpayer_identification_number; end", "def pre_payment_req_params\n params.require(:pre_payment_req).permit(:billing_info_id, :amount, :reference)\n end", "def set_receipt_no\n self.receipt_sequence, self.receipt_number = TransactionReceipt.generate_receipt_no self.receipt_set\n self.ef_receipt_number = \"#{self.receipt_sequence}#{self.receipt_number}\"\n end", "def customer_credit_card_charge_rq(amount, creditcard, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n\n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardChargeRq') do\n xml.tag!('TransRequestID', options[:order_id])\n add_creditcard(xml, creditcard) \n xml.tag!('Amount', amount)\n add_address(xml, options) \n add_creditcard_security_code(xml, creditcard)\n end\n }\n\n xml.target!\n end", "def default_service_msg_number\n 1002\n end", "def request_placeholder\n \"JIRA Number: HIANDEV-XXXX\nSolution: HealtheAnalytics\nTest Date: 10-May-2017\nEnvironment: Staging\nOperating System: OS-X\nAssociate ID: AA00000\nPrerequisite Evidence: N/A\"\n end", "def linkwizard_crm_num_field\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/ats-enter_subscriber_number_field/\") ,__method__)\n end", "def get_rebill_id()\n return @RESPONSE_HASH['REBID']\n end", "def notes\n @reason_structure[@num]\n end", "def ACK01=(arg)", "def create_request_code\n service_key = Buynance::Application.config.service_key\n profile_guid = Buynance::Application.config.profile_guid\n site_user_guid = Buynance::Application.config.site_user_guid \n customer_id = self.email\n self.initial_request_code = DecisionLogic.get(\"https://www.decisionlogic.com/CreateRequestCode.aspx?serviceKey=#{service_key}&profileGuid=#{profile_guid}&siteUserGuid=#{site_user_guid}&customerId=#{customer_id}&firstName=#{self.owner_first_name.strip}&lastName=#{self.owner_last_name.strip}&accountNumber=#{self.bank_account.account_number}&routingNumber=#{self.bank_account.routing_number}\")\n is_valid = (self.initial_request_code.length <= 10)\n return is_valid\n end", "def schema\n {\n 'AM'\t=> 'Segment Identification',\n 'EY'\t=> 'Provider ID Qualifier',\n 'E9'\t=> 'Provider ID' }\n end", "def request_params\n params.require(:request).permit(:payload, :reference)\n end", "def rewrite_request_block(auth_type=\"ST3DAUTH\")\n\n # set the required AUTH type\n REXML::XPath.first(@request_xml, \"//Request\").attributes[\"Type\"] = auth_type\n\n # delete term url and merchant name\n ops = REXML::XPath.first(@request_xml, \"//Operation\")\n [\"TermUrl\", \"MerchantName\"].each { |e| ops.delete_element e }\n\n # delete accept and user agent in customer info\n customer_info = REXML::XPath.first(@request_xml, \"//CustomerInfo\")\n [\"Accept\", \"UserAgent\"].each { |e| customer_info.delete_element e }\n\n # delete credit card details and add TransactionVerifier and TransactionReference from response xml\n # CC details are not needed anymore as verifier and reference are sufficient\n cc_details = REXML::XPath.first(@request_xml, \"//CreditCard\")\n [\"Number\", \"Type\", \"SecurityCode\", \"StartDate\", \"ExpiryDate\", \"Issue\"].each { |e| cc_details.delete_element e }\n cc_details.add_element(\"TransactionVerifier\").text = REXML::XPath.first(@response_xml, \"//TransactionVerifier\").text\n cc_details.add_element(\"ParentTransactionReference\").text = REXML::XPath.first(@response_xml, \"//TransactionReference\").text\n\n # unless it is an AUTH request, add additional required info for a 3DAUTH request\n unless auth_type == \"AUTH\"\n pm_method = REXML::XPath.first(@request_xml, \"//PaymentMethod\")\n threedsecure = pm_method.add_element(\"ThreeDSecure\")\n threedsecure.add_element(\"Enrolled\").text = REXML::XPath.first(@response_xml, \"//Enrolled\").text\n threedsecure.add_element(\"MD\").text = REXML::XPath.first(@response_xml, \"//MD\").text rescue \"\"\n end\n true\n end", "def tel_recharge(params={})\n login if @@cookie.blank?\n\n number = params[:number]\n number = \"#{number[0,3]} #{number[3,4]} #{number[7,4]}\"\n\n _params = {'case.internal.step' => '2', 'case.hidden.always' => 'OPERATOR_LOG_ID', 'OPERATOR_LOG_ID' =>'139506759904711',\n 'case.hidden.always' => 'case.menuid', 'case.menuid' => '050116', 'flagone'=> 0, 'flagtwo' => 1,\n 'rateofexchange' => 100, 'ratejs' => 2, 'hp_no' => '371603042', 'number_limit' => 11, 'sys_max_rech' => '999999999',\n 'trans_evType' => 2, 'trans_evBalancetype' => 0, 'WHERE_EV_DL_MASTER_MESSAGE' => 0,'trans_pin' => '148874',\n 'minbase' => 1, 'pin_min_len' => 4, 'pin_max_len' => 30, 'save_trans_msisdn' =>number, 'trans_msisdn' => number,\n 'tip_hpone' => params[:number], 'trans_money' => params[:total]}\n\n uri = URI(TEL_RECHARGE)\n p _params\n uri.query = URI.encode_www_form(_params)\n req = Net::HTTP::Post.new(uri.request_uri,{'Cookie' => @@cookie})\n res = @https.request(req)\n result = res.body.force_encoding(\"gb2312\").encode!('utf-8')\n p result\n result\n end", "def set_expense_on_seq\n if bill_type == 'client_expense'\n ledger = Sequence::Client.new(\n ledger_name: 'company-dev',\n credential: 'OUUY4ZFYQO4P3YNC5JC3GMY7ZQJCSNTH'\n )\n # self.contract.set_on_seq\n ce_issue = ledger.transactions.transact do |builder|\n builder.transfer(\n flavor_id: 'usd',\n amount: total_amount.to_i,\n source_account_id: 'cont_' + contract_id.to_s,\n destination_account_id: 'cons_' + self&.contract.buy_contract.candidate_id.to_s,\n action_tags: {\n type: 'transfer',\n contract: contract_id,\n candidate: contract.buy_contract.candidate_id.to_s,\n due_date: due_date,\n bill_type: bill_type\n }\n )\n end\n end\n end", "def cell_phone_in_e164; end", "def request_info\n @service = ($evm.root['vmdb_object_type'] == 'service_template_provision_task')\n @miq_request = $evm.root['miq_request']\n $evm.log(:info, \"Request: #{@miq_request.description} id: #{@miq_request.id} \")\nend", "def accepted_params\n [\n :Amount,\n :isPreAuth,\n :ServiceId, \n :RequestLang, \n :FullName, \n :Email, \n :Phone, \n :MaxInstallments,\n :MerchantTrns,\n :CustomerTrns,\n :SourceCode,\n :PaymentTimeOut,\n :ExpirationDate,\n :AllowRecurring,\n :Tags,\n :AllowTaxCard,\n :ActionUser,\n :DisableCash,\n :DisableCard\n ]\n end", "def build_insurance_request(options={}, xml_request)\n xml_request << XmlNode.new('wwex:insuranceDetail') do |insurance|\n insurance << XmlNode.new('wwex:insuranceCategory', INSURANCE_CATEGORY[options[:insurance_category_type]])\n insurance << XmlNode.new('wwex:insuredCommodityValue', options[:insurance_commodity_value])\n insurance << XmlNode.new('wwex:insuranceIncludingFreightCharge', options[:included_the_freight_charges])\n end\n xml_request.to_s\n end", "def credit_card_type; end", "def ACK02=(arg)", "def build_purchase_or_authorization_request(type, money, credit_card, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n \n xml.tag! :Transaction do\n xml.tag! :CardTxn do\n xml.tag! :method, type\n \n add_credit_card(xml, credit_card, options[:billing_address] || options[:address])\n end\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n end\n end\n end\n xml.target!\n end", "def encoded_call_no\n URI.encode_www_form_component(@call_number)\n end", "def default_service_msg_number\n \"0002\"\n end", "def set_fields result\n @txn.confirmation_no = result.id \n if CREDIT_CARD_API == 'balanced'\n @txn.payment_type, @txn.credit_card_no, @txn.debit_token = result.source.card_type, result.source.last_four, result.uri\n else\n @txn.payment_type, @txn.credit_card_no, @txn.debit_token = result.source.brand, result.source.last4, result.source.id\n end\n end", "def verify_reference_nbr(test_data)\n verify_values_match(test_data[UseOfCollections::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def get_trans_id()\n return @RESPONSE_HASH['RRNO']\n end", "def invoice #TODO need to be improve and confirmation with Client\n\tconnectiontype.amount\nend", "def test_19110_address_5\n\n xExpect = @@xFile.xpath('//gmd:contactInfo[4]')\n\n hJson = JSON.parse(@@mdJson)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(5)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n jsonIn = hJson.to_json\n\n hResponseObj = ADIWG::Mdtranslator.translate(\n file: jsonIn, reader: 'mdJson', writer: 'iso19110', showAllTags: true\n )\n\n xMetadata = Nokogiri::XML(hResponseObj[:writerOutput])\n xGot = xMetadata.xpath('//gmd:contactInfo')\n\n assert_equal xExpect.to_s.squeeze(' '), xGot.to_s.squeeze(' ')\n\n end", "def find_type\n check_number_position = cnf['CHECK']['check_number']\n check_number = parse(check_number_position[0]..check_number_position[1])\n if row[0..2].to_i > 0\n unless check_number.blank?\n @type = 'PAYMENT'\n else\n @type = 'CORRESP'\n end\n else\n @type = nil\n end\n end", "def reference\n @data['reference']\n end", "def enter_conservation_ref_num(data_set)\n cons_ref_num = data_set[CoreConservationData::CONS_REF_NUM.name]\n logger.debug \"Entering condition ref number '#{cons_ref_num}'\"\n wait_for_element_and_type(cons_ref_num_input_locator(0), cons_ref_num) if cons_ref_num\n end", "def ref_id\n 300_000_000 + data[0].to_i\n end", "def claim_number\n str = eob.check_information.check_number.to_s if eob.check_information\n (str += '_' + eob.claim_number) if !eob.claim_number.blank?\n str\n end", "def req_ord_line_params\n params.require(:req_ord_line).permit(:uuid, :req_ord_id, :req_ord_sup_id, :req_ord_mat_id, :werks, :cur_prc, :cur_prc_conv, :cur_leadtime, :cur_moq, :sup_prc, :sup_prc_conv, :chg_pct, :sup_valid_from, :sup_valid_to, :sup_moq, :sup_leadtime, :sup_remark, :open_by, :open_at, :open_ip, :reply_by, :reply_at, :reply_ip, :cur_alloc, :sup_alloc, :req_remark, :req_review_by, :req_review_at, :req_review_result, :req_review_remark, :req_approved_by, :req_approved_at, :req_approved_result, :req_approved_remark, :rcv_remark, :rcv_review_by, :rcv_review_at, :rcv_review_result, :rcv_review_remark, :rcv_approved_by, :rcv_approved_at, :rcv_approved_result, :rcv_approved_remark, :creator, :updater, :create_ip, :update_ip)\n end", "def enter_reference_nbr(test_data)\n hide_notifications_bar\n logger.info \"Entering reference number '#{test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name]}'\"\n wait_for_options_and_type(reference_nbr_input, reference_nbr_options, test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name])\n end", "def consume_number; end", "def read_request_message\n raw_request = CommonUi::IOUtils.read_to_array(\n \"#{ENV[\"XROAD_HOME\"]}/center-service/test/resources/\"\\\n \"client_reg_request_CONTROLLERTEST_WRONG_INSTANCE.soap\")\n\n raw_request.map!() { |line| line.strip() }\n\n return raw_request.join(\"\")\n end", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def health_remark_code_segments\n @eob = service.insurance_payment_eob\n facility = @eob.check_information.job.batch.facility\n health_remark_code_segments = []\n health_remark_code_segments << compute_lq(\"in\")\n health_remark_code_segments << compute_lq(\"out\") \n if facility.details[:interest_in_service_line] && service.interest_service_line?\n health_remark_code_segments << lq_rx_segments(\"109975\") if @eob.claim_interest.to_f > 0.0 \n end \n health_remark_code_segments << lq_rx_segments(\"109702\") if @eob.hcra.to_f > 0.0\n health_remark_code_segments.compact!\n health_remark_code_segments.flatten\n end", "def next_available_number\n session.request Debtor.soap_action(:get_next_available_number)\n end", "def reassociation_trace\n ['TRN', '1', output_check_number, (@payer.payid.to_s.rjust(10, '0') if @payer),\"999999999\"].trim_segment.join(@element_seperator)\n end", "def build_refund_request(money, credit_card, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n xml.tag! :Transaction do\n xml.tag! :CardTxn do\n xml.tag! :method, REFUND_TYPE\n add_credit_card(xml, credit_card, options[:billing_address])\n end\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money)\n end\n end\n end\n xml.target!\n end" ]
[ "0.55239296", "0.53948915", "0.5362379", "0.52976155", "0.52036434", "0.51425076", "0.5116596", "0.5092556", "0.5091087", "0.5080851", "0.5080851", "0.5077033", "0.5071219", "0.49948198", "0.49844977", "0.4982748", "0.49796268", "0.49771672", "0.49535206", "0.49384794", "0.49347988", "0.49330962", "0.49246132", "0.49027646", "0.4899494", "0.48832026", "0.48820567", "0.48645598", "0.48634127", "0.4862891", "0.4859452", "0.4847709", "0.48432934", "0.484213", "0.4829123", "0.4825403", "0.48247248", "0.48090735", "0.47968957", "0.47948876", "0.4781313", "0.47724706", "0.47612736", "0.47438893", "0.47437453", "0.47429764", "0.47384554", "0.47351635", "0.47337386", "0.4733388", "0.47318757", "0.47156626", "0.4713234", "0.4711443", "0.47035637", "0.47010264", "0.46931133", "0.46818987", "0.46760696", "0.46668178", "0.4662422", "0.4662363", "0.46584705", "0.4650504", "0.46471998", "0.46409747", "0.46333432", "0.46251768", "0.4623957", "0.4619714", "0.46180254", "0.46130574", "0.46103933", "0.46055308", "0.4604532", "0.45983732", "0.45964858", "0.45955974", "0.4588718", "0.4579305", "0.45787987", "0.45779538", "0.4575791", "0.45739555", "0.4573387", "0.45634365", "0.45598266", "0.45597094", "0.4558059", "0.4550646", "0.45437247", "0.45413727", "0.45396104", "0.4532929", "0.45273617", "0.45186242", "0.4516212", "0.45098013", "0.45079616", "0.4507755" ]
0.48913085
25
ACK07 Id: 235 Name: Product/Service ID Qualifier Type: ID Min/Max: 2/2 Description: Code identifying the type/source of the descriptive number used in Product/Service ID (234)
def ACK07=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manufacturer_id\n mac[0..7]\n end", "def identifier_code\n 'QuestionnaireResponseID'\n end", "def service_prov_identification\n code, qual = nil, nil\n claim = eob.claim_information\n\n if (claim && !claim.provider_npi.blank?)\n code = claim.provider_npi\n qual = 'XX'\n Output835.log.info \"Provider NPI from the 837 is chosen\"\n elsif (claim && !claim.provider_ein.blank?)\n code = claim.provider_ein\n qual = 'FI'\n Output835.log.info \"Provider TIN from 837 is chosen\"\n elsif !facility.facility_npi.blank?\n code = facility.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !facility.facility_tin.blank?\n code = facility.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def default_service_msg_number\n 1002\n end", "def default_service_msg_number\n \"0002\"\n end", "def qualified_id\n qualified_code + \"-\" + \"%04d\" % self.code\n end", "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def composite_med_proc_id\n elem = []\n if ((!cpt_code.blank? and !revenue_code.blank?)|| revenue_code.blank?)\n proc_code = \"HC:#{cpt_code}\"\n else\n proc_code = \"NU:#{revenue_code}\"\n end\n\n # proc_code = ((!cpt_code.blank? and !revenue_code.blank?) || revenue_code.blank?) ? \"HC:#{cpt_code}\" : \"NU:#{revenue_code}\"\n elem = [proc_code, service.service_modifier1 , service.service_modifier2 ,\n service.service_modifier3 , service.service_modifier4]\n elem = Output835.trim_segment(elem)\n elem.join(':')\n end", "def service_code\n \"#{shipment_mode_code}#{service_type_code}#{services_code}\"\n end", "def schema\n {\n 'AM'\t=> 'Segment Identification',\n 'EY'\t=> 'Provider ID Qualifier',\n 'E9'\t=> 'Provider ID' }\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def short_code\n id.to_s 36\n end", "def polish_taxpayer_identification_number; end", "def es_code\n id.to_s\n end", "def identifier_code\n 'ICN'\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def code\n '202'\n end", "def card_identification\n message.fields[6].strip\n end", "def header_for_id(id)\n raise 'Id must be 4 bytes' unless id.gsub(' ', '').length == 4*2\n # header is really \"B1 96 B1 D3 ED AE 5F 92 #{id}\"\n # however we're chopping off one byte to fit within 12 bytes in the search code.\n\n # the byte after item id changes. maybe 06 or 02 depending on the item.\n \"B1 96 B1 D3 ED AE 5F 92 #{id}\".gsub(' ', '')\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def message_send_device_id() -1003; end", "def assess_insurance()\n\t\tvalues = self.comb_values()\n\t\treturn '0010000' if values.include?('930') #If extra service code 930 (insurance <= $200) is found, return manifest value for $100 ('0010000')\n\t\treturn '0050000' if values.include?('931') #If extra service code 931 (insurance > $200) is found, return manifest value for $500 ('0050000')\n\t\treturn false #If insurance values are not found, return false.\n\tend", "def valid_id_number; end", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def id_number; end", "def identifier_type\n {\n coding: [{\n system: CODING_SYSTEM,\n code: IDENTIFIER_CODE,\n userSelected: false\n }]\n }\n end", "def mintOAPID(metadata)\n if $testMode\n return \"ark:/13030/fk#{(0...8).map { (65 + rand(26)).chr }.join}\"\n else\n resp = $ezidSession.mint(metadata)\n resp.respond_to?(:errored?) and resp.errored? and raise(\"Error minting ark: #{resp.response}\")\n return resp.identifier\n end\nend", "def odk_code\n \"q#{id}\"\n end", "def odk_code\n \"q#{id}\"\n end", "def Com6 # Recuperation Info\n \n end", "def type_code \n 4\n end", "def id_lookup(id)\n id = id.to_i\n if (id >= 128) && (id <= 255)\n id = \"oem_data_#{id}\"\n elsif DMI::ID_TO_DESCRIPTION.key?(id)\n id = DMI::ID_TO_DESCRIPTION[id]\n else\n Ohai::Log.debug(\"unrecognized header id; falling back to 'unknown'\")\n id = \"unknown_dmi_id_#{id}\"\n end\n rescue\n Ohai::Log.debug(\"failed to look up id #{id}, returning unchanged\")\n id\n end", "def value_cardtype_code\n :\"#{value_type_code}_value\"\nend", "def create_item_pack_product_code\n puts \"IN RETAIL CREATE IPC\"\n cosmetic_code = \"\"\n if self.label_code == \"U\" \n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"UL\"\n else\n cosmetic_code = \"WX\"\n end\n else\n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"LB\"\n else\n cosmetic_code = \"LW\"\n end\n \n end\n \n \n class_code = self.carton_setup.product_class_code\n puts \"prod sched: \" + self.production_schedule_code\n commodity = RmtSetup.find_by_production_schedule_name(self.production_schedule_code).commodity_code\n grade_code = self.carton_setup.grade_code\n \n std_count = StandardSizeCount.find_by_standard_size_count_value_and_commodity_code_and_basic_pack_code(self.carton_setup.standard_size_count_value,commodity,self.basic_pack_code)\n \n if !std_count\n err = \"An IPC could not be found or created, because no standard_size_count record exists for the following field values: <br>\"\n err += \"standard_size_count_value: \" + self.carton_setup.standard_size_count_value.to_s + \"<br>\"\n err += \"commodity: \" + commodity + \"<br>\"\n err += \"basic_pack_code: \" + self.basic_pack_code\n raise err\n \n end\n actual_count = std_count.actual_count\n \n variety = self.carton_setup.marketing_variety_code\n \n item_pack = ItemPackProduct.find_by_product_class_code_and_commodity_code_and_grade_code_and_actual_count_and_marketing_variety_code_and_cosmetic_code_name_and_size_ref_and_basic_pack_code(class_code,commodity,grade_code,actual_count,variety,cosmetic_code,self.size_ref,self.basic_pack_code)\n \n if ! item_pack\n \n item_pack = ItemPackProduct.new\n item_pack.product_class_code = class_code\n item_pack.commodity_code = commodity\n item_pack.commodity_group_code = std_count.commodity.commodity_group_code\n item_pack.cosmetic_code_name = cosmetic_code\n item_pack.grade_code = grade_code\n item_pack.basic_pack_code = self.basic_pack_code\n \n item_pack.treatment_code = self.carton_setup.treatment_code\n item_pack.treatment = Treatment.find_by_treatment_code_and_treatment_type_code(item_pack.treatment_code,\"PACKHOUSE\")\n item_pack.grade = Grade.find_by_grade_code(grade_code)\n item_pack.standard_size_count = std_count\n item_pack.standard_size_count_value = std_count.standard_size_count_value\n item_pack.marketing_variety_code = variety\n item_pack.actual_count = actual_count\n item_pack.size_ref = self.size_ref\n puts item_pack.size_ref\n item_pack.create\n \n \n end\n \n \n if ! self.new_record?\n old_ri = RetailItemSetup.find(self.id)\n old_ipc = old_ri.item_pack_product_code \n old_mark = old_ri.mark_code\n end\n \n self.item_pack_product = item_pack\n \n \n self.item_pack_product_code = item_pack.item_pack_product_code\n \n if ! self.new_record? && self.carton_setup.fg_setup\n \n if old_ipc != self.item_pack_product_code||old_mark != self.mark_code\n @update_fg = true\n end\n end\n \n end", "def product_codes\n data[:product_codes]\n end", "def nobasicas_indice_seq_con_id\n Msip::Ability::NOBASICAS_INDSEQID +\n Mr519Gen::Ability::NOBASICAS_INDSEQID +\n Heb412Gen::Ability::NOBASICAS_INDSEQID +\n Cor1440Gen::Ability::NOBASICAS_INDSEQID\n end", "def identifier=(value)\n value = value.to_i\n value = rand(65535) if value == 0\n @identifier = value\n @data.merge!({identifier: @identifier})\n # @identifier = [3, 4, value].pack('cnN')\n end", "def nic_slot_id\n return \"0\" if fqdd.include?(\"NIC.Integrated\") || fqdd.include?(\"NIC.Embedded\")\n\n fqdd.scan(/NIC.Slot.(\\d+).*/).flatten.first\n end", "def gene_id\n description.andand.match(/ GN=(\\w+) ?/)[1]\n end", "def op_code\n 2004\n end", "def south_african_pty_ltd_registration_number; end", "def op_code\n 2002\n end", "def hex_trace_id\n trace_id.unpack1('H*')\n end", "def acknowledgement_reference_id\r\n\t\tacknowledgement_message.split(\":\")[1].gsub(/\\s/,\"\")\r\n\tend", "def numid; end", "def get_codeSignIdentity(type)\r\n\tif type == 0 then\r\n\t\treturn 'iPhone Developer'\r\n\telsif type == 1 or type == 2 then\r\n\t\treturn 'iPhone Distribution'\r\n\telse\r\n\t\traise \"Unknown mobileprovision type #{type}\"\r\n\tend\r\nend", "def payer_reason_codes_for_nyu\n (facility.sitecode.to_s.strip == '00549' && eob.patient_account_number.to_s[0..2] == 'SAL') ? {0 => 'REF'} : nil\n end", "def qos_class_identifier(rule_name, info)\n #\n end", "def credit_card_type; end", "def south_african_close_corporation_registration_number; end", "def test_get_unique_codes_for_id\n reason_code_ids = [100]\n reason_code_records = []\n reason_code_records << reason_codes(:reason_code100)\n reason_code_records << reason_codes(:reason_code101)\n reason_code_records << reason_codes(:reason_code102)\n assert_equal(\"5D\", ReasonCode.get_unique_codes_for(reason_code_records, reason_code_ids))\n end", "def premium_service_number\n FFaker.numerify('1900 ### ####')\n end", "def invalid_id_number; end", "def get_serial_number(data)\n data['product']['serial_number'] || 'n/a'\n end", "def test_855\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*855*0001~\n BAK*00*AC*00000007397108*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n PO1*1*1*EA*59.95**UP*860001662184*VP*860001662184~\n PID*F****CBD Topical Cream 400mg THC Free~\n ACK*IA*1*EA****UP*860001662184*VP*860001662184~\n PO1*2*2*EA*49.95**UP*860001662108*VP*860001662108~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n ACK*IA*2*EA****UP*860001662108*VP*860001662108~\n CTT*2~\n SE*13*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS855::TS.new(store)\n ts.BAK do |bak|\n bak.TransactionSetPurposeCode = \"00\"\n bak.AcknowledgmentType = \"AC\"\n bak.PurchaseOrderNumber = \"00000007397108\"\n bak.Date = @epoch\n end\n ts.L_N1 do |rep|\n # N1\n rep.N1.EntityIdentifierCode = \"ST\"\n rep.N1.Name = \"Sweeney Todd\"\n # N3\n rep.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n rep.N4.CityName = \"Birmingham\"\n rep.N4.StateOrProvinceCode = \"AL\"\n rep.N4.PostalCode = \"35226\"\n rep.N4.CountryCode = \"US\"\n end\n ts.L_PO1 do |rep|\n rep.PO1.AssignedIdentification = \"1\"\n rep.PO1.QuantityOrdered = 1\n rep.PO1.UnitOrBasisForMeasurementCode = \"EA\"\n rep.PO1.UnitPrice = 59.95\n rep.PO1.ProductServiceIdQualifier1 = \"UP\"\n rep.PO1.ProductServiceId1 = \"860001662184\"\n rep.PO1.ProductServiceIdQualifier2 = \"VP\"\n rep.PO1.ProductServiceId2 = \"860001662184\"\n rep.L_PID do |rep|\n rep.PID.ItemDescriptionType = \"F\"\n rep.PID.Description = \"CBD Topical Cream 400mg THC Free\"\n end\n rep.L_ACK do |rep|\n rep.ACK.LineItemStatusCode = \"IA\"\n rep.ACK.Quantity = 1\n rep.ACK.UnitOrBasisForMeasurementCode = \"EA\"\n rep.ACK.ACK07 = \"UP\"\n rep.ACK.ACK08 = \"860001662184\"\n rep.ACK.ACK09 = \"VP\"\n rep.ACK.ACK10 = \"860001662184\"\n end\n end\n ts.L_PO1 do |rep|\n rep.PO1.AssignedIdentification = \"2\"\n rep.PO1.QuantityOrdered = 2\n rep.PO1.UnitOrBasisForMeasurementCode = \"EA\"\n rep.PO1.UnitPrice = 49.95\n rep.PO1.ProductServiceIdQualifier1 = \"UP\"\n rep.PO1.ProductServiceId1 = \"860001662108\"\n rep.PO1.ProductServiceIdQualifier2 = \"VP\"\n rep.PO1.ProductServiceId2 = \"860001662108\"\n rep.L_PID do |rep|\n rep.PID.ItemDescriptionType = \"F\"\n rep.PID.Description = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n rep.L_ACK do |rep|\n rep.ACK.LineItemStatusCode = \"IA\"\n rep.ACK.Quantity = 2\n rep.ACK.UnitOrBasisForMeasurementCode = \"EA\"\n rep.ACK.ACK07 = \"UP\"\n rep.ACK.ACK08 = \"860001662108\"\n rep.ACK.ACK09 = \"VP\"\n rep.ACK.ACK10 = \"860001662108\"\n end\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end", "def interchange_control_header\n ['ISA', '00', (' ' * 10), '00', (' ' * 10), 'ZZ', payer_id.to_s.justify(15),\n 'ZZ', isa_08, Time.now().strftime(\"%y%m%d\"), Time.now().strftime(\"%H%M\"),\n ((!@output_version || @output_version == '4010') ? 'U' : '^'),\n ((!@output_version || @output_version == '4010') ? '00401' : '00501'),\n (@isa_record.isa_number.to_s.justify(9, '0') if @isa_record), '0', 'P', ':'].join(@element_seperator)\n end", "def rp_id; end", "def credit_card_number; end", "def sic_code; end", "def component_id(barcode:)\n @cid_lookup[barcode]\n end", "def id\n code\n end", "def type\n length = @number.size\n if length == 15 && @number =~ /^(34|37)/\n \"AMEX\"\n elsif length == 16 && @number =~ /^6011/\n \"Discover\"\n elsif length == 16 && @number =~ /^5[1-5]/\n \"MasterCard\"\n elsif (length == 13 || length == 16) && @number =~ /^4/\n \"Visa\"\n else\n \"Unknown\"\n end\n end", "def getClientIdentificationObjName\r\n\t\t\treturn \"mfiforce__Client_Identification__c\"\r\n\t\tend", "def simple_identifier\n {\n id: @se_identifier.to_s,\n message: 'identifier is missing required elements'\n }\n end", "def product_type_decode(type)\n return \"Workstation\" if type == 1\n\n \"Server\"\n end", "def pcb_a_part_number(number,\n revision, \n numeric_revision)\n\n self.loaded_prefix + '-' + number + '-00'\n \n end", "def item_code( seqno )\n \"#{ code }-#{ seqno ? seqno : '?' }\"\n end", "def version_needed_to_extract\n 0x0014\n end", "def version_needed_to_extract\n 0x0014\n end", "def identifier\n num\n end", "def qrda_oid_for_hqmf_patient_characteristic(vs_oid, qrda_version = nil)\n # This is a special case. This HQMF OID maps to more than one QRDA OID.\n # So we need to try to figure out what template we should use based on the\n # content of the entry\n case vs_oid\n when '2.16.840.1.113883.3.526.3.1279'\n # Patient Characteristic Observation Assertion template for\n # Patient Characteristic: ECOG Performance Status-Poor\n qrda_version == 'r3_1' ? '2.16.840.1.113883.10.20.24.3.103_2016_02_01' : '2.16.840.1.113883.10.20.24.3.103'\n when '2.16.840.1.113883.3.117.1.7.1.402', '2.16.840.1.113883.3.117.1.7.1.403',\n '2.16.840.1.113883.3.117.1.7.1.287', '2.16.840.1.113883.3.117.1.7.1.307'\n # Patient Charasteristic Gestational Age\n '2.16.840.1.113883.10.20.24.3.101'\n when '2.16.840.1.113883.3.526.3.1189', '2.16.840.1.113883.3.526.3.1170', '2.16.840.1.113883.3.600.2390'\n # Patient Characteristic Tobacco User/Non-User\n case qrda_version\n when 'r3_1'\n '2.16.840.1.113883.10.20.24.3.103_2016_02_01'\n when 'r3'\n '2.16.840.1.113883.10.20.24.3.103'\n else\n '2.16.840.1.113883.10.20.22.4.85'\n end\n else\n # return generic pc observation template for anything not specificly mapped to its own template\n qrda_version == 'r3_1' ? '2.16.840.1.113883.10.20.24.3.103_2016_02_01' : '2.16.840.1.113883.10.20.24.3.103'\n end\n\n end", "def barcode\n str_order = order.id.to_s.rjust(5, '0')\n str_cardinality = 1.to_s.rjust(3, '0')\n str_order + str_cardinality\n end", "def item_id\n params['VendorTxCode']\n end", "def name_record_long(type, ext_ref) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x002a # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x001a # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n\n unknown03 = 0x29\n unknown04 = 0x0017\n unknown05 = 0x3b\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n\n # Column definition\n data += [unknown03].pack(\"C\")\n data += [unknown04].pack(\"v\")\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [0x0000].pack(\"v\")\n data += [0xffff].pack(\"v\")\n data += [@col_min].pack(\"v\")\n data += [@col_max].pack(\"v\")\n\n # Row definition\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [@row_min].pack(\"v\")\n data += [@row_max].pack(\"v\")\n data += [0x00].pack(\"v\")\n data += [0xff].pack(\"v\")\n # End of data\n data += [0x10].pack(\"C\")\n\n [header, data]\n end", "def identifier(no_version: false)\n return emma_recordId if emma_recordId.present?\n parts = [emma_repository, emma_repositoryRecordId, dc_format]\n parts << emma_formatVersion unless no_version\n parts.compact_blank.join('-').presence\n end", "def number\n\t\tname.gsub(/^rfc/i, '').to_i\n\tend", "def barcode\n \"*#{identifier}*\"\n end", "def interface_name(class_def)\n \t_IDENTIFIER5 = nil\n\n\n\n\n # 55:7: IDENTIFIER\n _IDENTIFIER5 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.add_interface(_IDENTIFIER5.text) \n\n\n\n end", "def autonomous_system_number; end", "def pty_ltd_registration_number; end", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def primary_response_code\r\n params['prc']\r\n end", "def type_id\n @type_id ||= extract_int(@content[0...TYPE_SIZE])\n end", "def full_no\n # Debt claim no (Office & year & sequential number) => OOOO-YYYY-NNNNN\n if claim_no == \"$err\"\n \"0000-0000-00000\"\n else\n claim_no.blank? ? \"\" : claim_no[0..3] + '-' + claim_no[4..7] + '-' + claim_no[8..12]\n end\n end", "def mint_ark\n Ezid::Identifier.mint\nend", "def part_number\n productnum\n end", "def res_id_to_s(res_id)\n return \"0x#{res_id.to_s(16)}\"\n end", "def getacquirerid()\r\n return getvalue(SVTags::ACQUIRER_ID)\r\n end", "def get_primary_reason_code_ids_of_svc\r\n reason_code_ids = []\r\n reason_code_ids << noncovered_reason_code_id unless noncovered_reason_code_id.blank?\r\n reason_code_ids << denied_reason_code_id unless denied_reason_code_id.blank?\r\n reason_code_ids << discount_reason_code_id unless discount_reason_code_id.blank?\r\n reason_code_ids << coinsurance_reason_code_id unless coinsurance_reason_code_id.blank?\r\n reason_code_ids << deductible_reason_code_id unless deductible_reason_code_id.blank?\r\n reason_code_ids << copay_reason_code_id unless copay_reason_code_id.blank?\r\n reason_code_ids << primary_payment_reason_code_id unless primary_payment_reason_code_id.blank?\r\n reason_code_ids << prepaid_reason_code_id unless prepaid_reason_code_id.blank?\r\n reason_code_ids << pr_reason_code_id unless pr_reason_code_id.blank?\r\n reason_code_ids << contractual_reason_code_id unless contractual_reason_code_id.blank?\r\n reason_code_ids << miscellaneous_one_reason_code_id unless miscellaneous_one_reason_code_id.blank?\r\n reason_code_ids << miscellaneous_two_reason_code_id unless miscellaneous_two_reason_code_id.blank?\r\n reason_code_ids\r\n end", "def identifiers\n {'issn' => @issn, 'eissn' => @eissn, 'isbn' => @isbn, 'eisbn' => @eisbn, 'oclc' => @oclc, 'lccn' => @lccn, 'doi' => @doi,\n 'svc_specific_id_1' => @svc_specific_id_1, 'svc_specific_id_2' => @svc_specific_id_2, 'svc_specific_id_3' => @svc_specific_id_3}\n end", "def qsi_response\r\n code = digital_reciept_info('DigitalReceipt.QSIResponseCode')\r\n return @no_error ? QSI_RESPONSE_CODE_MESSAGES[code.chomp!] : code\r\n end", "def _verxlhigh(id)\n {\n 0x0 => :'Excel 97',\n 0x1 => :'Excel 2000',\n 0x2 => :'Excel 2002',\n 0x3 => :'Excel 2003',\n 0x4 => :'Excel 2007',\n 0x6 => :'Excel 2010',\n 0x7 => :'Excel 2013'\n }[id]\n end", "def cached_ref_data_codes\n # identifies which type of return it is and loads the radio button descriptions\n # eg: CLAIMREASONS.LBTT.RSTU\n { reason: comp_key('CLAIMREASONS', @srv_code, 'RSTU'),\n eligibility_checker: comp_key('ELIGIBILITY_LIST', 'SYS', 'RSTU') }\n end", "def pcb_unique_number\n self.pcb_prefix + '-' + self.pcb_number\n end", "def extractCommandID(msgID)\n retVal = \"000\"\n\n # Check if the ID is a hexadecimal number\n if msgID =~ /(0x)?[0-9a-fA-F]+/\n # Convert the message ID from a string to a value\n val = msgID.to_i(16)\n\n # Strip off all but the last 12 bits and convert the value to a\n # hexadecimal string\n retVal = \"%03x\" % (val & 0x7ff)\n end\n\n return \"0x\" + retVal\nend", "def id\n branch_of_service_code + ':' + rank_code\n end", "def select_application(app_id)\n ber_data = iso_apdu! :ins => 0xA4, :p1 => 0x04, :p2 => 0x00, :data => app_id\n app_tags = Asn1Ber.decode ber_data\n app_data = {}\n Asn1Ber.visit app_tags do |path, value|\n case path\n when [0x6F, 0xA5, 0x9F65]\n app_data[:max_apdu_length] = value.inject(0) { |acc, v| (acc << 8) | v }\n when [0x6F, 0x84]\n app_data[:aid] = value\n end\n end\n app_data\n end", "def genetic_code_table; 11; end" ]
[ "0.59378564", "0.58263505", "0.58005244", "0.5726464", "0.57073325", "0.5682998", "0.56727046", "0.56295437", "0.5558307", "0.55364335", "0.5534659", "0.5480653", "0.54482937", "0.53254443", "0.53215224", "0.5295071", "0.5292925", "0.52752215", "0.527499", "0.5258509", "0.52371556", "0.5234353", "0.52337766", "0.52257794", "0.5211639", "0.5206132", "0.5206132", "0.51844054", "0.51832753", "0.51760674", "0.5175397", "0.5175397", "0.5170973", "0.5170686", "0.5160856", "0.51384634", "0.51346385", "0.5123348", "0.5120467", "0.5089076", "0.5088273", "0.50767386", "0.5071145", "0.5063007", "0.5041922", "0.5040875", "0.50315446", "0.5016637", "0.5002382", "0.50002337", "0.49996433", "0.4993267", "0.49891368", "0.49879786", "0.49873376", "0.49867094", "0.49837586", "0.49671072", "0.4966415", "0.49658522", "0.49645194", "0.4959338", "0.4954366", "0.49540636", "0.49516538", "0.49410582", "0.49380395", "0.49378306", "0.49366745", "0.49347052", "0.49226782", "0.49226782", "0.49203083", "0.49177334", "0.49101844", "0.4904195", "0.490162", "0.4901245", "0.489625", "0.4895347", "0.48910183", "0.48887125", "0.48854214", "0.48848248", "0.48838222", "0.48819202", "0.48801693", "0.4879283", "0.48768187", "0.4874146", "0.48734045", "0.48726553", "0.48681593", "0.4856508", "0.4852962", "0.4849827", "0.48463053", "0.4845972", "0.48435703", "0.48395604", "0.48390296" ]
0.0
-1
ACK08 Id: 234 Name: Product/Service ID Type: AN Min/Max: 1/48 Description: Identifying number for a product or service
def ACK08=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_service_msg_number\n 1002\n end", "def default_service_msg_number\n \"0002\"\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def get_serial_number(data)\n data['product']['serial_number'] || 'n/a'\n end", "def service_prov_identification\n code, qual = nil, nil\n claim = eob.claim_information\n\n if (claim && !claim.provider_npi.blank?)\n code = claim.provider_npi\n qual = 'XX'\n Output835.log.info \"Provider NPI from the 837 is chosen\"\n elsif (claim && !claim.provider_ein.blank?)\n code = claim.provider_ein\n qual = 'FI'\n Output835.log.info \"Provider TIN from 837 is chosen\"\n elsif !facility.facility_npi.blank?\n code = facility.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !facility.facility_tin.blank?\n code = facility.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def premium_service_number\n FFaker.numerify('1900 ### ####')\n end", "def manufacturer_id\n mac[0..7]\n end", "def part_number\n productnum\n end", "def assess_insurance()\n\t\tvalues = self.comb_values()\n\t\treturn '0010000' if values.include?('930') #If extra service code 930 (insurance <= $200) is found, return manifest value for $100 ('0010000')\n\t\treturn '0050000' if values.include?('931') #If extra service code 931 (insurance > $200) is found, return manifest value for $500 ('0050000')\n\t\treturn false #If insurance values are not found, return false.\n\tend", "def service_code\n \"#{shipment_mode_code}#{service_type_code}#{services_code}\"\n end", "def Com6 # Recuperation Info\n \n end", "def nic_slot_id\n return \"0\" if fqdd.include?(\"NIC.Integrated\") || fqdd.include?(\"NIC.Embedded\")\n\n fqdd.scan(/NIC.Slot.(\\d+).*/).flatten.first\n end", "def polish_taxpayer_identification_number; end", "def get_entity_id(section, service)\n return section if service.nil? or service.empty?\n section+service.rjust(3, '0')\nend", "def composite_med_proc_id\n elem = []\n if ((!cpt_code.blank? and !revenue_code.blank?)|| revenue_code.blank?)\n proc_code = \"HC:#{cpt_code}\"\n else\n proc_code = \"NU:#{revenue_code}\"\n end\n\n # proc_code = ((!cpt_code.blank? and !revenue_code.blank?) || revenue_code.blank?) ? \"HC:#{cpt_code}\" : \"NU:#{revenue_code}\"\n elem = [proc_code, service.service_modifier1 , service.service_modifier2 ,\n service.service_modifier3 , service.service_modifier4]\n elem = Output835.trim_segment(elem)\n elem.join(':')\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def autonomous_system_number; end", "def extract_product_id(order_line_product_id)\n api.lookup_product(order_line_product_id)['number']\n end", "def create_item_pack_product_code\n puts \"IN RETAIL CREATE IPC\"\n cosmetic_code = \"\"\n if self.label_code == \"U\" \n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"UL\"\n else\n cosmetic_code = \"WX\"\n end\n else\n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"LB\"\n else\n cosmetic_code = \"LW\"\n end\n \n end\n \n \n class_code = self.carton_setup.product_class_code\n puts \"prod sched: \" + self.production_schedule_code\n commodity = RmtSetup.find_by_production_schedule_name(self.production_schedule_code).commodity_code\n grade_code = self.carton_setup.grade_code\n \n std_count = StandardSizeCount.find_by_standard_size_count_value_and_commodity_code_and_basic_pack_code(self.carton_setup.standard_size_count_value,commodity,self.basic_pack_code)\n \n if !std_count\n err = \"An IPC could not be found or created, because no standard_size_count record exists for the following field values: <br>\"\n err += \"standard_size_count_value: \" + self.carton_setup.standard_size_count_value.to_s + \"<br>\"\n err += \"commodity: \" + commodity + \"<br>\"\n err += \"basic_pack_code: \" + self.basic_pack_code\n raise err\n \n end\n actual_count = std_count.actual_count\n \n variety = self.carton_setup.marketing_variety_code\n \n item_pack = ItemPackProduct.find_by_product_class_code_and_commodity_code_and_grade_code_and_actual_count_and_marketing_variety_code_and_cosmetic_code_name_and_size_ref_and_basic_pack_code(class_code,commodity,grade_code,actual_count,variety,cosmetic_code,self.size_ref,self.basic_pack_code)\n \n if ! item_pack\n \n item_pack = ItemPackProduct.new\n item_pack.product_class_code = class_code\n item_pack.commodity_code = commodity\n item_pack.commodity_group_code = std_count.commodity.commodity_group_code\n item_pack.cosmetic_code_name = cosmetic_code\n item_pack.grade_code = grade_code\n item_pack.basic_pack_code = self.basic_pack_code\n \n item_pack.treatment_code = self.carton_setup.treatment_code\n item_pack.treatment = Treatment.find_by_treatment_code_and_treatment_type_code(item_pack.treatment_code,\"PACKHOUSE\")\n item_pack.grade = Grade.find_by_grade_code(grade_code)\n item_pack.standard_size_count = std_count\n item_pack.standard_size_count_value = std_count.standard_size_count_value\n item_pack.marketing_variety_code = variety\n item_pack.actual_count = actual_count\n item_pack.size_ref = self.size_ref\n puts item_pack.size_ref\n item_pack.create\n \n \n end\n \n \n if ! self.new_record?\n old_ri = RetailItemSetup.find(self.id)\n old_ipc = old_ri.item_pack_product_code \n old_mark = old_ri.mark_code\n end\n \n self.item_pack_product = item_pack\n \n \n self.item_pack_product_code = item_pack.item_pack_product_code\n \n if ! self.new_record? && self.carton_setup.fg_setup\n \n if old_ipc != self.item_pack_product_code||old_mark != self.mark_code\n @update_fg = true\n end\n end\n \n end", "def numid; end", "def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << svc_revenue_code\n service_payment_elements << service.service_quantity.to_f.to_amount\n service_payment_elements = Output835.trim_segment(service_payment_elements)\n service_payment_elements.join(@element_seperator )\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def satellitenumber\n @line1[02...07].to_i\n end", "def product_codes\n data[:product_codes]\n end", "def id_number; end", "def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << revenue_code\n service_payment_elements.join(@element_seperator )\n end", "def type\n length = @number.size\n if length == 15 && @number =~ /^(34|37)/\n \"AMEX\"\n elsif length == 16 && @number =~ /^6011/\n \"Discover\"\n elsif length == 16 && @number =~ /^5[1-5]/\n \"MasterCard\"\n elsif (length == 13 || length == 16) && @number =~ /^4/\n \"Visa\"\n else\n \"Unknown\"\n end\n end", "def tl_dr_version\n client = SoftLayer::Client.new(\n # :username => \"joecustomer\" # enter your username here\n # :api_key => \"feeddeadbeefbadf00d...\" # enter your api key here\n )\n\n # Select a package\n quad_intel_package = SoftLayer::ProductPackage.package_with_id(client, 32)\n\n # Find required Categories and fill config_options with defaults\n config_options = {}\n required_categories = quad_intel_package.configuration.select { |category| category.required? }\n required_categories.each { |required_category| config_options[required_category.categoryCode] = required_category.default_option }\n\n # Provide a value for missing config categories\n config_options['server'] = 1417 # price id of Quad Processor Quad Core Intel 7420 - 2.13GHz (Dunnington) - 4 x 6MB / 8MB cache\n\n # With all the config options in place we can now construct the product order.\n server_order = SoftLayer::BareMetalServerOrder_Package.new(quad_intel_package, client)\n server_order.location = 'sng01'\n server_order.hostname = 'sample'\n server_order.domain = 'softlayerapi.org'\n server_order.configuration_options = config_options\n\n begin\n server_order.verify()\n puts \"The Order appears to be OK\"\n rescue Exception => e\n puts \"Order didn't verify :-( #{e}\"\n end\nend", "def get_client_info_int(question)\n\tputs question\n\tgets.to_i\nend", "def test_processor_input_field_count_with_for_with_remark_codes\n svc = service_payment_eobs(:svc_7)\n total_field_count = svc.processor_input_field_count(facilities(:facility8), false)\n assert_equal(total_field_count, 7)\n end", "def product_tag\n @product_id ||= node.product_id\n case @product_id\n when /N3K-C35/\n tag = 'n35'\n when /N3/\n tag = Utils.fretta? ? 'n3k-f' : 'n3k'\n when /N5/\n tag = 'n5k'\n when /N6/\n tag = 'n6k'\n when /N7/\n tag = 'n7k'\n when /N9/\n tag = Utils.fretta? ? 'n9k-f' : 'n9k'\n else\n fail \"Unrecognized product_id: #{@product_id}\"\n end\n tag\n end", "def short_number\n \"#{self.is_a?(PurchaseInvoice) ? 'PI' : (self.is_a?(SalesInvoice) ? 'SI' : 'IN') }-#{number_without_formatting}\"\n end", "def linkwizard_crm_num_field\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/ats-enter_subscriber_number_field/\") ,__method__)\n end", "def item_id\n params['VendorTxCode']\n end", "def valid_id_number; end", "def invoice_num\n item_id\n end", "def identifier\n num\n end", "def determineMachineId(record, regex)\n message = record[\"message\"]\n if message !~ regex\n log.info \"Returning record without BareMetalMachineID info: message #{message} did not match regex #{regex}\"\n return\n end\n\n chassisNumber = message[regex,1]\n bladeNumber = message[regex,2]\n\n begin\n serviceProfile = getServiceProfile(record[ucsHostNameKey], chassisNumber, bladeNumber, 1)\n rescue SecurityError => se\n record[\"error\"] += \"Error getting service profile: #{se.message}\"\n end\n\n if !serviceProfile.to_s.empty?\n record[\"machineId\"] = \"Cisco_UCS:#{coloregion}:#{serviceProfile}\"\n end\n end", "def nextCode(model,prefix,num)\n\t\t# naming= NamingSery.where('naming_type=\"Sale Invoice\"').first\n\t\tlastRecord=model.order(\"id desc\").first\n\t\t# name=''\n\t\t# if !naming.nil?\n\t\t# \tname=naming.series \n\t\t# end\n\n\t\tmaxNumber=''\n\t\t\tif !lastRecord.nil?\n\t\t\t\t\n\t\t\t\tnamingSeries=lastRecord[self]\n\t\t\t\tif !namingSeries.nil?\n\t\t\t\t\ti = 0\n\t\t\t\t\tlength = namingSeries.length\n\n\t\t\t\t\twhile i < length do\n\t\t\t\t\t\ti +=1\n\t\t\t\t\t \t chr=namingSeries[length-i].chr\n\t\t\t\t\t \tif (chr).is_number?\n\t\t\t\t\t \t\tmaxNumber.insert(0,chr)\t\t\t\t \t\t\n\t\t\t\t\t \telse\n\t\t\t\t\t \t\tbreak\n\t\t\t\t\t \tend\n\t\t\t\t\t \n\t\t\t\t\tend\t\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\n\t\t\tend\n\t\treturn (maxNumber.to_i).generateCode(prefix,num)\n\tend", "def item_id\n unescape params['x_invoice_num']\n end", "def item_id\n unescape params['x_invoice_num']\n end", "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def slot_number_for_registration_number(regis_no)\n @parcel.get(\"slot_number_for_registration_number\", regis_no, nil)\nend", "def product_type_decode(type)\n return \"Workstation\" if type == 1\n\n \"Server\"\n end", "def get_desired_count\n return @describe_service.services[0].desired_count\n end", "def number\n\t\tname.gsub(/^rfc/i, '').to_i\n\tend", "def schema\n {\n 'AM'\t=> 'Segment Identification',\n 'EY'\t=> 'Provider ID Qualifier',\n 'E9'\t=> 'Provider ID' }\n end", "def mintOAPID(metadata)\n if $testMode\n return \"ark:/13030/fk#{(0...8).map { (65 + rand(26)).chr }.join}\"\n else\n resp = $ezidSession.mint(metadata)\n resp.respond_to?(:errored?) and resp.errored? and raise(\"Error minting ark: #{resp.response}\")\n return resp.identifier\n end\nend", "def invoice_num\n item_id\n end", "def option_number\n pricing_db_hp_support_option.option_number\n end", "def capacity_type\n\t\t\t\t\t:integer\n\t\t\t\tend", "def extract_invoice_id\n invoice_id = Converter.xml_get('Betreff_NR', self.order)\n if invoice_id && invoice_id.match(/Rechnung Nr/)\n self.id = invoice_id.match(/\\d+/)[0]\n end\n end", "def consume_number; end", "def paybox_transaction_number\n return unless accepted_payment.present? && accepted_payment.paybox_transaction.present?\n \"Num Appel : #{accepted_payment.paybox_transaction[0..9]} | Ref Paybox : #{accepted_payment.paybox_transaction[10..19]}\"\n end", "def service_type_name\n \"\" \n end", "def extract_data line\n card_num = line.match(/^\\d+/).to_s\n card_name = line.gsub(/^\\d+/,\"\").strip\n require 'pry'; binding.pry;\n if card_has = line.match(/\\[(\\d+)\\]/)\n card_has = card_has.captures.first\n card_name = card_name.gsub(/\\[\\d+\\]/,\"\").strip\n else\n card_has = 0\n end\n card = {\n card_name: card_name,\n card_num: card_num.to_i,\n card_has: card_has.to_i,\n }\nend", "def production_number\n @production_number\n end", "def next_available_number\n session.request Debtor.soap_action(:get_next_available_number)\n end", "def receipt_code(xml_doc)\n node = xml_doc && xml_doc.at_css('Kvit')\n node && node['v'] ? node['v'].to_i : -1\n end", "def primary_fta_service_type_id=(num)\n build_primary_assets_fta_service_type(fta_service_type_id: num, is_primary: true)\n end", "def ndp_code; self[:ndp_code].to_i; end", "def po_num\n unescape params['x_po_num']\n end", "def product_info\n {\n product_name: {\n default_value: 'similarity detection reference tool'\n },\n product_version: '1.0',\n description: {\n default_value: 'LTI 2.1 tool provider reference implementation'\n },\n product_family: {\n code: 'similarity detection reference tool',\n vendor: {\n code: 'Instructure.com',\n vendor_name: {\n default_value: 'Instructure'\n },\n description: {\n default_value: 'Canvas Learning Management System'\n }\n }\n }\n }\n end", "def full_info number \n\t\tshort_text = description.split(\"<br>\")[0][0..59]\n\t\tshort_text = short_text + \"...\" if short_text.length == 60\n\t\t\"#{number}. #{short_text}\"\n\tend", "def production_number\n @production_number\n end", "def get_model_sys_id(model)\n query_data = URI::encode(model)\n url = \"#{@service_now_url}/table/cmdb_hardware_product_model?sysparm_query=display_name%3D#{query_data}\"\n sys_id = get_record_sys_id(url)\n sys_id\n end", "def interchange_control_header\n ['ISA', '00', (' ' * 10), '00', (' ' * 10), 'ZZ', payer_id.to_s.justify(15),\n 'ZZ', isa_08, Time.now().strftime(\"%y%m%d\"), Time.now().strftime(\"%H%M\"),\n ((!@output_version || @output_version == '4010') ? 'U' : '^'),\n ((!@output_version || @output_version == '4010') ? '00401' : '00501'),\n (@isa_record.isa_number.to_s.justify(9, '0') if @isa_record), '0', 'P', ':'].join(@element_seperator)\n end", "def get_prodid\n\t\t@attributes[:app_prod_id]\n\tend", "def item_id\n\tparams['item_number'] || params['custom']\n end", "def test_processor_input_field_count_for_retention_fee_line_item_number_pbid_and_payment_status_code_with_data\n svc = ServicePaymentEob.find(10)\n total_field_count = svc.processor_input_field_count(facilities(:facility_25), true)\n assert_equal(total_field_count, 4)\n end", "def an_numeric_component\n @record.eds_accession_number.split('.').last\n end", "def get_id (sku,type,store)\n id = \"\"\n case type\n when :main\n sku_ids = Product.select(:id).where(:sku => sku)\n sku_ids.each do |product|\n unless 0 == ContSpec.joins(\"INNER JOIN `cat_specs` ON `cont_specs`.product_id = `cat_specs`.product_id\").where(\"`cont_specs`.product_id = ? AND `cat_specs`.name = ? AND `cat_specs`.value REGEXP ?\",product.id,'product_type',store).count(\"*\")\n id = product.id\n end\n end\n when :accessory\n acc_ids = Product.select(:id).where(:sku => sku)\n acc_ids.each do |accessory|\n unless 0 == CatSpec.where(\"`cat_specs`.product_id = ? AND `cat_specs`.name = ? AND `cat_specs`.value REGEXP ?\",accessory.id,'product_type',store).count(\"*\")\n id = accessory.id\n end\n end\n when :category\n # Eventually add ability to find most suitable product type (when one product is in multiple categories)\n CatSpec.select(:value).joins(\"INNER JOIN `products` ON `cat_specs`.product_id = `products`.id\").where(products: {sku:sku}, cat_specs: {name:\"product_type\"}).each do |cat|\n if cat.value =~ /^#{store}/\n id = cat.value\n end\n end\n end\n id\nend", "def newMicroServiceType(name,abbr,style,opmode,min=1,max=1)\n\nend", "def producer\n #f = @properties.field('PRODID')\n #f && f.to_text\n @properties.text('PRODID').first\n end", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend", "def type_code \n 4\n end", "def quantity_description\n data[:quantity_description]\n end", "def south_african_pty_ltd_registration_number; end", "def service\n softlayer_client[:Product_Package].object_with_id(self.id)\n end", "def ena_support\n data[:ena_support]\n end", "def south_african_listed_company_registration_number; end", "def getIdFromString(option)\n str = option.split(\" \")\n str[1].to_i\nend", "def find_type_wellsfargo\n batch_id = csv[0][(config_hash['BANK_OF_AMERICA']['PAYMENT']['BATCH']['batchid'])].to_i\n (900..999).include?(batch_id) ? 'CORRESP' : 'PAYMENT'\n end", "def barcode\n str_order = order.id.to_s.rjust(5, '0')\n str_cardinality = 1.to_s.rjust(3, '0')\n str_order + str_cardinality\n end", "def capacity_reservation_specification\n data[:capacity_reservation_specification]\n end", "def request_info\n @service = ($evm.root['vmdb_object_type'] == 'service_template_provision_task')\n @miq_request = $evm.root['miq_request']\n $evm.log(:info, \"Request: #{@miq_request.description} id: #{@miq_request.id} \")\nend", "def numId\n id.to_s.slice(-9,9).hex.to_i\n end", "def ndp_code=(i); typecast i; end", "def voip_number\n FFaker.numerify('3### ####')\n end", "def find_test_no()\n\t\t@test=TestBooking.last\n\t\t@number=NumberMaster.last\n\t\[email protected]_id\t\n\t\tstr=\"\"\n\t\tif(@test)\n\t\t\t@[email protected]_id\n\n\t\t\[email protected]_length\n\t\t\ttest_no_prefix<<@test.barcode_id.slice!(test_no_prefix.length..test.length).next\n\t\t\treturn test_no_prefix\n\t\telse\n\t\t\t\n\t\t\ttest_no_prefix<<@number.barcode_id.to_s<<@number.barcode_length.to_s\n\t\t\tputs test_no_prefix\n\t\t\treturn test_no_prefix\n\n\t\tend\n\tend", "def message_send_device_id() -1003; end", "def identifier_code\n 'QuestionnaireResponseID'\n end", "def south_african_close_corporation_registration_number; end", "def value_cardtype_code\n :\"#{value_type_code}_value\"\nend", "def company_number\n 1\n end", "def productVersion \n \"productVersion\" \n end", "def to_s() designation_number; end" ]
[ "0.5923048", "0.57499444", "0.55433947", "0.55170137", "0.55041224", "0.549043", "0.5463996", "0.5418305", "0.539549", "0.53248733", "0.5254535", "0.5240311", "0.52114373", "0.51996535", "0.5197837", "0.5195088", "0.5146734", "0.513048", "0.51129854", "0.5106533", "0.50745547", "0.5058627", "0.50459254", "0.50450766", "0.5041785", "0.50332445", "0.5017708", "0.49939045", "0.49759904", "0.49677184", "0.49645802", "0.49614218", "0.4958078", "0.4941797", "0.4941362", "0.49233052", "0.4916826", "0.49072695", "0.4890213", "0.4872711", "0.4872198", "0.48712718", "0.48698646", "0.4849552", "0.4835035", "0.48340902", "0.48302653", "0.4823295", "0.48169938", "0.48132107", "0.48113194", "0.4807259", "0.4805751", "0.4804626", "0.4802619", "0.47991723", "0.479857", "0.47961888", "0.47898653", "0.47892147", "0.47839218", "0.47833708", "0.4780534", "0.477928", "0.47767773", "0.47624755", "0.47612906", "0.47562242", "0.47460565", "0.4742273", "0.47421026", "0.47329858", "0.473229", "0.4727426", "0.47201002", "0.47196522", "0.47180846", "0.47180846", "0.47055855", "0.47008872", "0.4681315", "0.46772477", "0.46680278", "0.4666446", "0.46662617", "0.46654508", "0.4657558", "0.46530885", "0.46530464", "0.46523887", "0.46518937", "0.46508712", "0.46490568", "0.46481922", "0.46473756", "0.4643037", "0.46359804", "0.46338096", "0.46331674", "0.4630376", "0.4620251" ]
0.0
-1
ACK09 Id: 235 Name: Product/Service ID Qualifier Type: ID Min/Max: 2/2 Description: Code identifying the type/source of the descriptive number used in Product/Service ID (234)
def ACK09=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manufacturer_id\n mac[0..7]\n end", "def identifier_code\n 'QuestionnaireResponseID'\n end", "def service_prov_identification\n code, qual = nil, nil\n claim = eob.claim_information\n\n if (claim && !claim.provider_npi.blank?)\n code = claim.provider_npi\n qual = 'XX'\n Output835.log.info \"Provider NPI from the 837 is chosen\"\n elsif (claim && !claim.provider_ein.blank?)\n code = claim.provider_ein\n qual = 'FI'\n Output835.log.info \"Provider TIN from 837 is chosen\"\n elsif !facility.facility_npi.blank?\n code = facility.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !facility.facility_tin.blank?\n code = facility.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def qualified_id\n qualified_code + \"-\" + \"%04d\" % self.code\n end", "def schema\n {\n 'AM'\t=> 'Segment Identification',\n 'EY'\t=> 'Provider ID Qualifier',\n 'E9'\t=> 'Provider ID' }\n end", "def default_service_msg_number\n 1002\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def composite_med_proc_id\n elem = []\n if ((!cpt_code.blank? and !revenue_code.blank?)|| revenue_code.blank?)\n proc_code = \"HC:#{cpt_code}\"\n else\n proc_code = \"NU:#{revenue_code}\"\n end\n\n # proc_code = ((!cpt_code.blank? and !revenue_code.blank?) || revenue_code.blank?) ? \"HC:#{cpt_code}\" : \"NU:#{revenue_code}\"\n elem = [proc_code, service.service_modifier1 , service.service_modifier2 ,\n service.service_modifier3 , service.service_modifier4]\n elem = Output835.trim_segment(elem)\n elem.join(':')\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def default_service_msg_number\n \"0002\"\n end", "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def short_code\n id.to_s 36\n end", "def service_code\n \"#{shipment_mode_code}#{service_type_code}#{services_code}\"\n end", "def polish_taxpayer_identification_number; end", "def identifier_code\n 'ICN'\n end", "def es_code\n id.to_s\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def header_for_id(id)\n raise 'Id must be 4 bytes' unless id.gsub(' ', '').length == 4*2\n # header is really \"B1 96 B1 D3 ED AE 5F 92 #{id}\"\n # however we're chopping off one byte to fit within 12 bytes in the search code.\n\n # the byte after item id changes. maybe 06 or 02 depending on the item.\n \"B1 96 B1 D3 ED AE 5F 92 #{id}\".gsub(' ', '')\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def card_identification\n message.fields[6].strip\n end", "def id_number; end", "def valid_id_number; end", "def value_cardtype_code\n :\"#{value_type_code}_value\"\nend", "def identifier_type\n {\n coding: [{\n system: CODING_SYSTEM,\n code: IDENTIFIER_CODE,\n userSelected: false\n }]\n }\n end", "def code\n '202'\n end", "def assess_insurance()\n\t\tvalues = self.comb_values()\n\t\treturn '0010000' if values.include?('930') #If extra service code 930 (insurance <= $200) is found, return manifest value for $100 ('0010000')\n\t\treturn '0050000' if values.include?('931') #If extra service code 931 (insurance > $200) is found, return manifest value for $500 ('0050000')\n\t\treturn false #If insurance values are not found, return false.\n\tend", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def Com6 # Recuperation Info\n \n end", "def type_code \n 4\n end", "def odk_code\n \"q#{id}\"\n end", "def odk_code\n \"q#{id}\"\n end", "def identifier=(value)\n value = value.to_i\n value = rand(65535) if value == 0\n @identifier = value\n @data.merge!({identifier: @identifier})\n # @identifier = [3, 4, value].pack('cnN')\n end", "def mintOAPID(metadata)\n if $testMode\n return \"ark:/13030/fk#{(0...8).map { (65 + rand(26)).chr }.join}\"\n else\n resp = $ezidSession.mint(metadata)\n resp.respond_to?(:errored?) and resp.errored? and raise(\"Error minting ark: #{resp.response}\")\n return resp.identifier\n end\nend", "def message_send_device_id() -1003; end", "def gene_id\n description.andand.match(/ GN=(\\w+) ?/)[1]\n end", "def id_lookup(id)\n id = id.to_i\n if (id >= 128) && (id <= 255)\n id = \"oem_data_#{id}\"\n elsif DMI::ID_TO_DESCRIPTION.key?(id)\n id = DMI::ID_TO_DESCRIPTION[id]\n else\n Ohai::Log.debug(\"unrecognized header id; falling back to 'unknown'\")\n id = \"unknown_dmi_id_#{id}\"\n end\n rescue\n Ohai::Log.debug(\"failed to look up id #{id}, returning unchanged\")\n id\n end", "def product_codes\n data[:product_codes]\n end", "def numid; end", "def south_african_pty_ltd_registration_number; end", "def nic_slot_id\n return \"0\" if fqdd.include?(\"NIC.Integrated\") || fqdd.include?(\"NIC.Embedded\")\n\n fqdd.scan(/NIC.Slot.(\\d+).*/).flatten.first\n end", "def nobasicas_indice_seq_con_id\n Msip::Ability::NOBASICAS_INDSEQID +\n Mr519Gen::Ability::NOBASICAS_INDSEQID +\n Heb412Gen::Ability::NOBASICAS_INDSEQID +\n Cor1440Gen::Ability::NOBASICAS_INDSEQID\n end", "def interchange_control_header\n ['ISA', '00', (' ' * 10), '00', (' ' * 10), 'ZZ', payer_id.to_s.justify(15),\n 'ZZ', isa_08, Time.now().strftime(\"%y%m%d\"), Time.now().strftime(\"%H%M\"),\n ((!@output_version || @output_version == '4010') ? 'U' : '^'),\n ((!@output_version || @output_version == '4010') ? '00401' : '00501'),\n (@isa_record.isa_number.to_s.justify(9, '0') if @isa_record), '0', 'P', ':'].join(@element_seperator)\n end", "def create_item_pack_product_code\n puts \"IN RETAIL CREATE IPC\"\n cosmetic_code = \"\"\n if self.label_code == \"U\" \n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"UL\"\n else\n cosmetic_code = \"WX\"\n end\n else\n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"LB\"\n else\n cosmetic_code = \"LW\"\n end\n \n end\n \n \n class_code = self.carton_setup.product_class_code\n puts \"prod sched: \" + self.production_schedule_code\n commodity = RmtSetup.find_by_production_schedule_name(self.production_schedule_code).commodity_code\n grade_code = self.carton_setup.grade_code\n \n std_count = StandardSizeCount.find_by_standard_size_count_value_and_commodity_code_and_basic_pack_code(self.carton_setup.standard_size_count_value,commodity,self.basic_pack_code)\n \n if !std_count\n err = \"An IPC could not be found or created, because no standard_size_count record exists for the following field values: <br>\"\n err += \"standard_size_count_value: \" + self.carton_setup.standard_size_count_value.to_s + \"<br>\"\n err += \"commodity: \" + commodity + \"<br>\"\n err += \"basic_pack_code: \" + self.basic_pack_code\n raise err\n \n end\n actual_count = std_count.actual_count\n \n variety = self.carton_setup.marketing_variety_code\n \n item_pack = ItemPackProduct.find_by_product_class_code_and_commodity_code_and_grade_code_and_actual_count_and_marketing_variety_code_and_cosmetic_code_name_and_size_ref_and_basic_pack_code(class_code,commodity,grade_code,actual_count,variety,cosmetic_code,self.size_ref,self.basic_pack_code)\n \n if ! item_pack\n \n item_pack = ItemPackProduct.new\n item_pack.product_class_code = class_code\n item_pack.commodity_code = commodity\n item_pack.commodity_group_code = std_count.commodity.commodity_group_code\n item_pack.cosmetic_code_name = cosmetic_code\n item_pack.grade_code = grade_code\n item_pack.basic_pack_code = self.basic_pack_code\n \n item_pack.treatment_code = self.carton_setup.treatment_code\n item_pack.treatment = Treatment.find_by_treatment_code_and_treatment_type_code(item_pack.treatment_code,\"PACKHOUSE\")\n item_pack.grade = Grade.find_by_grade_code(grade_code)\n item_pack.standard_size_count = std_count\n item_pack.standard_size_count_value = std_count.standard_size_count_value\n item_pack.marketing_variety_code = variety\n item_pack.actual_count = actual_count\n item_pack.size_ref = self.size_ref\n puts item_pack.size_ref\n item_pack.create\n \n \n end\n \n \n if ! self.new_record?\n old_ri = RetailItemSetup.find(self.id)\n old_ipc = old_ri.item_pack_product_code \n old_mark = old_ri.mark_code\n end\n \n self.item_pack_product = item_pack\n \n \n self.item_pack_product_code = item_pack.item_pack_product_code\n \n if ! self.new_record? && self.carton_setup.fg_setup\n \n if old_ipc != self.item_pack_product_code||old_mark != self.mark_code\n @update_fg = true\n end\n end\n \n end", "def qos_class_identifier(rule_name, info)\n #\n end", "def component_id(barcode:)\n @cid_lookup[barcode]\n end", "def credit_card_type; end", "def get_serial_number(data)\n data['product']['serial_number'] || 'n/a'\n end", "def identifier\n num\n end", "def barcode\n str_order = order.id.to_s.rjust(5, '0')\n str_cardinality = 1.to_s.rjust(3, '0')\n str_order + str_cardinality\n end", "def credit_card_number; end", "def type\n length = @number.size\n if length == 15 && @number =~ /^(34|37)/\n \"AMEX\"\n elsif length == 16 && @number =~ /^6011/\n \"Discover\"\n elsif length == 16 && @number =~ /^5[1-5]/\n \"MasterCard\"\n elsif (length == 13 || length == 16) && @number =~ /^4/\n \"Visa\"\n else\n \"Unknown\"\n end\n end", "def hex_trace_id\n trace_id.unpack1('H*')\n end", "def barcode\n \"*#{identifier}*\"\n end", "def get_codeSignIdentity(type)\r\n\tif type == 0 then\r\n\t\treturn 'iPhone Developer'\r\n\telsif type == 1 or type == 2 then\r\n\t\treturn 'iPhone Distribution'\r\n\telse\r\n\t\traise \"Unknown mobileprovision type #{type}\"\r\n\tend\r\nend", "def name_record_long(type, ext_ref) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x002a # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x001a # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n\n unknown03 = 0x29\n unknown04 = 0x0017\n unknown05 = 0x3b\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n\n # Column definition\n data += [unknown03].pack(\"C\")\n data += [unknown04].pack(\"v\")\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [0x0000].pack(\"v\")\n data += [0xffff].pack(\"v\")\n data += [@col_min].pack(\"v\")\n data += [@col_max].pack(\"v\")\n\n # Row definition\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [@row_min].pack(\"v\")\n data += [@row_max].pack(\"v\")\n data += [0x00].pack(\"v\")\n data += [0xff].pack(\"v\")\n # End of data\n data += [0x10].pack(\"C\")\n\n [header, data]\n end", "def south_african_close_corporation_registration_number; end", "def identifier(no_version: false)\n return emma_recordId if emma_recordId.present?\n parts = [emma_repository, emma_repositoryRecordId, dc_format]\n parts << emma_formatVersion unless no_version\n parts.compact_blank.join('-').presence\n end", "def rp_id; end", "def premium_service_number\n FFaker.numerify('1900 ### ####')\n end", "def op_code\n 2004\n end", "def interface_name(class_def)\n \t_IDENTIFIER5 = nil\n\n\n\n\n # 55:7: IDENTIFIER\n _IDENTIFIER5 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.add_interface(_IDENTIFIER5.text) \n\n\n\n end", "def pcb_a_part_number(number,\n revision, \n numeric_revision)\n\n self.loaded_prefix + '-' + number + '-00'\n \n end", "def invalid_id_number; end", "def sic_code; end", "def simple_identifier\n {\n id: @se_identifier.to_s,\n message: 'identifier is missing required elements'\n }\n end", "def acknowledgement_reference_id\r\n\t\tacknowledgement_message.split(\":\")[1].gsub(/\\s/,\"\")\r\n\tend", "def type_id\n @type_id ||= extract_int(@content[0...TYPE_SIZE])\n end", "def getClientIdentificationObjName\r\n\t\t\treturn \"mfiforce__Client_Identification__c\"\r\n\t\tend", "def qrda_oid_for_hqmf_patient_characteristic(vs_oid, qrda_version = nil)\n # This is a special case. This HQMF OID maps to more than one QRDA OID.\n # So we need to try to figure out what template we should use based on the\n # content of the entry\n case vs_oid\n when '2.16.840.1.113883.3.526.3.1279'\n # Patient Characteristic Observation Assertion template for\n # Patient Characteristic: ECOG Performance Status-Poor\n qrda_version == 'r3_1' ? '2.16.840.1.113883.10.20.24.3.103_2016_02_01' : '2.16.840.1.113883.10.20.24.3.103'\n when '2.16.840.1.113883.3.117.1.7.1.402', '2.16.840.1.113883.3.117.1.7.1.403',\n '2.16.840.1.113883.3.117.1.7.1.287', '2.16.840.1.113883.3.117.1.7.1.307'\n # Patient Charasteristic Gestational Age\n '2.16.840.1.113883.10.20.24.3.101'\n when '2.16.840.1.113883.3.526.3.1189', '2.16.840.1.113883.3.526.3.1170', '2.16.840.1.113883.3.600.2390'\n # Patient Characteristic Tobacco User/Non-User\n case qrda_version\n when 'r3_1'\n '2.16.840.1.113883.10.20.24.3.103_2016_02_01'\n when 'r3'\n '2.16.840.1.113883.10.20.24.3.103'\n else\n '2.16.840.1.113883.10.20.22.4.85'\n end\n else\n # return generic pc observation template for anything not specificly mapped to its own template\n qrda_version == 'r3_1' ? '2.16.840.1.113883.10.20.24.3.103_2016_02_01' : '2.16.840.1.113883.10.20.24.3.103'\n end\n\n end", "def test_855\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*855*0001~\n BAK*00*AC*00000007397108*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n PO1*1*1*EA*59.95**UP*860001662184*VP*860001662184~\n PID*F****CBD Topical Cream 400mg THC Free~\n ACK*IA*1*EA****UP*860001662184*VP*860001662184~\n PO1*2*2*EA*49.95**UP*860001662108*VP*860001662108~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n ACK*IA*2*EA****UP*860001662108*VP*860001662108~\n CTT*2~\n SE*13*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS855::TS.new(store)\n ts.BAK do |bak|\n bak.TransactionSetPurposeCode = \"00\"\n bak.AcknowledgmentType = \"AC\"\n bak.PurchaseOrderNumber = \"00000007397108\"\n bak.Date = @epoch\n end\n ts.L_N1 do |rep|\n # N1\n rep.N1.EntityIdentifierCode = \"ST\"\n rep.N1.Name = \"Sweeney Todd\"\n # N3\n rep.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n rep.N4.CityName = \"Birmingham\"\n rep.N4.StateOrProvinceCode = \"AL\"\n rep.N4.PostalCode = \"35226\"\n rep.N4.CountryCode = \"US\"\n end\n ts.L_PO1 do |rep|\n rep.PO1.AssignedIdentification = \"1\"\n rep.PO1.QuantityOrdered = 1\n rep.PO1.UnitOrBasisForMeasurementCode = \"EA\"\n rep.PO1.UnitPrice = 59.95\n rep.PO1.ProductServiceIdQualifier1 = \"UP\"\n rep.PO1.ProductServiceId1 = \"860001662184\"\n rep.PO1.ProductServiceIdQualifier2 = \"VP\"\n rep.PO1.ProductServiceId2 = \"860001662184\"\n rep.L_PID do |rep|\n rep.PID.ItemDescriptionType = \"F\"\n rep.PID.Description = \"CBD Topical Cream 400mg THC Free\"\n end\n rep.L_ACK do |rep|\n rep.ACK.LineItemStatusCode = \"IA\"\n rep.ACK.Quantity = 1\n rep.ACK.UnitOrBasisForMeasurementCode = \"EA\"\n rep.ACK.ACK07 = \"UP\"\n rep.ACK.ACK08 = \"860001662184\"\n rep.ACK.ACK09 = \"VP\"\n rep.ACK.ACK10 = \"860001662184\"\n end\n end\n ts.L_PO1 do |rep|\n rep.PO1.AssignedIdentification = \"2\"\n rep.PO1.QuantityOrdered = 2\n rep.PO1.UnitOrBasisForMeasurementCode = \"EA\"\n rep.PO1.UnitPrice = 49.95\n rep.PO1.ProductServiceIdQualifier1 = \"UP\"\n rep.PO1.ProductServiceId1 = \"860001662108\"\n rep.PO1.ProductServiceIdQualifier2 = \"VP\"\n rep.PO1.ProductServiceId2 = \"860001662108\"\n rep.L_PID do |rep|\n rep.PID.ItemDescriptionType = \"F\"\n rep.PID.Description = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n rep.L_ACK do |rep|\n rep.ACK.LineItemStatusCode = \"IA\"\n rep.ACK.Quantity = 2\n rep.ACK.UnitOrBasisForMeasurementCode = \"EA\"\n rep.ACK.ACK07 = \"UP\"\n rep.ACK.ACK08 = \"860001662108\"\n rep.ACK.ACK09 = \"VP\"\n rep.ACK.ACK10 = \"860001662108\"\n end\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end", "def part_number\n productnum\n end", "def op_code\n 2002\n end", "def autonomous_system_number; end", "def product_type_decode(type)\n return \"Workstation\" if type == 1\n\n \"Server\"\n end", "def id\n code\n end", "def number\n\t\tname.gsub(/^rfc/i, '').to_i\n\tend", "def pty_ltd_registration_number; end", "def identifiers\n {'issn' => @issn, 'eissn' => @eissn, 'isbn' => @isbn, 'eisbn' => @eisbn, 'oclc' => @oclc, 'lccn' => @lccn, 'doi' => @doi,\n 'svc_specific_id_1' => @svc_specific_id_1, 'svc_specific_id_2' => @svc_specific_id_2, 'svc_specific_id_3' => @svc_specific_id_3}\n end", "def test_get_unique_codes_for_id\n reason_code_ids = [100]\n reason_code_records = []\n reason_code_records << reason_codes(:reason_code100)\n reason_code_records << reason_codes(:reason_code101)\n reason_code_records << reason_codes(:reason_code102)\n assert_equal(\"5D\", ReasonCode.get_unique_codes_for(reason_code_records, reason_code_ids))\n end", "def item_id\n params['VendorTxCode']\n end", "def item_code( seqno )\n \"#{ code }-#{ seqno ? seqno : '?' }\"\n end", "def getacquirerid()\r\n return getvalue(SVTags::ACQUIRER_ID)\r\n end", "def version_needed_to_extract\n 0x0014\n end", "def version_needed_to_extract\n 0x0014\n end", "def south_african_listed_company_registration_number; end", "def mint_ark\n Ezid::Identifier.mint\nend", "def payer_reason_codes_for_nyu\n (facility.sitecode.to_s.strip == '00549' && eob.patient_account_number.to_s[0..2] == 'SAL') ? {0 => 'REF'} : nil\n end", "def name_record_short(type, ext_ref, hidden = nil) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x001b # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x000b # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n unknown03 = 0x3b #\n\n grbit = 0x0021 if hidden\n\n rowmin = row_min\n rowmax = row_max\n rowmin, rowmax = 0x0000, 0xffff unless row_min\n\n colmin = col_min\n colmax = col_max\n colmin, colmax = 0x00, 0xff unless col_min\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n data += [unknown03].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n\n data += [rowmin].pack(\"v\")\n data += [rowmax].pack(\"v\")\n data += [colmin].pack(\"v\")\n data += [colmax].pack(\"v\")\n\n [header, data]\n end", "def genetic_code_table; 11; end", "def full_no\n # Debt claim no (Office & year & sequential number) => OOOO-YYYY-NNNNN\n if claim_no == \"$err\"\n \"0000-0000-00000\"\n else\n claim_no.blank? ? \"\" : claim_no[0..3] + '-' + claim_no[4..7] + '-' + claim_no[8..12]\n end\n end", "def producer\n #f = @properties.field('PRODID')\n #f && f.to_text\n @properties.text('PRODID').first\n end", "def _verxlhigh(id)\n {\n 0x0 => :'Excel 97',\n 0x1 => :'Excel 2000',\n 0x2 => :'Excel 2002',\n 0x3 => :'Excel 2003',\n 0x4 => :'Excel 2007',\n 0x6 => :'Excel 2010',\n 0x7 => :'Excel 2013'\n }[id]\n end", "def name\n return 'XcelEDAReportingandQAQC'\n end", "def vendor\n return :qlogic if self[\"VendorName\"] =~ /qlogic|broadcom/i\n return :qlogic if self[\"PCIVendorID\"] == \"14e4\"\n\n return :mellanox if self[\"VendorName\"] =~ /mellanox/i\n return :mellanox if self[\"PCIVendorID\"] == \"15b3\"\n\n return :intel if self[\"VendorName\"] =~ /intel/i\n\n :intel if self[\"PCIVendorID\"] == \"8086\" # have seen cases where VendorName not populated\n end", "def short\n rid\n end", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def pcb_unique_number\n self.pcb_prefix + '-' + self.pcb_number\n end", "def entry_helper_code(code, display, type, value_code, value_display, entry_type = 'COMP')\n s_entry = entry_helper(entry_type)\n s_obs = observation_helper('OBS', 'EVN')\n s_entry << s_obs\n s_obs << code_helper(code, '2.16.840.1.114222.4.5.1', display, 'NEDSS Base System')\n s_obs << value_helper_code(type, value_code, '1.2.3.5', value_display)\n s_entry\n end", "def quality_indicator_name\n \"code complexity\"\n end" ]
[ "0.5930636", "0.57382226", "0.5727505", "0.5642756", "0.5642053", "0.56048656", "0.55941564", "0.5573798", "0.5573516", "0.55725354", "0.5537394", "0.5473357", "0.5447961", "0.5375135", "0.5370509", "0.53426796", "0.5300786", "0.5299057", "0.5298297", "0.52878845", "0.5287061", "0.5265248", "0.524779", "0.52463084", "0.5236099", "0.5227342", "0.52196", "0.52007276", "0.52007276", "0.51963305", "0.51861596", "0.51849115", "0.51849115", "0.51750296", "0.51545644", "0.51531714", "0.5146238", "0.5143776", "0.51373106", "0.5124017", "0.5108933", "0.51040375", "0.50978297", "0.50962424", "0.50868946", "0.5069914", "0.50663626", "0.5061627", "0.50589705", "0.50518364", "0.50425655", "0.50271726", "0.5026954", "0.5025578", "0.50253505", "0.50130445", "0.50112617", "0.50033724", "0.50008374", "0.49943772", "0.4990806", "0.49906832", "0.49889067", "0.4987733", "0.49875644", "0.4986828", "0.49805865", "0.49793473", "0.49739408", "0.4972336", "0.4965872", "0.49644598", "0.4957091", "0.49497914", "0.49480608", "0.49405578", "0.4939055", "0.4935354", "0.4935264", "0.4934346", "0.49337596", "0.4933142", "0.4927681", "0.49125043", "0.49078012", "0.49078012", "0.49001294", "0.4899396", "0.48936492", "0.48873696", "0.48868054", "0.48845503", "0.48771185", "0.48768154", "0.4870377", "0.48569685", "0.4848688", "0.48449537", "0.48441613", "0.48359463", "0.48350018" ]
0.0
-1
ACK10 Id: 234 Name: Product/Service ID Type: AN Min/Max: 1/48 Description: Identifying number for a product or service
def ACK10=(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_service_msg_number\n 1002\n end", "def default_service_msg_number\n \"0002\"\n end", "def get_serial_number(data)\n data['product']['serial_number'] || 'n/a'\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def manufacturer_id\n mac[0..7]\n end", "def premium_service_number\n FFaker.numerify('1900 ### ####')\n end", "def assess_insurance()\n\t\tvalues = self.comb_values()\n\t\treturn '0010000' if values.include?('930') #If extra service code 930 (insurance <= $200) is found, return manifest value for $100 ('0010000')\n\t\treturn '0050000' if values.include?('931') #If extra service code 931 (insurance > $200) is found, return manifest value for $500 ('0050000')\n\t\treturn false #If insurance values are not found, return false.\n\tend", "def service_prov_identification\n code, qual = nil, nil\n claim = eob.claim_information\n\n if (claim && !claim.provider_npi.blank?)\n code = claim.provider_npi\n qual = 'XX'\n Output835.log.info \"Provider NPI from the 837 is chosen\"\n elsif (claim && !claim.provider_ein.blank?)\n code = claim.provider_ein\n qual = 'FI'\n Output835.log.info \"Provider TIN from 837 is chosen\"\n elsif !facility.facility_npi.blank?\n code = facility.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !facility.facility_tin.blank?\n code = facility.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def part_number\n productnum\n end", "def service_code\n \"#{shipment_mode_code}#{service_type_code}#{services_code}\"\n end", "def Com6 # Recuperation Info\n \n end", "def polish_taxpayer_identification_number; end", "def composite_med_proc_id\n elem = []\n if ((!cpt_code.blank? and !revenue_code.blank?)|| revenue_code.blank?)\n proc_code = \"HC:#{cpt_code}\"\n else\n proc_code = \"NU:#{revenue_code}\"\n end\n\n # proc_code = ((!cpt_code.blank? and !revenue_code.blank?) || revenue_code.blank?) ? \"HC:#{cpt_code}\" : \"NU:#{revenue_code}\"\n elem = [proc_code, service.service_modifier1 , service.service_modifier2 ,\n service.service_modifier3 , service.service_modifier4]\n elem = Output835.trim_segment(elem)\n elem.join(':')\n end", "def nic_slot_id\n return \"0\" if fqdd.include?(\"NIC.Integrated\") || fqdd.include?(\"NIC.Embedded\")\n\n fqdd.scan(/NIC.Slot.(\\d+).*/).flatten.first\n end", "def create_item_pack_product_code\n puts \"IN RETAIL CREATE IPC\"\n cosmetic_code = \"\"\n if self.label_code == \"U\" \n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"UL\"\n else\n cosmetic_code = \"WX\"\n end\n else\n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"LB\"\n else\n cosmetic_code = \"LW\"\n end\n \n end\n \n \n class_code = self.carton_setup.product_class_code\n puts \"prod sched: \" + self.production_schedule_code\n commodity = RmtSetup.find_by_production_schedule_name(self.production_schedule_code).commodity_code\n grade_code = self.carton_setup.grade_code\n \n std_count = StandardSizeCount.find_by_standard_size_count_value_and_commodity_code_and_basic_pack_code(self.carton_setup.standard_size_count_value,commodity,self.basic_pack_code)\n \n if !std_count\n err = \"An IPC could not be found or created, because no standard_size_count record exists for the following field values: <br>\"\n err += \"standard_size_count_value: \" + self.carton_setup.standard_size_count_value.to_s + \"<br>\"\n err += \"commodity: \" + commodity + \"<br>\"\n err += \"basic_pack_code: \" + self.basic_pack_code\n raise err\n \n end\n actual_count = std_count.actual_count\n \n variety = self.carton_setup.marketing_variety_code\n \n item_pack = ItemPackProduct.find_by_product_class_code_and_commodity_code_and_grade_code_and_actual_count_and_marketing_variety_code_and_cosmetic_code_name_and_size_ref_and_basic_pack_code(class_code,commodity,grade_code,actual_count,variety,cosmetic_code,self.size_ref,self.basic_pack_code)\n \n if ! item_pack\n \n item_pack = ItemPackProduct.new\n item_pack.product_class_code = class_code\n item_pack.commodity_code = commodity\n item_pack.commodity_group_code = std_count.commodity.commodity_group_code\n item_pack.cosmetic_code_name = cosmetic_code\n item_pack.grade_code = grade_code\n item_pack.basic_pack_code = self.basic_pack_code\n \n item_pack.treatment_code = self.carton_setup.treatment_code\n item_pack.treatment = Treatment.find_by_treatment_code_and_treatment_type_code(item_pack.treatment_code,\"PACKHOUSE\")\n item_pack.grade = Grade.find_by_grade_code(grade_code)\n item_pack.standard_size_count = std_count\n item_pack.standard_size_count_value = std_count.standard_size_count_value\n item_pack.marketing_variety_code = variety\n item_pack.actual_count = actual_count\n item_pack.size_ref = self.size_ref\n puts item_pack.size_ref\n item_pack.create\n \n \n end\n \n \n if ! self.new_record?\n old_ri = RetailItemSetup.find(self.id)\n old_ipc = old_ri.item_pack_product_code \n old_mark = old_ri.mark_code\n end\n \n self.item_pack_product = item_pack\n \n \n self.item_pack_product_code = item_pack.item_pack_product_code\n \n if ! self.new_record? && self.carton_setup.fg_setup\n \n if old_ipc != self.item_pack_product_code||old_mark != self.mark_code\n @update_fg = true\n end\n end\n \n end", "def autonomous_system_number; end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def get_entity_id(section, service)\n return section if service.nil? or service.empty?\n section+service.rjust(3, '0')\nend", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << svc_revenue_code\n service_payment_elements << service.service_quantity.to_f.to_amount\n service_payment_elements = Output835.trim_segment(service_payment_elements)\n service_payment_elements.join(@element_seperator )\n end", "def extract_product_id(order_line_product_id)\n api.lookup_product(order_line_product_id)['number']\n end", "def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << revenue_code\n service_payment_elements.join(@element_seperator )\n end", "def numid; end", "def tl_dr_version\n client = SoftLayer::Client.new(\n # :username => \"joecustomer\" # enter your username here\n # :api_key => \"feeddeadbeefbadf00d...\" # enter your api key here\n )\n\n # Select a package\n quad_intel_package = SoftLayer::ProductPackage.package_with_id(client, 32)\n\n # Find required Categories and fill config_options with defaults\n config_options = {}\n required_categories = quad_intel_package.configuration.select { |category| category.required? }\n required_categories.each { |required_category| config_options[required_category.categoryCode] = required_category.default_option }\n\n # Provide a value for missing config categories\n config_options['server'] = 1417 # price id of Quad Processor Quad Core Intel 7420 - 2.13GHz (Dunnington) - 4 x 6MB / 8MB cache\n\n # With all the config options in place we can now construct the product order.\n server_order = SoftLayer::BareMetalServerOrder_Package.new(quad_intel_package, client)\n server_order.location = 'sng01'\n server_order.hostname = 'sample'\n server_order.domain = 'softlayerapi.org'\n server_order.configuration_options = config_options\n\n begin\n server_order.verify()\n puts \"The Order appears to be OK\"\n rescue Exception => e\n puts \"Order didn't verify :-( #{e}\"\n end\nend", "def item_id\n params['VendorTxCode']\n end", "def id_number; end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def product_tag\n @product_id ||= node.product_id\n case @product_id\n when /N3K-C35/\n tag = 'n35'\n when /N3/\n tag = Utils.fretta? ? 'n3k-f' : 'n3k'\n when /N5/\n tag = 'n5k'\n when /N6/\n tag = 'n6k'\n when /N7/\n tag = 'n7k'\n when /N9/\n tag = Utils.fretta? ? 'n9k-f' : 'n9k'\n else\n fail \"Unrecognized product_id: #{@product_id}\"\n end\n tag\n end", "def product_codes\n data[:product_codes]\n end", "def linkwizard_crm_num_field\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/ats-enter_subscriber_number_field/\") ,__method__)\n end", "def short_number\n \"#{self.is_a?(PurchaseInvoice) ? 'PI' : (self.is_a?(SalesInvoice) ? 'SI' : 'IN') }-#{number_without_formatting}\"\n end", "def get_client_info_int(question)\n\tputs question\n\tgets.to_i\nend", "def test_processor_input_field_count_with_for_with_remark_codes\n svc = service_payment_eobs(:svc_7)\n total_field_count = svc.processor_input_field_count(facilities(:facility8), false)\n assert_equal(total_field_count, 7)\n end", "def type\n length = @number.size\n if length == 15 && @number =~ /^(34|37)/\n \"AMEX\"\n elsif length == 16 && @number =~ /^6011/\n \"Discover\"\n elsif length == 16 && @number =~ /^5[1-5]/\n \"MasterCard\"\n elsif (length == 13 || length == 16) && @number =~ /^4/\n \"Visa\"\n else\n \"Unknown\"\n end\n end", "def invoice_num\n item_id\n end", "def item_id\n unescape params['x_invoice_num']\n end", "def item_id\n unescape params['x_invoice_num']\n end", "def valid_id_number; end", "def satellitenumber\n @line1[02...07].to_i\n end", "def identifier\n num\n end", "def paybox_transaction_number\n return unless accepted_payment.present? && accepted_payment.paybox_transaction.present?\n \"Num Appel : #{accepted_payment.paybox_transaction[0..9]} | Ref Paybox : #{accepted_payment.paybox_transaction[10..19]}\"\n end", "def invoice_num\n item_id\n end", "def mintOAPID(metadata)\n if $testMode\n return \"ark:/13030/fk#{(0...8).map { (65 + rand(26)).chr }.join}\"\n else\n resp = $ezidSession.mint(metadata)\n resp.respond_to?(:errored?) and resp.errored? and raise(\"Error minting ark: #{resp.response}\")\n return resp.identifier\n end\nend", "def capacity_type\n\t\t\t\t\t:integer\n\t\t\t\tend", "def production_number\n @production_number\n end", "def get_desired_count\n return @describe_service.services[0].desired_count\n end", "def item_id\n\tparams['item_number'] || params['custom']\n end", "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def consume_number; end", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend", "def get_prodid\n\t\t@attributes[:app_prod_id]\n\tend", "def extract_invoice_id\n invoice_id = Converter.xml_get('Betreff_NR', self.order)\n if invoice_id && invoice_id.match(/Rechnung Nr/)\n self.id = invoice_id.match(/\\d+/)[0]\n end\n end", "def product_info\n {\n product_name: {\n default_value: 'similarity detection reference tool'\n },\n product_version: '1.0',\n description: {\n default_value: 'LTI 2.1 tool provider reference implementation'\n },\n product_family: {\n code: 'similarity detection reference tool',\n vendor: {\n code: 'Instructure.com',\n vendor_name: {\n default_value: 'Instructure'\n },\n description: {\n default_value: 'Canvas Learning Management System'\n }\n }\n }\n }\n end", "def production_number\n @production_number\n end", "def determineMachineId(record, regex)\n message = record[\"message\"]\n if message !~ regex\n log.info \"Returning record without BareMetalMachineID info: message #{message} did not match regex #{regex}\"\n return\n end\n\n chassisNumber = message[regex,1]\n bladeNumber = message[regex,2]\n\n begin\n serviceProfile = getServiceProfile(record[ucsHostNameKey], chassisNumber, bladeNumber, 1)\n rescue SecurityError => se\n record[\"error\"] += \"Error getting service profile: #{se.message}\"\n end\n\n if !serviceProfile.to_s.empty?\n record[\"machineId\"] = \"Cisco_UCS:#{coloregion}:#{serviceProfile}\"\n end\n end", "def slot_number_for_registration_number(regis_no)\n @parcel.get(\"slot_number_for_registration_number\", regis_no, nil)\nend", "def service_type_name\n \"\" \n end", "def option_number\n pricing_db_hp_support_option.option_number\n end", "def full_info number \n\t\tshort_text = description.split(\"<br>\")[0][0..59]\n\t\tshort_text = short_text + \"...\" if short_text.length == 60\n\t\t\"#{number}. #{short_text}\"\n\tend", "def service\n softlayer_client[:Product_Package].object_with_id(self.id)\n end", "def extract_data line\n card_num = line.match(/^\\d+/).to_s\n card_name = line.gsub(/^\\d+/,\"\").strip\n require 'pry'; binding.pry;\n if card_has = line.match(/\\[(\\d+)\\]/)\n card_has = card_has.captures.first\n card_name = card_name.gsub(/\\[\\d+\\]/,\"\").strip\n else\n card_has = 0\n end\n card = {\n card_name: card_name,\n card_num: card_num.to_i,\n card_has: card_has.to_i,\n }\nend", "def primary_fta_service_type_id=(num)\n build_primary_assets_fta_service_type(fta_service_type_id: num, is_primary: true)\n end", "def next_available_number\n session.request Debtor.soap_action(:get_next_available_number)\n end", "def producer\n #f = @properties.field('PRODID')\n #f && f.to_text\n @properties.text('PRODID').first\n end", "def po_num\n unescape params['x_po_num']\n end", "def quantity_description\n data[:quantity_description]\n end", "def request_info\n @service = ($evm.root['vmdb_object_type'] == 'service_template_provision_task')\n @miq_request = $evm.root['miq_request']\n $evm.log(:info, \"Request: #{@miq_request.description} id: #{@miq_request.id} \")\nend", "def schema\n {\n 'AM'\t=> 'Segment Identification',\n 'EY'\t=> 'Provider ID Qualifier',\n 'E9'\t=> 'Provider ID' }\n end", "def number\n\t\tname.gsub(/^rfc/i, '').to_i\n\tend", "def get_model_sys_id(model)\n query_data = URI::encode(model)\n url = \"#{@service_now_url}/table/cmdb_hardware_product_model?sysparm_query=display_name%3D#{query_data}\"\n sys_id = get_record_sys_id(url)\n sys_id\n end", "def message_send_device_id() -1003; end", "def product_type_decode(type)\n return \"Workstation\" if type == 1\n\n \"Server\"\n end", "def newMicroServiceType(name,abbr,style,opmode,min=1,max=1)\n\nend", "def assign_id\n noid_service.mint\n end", "def receipt_code(xml_doc)\n node = xml_doc && xml_doc.at_css('Kvit')\n node && node['v'] ? node['v'].to_i : -1\n end", "def test_processor_input_field_count_for_retention_fee_line_item_number_pbid_and_payment_status_code_with_data\n svc = ServicePaymentEob.find(10)\n total_field_count = svc.processor_input_field_count(facilities(:facility_25), true)\n assert_equal(total_field_count, 4)\n end", "def get_id (sku,type,store)\n id = \"\"\n case type\n when :main\n sku_ids = Product.select(:id).where(:sku => sku)\n sku_ids.each do |product|\n unless 0 == ContSpec.joins(\"INNER JOIN `cat_specs` ON `cont_specs`.product_id = `cat_specs`.product_id\").where(\"`cont_specs`.product_id = ? AND `cat_specs`.name = ? AND `cat_specs`.value REGEXP ?\",product.id,'product_type',store).count(\"*\")\n id = product.id\n end\n end\n when :accessory\n acc_ids = Product.select(:id).where(:sku => sku)\n acc_ids.each do |accessory|\n unless 0 == CatSpec.where(\"`cat_specs`.product_id = ? AND `cat_specs`.name = ? AND `cat_specs`.value REGEXP ?\",accessory.id,'product_type',store).count(\"*\")\n id = accessory.id\n end\n end\n when :category\n # Eventually add ability to find most suitable product type (when one product is in multiple categories)\n CatSpec.select(:value).joins(\"INNER JOIN `products` ON `cat_specs`.product_id = `products`.id\").where(products: {sku:sku}, cat_specs: {name:\"product_type\"}).each do |cat|\n if cat.value =~ /^#{store}/\n id = cat.value\n end\n end\n end\n id\nend", "def nextCode(model,prefix,num)\n\t\t# naming= NamingSery.where('naming_type=\"Sale Invoice\"').first\n\t\tlastRecord=model.order(\"id desc\").first\n\t\t# name=''\n\t\t# if !naming.nil?\n\t\t# \tname=naming.series \n\t\t# end\n\n\t\tmaxNumber=''\n\t\t\tif !lastRecord.nil?\n\t\t\t\t\n\t\t\t\tnamingSeries=lastRecord[self]\n\t\t\t\tif !namingSeries.nil?\n\t\t\t\t\ti = 0\n\t\t\t\t\tlength = namingSeries.length\n\n\t\t\t\t\twhile i < length do\n\t\t\t\t\t\ti +=1\n\t\t\t\t\t \t chr=namingSeries[length-i].chr\n\t\t\t\t\t \tif (chr).is_number?\n\t\t\t\t\t \t\tmaxNumber.insert(0,chr)\t\t\t\t \t\t\n\t\t\t\t\t \telse\n\t\t\t\t\t \t\tbreak\n\t\t\t\t\t \tend\n\t\t\t\t\t \n\t\t\t\t\tend\t\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\n\t\t\tend\n\t\treturn (maxNumber.to_i).generateCode(prefix,num)\n\tend", "def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend", "def ndp_code; self[:ndp_code].to_i; end", "def interchange_control_header\n ['ISA', '00', (' ' * 10), '00', (' ' * 10), 'ZZ', payer_id.to_s.justify(15),\n 'ZZ', isa_08, Time.now().strftime(\"%y%m%d\"), Time.now().strftime(\"%H%M\"),\n ((!@output_version || @output_version == '4010') ? 'U' : '^'),\n ((!@output_version || @output_version == '4010') ? '00401' : '00501'),\n (@isa_record.isa_number.to_s.justify(9, '0') if @isa_record), '0', 'P', ':'].join(@element_seperator)\n end", "def identifier_code\n 'QuestionnaireResponseID'\n end", "def details\n data = Storm::Base::SODServer.remote_call '/Product/details',\n :code => @code\n self.from_hash data\n end", "def quantity\n return @ucItemNumber.value\n end", "def value_cardtype_code\n :\"#{value_type_code}_value\"\nend", "def barcode\n str_order = order.id.to_s.rjust(5, '0')\n str_cardinality = 1.to_s.rjust(3, '0')\n str_order + str_cardinality\n end", "def tarifa number\r\n cmd_tarifa number\r\n return false unless wait_for last_label\r\n return @response_args\r\n end", "def item_id\n params['item_number'] || params['custom']\n end", "def item_id\n params['item_number'] || params['custom']\n end", "def vendor_info\n ioss_vendor_collect_id = '0356'\n\n Element.new('VendorInfo').tap do |vendor_info|\n vendor_info << element_with_value('VendorCollectIDNumber', opts[:sender_ioss_number] || '')\n vendor_info << element_with_value('VendorCollectIDTypeCode', ioss_vendor_collect_id)\n vendor_info << element_with_value('ConsigneeType', '02')\n end\n end", "def product_model\n # CHANGED: DRYed\n # if recurring_monthly; elsif device_model.blank?; else <device_name_and_part_number>\n recurring_monthly ? \"Recurring Monthly\" : \\\n (device_model.blank? ? \"Unknown\" : \\\n (PRODUCT_HASH.index(device_model.part_number) || '') + \" (\" + device_model.part_number + \")\"\n )\n \n # part_num_hash = PRODUCT_HASH.invert\n # \n # if(recurring_monthly == true)\n # \"Recurring Monthly\"\n # else\n # if !device_model.nil?\n # label = part_num_hash[device_model.part_number] + \" (\" + device_model.part_number + \")\" \n # else\n # label = \"Unknown\"\n # end\n # end\n end", "def capacity_reservation_specification\n data[:capacity_reservation_specification]\n end", "def item_id\n params['cs1']\n end", "def getIdFromString(option)\n str = option.split(\" \")\n str[1].to_i\nend", "def credit_card_number; end", "def tag\n #ban = true\n puts \"entro\"\n\n port_str = \"/dev/ttyACM0\" #may be different for you\n baud_rate = 115200\n data_bits = 8\n stop_bits = 1\n parity = SerialPort::NONE\n\n sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)\n # while ban do\n while (i = sp.gets.chomp) do\n \ti.slice!(\"Tag is not NDEF formatted.\")\n \ttagUID = i\n \tputs \"el while\"\n puts tagUID\n if tagUID.empty?\n\t ban= true\n\t else\n return tagUID\n\t end\n\n\n\n end\n #end\n #sp.closes\n end", "def company_number\n 1\n end", "def card_identification\n message.fields[6].strip\n end", "def productinfo\n \tif self.barcode.present?\n \t\tproduct = ProductList.where(list_barcode: self.barcode)\n\t \tif product.present?\n\t \t\tproduct.first.name + \" (\" + self.barcode + \")\"\n\t \telse\n\t \t\t\"<span style=color:violet;font-weight: normal; font-size:11px;>No barcode found in Product (Sell) List </span>\"\n\t \tend\n \telse\n \t\t\"<span style=color:violet;font-weight: normal; font-size:11px;>No barcode found in Product stock </span>\"\n \tend\n \t\n \n end" ]
[ "0.59463835", "0.57325035", "0.544988", "0.54101753", "0.5391643", "0.5390331", "0.5362745", "0.53425485", "0.5288533", "0.5267563", "0.52146196", "0.51571774", "0.5150533", "0.51503986", "0.5136635", "0.5098059", "0.50921005", "0.5071283", "0.50500387", "0.50330955", "0.5031296", "0.50020295", "0.49944326", "0.49689752", "0.49623764", "0.49595833", "0.49427712", "0.4940915", "0.49377665", "0.49362186", "0.4921933", "0.49216914", "0.49118555", "0.49083227", "0.48981288", "0.4893301", "0.48884696", "0.4885746", "0.4858219", "0.48517638", "0.4808768", "0.48067018", "0.47980526", "0.4796214", "0.4781816", "0.47802046", "0.477918", "0.47782686", "0.47770038", "0.47723484", "0.47583073", "0.47583073", "0.47571665", "0.4755204", "0.4755017", "0.4753454", "0.47511426", "0.47499508", "0.47440103", "0.47436368", "0.47312725", "0.4730179", "0.47289342", "0.4722727", "0.47208676", "0.47193453", "0.4717278", "0.47141647", "0.470867", "0.47061998", "0.47042668", "0.46996903", "0.46851313", "0.46847188", "0.4676342", "0.46721578", "0.46679875", "0.46619147", "0.46540526", "0.46459132", "0.46420363", "0.46373883", "0.46351135", "0.46308675", "0.46240646", "0.46213505", "0.46194208", "0.46168864", "0.46091914", "0.46010366", "0.46010366", "0.45999712", "0.45999107", "0.45950416", "0.4595041", "0.45942202", "0.45933792", "0.45888686", "0.45798236", "0.45757988", "0.45752776" ]
0.0
-1
Triggered by Group callbacks
def add_user_member(user, group) ids = users_by_group_id(group.id).push(user).map(&:id) current_ids = users_by_group_id(group.id).map(&:id) create_member(ids, current_ids, 'User', inherited_by: group.id, destroy: false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_update_group\n\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n self.create_activity :update, owner: current_user,organization_id: self.organization_id, params: {:detail => I18n.t('logs.update_group', group_name: self.name)}\n\n end", "def after_create_group\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n self.create_activity :create, owner: current_user,organization_id: self.organization_id, params: {:detail => I18n.t('logs.create_group', group_name: self.name)}\n end", "def on(group)\n @group = group\n self\n end", "def group; end", "def perform_save\n api.group_save(self)\n end", "def approver_group_finished\n return unless request.group_name\n\n send_event(EVENT_APPROVER_GROUP_FINISHED,\n :request_id => request.root.id,\n :group_name => request.group_name,\n :decision => request.decision,\n :reason => request.reason || '')\n end", "def group\n @object.send(:try, Innsights.group_call) if Innsights.group_call.present?\n end", "def postprocess(groups)\n end", "def group\n @group\n end", "def set_group\n data[:group]\n end", "def groups; end", "def groups; end", "def groups; end", "def update_group(increment)\n end", "def example_group_finished(notification)\n #super(notification)\n @example_group_stack.pop\n end", "def group_builder; end", "def group\n @group\n end", "def init_callback(&block)\n if @group.topic.nil?\n debug \"Delaying callback creation for 1 seconds\"\n OmfCommon.el.after(1) {\n init_callback(&block)\n }\n return\n end\n info \"Setting message callback for WiseGroup (#{self.name})\"\n @group.topic.on_message(:wise_group_callback_handler) { |msg|\n rid = msg.content.properties.requestId\n if rid.nil? && @@default_message_types.include?(msg.content.type)\n self.default_callback.call(msg) unless self.default_callback.nil?\n else\n callback = @callback_cache.fetch(rid)\n unless callback.nil?\n callback.call(msg.content.properties)\n else\n if @@default_message_types.include? msg.content.type\n self.default_callback.call(msg) unless self.default_callback.nil?\n end\n end\n end\n }\n block.call(self) if block\n\n end", "def current_group\n end", "def group(*) end", "def example_group_started(example_group_proxy)\n end", "def aggregate_after_grouping?; @aggregate_after_grouping; end", "def grouped hash = nil, &block\n @grouped = block\n @current_group_hash = hash\n\n # get current group from grouper and set response (unless the group hash is unchanged)\n\n async_group { |group| update_grouped( group ) }\n\n # wait for another client to update the group with an environment update or by signing off\n # if that did not happen after 60s, get group info and set response even if group hash is unchanged\n\n @peek_timer = EM::Timer.new(60) do\n async_group { |group| update_grouped( group, true ) }\n end\n end", "def group\n object.group.id\n end", "def record_processed_event(group, log_event)\n ensure_group(group).record_processed_event(log_event) \n end", "def group; Group.get(self.group_id); end", "def add_group(name)\n join_button_for(name).fire_event(\"onclick\")\n self.linger_for_ajax(1)\n end", "def before_destroy_group\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller\n\n current_user = PublicActivity.get_controller.current_user\n\n self.create_activity :destroy, owner: current_user,organization_id: self.organization_id, params: {:detail => I18n.t('logs.destroy_group', group_name: self.name)}\n end", "def group_id\n super\n end", "def run\n event_list = @next_events\n @next_events = []\n\n handlers = @handlers.select { |o| group_enabled?(o.group) }\n\n event_list.each do |ev|\n handlers.each { |o| o.call(ev) if o.match?(ev) }\n end\n end", "def group\n nil\n end", "def group\n nil\n end", "def group\n nil\n end", "def group\n raise(NotImplementedError)\n end", "def group_save(group)\n raise NotImplementedError\n end", "def group_info\n super\n end", "def with_group\n self\n end", "def i_groups; end", "def group\n return if record.respond_to?(:where)\n record.group\n end", "def on_tag_group_create( node, tag_group )\n\t\t\tself.log.debug \"unhandled on_tag_group_create: node %p now has tag group %p\" %\n\t\t\t \t[ node, tag_group ]\n\t\tend", "def groups()\n\t\t\tend", "def group\n self.event.owner\n end", "def each\n group.each\n end", "def onBriefingGroup _args\n \"onBriefingGroup _args;\" \n end", "def group\n nil\n end", "def atest_ID_25862_new_post_in_group_you_manage()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Open Group\", \"Family\")\n logout_common\n login_as_user2\n post_to_any_group(\"Family\",groupName)\n logout_common\n login_as_user1\n verify_updates\n end", "def process_group(group, result)\n\t\tif result.has_key?(group)\n\t\t\traise 'Repeated group. Invalid config file. ' << group\n\t\tend\n\t\t\n\t\tresult[group] = ModifiedHash.new\n\t\t#set global var to hold current group name. Used while processing key-val pair\n\t\t$current_group = group\n\tend", "def girl_groups; end", "def each_group\n @groups.each_value do | group |\n yield( group )\n end\n end", "def group\n override_attr(:group, super)\n end", "def refresh_ce_group!\n self.save! if refresh_ce_group\n end", "def done\n self.group.topic.unsubscribe(:wise_group_callback_handler)\n end", "def add_group(name)\n name_li(name).div(:class=>/searchgroups_result_left_filler/).fire_event(\"onclick\")\n end", "def after_store\n if group_owner?\n self.stored_group_notification_count = group_notification_count\n self.stored_group_member_notifier_count = group_member_notifier_count\n self.stored_group_members = group_members.as_json\n self.stored_group_members.each do |group_member|\n # Cast Time and DateTime field to String to handle Dynamoid unsupported type error\n group_member.each do |k, v|\n group_member[k] = v.to_s if v.is_a?(Time) || v.is_a?(DateTime)\n end\n end\n save\n else\n group_owner.after_store\n end\n end", "def createGroup\n call :createGroup\n end", "def perform_reload\n api.group_reload(self)\n end", "def group name\n TetCore.group(name) { yield }\nend", "def update_grouped group, forced = false\n\n # get sorted list of clients in group and calculate hash\n \n group_array = group.client_infos( uuid )\n sorted_group = group_array.sort { |m,n| m[:id] <=> n[:id] }\n\n md5 = Digest::MD5.hexdigest( sorted_group.to_json )\n\n # if group has changed or the method is called with the forced parameter\n\n puts \"forced group update for client #{uuid} after 60s\" if forced\n\n if (@current_group_hash != md5 && group.size > 0) || forced\n\n # set response for peek request\n\n response = {\n :group_id => md5,\n :group => sorted_group\n }\n\n @grouped.call( response ) if @grouped\n\n # if client was peeking, stop\n # (if this method was called by another client's environment update or signing off)\n\n @peek_timer.cancel if @peek_timer\n end\n end", "def onGroupIconOverEnter _args\n \"onGroupIconOverEnter _args;\" \n end", "def end_group(kind); end", "def end_group(kind); end", "def group\n raise \"View#reduce must have been set before grouping is permitted\" unless query[:reduce]\n update_query(:group => true)\n end", "def group_events\n @group = Group.find(params[:groupId])\n @events = @group.events\n render \"api/events/group_events\"\n end", "def group\n return @group\n end", "def group\n return @group\n end", "def groups=(_arg0); end", "def add_group(*args)\n end", "def group(entry)\n push(\"$group\" => evolve(entry.__expand_complex__))\n end", "def groups(*args)\n end", "def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def onGroupIconOverLeave _args\n \"onGroupIconOverLeave _args;\" \n end", "def set_group_event\n \t@user = User.find(params[:user_id])\n @group_event = @user.group_events\n end", "def show\n render_json_message({:success => t('.success')}, 201, {group: @group})\n end", "def process(group, stream, window)\n end", "def group\n return @group unless @group.nil?\n @group, @group_level = self.class.group_and_level(event_type)\n @group\n end", "def async_group &block\n em_get( \"/clients/#{uuid}/group\") do |response|\n group = Group.new( response[:content] )\n block.call( group )\n end\n end", "def callbacks; end", "def callbacks; end", "def save\n \n transaction do |transaction|\n check_usergroups! if self.usergroups and (not self.usergroups.empty?)\n super\n update_aspects\n transaction.commit\n end\n\n end", "def event_group(name)\n old_group = current_event_group\n self.current_event_group = name\n\n begin\n yield name\n ensure\n self.current_event_group = old_group\n end\n end", "def after_create entity_group\n ueg=entity_group.user_entity_groups.build\n ueg.user=entity_group.creator\n ueg.save\n end", "def group(*groups)\n @current_groups = groups\n\n yield\n\n ensure\n @current_groups = nil\n end", "def show_group\r\n show_group_by_id()\r\n end", "def using_group(group, &_block)\n older_group = current_group\n\n begin\n self.current_group = group\n yield\n ensure\n self.current_group = older_group\n end\n end", "def record!\n find_or_build_event_group\n update_event_group_attributes\n send_notifications_for_event_group\n \n @event_group.archived = false\n @event_group.save\n @event_group.events.create(event_params)\n @event_group\n end", "def set_sir_groups\n case action_name\n when 'new'\n case @sir_entry.rec_type\n when 0 # forward\n @sir_entry.orig_group_id = @group_stack.last\n @sir_entry.resp_group_id = nil\n @sir_groups = Group.all.participants_only.collect{ |g| [ g.code_and_label, g.id ] unless @group_stack.include?( g.id )}.compact!\n when 1 # comment - use current group\n @sir_entry.orig_group_id = @group_stack.last\n @sir_entry.resp_group_id = @group_stack.last\n @sir_groups = Group.all.participants_only.collect{ |g| [ g.code_and_label, g.id ]}\n when 2 # response - use group before current group\n if @group_stack.size < 2\n @sir_entry.errors.add( :base, I18n.t( 'sir_entries.msg.bad_request' ))\n else\n @sir_entry.orig_group_id = @group_stack.last\n @sir_entry.resp_group_id = @group_stack[ -2 ]\n end\n @sir_groups = nil\n end\n when 'edit'\n case @sir_entry.rec_type\n when 0, 1 # forward\n @sir_groups = Group.all.participants_only.collect{ |g| [ g.code_and_label, g.id ]}\n when 2 # response - use group before current group\n @sir_groups = nil\n end\n end\n end", "def on_after_consume\n coordinator.on_finished do |first_group_message, last_group_message|\n on_after_consume_regular(first_group_message, last_group_message)\n end\n end", "def group\n raise \"View#reduce must have been set before grouping is permitted\" unless query[:reduce]\n update_query(:group => true)\n end", "def add_group!( group )\n save if add_group( group )\n end", "def after_create(group_announcement)\n expire_group_announcement(group_announcement)\n end", "def group!( &block )\n\t\tn = new!( true )\n\t\tblock.call(n)\n\t\tn\n\tend", "def setup\n @key = :__first_group__\n start(nil)\n end", "def eachGroup(&block)\n debug(\"Running 'eachGroup' in GroupNodeSet\")\n @nodeSets.each { |g|\n block.call(g)\n }\n end", "def set_group(param)\n @group = param\n end", "def each(&block)\n group.each_value(&block)\n end", "def group=(value)\n @group = value\n end", "def group=(value)\n @group = value\n end", "def group\n @group ||= producer.groups.first\n end", "def group_by\n\n end", "def group_request (v1_requests_params)\n req = Request.find(v1_requests_params[:id])\n @group = Group.where(id: v1_requests_params[:group_id]).first\n user = User.find(req.reciever_id)\n if v1_requests_params[:response]\n @group.users << user\n end\n @group\n end", "def group(name)\n @_group = name\n end" ]
[ "0.69475347", "0.6751781", "0.66889435", "0.6669486", "0.65381587", "0.646725", "0.6465422", "0.64219606", "0.62591434", "0.62356716", "0.6233789", "0.6233789", "0.6233789", "0.61967", "0.61446214", "0.6142359", "0.6110487", "0.6087711", "0.6086199", "0.6067021", "0.6029804", "0.60138005", "0.6003405", "0.60022265", "0.59850955", "0.59779936", "0.5976165", "0.5966489", "0.5950565", "0.5938845", "0.59184396", "0.59184396", "0.59184396", "0.58867085", "0.58787763", "0.58756757", "0.5863402", "0.58546597", "0.58364886", "0.58318853", "0.58277225", "0.5824042", "0.58154565", "0.57950366", "0.5735375", "0.57318234", "0.5730976", "0.5729597", "0.57271796", "0.57248557", "0.57235515", "0.57110494", "0.570857", "0.5708284", "0.56912994", "0.56652725", "0.56629896", "0.5655828", "0.565192", "0.56464374", "0.56464374", "0.5641528", "0.5637505", "0.5627155", "0.5627155", "0.5625428", "0.5613782", "0.56124175", "0.5610247", "0.5595843", "0.5595527", "0.5594422", "0.55837893", "0.5583574", "0.5579608", "0.5579376", "0.5577797", "0.5577797", "0.5577593", "0.5565252", "0.5553345", "0.5553241", "0.55520475", "0.5551444", "0.5551138", "0.5542918", "0.5541126", "0.5536202", "0.55077213", "0.55008805", "0.5500784", "0.5498591", "0.5498273", "0.5495921", "0.54922146", "0.54832166", "0.54832166", "0.54815936", "0.5464906", "0.54640305", "0.5460491" ]
0.0
-1
Returns linking params for a specified +page_number+. The returned Hash is intended for use with +link_to+, +url_for+, etc.
def params_for_page(page_number) { controller: controller, action: action, params: query_params.merge( Foliate.config.page_param => (page_number if page_number > 1) ) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_page(page_number)\n q = Rack::Utils.parse_query(request.query_string)\n q['page'] = page_number\n query_string = Rack::Utils.build_query(q)\n { 'href' => \"#{request.path}?#{query_string}\" }\n end", "def pagination_params(page)\n # TODO: include sort params\n {\n :page => page,\n :per_page => per_page\n }.tap do |params|\n params.delete(:per_page) if per_page == default_per_page\n end\n end", "def next_page_number\n Hash(next_page_params).fetch('page', {}).fetch('number', nil)\n end", "def page(page_number)\n params[:page] = page_number\n self\n end", "def merge_params(number)\n @params.merge(page: { number: number, limit: @per_page })\n end", "def pagination_params\n page = params[:page].to_i\n page = 1 unless page > 0\n per = params[:per].to_i\n per = 25 unless per > 0\n {page: page, per: per}\n end", "def to_h(page_number)\n {\n page_size: page_size,\n size: page_size,\n orientation: orientation,\n top_margin: margin.top,\n bottom_margin: margin.bottom\n }.tap do |hash|\n if page_number.even?\n hash[:left_margin] = margin.outer\n hash[:right_margin] = margin.inner\n else\n hash[:left_margin] = margin.inner\n hash[:right_margin] = margin.outer\n end\n end\n end", "def page_params \n params.has_key?(:pagination) ? get_page_params( params.require(:pagination) ) : {}\n end", "def get_page_link_annotations(name, page_number, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_link_annotations_with_http_info(name, page_number, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_link_annotations_with_http_info(name, page_number, opts)\n else\n raise\n end\n return data\n end", "def get_link page_number, link_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if page_number == ''\n raise 'page number not specified'\n end\n \n if link_index == ''\n raise 'link index not specified'\n end\n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '/links/' + link_index.to_s\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Link']\n \n \n rescue Exception=>e\n print e\n end\n end", "def params_for_page page\n page_string = page > 1 ? \"/page/#{page}\" : ''\n params = @additional_params.join('&')\n if params.empty?\n page_string\n else\n page_string + \"?#{params}\"\n end\n end", "def page_params\n params.fetch(:page, {})\n end", "def page_params\n params.fetch(:page, {})\n end", "def page_params\n @page_params ||= begin\n page = @request.params.to_unsafe_hash['page'] || {}\n ActionController::Parameters.new(page)\n end\n end", "def pagination_dict(object)\n {\n # current_page: object.current_page,\n # next_page: object.next_page,\n # prev_page: object.prev_page,\n # total_pages: object.total_pages,\n total_count: object.total_count\n }\n end", "def create_page_links(page_number, page, pages, campaign)\n page_number = page_number.to_i\n \n if page_number == pages.count\n return content_tag(:div, content_tag(:p, link_to(\"Previous page\", \n edit_campaign_path(campaign, :page_number => page_number - 1), :class => \"nice small radius blue button\"), \n :class => \"four columns\", :id => \"previouspage\") + \n content_tag(:div, content_tag(:p, \"#{page.number} / #{pages.count}\"), \n :class => \"four columns\", :id => \"pagecounter\") +\n content_tag(:div, content_tag(:p, (link_to \"Add page\", add_new_page_path(:id => @campaign.id, :page_number => page_number), \n :class => \"nice small radius green button\")), \n :class => \"four columns\", :id => \"nextpage\"))\n elsif page_number == 1 \n return content_tag(:div, content_tag(:p, \"#{page.number} / #{pages.count}\"), \n :class => \"four columns offset-by-four\", :id => \"pagecounter\") +\n content_tag(:div, content_tag(:p, link_to(\"Next page\", \n edit_campaign_path(campaign, :page_number => page_number + 1), :class => \"nice small radius blue button\")),\n :class => \"four columns\", :id => \"nextpage\")\n else\n return content_tag(:div, content_tag(:p, link_to(\"Previous page\", \n edit_campaign_path(campaign, :page_number => page_number - 1), :class => \"nice small radius blue button\"), \n :class => \"four columns\", :id => \"previouspage\") + \n content_tag(:div, content_tag(:p, \"#{page.number} / #{pages.count}\"), \n :class => \"four columns\", :id => \"pagecounter\") +\n content_tag(:div, content_tag(:p, link_to(\"Next page\", \n edit_campaign_path(campaign, :page_number => page_number + 1), :class => \"nice small radius blue button\")),\n :class => \"four columns\", :id => \"nextpage\"))\n end\n end", "def jsonapi_pagination_params\n pagination = params[:page].try(:slice, :number, :size) || {}\n per_page = jsonapi_page_size(pagination)\n num = [1, pagination[:number].to_f.to_i].max\n\n [(num - 1) * per_page, per_page, num]\n end", "def page(page)\n params['page'] = page\n end", "def link_params\n CGI::parse(URI.parse(self['href']).query)\n end", "def get_page(page_number)\n # Find URI that we can work with, if we cannot get the first\n # page URI then there is only one page.\n return nil unless first_page_uri\n params = parse_query URI(first_page_uri).query\n params['page'] = page_number\n\n response = page_request URI(first_page_uri).path, params\n update_page_links response.links\n response\n end", "def get_result_pages(page_nos, options = {})\n pages = {}\n page_nos.map(&:to_i).each do |page_no|\n pages[page_no] = get_result_page(page_no, options)\n end\n pages\n end", "def get_page_link_annotation(name, page_number, link_id, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_link_annotation_with_http_info(name, page_number, link_id, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_link_annotation_with_http_info(name, page_number, link_id, opts)\n else\n raise\n end\n return data\n end", "def page_param\n if params[:page].is_a? ActionController::Parameters\n params[:page][:number]\n else\n params[:page]\n end\n end", "def page_params\n []\n end", "def page_params\n end", "def pagination_meta(total_count)\n current_page = page_from_params.to_i\n total_pages = (total_count / page_size.to_f).ceil\n {\n count: total_count,\n pagination: {\n current_page: current_page,\n next_page: current_page < total_pages ? current_page + 1 : nil,\n prev_page: current_page > 1 ? current_page - 1 : nil,\n total_pages: total_pages,\n total_count: total_count,\n },\n }\n end", "def previous_page_number\n Hash(previous_page_params).fetch('page', {}).fetch('number', nil)\n end", "def get_all_links page_number\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if page_number == ''\n raise 'page number not specified'\n end\n \n total_links = self.get_links_count(page_number)\n \n all_links = Array.new\n \n index = 1\n while index <= total_links\n \n all_annotations.push(self.get_link(page_number, index))\n \n index+=1\n end\n \n return all_links\n \n \n rescue Exception=>e\n print e\n end\n end", "def page_number\n query_params&.dig(:page)\n end", "def page_number\n query_params&.dig(:page)\n end", "def pagination_dict(collection)\n {\n current_page: collection.try(:current_page) || DEFAULT_PAGE,\n next_page: collection.try(:next_page),\n prev_page: collection.try(:prev_page),\n total_pages: collection.try(:total_pages) || 0,\n total_count: collection.try(:total_count) || 0,\n }\n end", "def get_paging_order_info\n {\n :page => params[:page],\n :limit => params[:limit].nil? ? 20 : params[:limit]\n }\n end", "def page_size_with_links\n [10, 25, 50, 100].map do |per_page|\n # do math so that current first item is still on screen.\n # (use zero-based params for talking to GA)\n new_page_number = (@start.div per_page) + 1\n [search_merge('page' => new_page_number, 'per_page' => per_page), per_page]\n end\n end", "def pagination_dict(collection)\n {\n current_page: collection.current_page,\n total_pages: collection.total_pages,\n total_count: collection.count\n }\n end", "def get_page_link_annotations_with_http_info(name, page_number, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_page_link_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_page_link_annotations\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.get_page_link_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/links\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LinkAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_page_link_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def make_pagination_params(options)\n params = {}\n params['Marker'] = options[:marker] if options[:marker]\n params['MaxItems'] = options[:max_items] if options[:max_items]\n params\n end", "def paginate(collection)\n pages = {}\n\n unless collection.first_page?\n pages[:first] = 1\n pages[:prev] = collection.current_page - 1\n end\n\n unless collection.last_page?\n pages[:last] = collection.total_pages\n pages[:next] = collection.current_page + 1\n end\n\n links = []\n url = request.original_url.sub(/\\?.*$/, '')\n\n pages.each do |k, v|\n new_params = request.query_parameters.merge(page: v)\n links << %(<#{url}?#{new_params.to_param}>; rel=\"#{k}\")\n end\n\n headers['Link'] = links.join(', ') unless links.empty?\n end", "def pagination_metadata_for(records)\n { total: records.total_entries,\n total_pages: records.total_pages,\n last_page: records.next_page.blank?,\n previous_page: previous_link_for(records),\n next_page: next_link_for(records),\n out_of_bounds: records.out_of_bounds?,\n offset: records.offset }\n end", "def url_for_pagination(page, path = request.path, q = request.query_string)\n # Remove any current reference to page in the query string\n q = q.to_s.gsub(/page=(-?[\\d]+)(&?)/, '')\n # Assemble new link\n link = \"#{path}?page=#{page}&#{q}\"\n link = link[0..-2] if link[-1..-1] == '&' # Strip trailing ampersand\n link\n end", "def get_page(page_number)\n # Find URI that we can work with, if we cannot get the first or the\n # last page URI then there is only one page.\n page_uri = first_page_uri || last_page_uri\n return nil unless page_uri\n\n perform_request(page_uri, page_number)\n end", "def get_page_number\n if page_parameters_defined?\n @query_params[:page] = params[:document_counter].to_i==1 ? 1 : ((params[:document_counter].to_f-1)/current_per_page).ceil\n end\n end", "def pagination_options\n { :offset => offset, :limit => per_page } if paginated?\n end", "def set_params_page\n params[:page] = params.fetch(\"page\"){1}.to_i\n params[:per_page] = params.fetch(\"per_page\"){20}.to_i\n end", "def update_page_links(links) # :nodoc:\n ATTRIBUTES.each do |attr|\n send(:\"#{attr}_page_uri=\", links.send(:\"#{attr}\"))\n send(:\"#{attr}_page=\", parse_page_number(links.send(:\"#{attr}\")))\n end\n end", "def page(number, records_per_page=40)\n raise ArgumentError, \"the first page number is 1 (got #{number})\" if number < 1\n \n chain { |x|\n x.start_record = (number - 1) * records_per_page\n x.record_count = records_per_page\n }\n end", "def next_url(page_number)\n onliner_url.gsub(/page=\\d{1,}/, \"page=#{page_number + 1}\")\n end", "def get_page_underline_annotations(name, page_number, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_underline_annotations_with_http_info(name, page_number, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_underline_annotations_with_http_info(name, page_number, opts)\n else\n raise\n end\n return data\n end", "def next_page_link\n paging['next'] if paging\n end", "def pagination_info\n h = {}\n\n [:current_page, :next_page, :prev_page, :total_pages,\n :limit_value, :offset_value, :total_count,\n :first_page?, :last_page?].each do |k|\n h[k] = @response.send(k)\n end\n\n h\n end", "def set_params_page\n params[:page] = params.fetch(\"page\"){1}.to_i\n params[:per_page] = params.fetch(\"per_page\"){20}.to_i\n end", "def page(page_number)\n data = page_data(page_number)\n Innodb::Page.parse(self, data, page_number) if data\n end", "def page_params\n params[:title, :page]\n end", "def pagination_links(where, vars = {}, prev_str = nil, next_str = nil, cur_pg_class = nil)\n range_start = MAX.call(@page_number - DEFAULT_PAGE_LINK_RANGE, 1)\n range_end = MIN.call(@page_number + DEFAULT_PAGE_LINK_RANGE, @pages)\n\n prev_str ||= 'Previous'\n next_str ||= 'Next'\n\n links = []\n prev_link = nil\n next_link = nil\n\n # Create links for \"< Previous \" if the current page is not the first\n if @page_number > 1\n prev_link = to_link(to_href(where, vars, page: @page_number - 1), prev_str, 'va-pagination-prev')\n end\n\n # Display a link for \"1 ...\" if the start of the page range >= 2\n if range_start > 1\n links << to_link(to_href(where, vars, page: 1), '1') + ' ...'\n end\n\n # Create links for each page in the ragebut the current page\n (range_start..range_end).each do |i|\n links << if i == @page_number\n %(<a class=\"#{cur_pg_class}\">#{i}</a>)\n else\n to_link(to_href(where, vars, page: i), i)\n end\n end\n\n # Create links for \" ... n\" if the end of the page range <= n\n if range_end < @pages\n links << '... ' + to_link(to_href(where, vars, page: @pages), @pages)\n end\n\n # Create links for \" Next >\" if the current page is not the last\n if @page_number < @pages\n next_link = to_link(to_href(where, vars, page: @page_number + 1), next_str, 'va-pagination-next')\n end\n\n [\n prev_link,\n \"<div class='va-pagination-inner'>\",\n *links,\n '</div>',\n next_link\n ].compact.join(' ')\n end", "def get_page_data(json_file)\n pages = {}\n pages[\"page_count\"] = json_file[\"pagination\"][\"page_count\"]\n pages[\"page_number\"] = json_file[\"pagination\"][\"page_number\"]\n return pages\n end", "def get_all_links_as_hash(page)\n parsed_page = Nokogiri::HTML(page)\n links = parsed_page.css('a')\n\n all_links = Hash[links.xpath('//a[@href]').map {|link| [link.text.strip, link['href']]}]\n\n return all_links\nend", "def last_page_number\n Hash(last_page_params).fetch('page', {}).fetch('number', nil)\n end", "def page_link text, page, _current=false, options={}\n @paging_path_args[:offset] = page * @paging_limit\n filter_args = {}\n page_link_params.each do |key|\n filter_args[key] = params[key] if params[key].present?\n end\n options[:class] = \"card-paging-link slotter\"\n options[:remote] = true\n link_to raw(text), path(@paging_path_args.merge(filter_args)), options\n end", "def calculate_page_details(current_page, page_size, total_number)\n return page_first(current_page, page_size), page_last(current_page, page_size, total_number),\n total_pages(page_size, total_number)\n end", "def page_number\n (params[:page] || 1).to_i\n end", "def pagy_url_for(n)\n url = File.join(request.script_name.to_s, request.path_info)\n params = request.GET.merge('page' => n.to_s)\n url << '?' << Rack::Utils.build_nested_query(params)\n end", "def pagination_params(opts = {})\n { :page => params[:page] || 1, :per_page => params[:per_page] || 10 }.merge(opts)\n end", "def page_link(records, opts = {})\n uri = URI.parse(request.original_url)\n query = Rack::Utils.parse_query(uri.query)\n query['page'] = records.send(\"#{opts[:page]}_page\")\n uri.query = Rack::Utils.build_query(query)\n uri.to_s\n end", "def to_href(where, vars = {}, for_page = {})\n return where if vars.blank? && for_page.blank?\n\n params = (vars || {}).select { |k, v| k != :page && v.present? }.to_query\n\n url = where + '?' + params\n\n url += \"#{for_page.keys[0]}=#{for_page.values[0]}\" if for_page.present?\n\n URI.encode(url)\n end", "def link_to_navigation_pagination name, urlname, pages, page, css_class = \"\"\n p = {}\n p[\"navigation_level_1_page\"] = params[:navigation_level_1_page] unless params[:navigation_level_1_page].nil?\n p[\"navigation_level_2_page\"] = params[:navigation_level_2_page] unless params[:navigation_level_2_page].nil?\n p[\"navigation_level_3_page\"] = params[:navigation_level_3_page] unless params[:navigation_level_3_page].nil?\n p[\"navigation_level_#{pages.to_a.first.depth}_page\"] = page\n link_to name, show_page_url(urlname, p), :class => (css_class unless css_class.empty?)\n end", "def pagination_numbers(pages, args = {})\n result = safe_empty\n if pages && pages.num_pages > 1\n params = args[:params] ||= {}\n if pages.letter_arg && pages.letter\n params[pages.letter_arg] = pages.letter\n end\n\n num = pages.num_pages\n arg = pages.number_arg\n this = pages.number\n this = 1 if this < 1\n this = num if this > num\n size = args[:window_size] || 5\n from = this - size\n to = this + size\n\n result = []\n pstr = \"« #{:PREV.t}\"\n nstr = \"#{:NEXT.t} »\"\n result << pagination_link(pstr, this - 1, arg, args) if this > 1\n result << pagination_link(1, 1, arg, args) if from > 1\n if from > 2\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n (from..to).each do |n|\n if n == this\n result << content_tag(:li, content_tag(:span, n), class: \"active\")\n elsif n.positive? && n <= num\n result << pagination_link(n, n, arg, args)\n end\n end\n if to < num - 1\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n result << pagination_link(num, num, arg, args) if to < num\n result << pagination_link(nstr, this + 1, arg, args) if this < num\n\n result = content_tag(:ul,\n result.safe_join(\" \"),\n class: \"pagination pagination-sm\")\n end\n result\n end", "def page_params\n params.fetch(:page, {}).permit(:pageNr, :text, :document_id)\n end", "def page_data(page_number)\n read_at_offset(page_number * page_size, page_size)\n end", "def parameters\n resolve_parameters(link_schema['href'].scan(PARAMETER_REGEX))\n end", "def build_configuration_from_page(page)\n configuration = {}\n\n page.each do |parameter|\n key_name = get_gcp_key_name(parameter)\n next unless key_name.start_with?(@prefix)\n\n parameter_parts = key_name[@prefix.length..-1].split(PATH_SEPARATOR).map(&:to_sym)\n param_container = parameter_parts[0..-2].reduce(configuration) do |container, part|\n container[part] ||= {}\n end\n param_container[parameter_parts[-1]] = get_latest_key_value(key_name)\n end\n\n configuration\n end", "def page(query_options={}, page_num=0, limit=15)\n return pages(@default_query_options.merge(query_options), page_num, limit, false, false)\n end", "def set_pagination_info(page_no, page_size, record_count)\n @current_page = page_no\n @page_size = page_size\n @pagination_record_count = record_count\n @page_count = (record_count / page_size.to_f).ceil\n end", "def pagination_meta(object)\n {\n :count => object.length,\n :total_pages => object.total_pages,\n :current_page => object.current_page,\n :prev_page => object.prev_page,\n :next_page => object.next_page\n }\n end", "def layout_for_page(page_number)\n page_key = layout_key_for_page(page_number)\n @layout_for[page_key]\n end", "def query_params_cache_keys\n [params[:page]]\n end", "def compute_pages(count = 1, page = 1, pagesize = PAGE_SIZE)\n pages = [(count.to_f / pagesize).ceil, 1].max\n page = page > pages ? pages : (page < 1 ? 1 : page)\n offset = (page - 1) * pagesize\n { page: page, pages: pages, offset: offset }\nend", "def bundle_search_links(page, page_size, resources, resource_type, search_params)\n total = resources.size\n last_page = (total.to_f / page_size).ceil\n [\n page != 1 && total > page_size ?\n FHIR::Bundle::Link.new(relation: 'first', url: bundle_search_link_url(search_params, resource_type, 1)) : nil,\n page > 1 && total > page_size && page - 1 < last_page ?\n FHIR::Bundle::Link.new(relation: 'previous', url: bundle_search_link_url(search_params, resource_type, page - 1)) : nil,\n page < last_page && total > (page_size * page) ?\n FHIR::Bundle::Link.new(relation: 'next', url: bundle_search_link_url(search_params, resource_type, page + 1)) : nil,\n page != last_page && total > (page_size * page) ?\n FHIR::Bundle::Link.new(relation: 'last', url: bundle_search_link_url(search_params, resource_type, last_page)) : nil\n ].reject(&:nil?)\n end", "def pagination_headers(collection)\n links = (headers['Link'] || \"\").split(',').map(&:strip)\n clean_url = request.original_url.sub(/\\?.*$/, '')\n\n paging_info = pages(collection)\n\n paging_info.each do |key, value|\n query_params = request.query_parameters.merge(page: value)\n links << %Q( <#{clean_url}?#{query_params.to_param}>; rel=\"#{key}\" )\n end\n\n headers['Link'] = links.join(\", \") unless links.empty?\n headers[PagerApi.total_pages_header] = collection.total_pages\n headers[PagerApi.total_count_header] = collection.total_count\n\n return nil\n end", "def page(number)\n\t\tfail ArgumentError.new(\"Page number cannot be lower than 1, #{number} given\") unless number > 0\n\t\t@result = nil\n\t\t@skip = (number - 1) * get_resultcount\n\t\treturn self\n\tend", "def params\n @pagination.request.query_parameters\n end", "def link_to_page(page, paginated_set, options = {}, html_options = {})\n page_parameter = peiji_san_option(:page_parameter, options)\n \n # Sinatra/Rails differentiator\n pageable_params = respond_to?(:controller) ? controller.params : self.params\n \n url_options = (page == 1 ? pageable_params.except(page_parameter) : pageable_params.merge(page_parameter => page))\n anchor = peiji_san_option(:anchor, options)\n url_options[:anchor] = anchor if anchor\n html_options[:class] = peiji_san_option(:current_class, options) if paginated_set.current_page?(page)\n \n # Again a little fork here\n normalized_url_options = if respond_to?(:controller) # Rails\n url_for(url_options)\n else # Sinatra\n root_path = env['PATH_INFO'].blank? ? \"/\" : env[\"PATH_INFO\"]\n url_for(root_path, url_options)\n end\n \n link_to page, normalized_url_options, html_options\n end", "def links\n param = {lat: lat.to_f, lng: lng.to_f, latlng: latlng}\n Hashie::Mash.new(EXTERNAL_LINKS.map{|key, pattern| [key, pattern % param]}.to_h)\n end", "def extract_pagination_hash(model)\n\n {pagination: {current_page: model.current_page, total_pages: model.total_pages}}#,total_entries: model.total_entries,\n #offset: model.offset}} \n end", "def scrape_page_for_links(page)\n page_dom = Nokogiri::HTML(fetch_html(WIKIPEDIA_URL + page))\n page_dom.css('a').map { |link| link['href'] }\n end", "def post_page_link_annotations(name, page_number, links, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_page_link_annotations_with_http_info(name, page_number, links, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_page_link_annotations_with_http_info(name, page_number, links, opts)\n else\n raise\n end\n return data\n end", "def get_page_ink_annotations(name, page_number, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_ink_annotations_with_http_info(name, page_number, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_ink_annotations_with_http_info(name, page_number, opts)\n else\n raise\n end\n return data\n end", "def get_page_params( required_params )\n required_params.permit( :page, :page_size )\n end", "def library_params\n #params.fetch(:page, {name})\n params[:library].permit(:name, :address, :number)\n end", "def result_page_info(headers)\n link = headers[:link]\n\n return [] if link.nil?\n\n page_strings = link.split('page=')\n\n pages = []\n\n page_strings.each_with_index do |item, index|\n next if index == 0\n\n pages << item.to_i\n end\n\n pages\nend", "def set_page_vars\n @page = params[:page] ? params[:page].to_i : START_PAGE\n @per_page = PER_PAGE\n end", "def to_hash\n hash = {\n 'type' => 'Page',\n 'name' => page_name,\n 'text' => text.to_s\n }\n unless page_panes.empty?\n hash['panes'] = page_panes.map do |page_pane|\n page_pane.pane.to_hash\n end\n end\n unless page_sequences.empty?\n hash['sequence'] = page_sequences.first.sequence.to_hash\n end\n hash\n end", "def layout_key_for_page(page_number)\n @layout_for.each_key do |key|\n return key if Array(key).include?(page_number)\n end\n return :all\n end", "def plaid_link_params\n params.fetch(:plaid_link, {})\n end", "def page_from_params\n page_num = params[:page].to_i\n\n page_num.zero? ? DEFAULT_PAGE : page_num\n end", "def get_page_signature_fields(name, page_number, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_signature_fields_with_http_info(name, page_number, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_signature_fields_with_http_info(name, page_number, opts)\n else\n raise\n end\n return data\n end", "def link_params\n params[:link]\n end", "def jsonapi_pagination(resources)\n links = { self: request.base_url + request.fullpath }\n pagination = jsonapi_pagination_meta(resources)\n\n return links if pagination.blank?\n\n original_params = params.except(\n *jsonapi_path_parameters.keys.map(&:to_s)\n ).as_json.with_indifferent_access\n\n original_params[:page] = original_params[:page].dup || {}\n original_url = request.base_url + request.path + '?'\n\n pagination.each do |page_name, number|\n next if page_name == :records\n\n original_params[:page][:number] = number\n links[page_name] = original_url + CGI.unescape(\n original_params.to_query\n )\n end\n\n links\n end", "def links\n\t\t\tlinks = {}\n\t\t\tself.page_files(true).each do |p|\n\t\t\t\tpage = Page.new(p)\n\t\t\t\tlinks[page.base_dir] = page.url\n\t\t\tend\n\t\t\tlinks\n\t\tend", "def add_page_numbering\n numbering_options = {\n at: [@pdf.bounds.right - 150, 0-@format[:footer_size]],\n width: 150,\n align: :right,\n start_count_at: 1,\n color: \"999999\",\n size: 8\n }\n @pdf.number_pages t('paging'), numbering_options\n end", "def page_url(page)\n \"#{request.path}?page=#{page}\"\n end", "def paginate_opts\n ({}).tap do |ret|\n ret[:per_page] = Spree::Config[:products_per_page]\n ret[:page] = params[:page]\n end\n end" ]
[ "0.72023064", "0.6036921", "0.5969339", "0.5950147", "0.59397346", "0.58530027", "0.58235127", "0.5805302", "0.57417786", "0.569462", "0.5633448", "0.5611987", "0.5611987", "0.5575739", "0.55337757", "0.5467556", "0.5466564", "0.53366023", "0.5324554", "0.53241247", "0.52854663", "0.5284604", "0.52816665", "0.5271225", "0.5263112", "0.5260538", "0.5257834", "0.5253719", "0.52458626", "0.52458626", "0.524072", "0.5235962", "0.5234937", "0.5227089", "0.52207494", "0.520996", "0.5191439", "0.5180382", "0.51597124", "0.5153647", "0.515181", "0.5131444", "0.5125985", "0.5120755", "0.5111868", "0.5109853", "0.5088602", "0.5075151", "0.5073399", "0.50650257", "0.506374", "0.5057887", "0.5041962", "0.5041068", "0.5030656", "0.5029065", "0.50198305", "0.5015758", "0.5012159", "0.5011151", "0.5003381", "0.5000617", "0.49949712", "0.49848583", "0.49755663", "0.4967373", "0.4963299", "0.49530885", "0.4946356", "0.49346206", "0.4922581", "0.49163184", "0.49030527", "0.4898409", "0.4879031", "0.48759714", "0.48755285", "0.48743325", "0.48725897", "0.48715922", "0.4863402", "0.48617", "0.4853486", "0.48493323", "0.48470074", "0.48464057", "0.48365015", "0.48254684", "0.4822261", "0.4806201", "0.48027498", "0.4798641", "0.47723913", "0.47704393", "0.47692502", "0.4767993", "0.4766224", "0.47556743", "0.4751706", "0.47492543" ]
0.71736586
1
Indicates if there is a page expected before the current page.
def prev? current_page > 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_page?\n page_number > first_page_number\n end", "def has_previous_page?\n @current_page != 1\n end", "def has_previous_page\n if last\n paged_nodes.length >= last\n else\n false\n end\n end", "def previous_page?\n page > 1\n end", "def previous?\n return @page > 1\n end", "def has_previous_page\n @agent.page.links.find { |l| l.text == \"← Previous\" } == nil ? false : true\n end", "def has_previous?\n return self.current_page != 1 && self.total_pages > 1\n end", "def first_page?\n page_number > first_page_number\n end", "def previous_page?\n !previous_page_number.nil?\n end", "def first_page?\n\t\t\t!prev_page_url if paginated?\n\t\tend", "def first_page?\n current_page == pages.begin\n end", "def is_before?(step_nr)\n return flow.flow_step_is_before?(current_step:step, other_step:step_nr)\n end", "def first_page?\n current_page == 0\n end", "def first_page?\n page == 1\n end", "def previous_page?\n !previous_page_link.nil?\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def before?\n !before.nil?\n end", "def is_first_page?\n p_index.to_i == 1\n end", "def next_page?\n page.zero? || page < total_pages\n end", "def first_page?\n return true if total_pages < 1\n return (page == 1)\n end", "def leading\n (@total_pages > 0) ? 1 : nil\n end", "def prev_page\n p = page - 1\n p < 1 && p = nil\n p\n end", "def current_page?(page)\n @current_page == page\n end", "def calculate_prev\n p = @current_page - 1\n p <= 0 || p > @total_pages ? nil : p\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def next_page?\n page_number < last_page_number\n end", "def on_page?\n false\n end", "def out_of_range?\n current_page > total_pages\n end", "def has_next_page?\n @current_page < page_count\n end", "def out_of_bounds?\n current_page > total_pages\n end", "def paginated?\n current_page && current_page > 0\n end", "def page_num_checker \n\t\t@page_num < @total_page || @total_page == 0\n\tend", "def next_page?\n !next_page_number.nil?\n end", "def current?(page)\n @current == page\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def has_next_page\n if first\n paged_nodes.length >= first\n else\n false\n end\n end", "def more?\n @current < @pages\n end", "def out_of_bounds?\n current_page > total_pages\n end", "def next_page?\n @page.next_page_token?\n end", "def next?\n return @pages > @page\n end", "def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end", "def first_page?\n params[:page].nil?\n end", "def page?\n !!self.page_id\n end", "def more_pages?\n return false if start_index == 0\n (self.start_index + self.page_length) -1 < self.total_result_count\n end", "def next?\n current_page < total_pages\n end", "def current?(other_page)\n page == other_page\n end", "def prev_page\n current_page - 1 unless first_page? || out_of_range?\n end", "def on_page?\n raise NotImplementedError, \"implement me, e.g. using #has_title?\"\n end", "def next_page?\n return (@query[:startPage] * (@query[:count] + 1)) < @total_results\n end", "def next_page?\n # rubocop:disable Style/DoubleNegation\n !!next_page_url\n # rubocop:enable Style/DoubleNegation\n end", "def before_last_page\n #@history[@history.size - 2][1].dup\n self[self.size - 2][:page].dup\n end", "def last_page?\n page_number < last_page_number\n end", "def pages_left\n self.page_count - self.current_page\n end", "def prev_page\n page - 1 if pages.include?(page - 1)\n end", "def prev_page\n num = current_page - 1\n num if num.positive?\n end", "def next_page_greater_than_current_page\n self.errors.add(:next_page, \"Next page must come after the current page.\") if self.next_page_id.present? && self.next_page.page_number < self.page_number\n end", "def last_page?\n !next_page_url\n end", "def last_page?\n return true if total_pages < 1\n return (page == total_pages)\n end", "def has_next_page?\n !@raw_page['nextRecordsUrl'].nil?\n end", "def next_page?\n !next_page_token.nil? && !next_page_token.empty?\n end", "def assert_not_last_page\n assert_link NEXT_LABEL\n end", "def paginated?\n return false unless current_page\n true\n end", "def out_of_bounds?\n current_page > page_count\n end", "def is_before_last?(elt)\n self[self.size - 2][:page].url == elt.url or self[self.size - 2][:driver].popup_name == elt.popup_name\n end", "def next_page?\n !next_page_link.nil?\n end", "def paginated?\n\t\t\t!next_page_url.nil?||!prev_page_url.nil?\n\t\tend", "def current_is_last_page?\n @current_page.next_page == 0\n end", "def next_page?\n !!fetch[\"next_page\"]\n end", "def bottom_gap?\n near_pages.first > 1\n end", "def last_page?\n current_page == total_pages - 1\n end", "def last_page?\n page == total_pages\n end", "def last_page?\n current_page >= num_pages\n end", "def first_page_in_class?\n @current_class == \"Druid\" ? false : @cards.current_page == 1\n end", "def last_page?\n current_page >= num_pages\n end", "def last_page?\n current_page >= num_pages\n end", "def has_next_page\n @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n end", "def paginated?\n @pages and @pages.length > 1\n end", "def prev_page\n current_page > 1 ? (current_page - 1) : nil\n end", "def upper_gap?\n near_pages.last < last_page\n end", "def is_on_page? page_text, negation = ''\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil, otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n raise \"Unexpected Page. The page should not have: '#{page_text}'\" if should_not_have_exception\n raise \"Unexpected Page. Expected was: '#{page_text}'\" if should_have_exception\n end", "def prev\n perform_request(prev_page_uri) if prev_page_uri\n end", "def previous_page\n return if page == 1\n page - 1\n end", "def last_page?\n current_page == total_pages\n end", "def previous_page\n @current_page - 1 if has_previous_page?\n end", "def last_page?\n current_page_number == total_pages\n end", "def has_next?\n return self.current_page != self.total_pages && self.total_pages > 1\n end", "def test_previous_when_fewer_than_three_prev_pages\n pg = Ruhoh::Parsers::Posts::Paginator.new(1, @five_posts)\n pages = pg.paginate()\n page = pages['index_pages'][3]\n assert_equal([1, 2, 3], page['prev'].map {|p| p['page_number']})\n assert_equal(['/index/1/', '/index/2/', '/index/3/'], page['prev'].map { |p| p['url'] })\n assert_equal(nil, page['prev_truncated'])\n end", "def previous_page\n @current_page > 1 ? (@current_page - 1) : nil\n end", "def before\n all? {|transition| transition.before}\n end", "def next_page_token?\n !next_page_token.empty?\n end", "def last_page?\n current_page == pages.end\n end", "def pagination_candidate?(config, page); end", "def prev_page\n @page = info(@page[:previous_page])\n end", "def last_page?\n !out_of_bounds? && next_page.nil?\n end", "def page_found_with_redirect?\n @page_found_with_redirect\n end" ]
[ "0.74566734", "0.7410143", "0.7139342", "0.7093873", "0.70392466", "0.70324326", "0.6994375", "0.6945464", "0.69131947", "0.6795923", "0.67908967", "0.67281073", "0.66923183", "0.6682758", "0.6645045", "0.6589202", "0.6589202", "0.6589202", "0.6589202", "0.6573795", "0.6573795", "0.6521392", "0.6472268", "0.63318187", "0.6305825", "0.6304928", "0.6282611", "0.6266172", "0.6256284", "0.62490743", "0.6216876", "0.6191237", "0.6181071", "0.61666054", "0.6159347", "0.6152641", "0.61271185", "0.6112615", "0.6110571", "0.6092327", "0.6090559", "0.60869247", "0.60710067", "0.6062342", "0.60554016", "0.6019962", "0.6010492", "0.6007984", "0.6007745", "0.59852475", "0.59747064", "0.59620047", "0.59348375", "0.59339404", "0.59323454", "0.59320265", "0.5924958", "0.5924589", "0.59193325", "0.5911009", "0.5910971", "0.59067833", "0.59032315", "0.58968997", "0.587372", "0.58674836", "0.5866848", "0.586074", "0.5845778", "0.5837045", "0.58330256", "0.582619", "0.58172065", "0.5805065", "0.5796693", "0.57937145", "0.5787814", "0.5765895", "0.5753526", "0.5753526", "0.57490015", "0.57423574", "0.57385623", "0.5735663", "0.572958", "0.5721544", "0.5714069", "0.5712788", "0.5700924", "0.56786597", "0.566792", "0.5667792", "0.5663935", "0.5660008", "0.56529206", "0.5642456", "0.56366056", "0.56281376", "0.56241995", "0.5622044" ]
0.7025491
6
Indicates if there is a page expected after the current page.
def next? current_page < total_pages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end", "def next_page?\n page_number < last_page_number\n end", "def last_page?\n !next_page_url\n end", "def last_page?\n return true if total_pages < 1\n return (page == total_pages)\n end", "def last_page?\n current_page == pages.end\n end", "def last_page?\n page == total_pages\n end", "def has_next_page?\n @current_page < page_count\n end", "def last_page?\n page_number < last_page_number\n end", "def last_page?\n current_page == total_pages - 1\n end", "def last_page?\n current_page >= num_pages\n end", "def last_page?\n !out_of_bounds? && next_page.nil?\n end", "def last_page?\n current_page == total_pages\n end", "def assert_last_page\n assert_no_link NEXT_LABEL\n end", "def last_page?\n current_page_number == total_pages\n end", "def next?\n return @pages > @page\n end", "def last_page?\n current_page >= num_pages\n end", "def last_page?\n current_page >= num_pages\n end", "def next_page?\n page.zero? || page < total_pages\n end", "def current_is_last_page?\n @current_page.next_page == 0\n end", "def assert_not_last_page\n assert_link NEXT_LABEL\n end", "def next_page?\n @page.next_page_token?\n end", "def last_page?\n current_page == page_count\n end", "def last_page?\n\t\t\t!next_page_url if paginated?\n\t\tend", "def has_previous_page\n if last\n paged_nodes.length >= last\n else\n false\n end\n end", "def has_next_page\n @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n end", "def next_page?\n !next_page_number.nil?\n end", "def has_next_page?\n !@raw_page['nextRecordsUrl'].nil?\n end", "def has_previous_page?\n @current_page != 1\n end", "def previous_page?\n page > 1\n end", "def previous?\n return @page > 1\n end", "def next_page?\n !next_page_link.nil?\n end", "def has_next_page\n if first\n paged_nodes.length >= first\n else\n false\n end\n end", "def next_page?\n !next_page_token.nil? && !next_page_token.empty?\n end", "def upper_gap?\n near_pages.last < last_page\n end", "def last_page?\n last_page_number.nil?\n end", "def next_page?\n !!fetch[\"next_page\"]\n end", "def next_page?\n return (@query[:startPage] * (@query[:count] + 1)) < @total_results\n end", "def is_last? response, page\n ( (page >= response.max_pages) ||\n (response && response.healthy? && partial_response?(response)) )\n end", "def last_page?\n response['next'].nil?\n end", "def next_page?\n # rubocop:disable Style/DoubleNegation\n !!next_page_url\n # rubocop:enable Style/DoubleNegation\n end", "def has_next?\n return self.current_page != self.total_pages && self.total_pages > 1\n end", "def bottom_gap?\n near_pages.first > 1\n end", "def prev_page?\n page_number > first_page_number\n end", "def more_pages?\n return false if start_index == 0\n (self.start_index + self.page_length) -1 < self.total_result_count\n end", "def out_of_bounds?\n current_page > total_pages\n end", "def last_page?; ! @doc.has_key? 'next' end", "def last?\n\t locate == self.comic.live_pages.length\n\tend", "def has_previous?\n return self.current_page != 1 && self.total_pages > 1\n end", "def more?\n @current < @pages\n end", "def out_of_bounds?\n current_page > total_pages\n end", "def is_before_last?(elt)\n self[self.size - 2][:page].url == elt.url or self[self.size - 2][:driver].popup_name == elt.popup_name\n end", "def last_page?\n @paging_state.nil?\n end", "def on_page?\n false\n end", "def next_page_token?\n !next_page_token.empty?\n end", "def is_after?(step_nr)\n return !flow.flow_step_is_before?(current_step:step, other_step:step_nr)\n end", "def has_previous_page\n @agent.page.links.find { |l| l.text == \"← Previous\" } == nil ? false : true\n end", "def out_of_range?\n current_page > total_pages\n end", "def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end", "def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def previous_page?\n !previous_page_number.nil?\n end", "def next_page_greater_than_current_page\n self.errors.add(:next_page, \"Next page must come after the current page.\") if self.next_page_id.present? && self.next_page.page_number < self.page_number\n end", "def out_of_bounds?\n current_page > page_count\n end", "def prev?\n current_page > 1\n end", "def eoq?(meta = @meta)\n meta.tail_page_index >= meta.head_page_index && meta.tail_page_offset >= meta.head_page_offset\n end", "def first_page?\n page_number > first_page_number\n end", "def current?(page)\n @current == page\n end", "def after?\n !!@after\n end", "def after?\n !!@after\n end", "def current_page?(page)\n @current_page == page\n end", "def previous_page?\n !previous_page_link.nil?\n end", "def first_page?\n page == 1\n end", "def first_page?\n current_page == pages.begin\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def is_on_page? page_text, negation = ''\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil, otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n raise \"Unexpected Page. The page should not have: '#{page_text}'\" if should_not_have_exception\n raise \"Unexpected Page. Expected was: '#{page_text}'\" if should_have_exception\n end", "def on_page?\n raise NotImplementedError, \"implement me, e.g. using #has_title?\"\n end", "def _next_page\n return false unless defined? @pager and @pager\n\n # go to the next page; break out if there is no next page\n if @pager.next?\n @pager = @pager.next\n else\n @page.number = nil\n return false\n end\n\n true\n end", "def is_first_page?\n p_index.to_i == 1\n end", "def page?\n !!self.page_id\n end", "def first_page?\n current_page == 0\n end", "def current?(other_page)\n page == other_page\n end", "def after?\n !after.nil?\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n unless next_page_condition.nil? || next_page_condition['onclick'] =~ /return false/\n return true\n else\n return false\n end\nend", "def has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n unless next_page_condition.nil? || next_page_condition['onclick'] =~ /return false/\n return true\n else\n return false\n end\nend", "def first_page?\n\t\t\t!prev_page_url if paginated?\n\t\tend", "def next_page\n page = get_page\n num_run_logs = get_run_logs.count\n return (page+1)*PER_PAGE < num_run_logs ? page + 1 : false\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def is_last? response, page\n sess_span.include?(prev_max) || super(response, page)\n end", "def pagination_candidate?(config, page); end", "def paginated?\n current_page && current_page > 0\n end", "def followed_redirects?\n current_url != @url\n end", "def page_found_with_redirect?\n @page_found_with_redirect\n end", "def more_after_cursor?\n more_results == :MORE_RESULTS_AFTER_CURSOR\n end", "def paginated?\n @pages and @pages.length > 1\n end", "def find_page_end\n \n end" ]
[ "0.7279935", "0.7204565", "0.71954507", "0.71824455", "0.71665156", "0.71585774", "0.7155386", "0.7152426", "0.7134372", "0.7065591", "0.7051688", "0.70505506", "0.7032502", "0.7023006", "0.7020634", "0.70202196", "0.70202196", "0.70174813", "0.70095366", "0.6986155", "0.69730455", "0.6953215", "0.6934291", "0.6929503", "0.69120157", "0.6896864", "0.68948126", "0.68926674", "0.68091756", "0.6806437", "0.6796613", "0.6788191", "0.6784689", "0.67702293", "0.67351365", "0.673494", "0.6727499", "0.67256445", "0.6722015", "0.67126554", "0.6711395", "0.66925967", "0.6625332", "0.6625106", "0.6595669", "0.65908074", "0.6578545", "0.6561482", "0.6555993", "0.65449214", "0.65266365", "0.6521631", "0.6518474", "0.6510949", "0.648657", "0.6485534", "0.64771897", "0.64597857", "0.64597857", "0.64551884", "0.64153874", "0.64136934", "0.64130604", "0.63708806", "0.62976587", "0.62917167", "0.6262863", "0.62109786", "0.62109786", "0.6201247", "0.61854887", "0.61819285", "0.61606073", "0.6118457", "0.61146706", "0.6099167", "0.60952616", "0.6082117", "0.60382855", "0.6031364", "0.6016488", "0.6013286", "0.60022974", "0.60022974", "0.60001636", "0.60001636", "0.5995947", "0.5984043", "0.5971942", "0.5971942", "0.5971942", "0.5971942", "0.5945296", "0.5940337", "0.5938655", "0.5933576", "0.59317595", "0.59265745", "0.58872", "0.5883211" ]
0.68062925
30
Path to the view partial. This method exists to allow +Pagination+ objects to be passed directly to +render+ calls in the view.
def to_partial_path "pagination" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_partial_path\n self.class._to_partial_path\n end", "def to_partial_path\n self.class._to_partial_path\n end", "def set_partial_path\n @partial_path = params[:partial_path]\n end", "def to_partial_path\n \"/fields/belongs_to/#{page}\"\n end", "def to_partial_path\n \"alchemy/elements/#{name}_view\"\n end", "def partial_path(path)\n \"listings/form_partials/#{path}\"\n end", "def to_partial_path\n \"alchemy/page_layouts/#{layout_partial_name}\"\n end", "def to_partial_path\n 'spotlight/pages/page'\n end", "def to_partial_path\n 'section'\n end", "def to_partial_path\n self.class._to_partial_path(site)\n end", "def partial\n segments = @page.template.split(\"/\").map!(&:underscore)\n\n # If we have multiple segments & they target an existing page partial\n if segments.count > 1 && lookup_context.exists?(segments.join(\"/\"), [\"pages\"], true)\n partial = segments.pop\n\n return partial_path(segments.join(\"/\"), partial)\n end\n\n partial_path(segments.join(\"/\"))\n end", "def to_partial_path\n 'row'\n end", "def to_partial_path\n model_name = self.class.model_name\n \"monologue/#{model_name.route_key}/#{model_name.singular_route_key}\"\n end", "def to_partial_path\n model_name = self.class.model_name\n \"monologue/#{model_name.route_key}/#{model_name.singular_route_key}\"\n end", "def to_partial_path\n \"alchemy/site_layouts/#{partial_name}\"\n end", "def to_partial_path\n \"curation_concern/#{super}\"\n end", "def partial\n \"/otus/page/material_examined\"\n end", "def to_partial_path\n \"users/user\"\n end", "def to_partial_path\n \"users/user\"\n end", "def render_page_path\n if Settings.website.base_url.present?\n render :partial => \"admin/general/page_path\", :locals => { :page_path => [email protected] }\n else\n render :partial => \"admin/general/page_path\", :locals => { :page_path => @page.path }\n end\n end", "def partial\n mod = self.class.name.split(\"::\")[-2]\n partial_name = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self.class.name))\n File.join(STREAMLINED_TEMPLATE_ROOT, \"relationships/#{mod.underscore}/_#{partial_name}.rhtml\")\n end", "def _to_partial_path\n @_to_partial_path ||= \"#{name.underscore.pluralize}/#{name.demodulize.underscore}\".freeze\n end", "def show_partial\n Partial\n end", "def path\n self.collection_tag.template_tag.page_generator.build_path( self.model)\n end", "def partial\n \"/otus/page/gmap\"\n end", "def partial\n \"/otus/page/public_images\"\n end", "def to_partial_path\n \"madmin/fields/#{self.class.to_s.split(\"Madmin::Field::\").last.underscore}\"\n end", "def partial_for_model(model, partial)\n controller = active_scaffold_controller_for(model)\n while controller.uses_active_scaffold?\n path = File.join(controller.controller_path, partial)\n return path if template_exists?(path, true)\n controller = controller.superclass\n end\n nil\n end", "def partial\n \"/otus/page/taxon_name_header\"\n end", "def render_partial(context, options, &block); end", "def render_partial(path, locals = {})\n raw theme_view.render(partial: path, locals: locals)\n end", "def to_partial_path\n 'documents_submitted_row'\n end", "def partial(name)\n BaseController.render_partial(\"#{name}\")\n end", "def partial(name, options = {})\n options[:partial] = name\n action_view.render(options)\n end", "def partial_for(obj, partial, parent_directory)\n\t\ttmp = obj.class.to_s.split('::')\n\t\tklass_sym = tmp[-1] # e.g, 'OfferArtifact'\n\t\tcontract_sym = tmp[-2] # e.g, 'Bet'\n\t\tpath = nil\n\t\tif (parent_directory != '') then\n\t\t\tpath = \"contract_views/#{contract_sym.underscore}/#{parent_directory}/#{klass_sym.underscore}\"\n\t\t\t# e.g, contract_views/bet/artifacts/OfferArtifact\n\t\telse\n\t\t\tpath = \"contract_views/#{contract_sym.underscore}/\"\n\t\t\t# e.g, contract_views/bet/\n\t\tend\n\t\tFile.join(path, partial)\n\tend", "def find_template\n self.class.ancestor_renderables.each do |klass|\n return \"kaminari/#{klass.template_filename}\" if @renderer.partial_exists? klass.template_filename\n end\n \"kaminari/#{self.class.template_filename}\"\n end", "def to_partial_path\n\t\t\t\t\"br_boleto/#{self.class.name.demodulize.underscore}\"\n\t\t\tend", "def partial\n \"/otus/page/tags_on_otu_by_keyword\"\n end", "def include_partial path, local_assigns = {}\r\n partial = @view.render :partial => path, :locals => local_assigns\r\n @output << partial\r\n end", "def include_partial path, local_assigns = {}\r\n partial = @view.render :partial => path, :locals => local_assigns\r\n @output << partial\r\n end", "def partial(name, options={})\n path = \"com/\"+(params[:path].empty? ? ['index'] : params[:path]).join(\"/\") + \"/\"\n path = 'com' if name.starts_with?('/')\n \n render options.merge(:partial => \"#{RIGHTJS_SRC_DOCS}/#{path}#{name}.html.erb\")\n end", "def lookup_partials_path\n # See FAQ for Views::Base class\n dir = ::File.join(wiki.path, ::File.dirname(file.path))\n path = ::File.join('_includes')\n\n partials_dir = lookup_path(path, dir)\n\n if partials_dir && ::File.directory?(partials_dir)\n partials_dir\n else\n ::File.join(LIBDIR, 'templates', 'includes')\n end\n end", "def render_partial(*ignore_args); end", "def render_partial name, locals\n @context.instance_eval { render :partial => \"view_models/collection/#{name}\", :locals => locals }\n end", "def render_partial(path, locals = {})\n controller.render(partial: \"integral/backend/shared/graphs/#{path}\",\n locals: locals,\n layout: false)\n end", "def navigation_partial\n # Aufgrund Controller ermitteln...\n controller.class.ancestors.grep(Class).each do |klass|\n basepath = klass.to_s.gsub(/Controller/, '').underscore\n nr_of_levels = basepath.scan(/\\//).size + 1\n partial_path = basepath\n nr_of_levels.times do |i|\n partial_name = \"navigation\"\n return \"#{partial_path}/#{partial_name}\" if path_exists?(\"app/views/#{partial_path}/_#{partial_name}.html.*\")\n partial_name = \"navigation_#{partial_path.gsub(/\\//, \"_\")}\"\n return \"shared/#{partial_name}\" if path_exists?(\"app/views/shared/_#{partial_name}.html.*\")\n index = partial_path.rindex(/\\//)\n a = partial_path.split('/')\n a.pop\n partial_path = \"\"\n not_first = false\n a.each do |s|\n if not_first\n partial_path += \"/\"\n end\n partial_path += s\n end\n end\n end\n nil\n end", "def embedded_partial(path,name,opts={})\n additional_opts = opts\n additional_opts.merge!({ :partial => name, :locals => { :___embedded_html___ => element_at(path).inner_html }.merge(opts[:locals]||{}) })\n renderer.view.instance_eval { render(additional_opts) }\n end", "def virtual_path(path, partial)\n return path unless partial\n if index = path.rindex(\"/\")\n path.insert(index + 1, \"_\")\n else\n \"_#{path}\"\n end\n end", "def to_partial_path\n 'contact_details_row'\n end", "def to_partial_form_path\n p = []\n klass = self.class\n #\n # Elkezdunk menni az osok fele, az elso input form template-et fogjuk hasznalni.\n # A model namespace-t figyelembe vesszuk a keresesnel.\n #\n loop do\n path = File.dirname(klass._to_partial_path)\n paths = [path, ::File.dirname(path.reverse).reverse]\n paths.each do |path|\n ActionController::Base.view_paths.each do |view_path|\n if File.exists?(File.join(view_path, path, '_fields.html.erb'))\n return File.join(path, '/fields')\n end\n end\n end\n p += paths\n break if not klass.respond_to?(:parent_class)\n klass = klass.parent_class\n end\n raise \"Partial template '_fields' not found for %s in: %s\" % [self.class.name, p.join(', ')]\n end", "def view_types_dir() 'views/partials/' end", "def preview_partial\n if lookup_context.find_all(\"#{controller_name}/_resource_preview\").any?\n \"#{controller_name}/resource_preview\"\n else\n 'assets/resource_preview'\n end\n end", "def pagination_partial(collection, partial_name = \"layout/page_links\", padding = 3)\n padding ||= 3\n partial(partial_name, :current_page => collection.current_page, :pages => collection.pages, :padding => padding)\n end", "def to_partial_path() \n \"activities/#{target_type.downcase}\" \n end", "def browse_partial\n render :layout => false, :html => (params.to_json * 20)\n end", "def partial; end", "def partial; end", "def partial; end", "def partial; end", "def to_partial_path\n 'room'\n end", "def to_partial_path\n ::File.basename(super)\n end", "def partial_in(controller, partial_name, *args)\n partial_name = PARTIAL_PREFIX + partial_name.to_s\n begin\n controller.render_partial(partial_name, *args)\n rescue\n Ramaze::Log.error(\"Error loading partial #{controller.to_s}.#{partial_name}\")\n raise $!\n end\n end", "def index_partial_for(o)\n \"#{o.class.name.underscore}s/index\"\n end", "def partial(*args)\n partial_name = args.shift.to_s\n partial_name = PARTIAL_PREFIX + partial_name\n render_partial(partial_name, *args)\n end", "def document_partial_path_templates\n @partial_path_templates ||=\n document_path_templates('%{action_name}', ['%{format}', nil])\n #\n # === In ArticlesController view:\n #\n # view_subdirs == ['articles', nil, 'catalog'] which yields:\n #\n # articles/%{action_name}_%{format}\n # articles/%{action_name}\n # %{action_name}_%{format}\n # %{action_name}\n # catalog/%{action_name}_%{format}\n # catalog/%{action_name}\n #\n # === In CatalogController view:\n #\n # view_subdirs == [nil, 'catalog'] which yields:\n #\n # %{action_name}_%{format}\n # %{action_name}\n # catalog/%{action_name}_%{format}\n # catalog/%{action_name}\n #\n # === In BookmarksController view:\n #\n # view_subdirs == [nil, 'catalog'] which yields:\n #\n # %{action_name}_%{format}\n # %{action_name}\n # catalog/%{action_name}_%{format}\n # catalog/%{action_name}\n #\n end", "def view relpath\n (folder_pages+relpath).deserb(self)\n end", "def paginate_path(site, num_page); end", "def partial_path_without_prefix\n old_value = ActionView::Base.prefix_partial_path_with_controller_namespace\n ActionView::Base.prefix_partial_path_with_controller_namespace = false\n\n yield\n ensure\n ActionView::Base.prefix_partial_path_with_controller_namespace = old_value\n end", "def view_paths; end", "def view_paths; end", "def view_paths; end", "def render_path(template, options = {:partial => true, :con_name => nil})\n options[:con_name] ||= controller_name\n template_file = \"_#{template}\" if options[:partial]\n File.exist?(File.join(RAILS_ROOT, 'app', 'views', options[:con_name], template_file + \".rhtml\")) ? template : \"../../vendor/plugins/streamlined/templates/generic_views/#{template}\"\n end", "def partial(partial)\n partial_view = \"partials/_#{partial}\".to_sym\n erb partial_view, :layout => false\nend", "def filter_partial\n # Aufgrund Controller ermitteln...\n controller.class.ancestors.grep(Class).each do |klass|\n basepath = klass.to_s.gsub(/Controller/, '').underscore\n nr_of_levels = basepath.scan(/\\//).size + 1\n partial_path = basepath\n nr_of_levels.times do |i|\n partial_name = \"filter\"\n return \"#{partial_path}/#{partial_name}\" if path_exists?(\"app/views/#{partial_path}/_#{partial_name}.html.*\")\n partial_name = \"navigation_#{partial_path.gsub(/\\//, \"_\")}\"\n return \"shared/#{partial_name}\" if path_exists?(\"app/views/shared/_#{partial_name}.html.*\")\n index = partial_path.rindex(/\\//)\n a = partial_path.split('/')\n a.pop\n partial_path = \"\"\n not_first = false\n a.each do |s|\n if not_first\n partial_path += \"/\"\n end\n partial_path += s\n end\n end\n end\n nil\n end", "def show_partial_for(o)\n \"#{o.class.name.underscore}s/show\"\n end", "def tm_partial_path(technical_metadatum)\n 'technical_metadatum/' + TechnicalMetadatumModule.tm_partials[TechnicalMetadatumModule.tm_class_formats[technical_metadatum.class]]\n end", "def partial_search_paths(requested_partial)\n [].tap do |paths|\n if current_path_nested?\n paths << \"#{current_path.split('/')[0..-2].join('/')}/#{requested_partial.pluralize}\"\n end\n\n paths << current_path\n paths << config(:base_path)\n end.uniq\n end", "def set_search_path\n render 'layouts/set_search_path'\n end", "def paginate(collection, partial)\n if params[:page].present?\n render partial: partial, collection: collection\n else\n render action_name\n end\n end", "def show_selected_item_limit_bookmarks\n render :partial=>\"bookmarks/selected_item_limit\"\n end", "def show_selected_item_limit_bookmarks\n render :partial=>\"bookmarks/selected_item_limit\"\n end", "def page_partial(page)\n page.set_page? ? 'set_page_li' : 'page_li'\n end", "def render_path\n return @render_path.dup unless @page_url.nil?\n generate_file_name()\n @render_path.dup\n end", "def partial(name, options={})\n old_format = self.template_format\n self.template_format = :html\n js render({ :partial => name }.merge(options))\n ensure\n self.template_format = old_format\n end", "def to_partial_path\n \"forms/default\"\n end", "def view_path\n @@view_path\n end", "def to_partial_path\n 'feed_message'\n end", "def path(options={}, &block)\n cur_page.path(options, &block)\n end", "def main_navigation_partial\n partial_path = \"shared/\"\n partial_name = \"main_navigation\"\n path_exists?(\"app/views/#{partial_path}_#{partial_name}.html.*\") ? \"#{partial_path}#{partial_name}\" : nil\n end", "def view relpath\n (folder_views + relpath).deserb(self)\n end", "def render_wizard_partial(main_wizard_model, f)\n @page = main_wizard_model.page || 0\n path = @controller.class.controller_path\n\n template = \"\"\n (0...@page).each { |i|\n fname = \"#{path}/sub_pages/#{main_wizard_model.get_page_template(i)}_hidden\"\n template << \"<%= yield :included_wizard_page_#{i+1} %>\"\n content_for \"included_wizard_page_#{i+1}\" do\n render :partial=>fname, :locals=>{:main_form=>f} rescue \"\"\n end\n }\n\n template << \"<%= yield :included_wizard_page_#{@page+1} %>\"\n content_for \"included_wizard_page_#{@page+1}\" do\n render :partial=>wizard_page_template(main_wizard_model), :locals=>{:main_form=>f}\n end\n\n render :inline=>template\n end", "def render_partial(name, options={})\n name = name.to_s\n if File.exists?(Rails.root.join(\"app\", \"views\", \"#{website.folder}/#{name.gsub(/\\/(?!.*\\/)/, \"/_\")}.html.erb\"))\n name = \"#{website.folder}/#{name}\"\n end\n eval(\"render '#{name}', options\")\n end", "def view\n render partial: params[:template]\n end", "def test_to_partial_path\n assert model.respond_to?(:to_partial_path), \"The model should respond to to_partial_path\"\n assert_kind_of String, model.to_partial_path\n end", "def partial(name)\n @logger.debug( \"#{__method__} name=#{name}\" )\n get_partial( name )\n end", "def to_partial_path\n\t\t\"shouts/shout\"\n\tend", "def partial!(*args)\n if args.one? && _is_active_model?(args.first)\n _render_active_model_partial args.first\n else\n _render_explicit_partial(*args)\n end\n end", "def on_partial(name, indentation)\n \"@output_buffer.concat(render(:partial => #{name.inspect}));\\n\"\n end", "def partial(page, locals={})\n haml page, {:layout => false}, locals\n end", "def render_partial(p,local_assigns={})\n# ActionView::TestCase::Behavior#, which invokes ActionView::Rendering#:\n if local_assigns.blank? # Work around bugs:\n render :partial => p\n else\n render p, local_assigns\n end\n @partial=p.clone.insert p.index(?/)+1, '_'\n end" ]
[ "0.7239226", "0.7102923", "0.6909864", "0.6883244", "0.6808162", "0.67922246", "0.67852366", "0.6759466", "0.67230576", "0.6609029", "0.65802264", "0.65341324", "0.64742404", "0.64742404", "0.63011765", "0.62252325", "0.6155496", "0.6140437", "0.6140437", "0.61348027", "0.6087186", "0.6079136", "0.60635006", "0.60598534", "0.60486484", "0.60316086", "0.60077053", "0.60029626", "0.59927", "0.59916306", "0.5984814", "0.5942011", "0.5914542", "0.5866873", "0.58656436", "0.5859691", "0.5857835", "0.58480567", "0.5841006", "0.5841006", "0.5798185", "0.578396", "0.576647", "0.57598287", "0.5739253", "0.5735146", "0.57287616", "0.5716557", "0.57072425", "0.569895", "0.56855726", "0.56768495", "0.56767964", "0.56683874", "0.56554794", "0.5645361", "0.5645361", "0.5645361", "0.5645361", "0.5632199", "0.56247413", "0.55947274", "0.55795723", "0.5565916", "0.55498785", "0.55395", "0.55376726", "0.55374855", "0.55371636", "0.55371636", "0.55371636", "0.55188227", "0.5511963", "0.5499724", "0.5496557", "0.5494463", "0.54836", "0.5479659", "0.5479357", "0.5463062", "0.5463062", "0.54377943", "0.54351324", "0.5433254", "0.54288614", "0.5388404", "0.5375733", "0.5353089", "0.5348877", "0.5320558", "0.5319763", "0.531818", "0.53180933", "0.5302324", "0.5266647", "0.52544194", "0.5246703", "0.5239601", "0.52361345", "0.5234559" ]
0.7642336
0
a [0, 1, 0, 3, 12] r a [1, 0, 0, 3, 12] r a [1, 0, 0, 3, 12] r a [1, 3, 0, 0, 12] r a [1, 3, 12, 0, 0] r > length so break let anchor = 0 let runner = 1 while runner < array.length // if anchor value = 0 & runner value = 0 // move runner forward if runner value != 0 swap values and incremenet both anchor value isn't 0 push them both forward
def move_zeroes(nums) a = 0 r = 1 while r < nums.length if nums[a] == 0 if nums[r] != 0 nums[a], nums[r] = nums[r], nums[a] else r += 1 next end end a += 1 r += 1 end return nums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arrayChange(a)\n total = 0\n a.each_with_index do |v, i|\n next if i == 0 \n if(v <= a [i-1]) \n total += (a[i-1] + 1) - a[i]\n a[i] = a[i-1] + 1\n end\n end\n total\nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def array_transform(array)\n\tb = []\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\tif i > 0\n\tend\n\treturn b.unshift(1).push(1)\nend", "def consecutive_collapse(arr)\n \n solved = false\n\n\tuntil solved\n\t\tsolved = true\n temp_arr = []\n\n\t\t(0...arr.length - 1).each do |i|\n next if arr[i] == nil\n\n\t\t\tif arr[i] + 1 == arr[i + 1] || arr[i] - 1 == arr[i + 1]\n\n\t\t\t\tarr[i], arr[i + 1] = nil, nil\n\n\t\t\t\tsolved = false\n\t\t\tend\n\n\t\tend\n arr.delete(nil)\n\tend\n\n arr\n\nend", "def collapse(arr)\n\n (0...arr.length - 1).each do |i|\n if arr[i] + 1 == arr[i + 1] || arr[i] == arr[i + 1] + 1\n return arr[0...i] + arr[i + 2..-1]\n end\n end\n arr\nend", "def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend", "def pancake_sort(arr)\n # your code goes here \n r = arr.length\n while r >= 0\n max_index = max(arr, r)\n if max_index != r - 1\n flip(arr, max_index + 1)\n flip(arr, r)\n end\n r -= 1\n end\n return arr\nend", "def countSwaps(a)\n # p a\n swaps = 0\n alen = a.length\n (alen-2).downto(0) do |h|\n sorted = true\n 0.upto(h) do |i|\n if a[i] > a[i+1]\n a[i],a[i+1]=a[i+1],a[i]\n swaps +=1\n sorted = false\n end\n end\n break if sorted\n end\n\n puts \"Array is sorted in #{swaps} swaps.\"\n puts \"First Element: #{a[0]}\"\n puts \"Last Element: #{a[-1]}\"\nend", "def brute_force_combinations(array)\n results = [[array.first]]\n\n until results.all? { |result| result.last == array.last }\n new_results = []\n results.each do |result|\n val = result.last\n next if val == array.last # This sequence is done\n\n i = array.find_index(val)\n\n valid_next_values = array[(i + 1)..[i + 3, array.last].min].select { |v| v <= val + 3 }\n\n # Always add the first one to the existing sequences\n result << valid_next_values.first\n\n # If we have additional values, create new duplicate sequences for them,\n # changing the final value to create the branch.\n new_results << result.dup.tap { |r| r[-1] = valid_next_values[1] } if valid_next_values.count >= 2\n new_results << result.dup.tap { |r| r[-1] = valid_next_values[2] } if valid_next_values.count == 3\n end\n results += new_results\n end\n results\nend", "def minimumSwaps(arr)\n arr = arr.map { |n| n - 1 }\n\n i = 0\n counter = 0\n\n while arr[i] != i do\n i += 1 if arr[i] == i\n if arr[i] && arr[i] != i\n arr[arr[i]], arr[i] = arr[i], arr[arr[i]]\n counter += 1\n end\n end\n\n counter\nend", "def quadruplet_recombine array\n left, right = halve(array)\n\n # ternary\n left_sorted = left.first > left.last ? [left.last, left.first] : left\n right_sorted = right.first > right.last ? [right.last, right.first] : right\n\n sorted = left_sorted[0] < right_sorted [0] ? [left_sorted,right_sorted] : [right_sorted,left_sorted]\n\n sorted.flatten\nend", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def repeatedNumber(a)\n new_arr = Array.new(a.length, false)\n result = []\n (0...a.length).each do |i|\n result << a[i] if new_arr[a[i] - 1] == true \n new_arr[a[i] - 1] = true \n end\n false_idx = new_arr.index(false)\n (false_idx...a.size).each do |i|\n result << i+1 if new_arr[i] == false\n end\n result\nend", "def solution(array)\n result = Array.new(array.length, 0)\n\n array.each do |element|\n if result[element - 1]\n result[element - 1] += 1\n else\n result[element - 1] = 1\n end\n end\n\n result.uniq.size == 1 ? 1 : 0\nend", "def repeated_number_ranges(arr)\n counter = 0\n answer = []\n while counter < arr.length\n temp = []\n while arr[counter] == arr[counter + 1]\n if temp.length == 0\n temp << counter\n end\n counter += 1\n end\n if temp.length == 1\n temp << counter\n answer << temp \n end\n counter += 1\n end\nanswer\nend", "def rotate_array(arr)\n results = arr.map { |n| n }\n results << results.shift\nend", "def move_zeros(array)\n count = 0\n index = 0\n array.each do |el|\n if el == 0\n count += 1\n else\n array[index] = el\n index += 1\n end\n end\n (index...array.length).each do |i|\n array[i] = 0\n end\n\n array\nend", "def build_new_array_from(array)\n\tb = []\n\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\n\t\tif i == 0\n\t\t\tb.push(array[i])\n\t\telsif i == array.length - 1\n\t\t\tb.push(array[i])\n\t\tend\n\tend\n\tb.shift\n\treturn b\nend", "def ari_slice(arr)\n start_diff=nil\n start_idx=nil\n rtn=[]\n idx=0\n until idx>arr.length-1\n if arr[idx+1] && arr[idx+2]\n if arr[idx]-arr[idx+1]==arr[idx+1]-arr[idx+2] &&start_diff.nil?\n start_diff=arr[idx]-arr[idx+1]\n start_idx=idx\n idx+=2\n elsif start_diff.nil?\n idx+=1\n elsif start_diff && start_diff==arr[idx]-arr[idx+1]\n idx+=1\n elsif start_diff\n rtn<< arr[start_idx..idx]\n start_idx=nil\n start_diff=nil\n idx+=1\n end\n elsif arr[idx+1]\n if start_diff && start_diff==arr[idx]-arr[idx+1]\n idx+=1\n elsif start_diff\n rtn<< arr[start_idx..idx]\n start_idx=nil\n start_diff=nil\n idx+=1\n else\n idx+=1\n end\n else\n if start_diff\n rtn<< arr[start_idx..idx]\n start_idx=nil\n start_diff=nil\n idx+=1\n else\n idx+=1\n end\n end\n end\n rtn\nend", "def bubbly(arr)\n loop do\n switch = false\n (arr.length - 1).times do |i|\n \tif arr[i] > arr[i + 1]\n arr[i + 1],arr[i] = arr[i],arr[i + 1]\n switch = true\n end\n end\n if switch == false\n break\n end\n end\n arr\nend", "def example2(arr)\n results = []\n # arr.reverse.each do |ele|\n # ele == 0 ? results << ele : results.unshift(ele)\n # end\n\n arr.each_with_index do |el, idx|\n if el == 0\n results << el\n arr.delete_at(idx)\n end\n end\n arr.concat(results)\nend", "def rotate_array(a, d) #Input array \"a\" and rotation by \"d\" elemets\n finish =a.length-1\n block_swap(a,0,finish,d)\nend", "def rotate_backwards(arr)\n\nend", "def zero_ord_arr(arr)\n z = 0\n i = 1\n while i < arr.length\n if arr[z] != 0 && arr[i] == 0\n z = i\n end\n if arr[z] == 0 && arr[i] != 0\n arr[z], arr[i] = arr[i], arr[z]\n z += 1\n end\n i += 1\n end\n arr\nend", "def consecutive_collapse(array)\n new_arr = array.map {|el| el}\n\n i = 0\n while i < new_arr.length\n if (new_arr[i] + 1 == new_arr[i+1]) || (new_arr[i] - 1 == new_arr[i+1])\n new_arr.delete_at(i+1)\n new_arr.delete_at(i)\n i = 0\n else\n i += 1\n end\n end\n new_arr\nend", "def b_sort(array)\n v = array.length\n loop do\n swap = false\n (v-1).times do |i|\n if array[i] > array[i + 1]\n array[i], array[i + 1] = array[i + 1], array[i]\n swap = true\n end\n end\n break if not swap\n end\n p array\nend", "def minimumSwaps(arr)\n swaps = 0\n i = 1\n arr.each do |element|\n j = arr.index(i) # i's index\n unless arr[j] == element\n arr[i-1] = arr[j]\n arr[j] = element\n swaps += 1\n end\n i += 1\n end\n return swaps\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def merge(l, r)\n merged_together = [] #The merged array\n while l.length > 0 && r.length > 0\n if l[0] <= r[0]\n merged_together << l.shift #The shfit deletes the number from the array and moves into\n # the merged_together array\n elsif r[0] < l[0]\n merged_together << r.shift #Same as the if statement except for the r\n end\n end\n merged_together + l + r\nend", "def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend", "def solve(a)\n return [[1]] if a == 1\n prev = solve(a - 1)\n last = prev.last\n new_row = [1]\n (0..last.length - 2).each do |i|\n new_row << last[i] + last[i + 1]\n end\n new_row << 1\n prev << new_row\nend", "def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n #use two pointers and do slidding window technique\n pointer_a = 0\n pointer_b = 1\n while(pointer_b < a.size)\n if a[pointer_a] == a[pointer_b]\n a.delete(a[pointer_a])\n else\n pointer_a += 1\n pointer_b += 1\n end\n end\n return a[0]\nend", "def zig_zag(arrays)\n flag = 0\n arrays.each_with_index do |e, i|\n break if arrays[i+1] == nil\n if flag == 0\n if not e < arrays[i+1]\n arrays[i], arrays[i+1] = arrays[i+1], arrays[i]\n end\n flag = 1\n elsif flag == 1\n if not e > arrays[i+1]\n arrays[i], arrays[i+1] = arrays[i+1], arrays[i]\n end\n flag = 0\n end\n end\n\n arrays\nend", "def solution(a)\n comp_array = (Array.new(a.length+1){ |index| index+1 })\n diff = comp_array - a\n p diff[0]\nend", "def minimumSwaps(arr)\n swaps = 0\n alen = arr.length\n index_lookup = {}\n 0.upto(alen-1) do |i|\n index_lookup[arr[i]] = i\n end\n 0.upto(alen-1) do |i|\n if arr[i] == i+1\n # puts \"nothing to do\"\n next\n end\n k = index_lookup[i+1]\n index_lookup[arr[i]] = k\n p [i, k]\n arr[i],arr[k] = arr[k],arr[i]\n swaps +=1\n end\n return swaps\nend", "def move_zeros_left_failure(array)\n zero_indexes = Array.new\n\n array.each_with_index do |value, index|\n if value == 0\n zero_indexes << index\n end\n end\n\n zeros_cursor = 0\n zero_indexes.each do |index|\n\n #This does not work, because we're swapping.. NOT maintaining order.\n #If this index is not in a place that will eventually be a zero.\n unless index < zero_indexes.size - 1\n tmp = array[index]\n array[index] = array[zeros_cursor]\n array[zeros_cursor] = 0\n zeros_cursor += 1\n end\n\n end\n\n return array\nend", "def smooth_sort(array)\n orders = [0]\n trees = 0\n\n (0...array.length).each do |i|\n if trees > 1 && orders[trees - 2] == orders[trees - 1] + 1\n trees -= 1\n orders[trees - 1] += 1\n elsif trees > 0 && orders[trees - 1] == 1\n orders[trees += 1] = 0\n else\n orders[trees += 1] = 1\n end\n find_and_sift(array, i, trees - 1, orders)\n end\n (array.length - 1).downto(1) do |i|\n if orders[trees - 1] <= 1\n trees -= 1\n else\n right_index = i - 1\n left_index = right_index - LEONARDO_NUMS[orders[trees - 1] - 2]\n trees += 1\n orders[trees - 2] -= 1\n orders[trees - 1] = orders[trees - 2] - 1\n find_and_sift(array, left_index, trees - 2, orders)\n find_and_sift(array, right_index, trees - 1, orders)\n end\n end\n array\nend", "def rotate_array(arr, num)\n num.abs.times do |i|\n if num < 0\n ele = arr.shift\n arr.push(ele)\n else\n ele = arr.pop \n arr.unshift(ele)\n end\n end\n arr\nend", "def zig_zag(array)\n flag = 0\n\n array.each_with_index do |v, i|\n break if array[i+1] == nil\n if flag == 0\n if not array[i] < array[i+1]\n array[i], array[i+1] = array[i+1], array[i]\n end\n flag = 1\n elsif flag == 1\n if not array[i] > array[i+1]\n array[i], array[i+1] = array[i+1], array[i]\n end\n flag = 0\n end\n end\n\n array\n\nend", "def merge_sort(array)\n total_length = array.length\n size = 2\n while size < total_length + 1\n sorted_array = []\n array.each_slice(size).to_a.each do |group|\n slice1 = group[0...(group.length / 2)]\n slice2 = group[(group.length / 2)..-1]\n combined = []\n \n while slice1.length > 0 || slice2.length > 0\n \n if slice1.empty? == false\n if slice2.empty? || slice1.first < slice2.first\n combined << slice1.shift\n elsif slice1.first == slice2.first\n combined << slice1.shift\n combined << slice2.shift\n else\n combined << slice2.shift\n end\n \n elsif slice2.empty? == false\n if slice1.empty? || slice2.first < slice1.first\n combined << slice2.shift\n elsif slice1.first == slice2.first\n combined << slice1.shift\n combined << slice2.shift\n else\n combined << slice1.shift\n end\n end\n end\n sorted_array << combined\n end\n array = sorted_array.flatten\n size += 2\n end\n p array\nend", "def sort_array_by_parity(a)\n result = []\n a.each do |ele|\n if ele.even?\n result.unshift(ele)\n else\n result << ele\n end\n end\n result\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def bubble(arr)\nmod_arr = arr.length\n loop do\n switch = false\n (mod_arr-1).times do |el|\n if arr[el] > arr[el+1]\n arr[el], arr[el+1] = arr[el+1], arr[el]\n switch = true\n end\n end\n break if switch == false\n end\narr\nend", "def repeated_number_ranges(arr)\n repeated_number_ranges = []\n index_start_end = []\n\n arr.each_with_index do |el, idx|\n if el == arr[idx + 1] && el != arr[idx - 1]\n # if == NEXT but != PREVIOUS\n index_start_end << idx\n elsif el == arr[idx - 1] && el != arr[idx + 1]\n # if == PREVIOUS but != NEXT\n index_start_end << idx\n repeated_number_ranges << index_start_end unless index_start_end.empty?\n index_start_end = [] # reinitialize temp variable as empty array\n end\n end\n\n repeated_number_ranges\nend", "def move_zeros(array)\n current_index = 0\n num_zeros = 0\n\n while current_index < (array.length - num_zeros)\n current_value = array[current_index]\n\n if current_value != 0\n current_index += 1\n next\n end\n\n back = array.length - 1 - num_zeros\n array[current_index], array[back] =\n array[back], array[current_index]\n num_zeros += 1\n\n # we can't add one to current_index since `back` may have contained a zero and we don't know it\n end\n\n array\nend", "def rotate_array(arr)\n result = []\n arr.reverse.each { |e| e == arr.first ? result << e : result.prepend(e) }\n result\nend", "def minimumSwaps(arr)\n right_pointer = arr.count - 1\n count = 0\n min_swaps = 0\n\n while count < arr.count\n arr_value = count + 1\n if (arr[count] != arr_value)\n\n while arr_value != arr[right_pointer]\n right_pointer -= 1;\n end\n\n if right_pointer != count\n arr[count], arr[right_pointer] = arr[right_pointer], arr[count]\n min_swaps += 1\n end\n end\n count += 1\n right_pointer = arr.count - 1\n end\n min_swaps\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def forward_pass(array, compare)\n swapped = false\n 0.upto(array.length - 2) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend", "def moves_zeros(array)\n i = 0\n count = 0\n new_array = []\n while i < array.length\n if array[i] != 0\n new_array << array[i]\n else\n count += 1\n end\n i += 1\n end\n count.times { new_array << 0}\n new_array\nend", "def solution(a)\n sorted_array = a.sort\n\n index = 0\n while index < sorted_array.length do\n break unless sorted_array[index] == sorted_array[index+1]\n index += 2\n end\n\n sorted_array[index]\nend", "def sort_array_by_parity(a)\n low = 0\n high = a.length - 1\n while low < high\n if a[low] % 2 == 0\n low += 1\n else\n a[low], a[high] = a[high], a[low]\n high -= 1\n end\n end\n a\nend", "def amicables(limit)\n numbers = Array.new(limit, 0)\n (1...limit).each do |i|\n ((i * 2)...limit).step(i) do |j|\n numbers[j] += i\n end\n end\n result = []\n numbers.each_with_index do |j, i|\n if j < limit && i == numbers[j] && i != j\n result << i\n end\n end\n result\nend", "def sluggish_octopus(array)\n\n sorted = false\n until sorted\n sorted = true\n\n array.each_index do |i|\n next if i == array.length - 1\n j = i + 1\n\n if array[i].length > array[j].length\n sorted = false\n array[i], array[j] = array[j], array[i]\n end\n end\n end\n array.last\n\nend", "def bubble_sort_by(arr)\n\tloop do\n\t\tswitched = false\n\t\t(arr.count-1).times do |i|\n\t\t\tif yield(arr[i],arr[i+1])<0\n\t\t\t\tarr[i],arr[i+1]=arr[i+1], arr[i]\n\t\t\tend\n\t\tend\n\t\tbreak if not switched\n\tend\n\tarr\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def consecutive_collapse(arr)\n flag = true\n\n while flag\n flag = false\n arr[0..-2].each_with_index do |num, idx|\n if num == arr[idx + 1] + 1 || num == arr[idx + 1] - 1\n arr.delete_at(idx)\n arr.delete_at(idx)\n flag = true\n break\n end\n end\n\n end\n\n arr\nend", "def consecutive_collapse(arr)\n\n n = (0...arr.length-1).to_a.index do |i|\n a = arr[i]\n b = arr[i+1]\n\n a == b + 1 || b == a + 1\n end \n return arr if n == nil\n \n narr = arr[0...n] + arr[n+2..-1]\n if narr == consecutive_collapse(narr)\n return narr\n else\n return consecutive_collapse(narr)\n end\nend", "def alternatingSort(a)\n ar = []\n f = a\n s = a.reverse\n (0...a.size).each do |i|\n if i.even?\n ar.push(f.shift)\n else\n ar.push(s.shift)\n end\n end\n return true if a.size == 1\n return false if ar.each_cons(2).any?{|(x,y)| x >= y}\n \n true\nend", "def rotate_array(input_array)\n return input_array if input_array.size <= 1\n new_array = []\n index_counter = 1\n loop do\n new_array << input_array[index_counter]\n index_counter += 1\n break if index_counter >= input_array.size\n end\n new_array << input_array[0]\n new_array\nend", "def destutter2(seq)\n result = [] #result will be a new array\n last = nil #keep track of last thing\n\n seq.each do |item|\n if item != last\n result.push(item)\n #result << item\n end\n last = item\n end\n result\nend", "def fold_array(array, runs)\n solution = []\n\n\n if runs ==1 and array.length == 1\n solution.push(array[0])\n return solution\n####################\n elsif runs == 1\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n return solution\n#######################\n elsif runs == 2\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n nextrun = solution\n if nextrun.length.even?\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-2) do |x|\n solution[x] = nextrun[x] + nextrun[array.length - (x+1)]\n end\n solution.push(nextrun[mid] + nextrun[mid - 1])\n else\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n end\n return nextrun\n########################\n elsif runs == 3\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n nextrun = solution\n if nextrun.length.even?\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-2) do |x|\n solution[x] = nextrun[x] + nextrun[array.length - (x+1)]\n end\n solution.push(nextrun[mid] + nextrun[mid - 1])\n else\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n end\n ######\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n return nextrun\n #return [nextrun[0] + nextrun[1]] if nextrun.length == 2\n\n\n end\n\n\n\nend", "def sluggish_octopus!(array)\n sorted = false\n until sorted\n sorted = true\n array.each_index do |index|\n index_2 = index + 1\n next if index_2 == array.length\n if array[index].length > array[index_2].length\n array[index],array[index_2] = array[index_2],array[index]\n sorted = false\n end\n end\n end\n array[-1]\nend", "def rotate_array(array)\r\n result = array.select {|x| x}\r\n result << result.shift\r\nend", "def arrayManipulation(arr)\n for i in 1..arr.size-1\n arr[i]=arr[i-1]+arr[i]\n end\n arr\nend", "def backtrack(nums, cur_array, result)\n if cur_array.size == nums.size\n result << cur_array.clone\n\n return\n end\n\n (0..nums.length - 1).each do |i|\n next if cur_array.include?(nums[i])\n\n cur_array << nums[i]\n\n backtrack(nums, cur_array, result)\n\n cur_array.pop\n end\nend", "def sort_array_by_parity(a)\n i = 0\n j = a.length - 1\n while i < j\n if a[i] % 2 > a[j] % 2\n temp = a[i]\n a[i] = a[j]\n a[j] = temp\n end\n if a[i] % 2 == 0\n i += 1\n end\n if a[j] % 2 == 1\n j -= 1\n end\n end\n return a\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def merge(array1, array2)\r\n mixed_array = array1 + array2\r\n \r\n loop do\r\n swap = false\r\n current_number = 0\r\n next_number = 1\r\n \r\n (mixed_array.size - 1).times do\r\n if mixed_array[current_number] <= mixed_array[next_number]\r\n current_number += 1\r\n next_number += 1\r\n next\r\n else\r\n mixed_array[current_number], mixed_array[next_number] = mixed_array[next_number], mixed_array[current_number]\r\n current_number += 1\r\n next_number += 1\r\n swap = true\r\n end\r\n end\r\n \r\n break if swap == false\r\n end\r\n \r\n mixed_array\r\nend", "def reverse!(arr)\n return arr if arr == [] || arr.length == 1\n \n finished = arr.length - 1\n \n loop do\n e = arr.shift\n arr.insert(finished, e)\n finished -= 1\n break if finished == 0\n end\n arr\nend", "def reverse!(arr)\n return arr if arr == [] || arr.length == 1\n \n finished = arr.length - 1\n \n loop do\n e = arr.shift\n arr.insert(finished, e)\n finished -= 1\n break if finished == 0\n end\n arr\nend", "def zig_zag(arr)\n # return 0 unless arr.length > 1\n\n arr.each_with_index do |x, i|\n return arr if arr[i + 1].nil?\n\n #y = x\n if ((x > arr[i + 1]) && i.even? ) || ((x < arr[i + 1]) && i.odd?)\n arr[i..(i + 1)] = arr[i..(i + 1)].reverse\n #arr[i] = arr[i + 1]\n #arr[i + 1] = y\n end\n end\n end", "def bubble_sort_by array\n\ti=0\n\tarray.length.times do\n\t\twhile i<array.length-1\t\t\n\t\t\tarray[i],array[i+1]=array[i+1],array[i] if yield(array[i],array[i+1])>0\n\t\t\ti+=1\n\t\tend\n\t\ti=0\n\tend\n\tarray\nend", "def consecutive_collapse(arr)\n (0...arr.size - 1).each do |i|\n j = i + 1\n next unless (arr[i] - arr[j]).abs == 1\n\n front = i.zero? ? [] : arr[0...i]\n rear = j == arr.size - 1 ? [] : arr[(j + 1)...arr.size]\n return consecutive_collapse(front + rear)\n end\n arr\nend", "def minimumSwaps(arr)\r\n swap_cnt = 0\r\n valid_arr = (1..arr.size).to_a\r\n\r\n until arr == valid_arr do\r\n arr.each_with_index do |elem, i|\r\n if elem > valid_arr[i]\r\n target = arr.index(i+1)\r\n\r\n arr[i] = valid_arr[i]\r\n arr[target] = elem\r\n swap_cnt += 1\r\n end\r\n end\r\n end\r\n\r\n swap_cnt\r\nend", "def move_zeros(array)\n current_index = 0\n num_zeros = 0\n\n while current_index < (array.length - num_zeros)\n current_value = array[current_index]\n\n if current_value != 0\n current_index += 1\n next\n end\n\n back = array.length - 1 - num_zeros\n array[current_index], array[back] =\n array[back], array[current_index]\n num_zeros += 1\n\n # we can't add one to current_index since `back` may have\n # contained a zero and we don't know it.\n end\n\n # Return the array\n array\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def bubble_sort_by(array)\n swap_status = nil\n iterations = 0\n\n until swap_status == false\n swap_status = false\n working_array = array[0..((array.count - 1) - iterations)]\n working_array.each_with_index do |item, index|\n if item != working_array.last\n if yield(array[index], array[index + 1]) < 0\n array[index], array[index + 1] = array[index + 1], array[index]\n swap_status = true\n end\n end\n end\n iterations += 1\n end\n array\nend", "def bubble_sort_by(array)\n switch = true\n while switch\n switch = false\n (0...array.length - 1).each do |i|\n if yield(array[i], array[i + 1]).positive? \n array[i], array[i + 1] = array[i + 1], array[i]\n switch = true\n end\n end\n end\n array\nend", "def three(array)\n array.sort!.shift\n array << 6\nend", "def changing_sequence(arr)\n pattern = arr[1] - arr[0]\n arr.each_cons(2).with_index do |(num1, num2), idx|\n return idx if (num2 - num1) * pattern < 0\n end\n -1\nend", "def rotate(array,opt)\r\n\ti=0\r\n\tif opt > 0\r\n\t\twhile i < opt\r\n\t\t\tarray.unshift(array.last)\r\n\t\t\tarray.pop\r\n\t\t\ti +=1\r\n\t\t\r\n\t\tend\r\n\telsif opt < 0\r\n\t\twhile opt < i\r\n\t\t\tarray << array.first\r\n\t\t\tarray.shift\r\n\t\t\topt +=1\r\n\t\tend\r\n\tend\r\n\r\n\tarray\r\n\r\nend", "def pack_consecutive_duplicates\n self.inject([[]]) do |array, current|\n if array[-1][-1] == current or array[-1][-1].nil?\n array[-1] << current\n else\n array << [current]\n end\n array\n end\n \n end", "def rotate_array(array)\n first_value = array.slice(0)\n other_values = array.slice(1..-1)\n other_values << first_value\nend", "def rotate_array(array)\n first_value = array.slice(0)\n other_values = array.slice(1..-1)\n other_values << first_value\nend", "def sum_it_up(array)\n return array if array.size == 1\n\n new_array = []\n\n array.size.times do |number|\n if (number + 1) < array.size\n new_array << (array[number] + array[number + 1])\n end\n end\n\n new_array\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def sortmore(array)\n (array.length-1).times do |a|\n i = 0\n n = array.length-2\n\n begin\n if array == [] || array == [1]\n break\n elsif array[i] > array[i+1] then\n\n array[i], array[i+1] = array[i+1], array[i]\n\n next\n\n end\n\n i+= 1\n end until i > n\n end\n print array\n return array\n end", "def reverse!(arr)\nreturn arr if arr.size == 0 || arr.size == 1\nfront_counter = 0\nback_counter = -1\n\nloop do\n arr[front_counter], arr[back_counter] = arr[back_counter], arr[front_counter]\n front_counter += 1\n back_counter -= 1\n break if front_counter == (arr.size / 2).floor\nend\n\n# while left_index < array.size / 2\n# array[left_index], array[right_index] = array[right_index], array[left_index]\n# left_index += 1\n# right_index -= 1\n# end\n\narr\nend", "def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend", "def get_abas(a)\n abas = []\n 0.upto(a.length) do |index|\n if (a[index+2] == nil)\n next\n else\n if (a[index] == a[index+2] && a[index] != a[index+1])\n abas << a[index] + a[index+1] + a[index+2]\n end\n end\n end\n return abas\nend", "def sq_arr(a)\n # require 'debug'\n a.map! { |x| x**2 }\n j = (a.length - 1)\n return a if j == 0\n while a[0] >= a[1] && j >= 0\n p j\n if a[0] > a[j]\n a.insert(j, a.shift)\n else\n j -= 1\n end\n end\n a\nend", "def reversal(array)\n array = array.map{|element| element} #creates a copy of array, remove to have same object_id's\n left_index = 0\n right_index = -1\n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -=1\n end\n\n array\nend", "def move_zeroes(nums)\n\n last_non_zero = -1\n\n # iterates through list once\n nums.length.times do |current|\n if nums[current] != 0\n last_non_zero += 1\n nums[current], nums[last_non_zero] = nums[last_non_zero], nums[current]\n end\n end\n\n nil\nend", "def permutations(array)\n #[1,2]\nreturn [array] if array==[1]\n\n\n\n\nprevious=permutations(array[0...-1])\nlast = array.last\nresult=[]\nprevious.each do |ele|\n (0...array.length-1).each do |i|\n result << ele[0..i]+[last]+ele[i+1..-1]\n \n \n end\n result << [last]+ele\n\n end\n result\nend", "def move_zeroes(array)\n num_of_zeros = array.count(0) # This step of assigning array.count(0) to a variable is necessary to reduce the time taken to evaluate the kata because LeetCode compiler doesn't have to evaluate array.count(0) again inside the loop; it can simply use the variable that is stored in memory. This is important because LeetCode imposes a time constraint on every kata.\n (0...array.count).each { |position| # (0..array.count-1) does the same as (0...array.count). triple dots for range operator means excluding the end value; double dots include the end value.\n break if position == array.count - num_of_zeros # Because there're 2 zeroes, if all of them have been deleted and pushed to the end of the array, then the 1st zero will be at position number 3(index starts at 0). Therefore, once we reached that position, we can stop and break from the loop.\n while array[position] == 0\n array.delete_at(position) # delete the number at that position from the array. delete_at() only accepts an index as argument.\n array.push(0) # push to the end of the array.\n end\n }\n return array\nend", "def array_sort(arr)\nx = arr.length\nif x == 1\nelsif x == 2\n if arr[0] > arr[1]\n arr[0], arr[1] = arr[1], arr[0]\n end\nelse\n loop do\n modified = FALSE\n (x-2).times do |x|\n if (arr[x] < arr[x + 1]) && (arr[x] < arr[x + 2])\n if arr[x + 2] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x], arr [x + 2], arr[x + 1]\n modified = TRUE\n end\n elsif (arr[x + 1] < arr[x]) && (arr[x + 1] < arr[x + 2])\n if arr[x] < arr[x + 2]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n elsif arr[x + 2] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr [x + 2], arr[x]\n modified = TRUE\n elsif arr[x + 2] == arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n end\n elsif (arr[x + 2] < arr[x]) && (arr[x + 2] < arr[x + 1])\n if arr[x] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n elsif arr[x + 1] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x + 1], arr[x]\n modified = TRUE\n elsif arr[x] == arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n end\n end\n end\n break if modified == FALSE\n end\nend\n arr\nend", "def consecutive_collapse(arr)\n collapsed = true\n while collapsed\n collapsed = false\n i = 0\n while i < arr.length - 1\n if arr[i] - arr[i + 1] == 1 || arr[i] - arr[i + 1] == -1\n arr = arr[0...i] + arr[i + 2..-1]\n collapsed = true\n end\n i += 1\n end\n end\n arr\nend", "def shift_values(arr)\n for i in 0...arr.length-1\n arr[i] = arr[i + 1]\n end\n arr[arr.length - 1] = 0\n return arr\nend" ]
[ "0.66889143", "0.661509", "0.6571891", "0.65650797", "0.651446", "0.6492954", "0.6449491", "0.6388994", "0.6383238", "0.63700044", "0.63621944", "0.63609236", "0.632027", "0.6316491", "0.63137066", "0.63135296", "0.63039297", "0.6291633", "0.62479186", "0.6243802", "0.62385976", "0.62295645", "0.62004036", "0.61978847", "0.6189702", "0.61849594", "0.61843264", "0.6178951", "0.6171872", "0.6171373", "0.6166077", "0.6164466", "0.61625314", "0.6159795", "0.6153871", "0.61454827", "0.6141389", "0.61402094", "0.61380875", "0.6137213", "0.6135099", "0.6130479", "0.6130015", "0.61258626", "0.6125208", "0.6121715", "0.612085", "0.61094975", "0.61024827", "0.6094343", "0.6093538", "0.6084747", "0.60793906", "0.60681087", "0.6063637", "0.6058019", "0.60490227", "0.604499", "0.6041091", "0.6039", "0.60278827", "0.6027125", "0.60266316", "0.60223144", "0.60217524", "0.6021633", "0.60187185", "0.60186434", "0.6013084", "0.60107684", "0.60087293", "0.60087293", "0.60055333", "0.6001419", "0.599759", "0.59946233", "0.599403", "0.59913605", "0.59900135", "0.598852", "0.5981737", "0.5979777", "0.5971229", "0.5968779", "0.5967002", "0.5966626", "0.59655946", "0.5962227", "0.596188", "0.5961398", "0.5956736", "0.5953322", "0.59417576", "0.59405464", "0.5931273", "0.59309226", "0.5930795", "0.5922894", "0.59226614", "0.5918193" ]
0.6482195
6
GET /docker_instances GET /docker_instances.json
def index @docker_instances = DockerInstance.all @docker_instance = DockerInstance.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def get_cloud_instances(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances\") \n end", "def list_instances(request_id)\n instances = []\n JSON.parse(resource[\"/requests/#{request_id}\"].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def monitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"MonitorInstances\", :params => params)\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "def get_instances_description\n instances\n end", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def instance_data\n @instance_data ||= JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def list_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_instances_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::BareMetalSolution::V2::ListInstancesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def fetch_instance(shortname = :all, options = {})\n return instances if instances && !options[:force]\n\n fetch_stack\n unless instance_list\n self.instance_list = self.instances =\n aws_client.describe_instances(stack_id: stack[:stack_id])[:instances]\n end\n\n if shortname != :all\n fetch_layer(shortname, force: true)\n self.instances = []\n\n layers.each do |layer|\n instance = aws_client.describe_instances(\n layer_id: layer[:layer_id])\n self.instances << instance[:instances]\n end\n\n self.instances.flatten!\n end\n end", "def available_instances\n @available_instances ||= {}\n end", "def get_images\n images = get(\"cloud-instances/#{guid}/images\")[\"images\"] || []\n\n images.map do |image|\n get_image(image[\"imageID\"])\n end.compact\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def index\n @instances = Instance.all\n end", "def index\n @instances = Instance.all\n end", "def instances\n @instances ||= []\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def get_pvm_instances\n pvm_instances = get(\"cloud-instances/#{guid}/pvm-instances\")[\"pvmInstances\"] || []\n\n pvm_instances.map do |pvm_instance|\n get_pvm_instance(pvm_instance[\"pvmInstanceID\"])\n end\n end", "def my_instance_id\n Net::HTTP.get(URI('http://169.254.169.254/1.0/meta-data/instance-id'))\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def instances()\n return @instances\n end", "def list_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_instances_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Notebooks::V1::ListInstancesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def list_public_virtual_machine_images\n request_path = '/services/images'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_images_from_xml(response)\n end", "def instances(type)\n @instances[type]\n end", "def get_instances(incl_stopped=false)\n \n instances = @ec2.describe_instances\n instances = instances.select { |x| x[:aws_groups].include? @group_name }\n \n if(instances.length == 0)\n raise CaTPAWS::EC2::Error::InstanceRetrieval, \"No instances found in this group\"\n end \n \n unless (incl_stopped)\n instances = instances.select {|x| x[:aws_state_code].to_i <= 16}\n end\n @instances = instances\n end", "def instance_for(challenge) \n instance_id = `docker run -P -d #{challenge['name']}`.chomp\n port = `docker port #{instance_id} #{challenge['port']}`.chomp.split(/:/)[1]\n [instance_id, port]\n end", "def vm_instances\n @conn.vminstances\n end", "def getPAYGInstances\n self.class.get('/v1/payAsYouGo/bareMetals/instances', @options)\n end", "def cached_instances\n # Puppet.debug(\"cached_instances - object id: #{PuppetX::PowerCLI::Helper.instance.object_id}\")\n # Puppet.debug(\"cached_instances - resource.type: #{resource.type}\")\n PuppetX::PowerCLI::Helper.instance.cached_instances[resource.type]\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def get_by_id(id)\n self.class.get(\"/aldebaran-instances/instances/#{id}\", :basic_auth => @auth)\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {}, Mastodon::Instance)\n end", "def find_instances(tags)\n attempts = 0\n begin\n ec2.servers.select { |server| tags.reject { |k,v| server.tags[k] == tags[k] }.empty? }\n rescue Excon::Errors::ServiceUnavailable\n sleep 5\n attempts += 1\n return [] if attempts == 5\n retry\n end\n end", "def call_describe_instances\n\t`ec2-describe-instances >> #{EC2_DESCRIBE_INSTANCES_OUTPUT}`\nend", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {},\n Mastodon::Instance)\n end", "def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end", "def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end", "def spawn_instances(challenges)\n challenges.map do |name, challenge|\n if challenge[\"launch_docker_per_user\"]\n instance_id, port = instance_for(challenge)\n [name, instance_id, port]\n else\n nil\n end\n end\n end", "def db_instances(region)\n logger.info(\"fetching db instances of region #{region}\")\n rds_client = get_rds_client(region)\n next_token = nil\n rds_instances = []\n\n loop do\n options = { marker: next_token }\n resp = rds_client.describe_db_instances(options)\n rds_instances += resp.db_instances\n next_token = resp.marker\n break unless next_token\n end\n rds_instances\n end", "def start_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = {}\n params.merge!(pathlist(\"InstanceId\", options[:instance_id]))\n return response_generator(:action => \"StartInstances\", :params => params)\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def get_instances\n all_instances = Array.new()\n @groups.values.each do |instances|\n instances.each do |instance|\n all_instances << instance\n end\n end\n all_instances\n end", "def set_docker_instance\n @docker_instance = DockerInstance.find(params[:id])\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def get_instances(role: nil, username: nil, bastion: nil)\n puts \"Getting instances for role: #{role}\"\n servers = []\n instances_for_role(role).each do |res|\n res[:instances].each do |inst|\n servers << \"#{username}@#{inst[:private_ip_address]}\"\n end\n end\n\n puts \" - #{servers.join(', ')}\"\n servers\n end", "def aws_instance_get(opts)\n AWS::EC2.new.instances[opts[:instance_id]]\n end", "def instances\n @instances ||= begin\n instances_channel = channel(\n Admin::V2::BigtableInstanceAdminClient::SERVICE_ADDRESS\n )\n Admin::V2::BigtableInstanceAdminClient.new(\n credentials: instances_channel,\n timeout: timeout,\n client_config: client_config,\n lib_name: \"gccl\",\n lib_version: Google::Cloud::Bigtable::VERSION\n )\n end\n end", "def instances_status\n @instances.each do |i_id, meta|\n status = AWS::CLI_Interface.ec2_instance_status(i_id)\n output = \"#{meta['name']} (#{i_id})\".colorize(color: :white, background: :blue) +\n \" : \".colorize(:yellow) +\n \"#{status[:label]}\".colorize(color: :white, background: status[:color])\n\n if meta.has_key? 'timeout'\n output += \" : \".colorize(:yellow)\n output += \"Timeout: #{meta['timeout']}\".colorize(color: :black, background: :light_yellow)\n end\n\n Logging.log output\n end\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def get_nvidia_docker_info(url)\n resp = Net::HTTP.get_response(URI.parse(url))\n buffer = resp.body\n json_result = JSON.parse(buffer)\n return json_result\nend", "def containers\n TestLab::Container.all\n end", "def all(options = {})\n request_model = @request_model_factory.all_builds_request_model(options)\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body)['instances'].map do |hash|\n Fabricio::Model::Build.new(hash)\n end\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def lookup_instance_id\n metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'\n instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )\n end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "def get_docker_image_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker image list\"\n output = execute_command(options,message,command)\n images = output.split(/\\n/)\n return images\nend", "def get_instance instance_id\n instances.get_instance name: instance_path(instance_id)\n end", "def get_instances_description\n @cached_descriptions ||= EC2ResponseObject.get_descriptions(ec2.describe_instances).sort_by {|a| a[:launching_time]}\n end", "def me\n require 'open-uri'\n begin\n instance_id = open('http://169.254.169.254/latest/meta-data/instance-id').read\n instance instance_id\n rescue OpenURI::HTTPError => e\n nil\n end\n end", "def instances\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def get_count\n capture(\"cf curl /v2/apps/#{$app_uuid} | jq .entity.instances\").to_i\nend", "def id_instances\n @id_instances ||= Hash[instances.map { |i| [i.instance_id, i] }]\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def index\n @instances = Instance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @instances }\n end\n end", "def get_role_instances(cloud_id, role_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/roles/#{role_id}/instances\")\n end", "def index\n @docker_cfgs = DockerCfg.all\n end", "def get_container_id(image=@ws_image, hosts=@hosts)\n hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [image],status:['running'] }.to_json)\n return containers.first unless containers.empty?\n end\n fail('Could not found a webserver running')\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def ec2_instances\n instances = EC2::InstanceCollection.new(:config => config)\n instances.tagged('aws:autoscaling:groupName').tagged_values(name)\n end", "def index\n @instances = Instance.page params[:page]\n authorize! :read, @instances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instances }\n end\n end", "def do_query(query_tags, options = {})\n query_tags = [query_tags] if query_tags.is_a?(String)\n Chef::Log.info \"Tagged query_tags: #{query_tags}\"\n match_all = options.fetch(:match_all, false)\n resources = api_client.tags.by_tag(resource_type: 'instances', tags: query_tags, match_all: match_all)\n Chef::Log.info \"Tagged resources: #{resources}\"\n\n tags_hash = {}\n if resources.first\n links = resources.first.links\n if links\n links.each do |link|\n Chef::Log.info \"Tagged Resource Cloud:#{link['href'].split('/')[0..3].join('/')}\"\n next unless api_client.get_instance.show.cloud.href == link['href'].split('/')[0..3].join('/')\n next unless api_client.resource(link['href']).state == 'operational'\n resource_tags = api_client.tags.by_resource(resource_hrefs: [link['href']]) # .first.tags\n tags_hash[link['href']] = {\n 'tags' => resource_tags.first.tags.map { |tag| tag['name'] },\n }\n end\n end\n end\n tags_set_array = []\n tags_hash.values.each do |value|\n tags_set_array << ::MachineTag::Set.new(value['tags'])\n end\n tags_set_array\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def watch_vm_instances(opts = {})\n @conn.watch_vminstances(opts)\n end" ]
[ "0.7425574", "0.7313987", "0.72997725", "0.6924347", "0.6922358", "0.6885139", "0.6794389", "0.6633275", "0.66304946", "0.651521", "0.6483365", "0.64713603", "0.6466137", "0.6465683", "0.644895", "0.6391875", "0.6333607", "0.63240856", "0.62963235", "0.6283747", "0.6277314", "0.62643", "0.6261518", "0.6220924", "0.6209785", "0.62081414", "0.62039346", "0.61654323", "0.6151825", "0.6115897", "0.6069937", "0.6044311", "0.60417545", "0.6036816", "0.59564686", "0.59517217", "0.59461343", "0.5924304", "0.5924304", "0.5917426", "0.5915905", "0.5909316", "0.59024125", "0.5893794", "0.5875048", "0.5867507", "0.5860327", "0.5833128", "0.5820353", "0.5785518", "0.5781715", "0.5776826", "0.57574564", "0.5756644", "0.5750535", "0.5746043", "0.5744698", "0.57350343", "0.57345265", "0.57243913", "0.5717991", "0.5717991", "0.57138914", "0.56855273", "0.5681907", "0.567619", "0.5670052", "0.5658486", "0.56524014", "0.565205", "0.56456923", "0.561487", "0.56135005", "0.5606301", "0.5598962", "0.5582336", "0.5578569", "0.5575768", "0.55702114", "0.55617297", "0.552066", "0.55200356", "0.55152404", "0.5470984", "0.5469801", "0.54494876", "0.5444439", "0.54271245", "0.5414602", "0.5414283", "0.5412325", "0.5407661", "0.54057676", "0.53861177", "0.5385687", "0.5384026", "0.53832304", "0.53807676", "0.53511274", "0.535084" ]
0.70174915
3
GET /docker_instances/1 GET /docker_instances/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def my_instance_id\n Net::HTTP.get(URI('http://169.254.169.254/1.0/meta-data/instance-id'))\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def set_docker_instance\n @docker_instance = DockerInstance.find(params[:id])\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def instance_data\n @instance_data ||= JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def get_by_id(id)\n self.class.get(\"/aldebaran-instances/instances/#{id}\", :basic_auth => @auth)\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {}, Mastodon::Instance)\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {},\n Mastodon::Instance)\n end", "def lookup_instance_id\n metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'\n instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )\n end", "def get_instance instance_id\n instances.get_instance name: instance_path(instance_id)\n end", "def instance_for(challenge) \n instance_id = `docker run -P -d #{challenge['name']}`.chomp\n port = `docker port #{instance_id} #{challenge['port']}`.chomp.split(/:/)[1]\n [instance_id, port]\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def fetch_instance(shortname = :all, options = {})\n return instances if instances && !options[:force]\n\n fetch_stack\n unless instance_list\n self.instance_list = self.instances =\n aws_client.describe_instances(stack_id: stack[:stack_id])[:instances]\n end\n\n if shortname != :all\n fetch_layer(shortname, force: true)\n self.instances = []\n\n layers.each do |layer|\n instance = aws_client.describe_instances(\n layer_id: layer[:layer_id])\n self.instances << instance[:instances]\n end\n\n self.instances.flatten!\n end\n end", "def get_nvidia_docker_info(url)\n resp = Net::HTTP.get_response(URI.parse(url))\n buffer = resp.body\n json_result = JSON.parse(buffer)\n return json_result\nend", "def me\n require 'open-uri'\n begin\n instance_id = open('http://169.254.169.254/latest/meta-data/instance-id').read\n instance instance_id\n rescue OpenURI::HTTPError => e\n nil\n end\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def aws_instance_get(opts)\n AWS::EC2.new.instances[opts[:instance_id]]\n end", "def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def get_cloud_instances(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances\") \n end", "def get_instance instance_id\n execute do\n instances.get_instance(\n instance_path(instance_id)\n )\n end\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end", "def get_container_id(image=@ws_image, hosts=@hosts)\n hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [image],status:['running'] }.to_json)\n return containers.first unless containers.empty?\n end\n fail('Could not found a webserver running')\n end", "def get_pvm_instance(instance_id)\n get(\"cloud-instances/#{guid}/pvm-instances/#{instance_id}\")\n end", "def get_existing_docker_image()\n @image = Docker::Image.get(ENV['IMAGE_ID'])\n set :docker_image, @image.id\n\n docker_image = @image.id\n puts \"Using supplied image id: #{docker_image}\"\nend", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def show\n @instance = Instance.find(params[:id])\n render :json =>@instance\n end", "def list_instances(request_id)\n instances = []\n JSON.parse(resource[\"/requests/#{request_id}\"].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n end", "def get_instances_description\n instances\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def instance_id\n `curl --connect-timeout 1 #{aws_url} 2>&1`.chomp\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def docker_version() ; info[:docker_version] ; end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def index\n @instances = Instance.all\n end", "def index\n @instances = Instance.all\n end", "def get(options = {})\n request_model = @request_model_factory.get_build_request_model(options)\n response = @network_client.perform_request(request_model)\n Fabricio::Model::Build.new(JSON.parse(response.body)['instances'].first)\n end", "def get_instance_of_cloud(cloud_id, instance_of_cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances/#{instance_of_cloud_id}\") \n end", "def instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\n end", "def get_instance_by_number(i=0, list = remote_instances_list) \n name = ((i.nil? || i.zero?) ? \"master\" : \"node#{i}\")\n list.select {|i| i.name == name }.first\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def info(type, instance_id, options={})\n args = {type: type, instanceId: instance_id}.merge(options)\n get('cloudInstanceInfo', args)\n end", "def show\n @instance = Instance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance }\n end\n end", "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "def show\n @instance = Instance.find(params[:id])\n @flavor = Flavor.find_by_flavor_id(@instance.flavor_id)\n @image = Image.find_by_image_id(@instance.image_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance }\n end\n end", "def get_instance_by_id(id)\n get_instances_description.select {|a| a.instance_id == id}[0] rescue nil\n end", "def show\n @server_instance = ServerInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_instance }\n end\n end", "def call_describe_instances\n\t`ec2-describe-instances >> #{EC2_DESCRIBE_INSTANCES_OUTPUT}`\nend", "def index\n @docker_cfgs = DockerCfg.all\n end", "def get_instance_id(instance_info)\n # puts \"look up instanceId in #{instance_info.inspect}\"\n instance_info['instancesSet']['item'][0]['instanceId']\n end", "def show\n @instance = Instance.find_by_id( params[:id] )\n @image = Image.find_by_ami(@instance.image_id)\n end", "def explotacion_local()\n puts \"[!] Starting a vulnerable local Portainer instance:\"\n `docker run -d -p \"#{$port}\":9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data_poc:/data portainer/portainer --no-auth`\n instances=`docker ps | grep portainer | awk '{print $1\" | \"$2\" | \"$3\" \"$4\" | \"$13}'`\n puts instances\n puts \"\\nYou should browse your local instance on port 9000, and click the 'Endpoints' menu under Settings.\"\n puts \"Configure the main endpoint as 'Local'.\"\n puts \"Configure yout Endpoint URL to your_network_address:2375\"\n puts \"Example using your current address: #{$myaddress}:2375\"\n puts \"To safely kill this vulnerable instance, invoke exorcist.rb. Avoid killing it manually.\"\n exit 0\nend", "def monitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"MonitorInstances\", :params => params)\n end", "def cached_instances\n # Puppet.debug(\"cached_instances - object id: #{PuppetX::PowerCLI::Helper.instance.object_id}\")\n # Puppet.debug(\"cached_instances - resource.type: #{resource.type}\")\n PuppetX::PowerCLI::Helper.instance.cached_instances[resource.type]\n end", "def instance_get(path)\n result = $evm.instance_get(path)\n # Returns Hash\n $evm.log('info',\"Instance:<#{path}> properties:<#{result.inspect}>\") if @debug\n return result\n end", "def load_instance_test_data()\n # todo: cache this , maybe Thread.current for now...\n @id = nil\n\n test_instance_id = ENV['TEST_INSTANCE_ID']\n if test_instance_id\n # use the first container in our test instance\n @instance = client.instances.get(test_instance_id.to_i)['instance']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @instance, \"Test instance #{test_instance_id} was not found!\"\n @container = client.containers.get(@instance['containers'].first)['container']\n @id = @instance['id']\n end\n assert_not_nil @id, \"A test instance must be specified to run this test.\\nTry setting environment variable TEST_CONTAINER_ID=42 or TEST_INSTANCE_ID=99\"\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def update\n respond_to do |format|\n if @docker_instance.update(docker_instance_params)\n format.html { redirect_to @docker_instance, notice: 'Docker instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @docker_instance }\n else\n format.html { render :edit }\n format.json { render json: @docker_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def docker_id(name)\n\t\treturn command_send(\"sudo docker ps -a --no-trunc -f name=#{name} | grep '\\\\s#{name}$' | tail -n 1 | awk '{ print $1 }'\")\n\tend", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def get_instance_by_number(i=0, list = remote_instances_list)\n name = (i.zero? ? \"master\" : \"node#{i}\")\n list.select {|i| i.name == name }.first\n end", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def instances(type)\n @instances[type]\n end", "def instance(instance_id)\n instances([instance_id])[0]\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def containers\n TestLab::Container.all\n end", "def get_count\n capture(\"cf curl /v2/apps/#{$app_uuid} | jq .entity.instances\").to_i\nend", "def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end", "def get(url, instance_id)\n invoke(\"get\", url, :params => {:instance_id => instance_id}, :url_params => :instance_id)\n end", "def info\n container.info\n end", "def docker_inspect(image, format)\n res = Cheetah.run(\"docker\", \"inspect\", \"--format='{{#{format}}}'\", image, stdout: :capture)\n return nil if res == \"<nil>\\n\"\n res.strip\n end", "def instances_status\n @instances.each do |i_id, meta|\n status = AWS::CLI_Interface.ec2_instance_status(i_id)\n output = \"#{meta['name']} (#{i_id})\".colorize(color: :white, background: :blue) +\n \" : \".colorize(:yellow) +\n \"#{status[:label]}\".colorize(color: :white, background: status[:color])\n\n if meta.has_key? 'timeout'\n output += \" : \".colorize(:yellow)\n output += \"Timeout: #{meta['timeout']}\".colorize(color: :black, background: :light_yellow)\n end\n\n Logging.log output\n end\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def show\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance_type }\n end\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def index_containers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.index_containers ...'\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'quota_total_size'] = opts[:'quota_total_size'] if !opts[:'quota_total_size'].nil?\n query_params[:'quota_on_cache'] = opts[:'quota_on_cache'] if !opts[:'quota_on_cache'].nil?\n query_params[:'stat_total_files'] = opts[:'stat_total_files'] if !opts[:'stat_total_files'].nil?\n query_params[:'stat_total_size'] = opts[:'stat_total_size'] if !opts[:'stat_total_size'].nil?\n query_params[:'stat_size_on_cache'] = opts[:'stat_size_on_cache'] if !opts[:'stat_size_on_cache'].nil?\n query_params[:'guest_right'] = opts[:'guest_right'] if !opts[:'guest_right'].nil?\n query_params[:'last_update'] = opts[:'last_update'] if !opts[:'last_update'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ContainerCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#index_containers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def docker\n @docker ||= Docker.new @docker_options\n end", "def show\n #@instance = Instance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance }\n end\n end", "def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def describe_instance(id=nil)\n describe_instances.select {|a| a[:name] == id}[0] rescue nil\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def instanceinfo(compute,name)\n\t\tresp = compute.describe_instances\t\n\t\tif (resp.status == 200)\n\t\t\t# check through the instances looking for one with a matching Name tag\n\t\t\tresp.body['reservationSet'].each { |x|\n\t\t\t\tx['instancesSet'].each { |y| \n\t\t\t\t\tif ( y['tagSet']['Name'] == name)\n\t\t\t\t\t\treturn y\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\traise \"ebsvol[aws]->instanceinfo: I couldn't list the instances\"\n\t\tend\n\t\tnil\n\tend", "def vm_instances\n @conn.vminstances\n end", "def get_images\n images = get(\"cloud-instances/#{guid}/images\")[\"images\"] || []\n\n images.map do |image|\n get_image(image[\"imageID\"])\n end.compact\n end" ]
[ "0.7129193", "0.698261", "0.6781233", "0.6536462", "0.64651084", "0.6353131", "0.62947845", "0.62450594", "0.62361497", "0.6226456", "0.6218825", "0.61803246", "0.6174355", "0.61647004", "0.61521846", "0.61426276", "0.6120157", "0.6094671", "0.60613567", "0.6038533", "0.60223395", "0.6014593", "0.60067445", "0.59889686", "0.5986204", "0.59667933", "0.59567857", "0.590282", "0.58638227", "0.5854068", "0.5815919", "0.57772845", "0.57349205", "0.57114285", "0.57058775", "0.5702669", "0.56839436", "0.567289", "0.56676036", "0.5663144", "0.5662447", "0.5662218", "0.5660384", "0.5636786", "0.56330967", "0.5628377", "0.5614442", "0.5575588", "0.5575588", "0.55674267", "0.5546312", "0.5536249", "0.5516545", "0.5513464", "0.5501931", "0.5499424", "0.5488269", "0.5488167", "0.5465909", "0.54574233", "0.54559016", "0.5455587", "0.5454874", "0.5452426", "0.54492074", "0.544632", "0.54454416", "0.5441882", "0.5440844", "0.5433106", "0.5430084", "0.54295766", "0.54236317", "0.5417534", "0.54173934", "0.54173803", "0.5413187", "0.5405216", "0.5398329", "0.53925484", "0.53718853", "0.53696036", "0.5369165", "0.5367577", "0.536455", "0.535653", "0.53523266", "0.5344098", "0.5337175", "0.5325237", "0.53205454", "0.5317222", "0.5305887", "0.52840936", "0.5282334", "0.5277745", "0.52721965", "0.52709043", "0.5267718", "0.52622664", "0.5260952" ]
0.0
-1
POST /docker_instances POST /docker_instances.json
def create @docker_instance = DockerInstance.new(docker_instance_params) @docker_instance.creating! respond_to do |format| if @docker_instance.save format.js else format.html { render :new } format.json { render json: @docker_instance.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "def create params = {}, body = {}\n @connection.request(method: :post, path: build_path(\"/containers/create\", params), headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def create\n @instance = Instance.new(params[:instance])\n\n respond_to do |format|\n if @instance.save\n\n system(\"ssh root@#{CloudGui::Application.config.hypervisor_ip} \\\"exec /data/cloud/scripts/provision.sh #{params[:instance][:cpus]} #{params[:instance][:memory]} #{params[:instance][:baseimage]} 2>&1 | tee /data/cloud/logs/cloud_gui.log\\\"\")\n\n format.html { redirect_to @instance, notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def docker_instance_params\n params.require(:docker_instance).permit(:name, :branch)\n end", "def create_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_create_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def create_instances(count)\n result = client.run_instances(AwsForm.map(params.merge(count: count)))\n instance_ids = result.instances.map(&:instance_id)\n ret = wait_for_create(instance_ids)\n # need to make sure add_tags is done after after wait_until or can have error that instance ids dont exist\n add_tags?(instance_ids, with_dtk_tag: true)\n IamInstanceProfile.set_iam_instance_profiles(self, instance_ids, params.iam_instance_profile) unless params.iam_instance_profile.nil?\n ret\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def set_docker_instance\n @docker_instance = DockerInstance.find(params[:id])\n end", "def create\n @instance = @provider.instances.new(params[:instance])\n @instance.state = \"Building\"\n respond_to do |format|\n if @instance.save\n @instance.create_instance(@provider.connect!)\n format.html { redirect_to cloud_provider_instance_path(@provider,@instance), notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def recreate_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_recreate_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def create_pvm_instance(instance_hash)\n post(\"cloud-instances/#{guid}/pvm-instances\", instance_hash.to_json)\n end", "def create\n begin\n #get the server chosen container_params[:server_id]\n @currentServer = Server.where(id: container_params[:server_id])\n Docker.url = 'tcp://' + @currentServer[0].ip + \":\" + @currentServer[0].port\n\n #create the container in docker\n if container_params[:exposed_port].blank?\n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image]\n ) \n else \n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image],\n 'ExposedPorts' => { container_params[:exposed_port]+'/tcp' => {} },\n 'HostConfig' => {\n 'PortBindings' => {\n container_params[:exposed_port]+'/tcp' => [{ 'HostPort' => container_params[:host_port] }]\n }\n }\n )\n end\n\n #adds the container into the database\n @container = Container.new(:name => container_params[:name], :image => container_params[:image], :command => container_params[:command], :exposed_port => container_params[:exposed_port], \n :host_port => container_params[:host_port], :dockercontainer_id => @con.id, :status => 'Created')\n\n Docker.url = ''\n\n respond_to do |format|\n if @container.save\n Serverhascontainer.new(:server_id => @currentServer[0].id, :container_id => @container.id).save\n format.html { redirect_to root_path, notice: 'Container was successfully created.' }\n format.json { render :show, status: :created, location: @container }\n else\n format.html { render :new }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Docker::Error::ClientError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::NotFoundError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n end\n end", "def aws_write_instances\n File.open( aws_instances_json, 'w' ) do |fout|\n aws_dump_instances( fout )\n end\n end", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def create_instances(count)\n fail DTK::Error::Usage, \"Attribute 'admin_state' cannot be set to powered_off if node not created\" if admin_state_powered_off?\n aws_api_operation(:create).create_instances(count)\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def create_instance_for_env(instance)\n whitelist = [:instance_id, :instance_index, :name, :uris, :users, :version, :start, :runtime, :state_timestamp, :port]\n env_hash = {}\n whitelist.each {|k| env_hash[k] = instance[k] if instance[k]}\n env_hash[:limits] = {\n :fds => instance[:fds_quota],\n :mem => instance[:mem_quota],\n :disk => instance[:disk_quota],\n }\n env_hash[:host] = @local_ip\n env_hash.to_json\n end", "def add_instance(opts)\n unless %w[app util].include?(opts[:role].to_s)\n # Fail immediately because we don't have valid arguments.\n raise InvalidInstanceRole, \"Instance role must be one of: app, util\"\n end\n\n # Sanitize the name to remove whitespace if there is any\n if opts[:name]\n name = opts[:name].gsub(/\\s+/, '')\n end\n\n if opts[:role] == 'util'\n unless name && name.length > 0\n raise InvalidInstanceName, \"When specifying a util instance you must also specify a name.\"\n end\n end\n \n request = { \"role\" => opts[:role], \"name\" => opts[:name] }\n request['snapshot_id'] = opts[:snapshot_id] if opts.key?(:snapshot_id)\n request['instance_size'] = opts[:instance_size] if opts.key?(:instance_size)\n\n # We know opts[:role] is right, name can be passed straight to the API.\n # Return the response body for error output, logging, etc.\n return api.post(\"/environments/#{id}/add_instances\", :request => request)\n end", "def instance_data\n @instance_data ||= JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def aws_instance_create(opts)\n AWS::EC2::InstanceCollection.new.create(\n image_id: Rails.configuration.x.aws[Rails.configuration.x.aws['region']][\"ami_#{self.os}\"], \n private_ip_address: self.ip_address,\n key_name: Rails.configuration.x.aws['ec2_key_pair_name'],\n user_data: self.generate_init,\n instance_type: \"t2.small\",\n subnet: self.subnet.driver_id\n )\n end", "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "def run\n node = Node.new(:instance_type => Aws.instance_type, :instance_id => Aws.instance_id)\n node.save\n write_pid\n process_loop\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def create\n @instance = Instance.new(instance_params)\n\n respond_to do |format|\n if @instance.save\n format.html { redirect_to @instance, notice: 'Instance was successfully created.' }\n format.json { render :show, status: :created, location: @instance }\n else\n format.html { render :new }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def spin_up_instance ami_name, vpc_id, key_name, security_group_id, subnet_id, instance_type = \"t2.micro\"\n resp = client.run_instances({\n dry_run: false,\n image_id: ami_name, # required\n min_count: 1, # required\n max_count: 1, # required\n key_name: key_name,\n instance_type: instance_type, # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n monitoring: {\n enabled: true, # required\n },\n network_interfaces: [\n {\n subnet_id: subnet_id,\n groups: [security_group_id],\n device_index: 0,\n associate_public_ip_address: true\n }\n ],\n\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n })\n\n error \"Error starting EC2 instance #{resp.inspect}\" if resp.instances.nil? || resp.instances.size == 0\n\n return resp.instances[0]\n end", "def run_instance options = {}\n instances = InstanceCollection.new(:config => config)\n instances.create(options.merge(:image => self))\n end", "def create\n @docker_cfg = DockerCfg.new(docker_cfg_params)\n\n respond_to do |format|\n if @docker_cfg.save\n format.html { redirect_to @docker_cfg, notice: 'Docker cfg was successfully created.' }\n format.json { render :show, status: :created, location: @docker_cfg }\n else\n format.html { render :new }\n format.json { render json: @docker_cfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend", "def start_and_create_instances(num=1, user_data=nil)\n logger.info \"ENTERING DELAYED JOB\"\n begin\n new_instances = run_spot_instances(num, user_data)\n new_instances.each do |i|\n temp = Instance.create_from_aws_hash(i)\n temp.user_data = user_data\n temp.state = 'launched'\n temp.save\n end\n logger.info \"Started and saved #{num} #{ami_id} instances.\"\n EventLog.info \"Started and saved #{num} #{ami_id} instances.\"\n rescue Exception => e\n logger.error \"Caught exception when trying to start #{num} #{ami_id} instances!: #{e.message} #{e.backtrace}\"\n EventLog.error \"Caught exception when trying to start #{num} #{ami_id} instances!: #{e.message} #{e.backtrace}\"\n end\n end", "def create_instance(credentials, image_id, opts)\n new_vapp = nil\n vapp_opts = {} #assemble options to pass to Fog::Terremark::Real.instantiate_vapp_template\n terremark_hwp = hardware_profiles(credentials, {:name => 'default'}).first #sanity check values against default\n name = opts[:name]\n if not name\n name = \"inst#{Time.now.to_i}\"\n end\n if name.length > USER_NAME_MAX\n raise \"Parameter name must be #{USER_NAME_MAX} characters or less\"\n end\n unless ( (terremark_hwp.include?(:cpu, opts[:hwp_cpu].to_i)) &&\n (terremark_hwp.include?(:memory, opts[:hwp_memory].to_i)) ) then\n raise Deltacloud::Exceptions::ValidationFailure.new(\n StandardError.new(\"Error with cpu and/or memory values. you said cpu->#{opts[:hwp_cpu]} and mem->#{opts[:hwp_memory]}\")\n )\n end\n vapp_opts['cpus'] = opts[:hwp_cpu]\n vapp_opts['memory'] = opts[:hwp_memory]\n safely do\n terremark_client = new_client(credentials)\n#######\n#FIXME# what happens if there is an issue getting the new vapp id? (eg even though created succesfully)\n#######\n vapp_id = terremark_client.instantiate_vapp_template(name, image_id, vapp_opts).body['href'].split('/').last\n new_vapp = terremark_client.get_vapp(vapp_id)\n return convert_instance(new_vapp, terremark_client, credentials.user) #return an Instance object\n end\n end", "def launch_instances(names:, **create_opts)\n res = {}\n host_opts = create_opts[:host_opts] || {}\n host_opts = opts[:host_opts].merge(host_opts) # merge with global opts\n names.each { |name|\n instance = create_instance(name, **create_opts)\n host_opts[:cloud_instance_name] = instance.name\n host_opts[:cloud_instance] = instance\n res[name] = Host.from_ip(instance.floating_ip, host_opts)\n }\n return res\n end", "def post_compute(request)\n # --- Create the new Instance ---\n vm = VirtualMachineOCCI.new(\n VirtualMachine.build_xml,\n @client,\n request.body.read,\n @config[:instance_types],\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = vm.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = vm.allocate(template)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n vm.info\n return to_occi_xml(vm, :code=>201)\n end", "def create\n @instance_eni = InstanceEni.new(instance_eni_params)\n\n respond_to do |format|\n if @instance_eni.save\n format.html { redirect_to @instance_eni, notice: 'Instance eni was successfully created.' }\n format.json { render :show, status: :created, location: @instance_eni }\n else\n format.html { render :new }\n format.json { render json: @instance_eni.errors, status: :unprocessable_entity }\n end\n end\n end", "def instances_params\n params.require(:instances) #.permit(:test_case, :module, :omp_num_threads,\n # :inlists, :mem_rn, :success_type,\n # :mem_re, :success_type, :checksum,\n # :outcome)\n end", "def spawn_instances(challenges)\n challenges.map do |name, challenge|\n if challenge[\"launch_docker_per_user\"]\n instance_id, port = instance_for(challenge)\n [name, instance_id, port]\n else\n nil\n end\n end\n end", "def create\n @server_instance = ServerInstance.new(params[:server_instance])\n\n respond_to do |format|\n if @server_instance.save\n format.html { redirect_to @server_instance, notice: 'Server instance was successfully created.' }\n format.json { render json: @server_instance, status: :created, location: @server_instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def explotacion_local()\n puts \"[!] Starting a vulnerable local Portainer instance:\"\n `docker run -d -p \"#{$port}\":9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data_poc:/data portainer/portainer --no-auth`\n instances=`docker ps | grep portainer | awk '{print $1\" | \"$2\" | \"$3\" \"$4\" | \"$13}'`\n puts instances\n puts \"\\nYou should browse your local instance on port 9000, and click the 'Endpoints' menu under Settings.\"\n puts \"Configure the main endpoint as 'Local'.\"\n puts \"Configure yout Endpoint URL to your_network_address:2375\"\n puts \"Example using your current address: #{$myaddress}:2375\"\n puts \"To safely kill this vulnerable instance, invoke exorcist.rb. Avoid killing it manually.\"\n exit 0\nend", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def post_storage(request)\n # --- Check OCCI XML from POST ---\n if request.params['occixml'] == nil\n error_msg = \"OCCI XML representation of Image\" +\n \" not present in the request\"\n error = OpenNebula::Error.new(error_msg)\n return error, 400\n end\n\n # --- Create and Add the new Image ---\n occixml = request.params['occixml']\n occixml = occixml[:tempfile].read if occixml.class == Hash\n\n image = ImageOCCI.new(\n Image.build_xml,\n @client,\n occixml,\n request.params['file'])\n\n # --- Generate the template and Allocate the new Instance ---\n template = image.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = image.allocate(template, @config[:datastore_id]||1)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n image.info\n #wait until image is ready to return\n while (image.state_str == 'LOCKED') && (image['RUNNING_VMS'] == '0') do\n sleep IMAGE_POLL_SLEEP_TIME\n image.info\n end\n\n # --- Prepare XML Response ---\n return to_occi_xml(image, :code=>201)\n end", "def instance_for(challenge) \n instance_id = `docker run -P -d #{challenge['name']}`.chomp\n port = `docker port #{instance_id} #{challenge['port']}`.chomp.split(/:/)[1]\n [instance_id, port]\n end", "def instance_params\n params.permit(:ip_address, :image, :launch_time, :status)\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def create_instance(credentials, image_id, opts)\n racks = new_client( credentials )\n hwp_id = opts[:hwp_id] || 1\n name = Time.now.to_s\n if (opts[:name]) then name = opts[:name] end\n safely do\n return convert_srv_to_instance(racks.start_server(image_id, hwp_id, name))\n end\n end", "def update\n respond_to do |format|\n if @docker_instance.update(docker_instance_params)\n format.html { redirect_to @docker_instance, notice: 'Docker instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @docker_instance }\n else\n format.html { render :edit }\n format.json { render json: @docker_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_instances\n min_count = max_count = @bs.number_of_nodes\n puts \"\\nCreating #{max_count} on-demand instance(s)\"\n options = {\n 'ClientToken' => generate_token,\n 'KeyName' => Chef::Config[:knife][:aws_ssh_key_id],\n 'InstanceType' => @bs.flavor,\n 'SubnetId' => @bs[:novpc] ? nil : @bs.subnet_id,\n 'Placement.AvailabilityZone' => @bs.mixins.az.data,\n 'SecurityGroupId' => @bs.mixins.sg.data\n }\n options['EbsOptimized'] = !! @bs[:ebs_optimized]\n\n ## REVIEW\n if ami.root_device_type == \"ebs\"\n ami_map = ami.block_device_mapping.first\n block_device_mapping = {\n 'DeviceName' => ami_map['deviceName'],\n 'Ebs.VolumeSize' => ami_map['volumeSize'].to_s,\n 'Ebs.DeleteOnTermination' => ami_map['deleteOnTermination']\n }\n options['BlockDeviceMapping'] = [block_device_mapping]\n end\n\n ## Optionally only include mapped devices\n ## This way we get all of the ephemeral drives, some unmapped however\n if @bs.mixins.volume.data[:ephemeral_available]\n ephmap = @bs.mixins.volume.data.ephemeral_available.each_with_index.map do |d,i|\n {\n 'VirtualName' => \"ephemeral#{i}\",\n 'DeviceName' => d\n }\n end\n options['BlockDeviceMapping'].concat( ephmap )\n end\n\n if (max_count == 1) and @bs[:private_ip_address]\n options['PrivateIpAddress'] = @bs.private_ip_address\n puts \"Assigning IP ADDRESS : #{options['PrivateIpAddress']}\"\n end\n\n if Chef::Config[:knife][:aws_user_data]\n begin\n options['UserData']= File.read(Chef::Config[:knife][:aws_user_data])\n rescue\n ui.warn(\"Cannot read #{Chef::Config[:knife][:aws_user_data]}:\"\\\n \" #{$!.inspect}. Ignoring option.\")\n end\n end\n\n # -----------------------------------------------------------------\n tries = 5\n print_table(options, 'Launch Config')\n begin\n puts \"\\nSending request...\"\n response = connection.run_instances(@bs.image, min_count,\n max_count, options)\n ui.msg(response.inspect)\n rescue Exception => e\n ui.warn(\"#{e.message}\\nException creating instances\")\n if (tries -= 1) <= 0\n ui.warn(\"\\n\\nMax tries reached. Exiting.\\n\\n\")\n exit 1\n else\n ui.msg(\"Trying again.\\n\")\n retry\n end\n end\n # now we have our servers\n instances = response.body['instancesSet']\n # select only instances that have instanceId key and collect those ids\n # into an array\n @bs[:instance_ids] =\n instances.select {|i| i.has_key?('instanceId')}.collect do |i|\n i['instanceId']\n end\n\n puts \"\\nNumber of instances started: #{@bs.instance_ids.size}\\n\"\n sleep 10\n puts \"Getting servers..\"\n # collect an array of servers retrieved based on the instance ids we\n # obtained above\n @bs[:servers] = @bs.instance_ids.collect do |id|\n begin\n server = connection.servers.get(id)\n rescue Exception => e\n sleep 7\n retry\n end\n raise Ec2Error.new(\"server #{id} was nil\") if server.nil?\n server\n end\n end", "def create\n @instance_eni_tag = InstanceEniTag.new(instance_eni_tag_params)\n\n respond_to do |format|\n if @instance_eni_tag.save\n format.html { redirect_to @instance_eni_tag, notice: 'Instance eni tag was successfully created.' }\n format.json { render :show, status: :created, location: @instance_eni_tag }\n else\n format.html { render :new }\n format.json { render json: @instance_eni_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = {}\n params.merge!(pathlist(\"InstanceId\", options[:instance_id]))\n return response_generator(:action => \"StartInstances\", :params => params)\n end", "def create_new_container\n puts 'Start creating a new container..'\n host = get_available_host\n if host.nil?\n puts 'Could not found a host with limit enough to create more containers'\n return\n end\n puts \"getting an available port to #{host}\"\n port = get_available_port(host)\n if port.nil?\n puts 'Could not found an available port'\n return\n end\n\n puts \"using port #{port} from #{host}\"\n\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n container = Docker::Container.create(\n 'Image' => \"#{@ws_image}\",\n 'ExposedPorts' => { \n '8070/tcp' => {}\n },\n 'HostConfig' => {\n 'CpuPeriod' => 25000,\n 'PortBindings' => {\n '8070/tcp' => [ { 'HostPort' => \"#{port}\" } ]\n }\n }\n )\n container.start\n register_container(host, port, container.id)\n end", "def delete_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_delete_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def store_image instance, tags\n begin\n \n puts \"waiting 2 minutes before starting to take the image...\"\n sleep 120\n puts \"creating image...\"\n \n image = @ec2.images.create( \n :instance_id => instance.id,\n :no_reboot => true,\n :description => \"automaticaly created #{tags[ 'image_type' ]} image\",\n :name => \"#{tags[ 'image_type' ]} #{Digest::SHA1.hexdigest tags.inspect}\" )\n \n wait_for_image image\n \n tags.each do | key, value |\n image.add_tag( key, :value => value )\n end \n ensure\n stop_instance instance\n end\n end", "def create_openstack_instances(nodes, credentials, thread_pool_size)\n #defaults\n threads_pool = Util::ThreadPool.new(thread_pool_size)\n key = credentials[:os_ssh_key] || 'ankus'\n groups = credentials[:os_sec_groups] || %w(ankus)\n flavor_id = credentials[:os_flavor]\n image_id = credentials[:os_image_ref]\n os = create_openstack_connection\n conn = os.create_connection\n ssh_key = File.expand_path('~/.ssh') + \"/#{key}\"\n ssh_user = credentials[:os_ssh_user]\n server_objects = {} # hash to store server object to tag mapping { tag => server_obj }\n\n begin\n unless os.valid_connection?(conn)\n @log.error 'Failed establishing connection to openstack, check your credentials'\n else\n @log.debug \"Sucessfully authnticated with openstack\"\n end\n rescue Excon::Errors::Timeout\n @log.error 'Cannot establish connection to openstack. Reason: ' + \"#{$!.message} (#{$!.class})\"\n @log.error 'Please check the url is reachable'\n exit 1\n end\n\n # Create key pairs and security groups\n os.create_kp_sg!(conn, key, groups)\n\n @log.info 'Creating servers with roles: ' + \"#{nodes.keys.join(',')}\".blue + ' ...'\n begin\n nodes.each do |tag, _|\n server_objects[tag] = os.create_server!(\n conn,\n tag,\n key,\n flavor_id,\n image_id,\n groups\n )\n end\n rescue Excon::Errors::BadRequest\n raise \"Failed creating instances, reason: #{$!.message} (#{$!.class})\"\n end\n\n # wait for servers to get created (:state => running)\n @log.info 'Waiting for cloud instances to get created ...'\n os.wait_for_servers(server_objects.values)\n\n # attach floating ip's to instances\n @log.info 'Attaching floating ip(s) to instances'\n nodes.each do |tag, _|\n os.associate_address!(conn, server_objects[tag])\n end\n\n # build the return string\n nodes.each do |tag, node_info|\n # fill in nodes hash with public and private dns\n node_info[:fqdn] = server_objects[tag].public_ip_address\n node_info[:private_ip] = server_objects[tag].private_ip_address\n end\n if @mock\n # pretend doing some work while mocking\n nodes.each do |tag, info|\n threads_pool.schedule do\n if info[:config][:volumes] > 0\n @log.debug \"Preparing attached volumes on instance #{server_objects[tag].public_ip_address}\" if @debug\n sleep 5\n else\n @log.debug \"Waiting for instance to become ssh'able #{server_objects[tag].public_ip_address} \" +\n \"with ssh_user: #{ssh_user} and ssh_key: #{ssh_key}\" if @debug\n end\n end\n end\n threads_pool.shutdown\n else\n # partition and format attached disks using thread pool\n nodes.each do |tag, info|\n threads_pool.schedule do\n if info[:config][:volumes] > 0\n @log.debug \"Formatting attached volumes on instance #{server_objects[tag].public_ip_address}\" if @debug\n os.attach_volumes!(server_objects[tag], info[:config][:volumes], info[:config][:volume_size])\n #build partition script\n partition_script = gen_partition_script(info[:config][:volumes], info[:config][:volume_mount_prefix], true)\n tempfile = Tempfile.new('partition')\n tempfile.write(partition_script)\n tempfile.close\n # wait for the server to be ssh'able\n Util::SshUtils.wait_for_ssh(server_objects[tag].public_ip_address, ssh_user, ssh_key)\n # upload and execute the partition script on the remote machine\n Util::SshUtils.upload!(\n tempfile.path,\n '/tmp',\n server_objects[tag].public_ip_address,\n ssh_user,\n ssh_key,\n @log,\n 22,\n )\n output = Util::SshUtils.execute_ssh!(\n \"chmod +x /tmp/#{File.basename(tempfile.path)} /tmp/#{File.basename(tempfile.path)} tee /var/log/bootstrap_volumes.log\",\n server_objects[tag].public_ip_address,\n ssh_user,\n ssh_key,\n @log,\n 22,\n true, # execute using sudo\n true # long running job\n )\n tempfile.unlink # delete the tempfile\n if @debug\n @log.debug \"Stdout on #{server_objects[tag].public_ip_address}\"\n puts \"\\r#{output[server_objects[tag].public_ip_address][0]}\"\n @log.debug \"Stderr on #{server_objects[tag].public_ip_address}\"\n puts \"\\r#{output[server_objects[tag].public_ip_address][1]}\"\n @log.debug \"Exit code from #{server_objects[tag].public_ip_address}: #{output[server_objects[tag].public_ip_address][2]}\"\n end\n else\n # if not waiting for mounting volumes, wait for instances to become sshable\n @log.debug \"Waiting for instance '#{server_objects[tag].public_ip_address}' to become ssh'albe using \" +\n \"username: '#{ssh_user}' and key: '#{ssh_key}'\" if @debug\n Util::SshUtils.wait_for_ssh(server_objects[tag].public_ip_address, ssh_user, ssh_key)\n end\n end\n end\n threads_pool.shutdown\n @log.debug 'Finished creating and attaching volumes' if @debug\n end\n nodes\n end", "def create\n params = run_params.clone\n pass_plaintxt = params[:password]\n params[:password] = BCrypt::Password.create(params[:password])\n heroku_netrc = nil\n if params[\"heroku_netrc\"]\n heroku_netrc = params[\"heroku_netrc\"].read\n end\n params[\"heroku_netrc\"] = \"dummystring\"\n # By default run is running :)\n params[\"status_id\"] = 1\n @run = Run.new(params)\n respond_to do |format|\n if @run.save\n @docker_kickstart = DockerKickstartsController.new(@run, params[\"rundockerservers_attributes\"], pass_plaintxt, heroku_netrc)\n number_of_containers = @docker_kickstart.docker_kickstart\n set_run_status(@run[:id], number_of_containers)\n\n format.html { redirect_to @run, notice: 'Run was successfully created.' }\n format.json { render :show, status: :created, location: @run }\n else\n format.html { render :new }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_instance(security_groups, key, user_data, size, region)\n @instances = nil\n Instance.new(@@ec2.run_instances(id, 1, 1, security_groups, key, user_data, nil, size, nil, nil, region).first)\n end", "def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def commit(options = {})\n options.merge!(container: self.id[0..7])\n hash = Docker::Util.parse_json(connection.post('/commit', options))\n Docker::Image.send(:new, id: hash[:id], connection: self.connection)\n end", "def 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 create_deployment(command, instances, timeout)\n instance_ids = nil\n instance_description = \"all instances\"\n\n if !instances.nil?\n instance_ids = instances.map(&:instance_id)\n instance_description = instances.map(&:hostname).join(',')\n end\n\n deployment_config = {\n stack_id: opsworks_app[:stack_id],\n app_id: app_id,\n instance_ids: instance_ids,\n command: command,\n comment: \"Git Sha: #{current_sha}\"\n }\n\n deployment = opsworks_client.create_deployment(deployment_config)\n print \"Running command \".light_blue\n print \"#{command[:name]}\".light_blue.bold\n puts \" on #{instance_description}\".light_blue\n\n begin\n _wait_until_deployed(deployment[:deployment_id], timeout)\n puts \"Deployment successful\".green\n true\n rescue Aws::Waiters::Errors::WaiterFailed => e\n puts \"Failed to deploy: #{e.message}\".red\n false\n end\n end", "def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end", "def create_kubernetes_virtual_machine_instance_type_with_http_info(kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.create_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.create_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\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(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.create_kubernetes_virtual_machine_instance_type\",\n :header_params => 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: KubernetesApi#create_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create # rubocop:disable Metrics/AbcSize\n inst_details = AttrFinder.new(@instanceparameters)\n inst_details.options = @options\n inst_details.validate = @validate\n inst_details.function = 'server'\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::Models::LaunchInstanceDetails.new\n ssh_public_key = @instanceparameters['server']['ssh-key']\n request.availability_domain = inst_details.ad\n request.compartment_id = inst_details.compartment\n request.display_name = @instanceparameters['server']['display_name']\n request.image_id = inst_details.image\n request.shape = @instanceparameters['server']['shape']\n request.subnet_id = inst_details.subnet\n request.metadata = { 'ssh_authorized_keys' => ssh_public_key }\n api = OracleBMC::Core::ComputeClient.new\n response = api.launch_instance(request)\n @instance_id = response.data.id\n compartment(inst_details.compartment)\n running_instance = api.get_instance(@instance_id).wait_until(:lifecycle_state,\n OracleBMC::Core::Models::Instance::LIFECYCLE_STATE_RUNNING,\n max_interval_seconds: 5, max_wait_seconds: 300)\n if @instanceparameters['server']['attachments']\n @instanceparameters['server']['attachments'].each do |vol|\n attach(@instance_id, vol['volume'])\n end\n end\n running_instance\n end", "def create_image(params)\n instance_id = params['InstanceId']\n instance_id = instance_id.split('-')[1]\n\n vm = VirtualMachine.new(\n VirtualMachine.build_xml(instance_id),\n @client)\n\n rc = vm.info\n if OpenNebula::is_error?(rc)\n rc.ec2_code = \"InvalidInstanceID.NotFound\"\n return rc\n end\n\n image_id = vm.disk_saveas(1,\n params[\"Name\"],\n OpenNebula::Image::IMAGE_TYPES[0])\n\n # TODO Add AMI Tags\n # TODO A new persistent image should be created for each instance\n\n if OpenNebula::is_error?(image_id)\n return image_id\n end\n\n erb_version = params['Version']\n\n response = ERB.new(File.read(@config[:views]+\"/create_image.erb\"))\n return response.result(binding), 200\n end", "def create\n @instance_type = InstanceType.new(params[:instance_type])\n\n respond_to do |format|\n if @instance_type.save\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully created.' }\n format.json { render json: @instance_type, status: :created, location: @instance_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def commit(options = {})\n options.merge!('container' => self.id[0..7])\n hash = JSON.parse(connection.request(:post, '/commit', options))\n Docker::Image.send(:new, :id => hash['Id'], :connection => self.connection)\n end", "def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end", "def create options = {}\n resp = case\n when options[:instance_id]\n client.create_image(options)\n when options[:image_location] || options[:root_device_name]\n if kernel = options.delete(:kernel)\n options[:kernel_id] = kernel.id\n end\n if ramdisk = options.delete(:ramdisk)\n options[:ramdisk_id] = ramdisk.id\n end\n options[:block_device_mappings] =\n translate_block_device_mappings(options[:block_device_mappings]) if\n options[:block_device_mappings]\n client.register_image(options)\n else\n raise(ArgumentError,\n \"expected instance_id, image_location, \" +\n \"or root_device_name\")\n end\n Image.new(resp.image_id, :config => config)\n end", "def add_instance(params)\n Fog::Logger.deprecation(\n \"#{self.class}.#{__method__} is deprecated, use Fog::Compute::Google::InstanceGroup.#{__method__} instead [light_black](#{caller(0..0)})[/]\"\n )\n params[:instance] = [params[:instance]] unless params[:instance] == Array\n service.add_instance_group_instances(params[:group], params[:zone], params[:instance])\n end", "def create\n @ec2_instance = Ec2Instance.new(ec2_instance_params)\n\n respond_to do |format|\n if @ec2_instance.save\n format.html { redirect_to @ec2_instance, notice: 'Ec2 instance was successfully created.' }\n format.json { render :show, status: :created, location: @ec2_instance }\n else\n format.html { render :new }\n format.json { render json: @ec2_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def monitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"MonitorInstances\", :params => params)\n end", "def safe_create_instances!(nodes)\n nodes = nodes.select { |k, v| k if v[:fqdn].empty? }\n begin\n case @provider\n when 'aws'\n nodes = create_aws_instances(nodes, @credentials, @thread_pool_size)\n when 'rackspace'\n nodes = create_rackspace_instances(nodes, @credentials, @thread_pool_size)\n when 'openstack'\n nodes = create_openstack_instances(nodes, @credentials, @thread_pool_size)\n else\n # Not yet implemented\n end\n rescue RuntimeError => ex\n @log.error \"Something went wrong provisioning vms on cloud, reason: #{ex}\"\n @log.error 'Rolling back instance(s)'\n delete_instances(nodes, true)\n exit 1\n end\n nodes\n end", "def create\n #@instance = Instance.new(params[:instance])\n\n respond_to do |format|\n if @instance.save\n format.html { redirect_to @instance, notice: '创建成功' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_launch_new_instances(num=1)\n out = []\n num.times {out << launch_new_instance!}\n out\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 launch_nat_instances(client,\n pub_net1_id,\n pub_net2_id,\n sg_in_tcp_22_pub,\n sg_in_tcp_80_nat,\n priv_route_table_id,\n instance_type,\n ami)\n # launching public subnet nat instances #1 and #2 in 10.0.100.0/24 and 10.0.200.0/24, respectively.\n puts 'Launching public subnet nat instances #1 and #2 in 10.0.100.0/24 and 10.0.200.0/24, respectively...'\n [1, 2].each do |subnet_num|\n pub_subnet_id = case subnet_num\n when 1 then pub_net1_id\n when 2 then pub_net2_id\n else puts 'debug: should not get here'\n end\n response = client.run_instances(image_id: ami,\n # key_name: 'UbuntuKeyPair',\n min_count: 1,\n max_count: 1,\n security_group_ids: [sg_in_tcp_80_nat], # sg_in_tcp_22_pub\n instance_type: instance_type,\n placement: {},\n # block_device_mappings: [{ebs: {delete_on_termination: true, volume_type: 'gp2'}}],\n monitoring: { enabled: false },\n subnet_id: pub_subnet_id,\n disable_api_termination: false,\n instance_initiated_shutdown_behavior: 'terminate',\n ebs_optimized: false,\n tag_specifications: [resource_type: 'instance',\n tags: [key: 'Name', value: 'nat instance']],\n user_data: Base64.encode64(\"#!/bin/bash -ex\\n\"\\\n \"export DEBIAN_FRONTEND=noninteractive\\n\"\\\n \"apt-get -q=2 update && apt-get -q=2 upgrade\\n\"\\\n \"sysctl -w net.ipv4.ip_forward=1\\n\"\\\n \"sysctl -w net.ipv4.conf.eth0.send_redirects=0\\n\"\\\n 'iptables -t nat -A POSTROUTING -s 10.0.0.0/16 -o eth0 -j MASQUERADE'))\n nat_instance_id = response.instances[0].instance_id\n puts \"nat_instance_id ##{subnet_num} = [#{nat_instance_id}];\"\n\n before_wait = Time.now\n term_error = 0\n begin\n puts \"Waiting for nat instance ##{subnet_num} [#{nat_instance_id}] to enter running state.\"\n client.wait_until(:instance_running,instance_ids: [nat_instance_id]) do |wait|\n wait.interval = 5 # Seconds between polling attempts. Same as wait.delay\n wait.max_attempts = 15 # Polling attempts before giving up. Wait time is 15*5=75 seconds.\n end\n rescue Aws::Waiters::Errors::WaiterFailed => error\n term_error = 1 # TODO: Do something more reliable if this ever occurs.\n puts \"Exception: failed waiting for instance running: #{error.message}\"\n end\n puts \"#{Time.now - before_wait.to_time} seconds elapsed while waiting.\" if term_error.zero?\n\n # Create route for 0.0.0.0/0 -> nat instance (for private instances to bootstrap/update)\n if subnet_num == 1 # Only insert this route one time. Will receive 'RouteAlreadyExists' otherwise.\"\n puts 'Creating route for 0.0.0.0/0 -> nat instances in private route table...'\n response = client.create_route(destination_cidr_block: '0.0.0.0/0',\n route_table_id: priv_route_table_id,\n instance_id: nat_instance_id)\n puts 'Route for 0.0.0.0/0 -> nat instances in private route table added.'\n end\n # Disable source/destination checking for network address translation to work.\n # The API doesn't allow setting this during the run_instances call... but does right afterward.\n printf \"Disabling source/destination checking on nat instance ##{subnet_num}... \"\n client.modify_instance_attribute(instance_id: nat_instance_id, source_dest_check: {value: false})\n puts 'done.'\n end\n puts 'public 10.0.100.0/24 and 10.0.200.0/24 nat instance #1 and #2 launch complete.'\nend", "def create_ec2_instance(attrs)\n instance = ec2.instances.create(attrs)\n perform_instance_checks(instance)\n instance\n end", "def create_snap # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function\n uri = URI.parse(url)\n #account = '/Compute-' + @id_domain + '/' + @user\n account = '/Compute-' + id_domain + '/cloud_storage'\n create_data = Hash.new\n create_data = { 'account' => account, 'instance' => container }\n create_data['machineimage'] = @machine_image if !@machine_image.nil?\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field 'Cookie', authcookie\n request.add_field 'Content-type', 'application/oracle-compute-v3+json'\n http.request(request, create_data.to_json)\n end", "def run_instances(parameters, secret)\n Kernel.puts(\"Received a request to run instances\")\n\n if @secret != secret\n Kernel.puts(\"Incoming secret #{secret} does not match current secret \" +\n \"#{@secret}, rejecting request.\")\n return BAD_SECRET_RESPONSE\n end\n\n Kernel.puts(\"Request parameters are #{parameters.inspect}\")\n RUN_INSTANCES_REQUIRED_PARAMS.each { |required_param|\n if parameters[required_param].nil? or parameters[required_param].empty?\n Kernel.puts(\"Incoming parameters was missing required parameter \" +\n \"#{required_param}, rejecting request.\")\n return {\"success\" => false, \"reason\" => \"no #{required_param}\"}\n end\n }\n\n reservation_id = HelperFunctions.get_random_alphanumeric()\n @reservations[reservation_id] = {\n \"success\" => true,\n \"reason\" => \"received run request\",\n \"state\" => \"pending\",\n \"vm_info\" => nil\n }\n Kernel.puts(\"Generated reservation id #{reservation_id} for this request.\")\n\n Thread.new {\n HelperFunctions.set_creds_in_env(parameters['credentials'], \"1\")\n public_ips, private_ips, ids = HelperFunctions.spawn_vms(parameters)\n @reservations[reservation_id][\"state\"] = \"running\"\n @reservations[reservation_id][\"vm_info\"] = {\n \"public_ips\" => public_ips,\n \"private_ips\" => private_ips,\n \"instance_ids\" => ids\n }\n Kernel.puts(\"Successfully finished request #{reservation_id}.\")\n }\n\n Kernel.puts(\"Successfully started request #{reservation_id}.\")\n return {\"success\" => true, \"reservation_id\" => reservation_id, \n \"reason\" => \"none\"}\n end", "def create\n @instance_type = InstanceType.new(instance_type_params)\n\n respond_to do |format|\n if @instance_type.save\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @instance_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_nvidia_container(tag_name, image, volume_driver)\n puts \"-- Creating Docker Container\"\n container = Docker::Container.create(\n 'name' => tag_name,\n 'Image' => image,\n 'ExposedPorts' => { '9999/tcp' => {} },\n 'HostConfig' => {\n 'PortBindings' => {\n '8888/tcp' => [{ 'HostPort' => '9999', 'HostIP' => '0.0.0.0'}]\n },\n 'Devices' => [\n { 'PathOnHost' => '/dev/nvidiactl', 'PathInContainer' => '/dev/nvidiactl', 'CgroupPermissions' => 'rwm' },\n { 'PathOnHost' => '/dev/nvidia-uvm', 'PathInContainer' => '/dev/nvidia-uvm', 'CgroupPermissions' => 'rwm'},\n # { 'PathOnHost' => '/dev/nvidia-uvm-tools', 'PathInContainer' => '/dev/nvidia-uvm-tools', 'CgroupPermissions' => 'rwm' },\n { 'PathOnHost' => '/dev/nvidia0', 'PathInContainer' => '/dev/nvidia0', 'CgroupPermissions' => 'rwm' }\n ],\n 'VolumeDriver' => 'nvidia-docker',\n 'Mounts' => [\n { 'Target' => '/usr/local/nvidia', 'Source' => volume_driver, 'Type' => 'bind'}\n ]\n }\n )\n container.start\nend", "def create\n @serverhascontainer = Serverhascontainer.new(serverhascontainer_params)\n\n respond_to do |format|\n if @serverhascontainer.save\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully created.' }\n format.json { render :show, status: :created, location: @serverhascontainer }\n else\n format.html { render :new }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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 create\n @app_instance = AppInstance.new(app_instance_params)\n\n respond_to do |format|\n if @app_instance.save\n format.html { redirect_to @app_instance, notice: 'App instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @app_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_server(name, image, flavor, networks = nil, keypair = nil, security_group = nil, metadata = nil)\n data = { \n \"server\" => { \n \"name\" => name,\n \"imageRef\" => image,\n \"flavorRef\" => flavor,\n } \n }\n unless networks.nil?\n data[\"server\"][\"networks\"] = networks \n end\n unless keypair.nil?\n data[\"server\"][\"key_name\"] = keypair\n end\n unless security_group.nil?\n data[\"server\"][\"security_group\"] = security_group \n end\n return post_request(address(\"/servers\"), data, @token)\n end", "def list_instances(request_id)\n instances = []\n JSON.parse(resource[\"/requests/#{request_id}\"].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n end", "def handle_create(event)\n @bus.request 'containers', 'created', event: event.json, container: container_info(event.id)\n end", "def create_workers(number_of_instances, options = {}, user_id = 'unknown_user')\n defaults = {\n instance_type: 'm2.4xlarge',\n security_groups: [],\n image_id: nil, # don't prescribe the image id so that it can determine later\n user_id: user_id,\n\n # optional -- will default later\n associate_public_ip_address: nil,\n subnet_id: nil,\n ebs_volume_id: nil,\n aws_key_pair_name: nil,\n private_key_file_name: nil, # required if using an existing \"aws_key_pair_name\",\n tags: []\n }\n options = defaults.merge(options)\n\n # for backwards compatibility, still allow security_group\n if options[:security_group]\n warn 'Pass security_groups as an array instead of security_group. security_group will be deprecated in 0.4.0'\n options[:security_groups] = [options[:security_group]]\n end\n\n # Get the right worker AMI ids based on the type of instance\n if options[:image_id].nil?\n options[:image_id] = determine_image_type(options[:instance_type])\n end\n\n raise \"Can't create workers without a server instance running\" if @os_aws.server.nil?\n\n user_data_file = @dockerized ? 'worker_script.sh.docker.template' : 'worker_script.sh.template'\n\n unless number_of_instances == 0\n worker_options = {\n user_id: options[:user_id],\n tags: options[:tags],\n subnet_id: options[:subnet_id],\n associate_public_ip_address: options[:associate_public_ip_address],\n user_data_file: user_data_file\n }\n\n # if options[:ebs_volume_size]\n # worker_options[:ebs_volume_size] = options[:ebs_volume_size]\n # end\n\n @os_aws.launch_workers(options[:image_id], options[:instance_type], number_of_instances, worker_options)\n end\n\n logger.info 'Waiting for server/worker configurations'\n\n begin\n if @dockerized\n @os_aws.configure_swarm_cluster(@save_directory)\n else\n @os_aws.configure_server_and_workers\n end\n rescue StandardError => e\n raise \"Configuring the cluster failed with error `#{e.message}` in:\\n#{e.backtrace.join('\\n')}\"\n end\n end", "def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end", "def createEc2Instance\n\n instance_descriptor = {\n :image_id => @config[\"image_id\"],\n :key_name => @deploy.ssh_key_name,\n :instance_type => @config[\"size\"],\n :disable_api_termination => true,\n :min_count => 1,\n :max_count => 1\n }\n\n instance_descriptor[:iam_instance_profile] = getIAMProfile\n\n security_groups = myFirewallRules.map { |fw| fw.cloud_id }\n if security_groups.size > 0\n instance_descriptor[:security_group_ids] = security_groups\n else\n raise MuError, \"Didn't get any security groups assigned to be in #{@mu_name}, that shouldn't happen\"\n end\n\n if @config['private_ip']\n instance_descriptor[:private_ip_address] = @config['private_ip']\n end\n\n if [email protected]? and @config.has_key?(\"vpc\")\n subnet = mySubnets.sample\n if subnet.nil?\n raise MuError, \"Got null subnet id out of #{@config['vpc']}\"\n end\n MU.log \"Deploying #{@mu_name} into VPC #{@vpc.cloud_id} Subnet #{subnet.cloud_id}\"\n allowBastionAccess\n instance_descriptor[:subnet_id] = subnet.cloud_id\n end\n\n if [email protected]? and [email protected]?\n instance_descriptor[:user_data] = Base64.encode64(@userdata)\n end\n\n MU::Cloud::AWS::Server.waitForAMI(@config[\"image_id\"], region: @region, credentials: @credentials)\n\n instance_descriptor[:block_device_mappings] = MU::Cloud::AWS::Server.configureBlockDevices(image_id: @config[\"image_id\"], storage: @config['storage'], region: @region, credentials: @credentials)\n\n instance_descriptor[:monitoring] = {enabled: @config['monitoring']}\n\n if @tags and @tags.size > 0\n instance_descriptor[:tag_specifications] = [{\n :resource_type => \"instance\",\n :tags => @tags.keys.map { |k|\n { :key => k, :value => @tags[k] }\n }\n }]\n end\n\n MU.log \"Creating EC2 instance #{@mu_name}\", details: instance_descriptor\n\n instance = resp = nil\n loop_if = Proc.new {\n instance = resp.instances.first if resp and resp.instances\n resp.nil? or resp.instances.nil? or instance.nil?\n }\n\n bad_subnets = []\n mysubnet_ids = if mySubnets\n mySubnets.map { |s| s.cloud_id }\n end\n begin\n MU.retrier([Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue], loop_if: loop_if, loop_msg: \"Waiting for run_instances to return #{@mu_name}\") {\n resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).run_instances(instance_descriptor)\n }\n rescue Aws::EC2::Errors::Unsupported => e\n bad_subnets << instance_descriptor[:subnet_id]\n better_subnet = (mysubnet_ids - bad_subnets).sample\n if e.message !~ /is not supported in your requested Availability Zone/ and\n (mysubnet_ids.nil? or mysubnet_ids.empty? or\n mysubnet_ids.size == bad_subnets.size or\n better_subnet.nil? or better_subnet == \"\")\n raise MuError.new e.message, details: mysubnet_ids\n end\n instance_descriptor[:subnet_id] = (mysubnet_ids - bad_subnets).sample\n if instance_descriptor[:subnet_id].nil?\n raise MuError.new \"Specified subnet#{bad_subnets.size > 1 ? \"s do\" : \" does\"} not support instance type #{instance_descriptor[:instance_type]}\", details: bad_subnets\n end\n MU.log \"One or more subnets does not support instance type #{instance_descriptor[:instance_type]}, attempting with #{instance_descriptor[:subnet_id]} instead\", MU::WARN, details: bad_subnets\n retry\n rescue Aws::EC2::Errors::InvalidRequest => e\n MU.log e.message, MU::ERR, details: instance_descriptor\n raise e\n end\n\n MU.log \"#{@mu_name} (#{instance.instance_id}) coming online\"\n\n instance\n end", "def my_instance_id\n Net::HTTP.get(URI('http://169.254.169.254/1.0/meta-data/instance-id'))\n end", "def create_instance(options = {})\n body = Hash.new\n (body[:flavor_ref] = options[:flavor_ref]) or raise CloudDB::Exception::MissingArgument, \"Must provide a flavor to create an instance\"\n (body[:size] = options[:size]) or raise CloudDB::Exception::MissingArgument, \"Must provide a size to create an instance\"\n body[:name].upcase! if body[:name]\n response = dbreq(\"POST\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme,{},body.to_json)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n body = JSON.parse(response.body)['instance']\n return get_instance(body[\"id\"])\n end", "def make_fake_instances\n return unless Fog.mock?\n\n asg_instances = []\n all_instances = []\n min_size.times do |n|\n instance_id = Fog::AWS::Mock.instance_id\n asg_instances << {\n 'AvailabilityZone' => availability_zones,\n 'HealthStatus' => 'Good',\n 'InstanceId' => instance_id,\n 'LifecycleState' => 'Pending',\n 'LaunchConfigurationName' => launch_configuration.aws_identifier\n }\n\n all_instances << {\n 'amiLaunchIndex' => n,\n 'architecture' => 'i386',\n 'blockDeviceMapping' => [],\n 'clientToken' => 'FAKE_CLIENT_TOKEN',\n 'dnsName' => 'not-a-real-hostname',\n 'ebsOptimized' => false,\n 'hypervisor' => 'xen',\n 'imageId' => launch_configuration.ami,\n 'instanceId' => instance_id,\n 'instanceState' => { 'code' => 0, 'name' => 'not pending?' },\n 'instanceType' => launch_configuration.instance_type,\n 'kernelId' => launch_configuration.kernel_id || Fog::AWS::Mock.kernel_id,\n 'keyName' => launch_configuration.key_name,\n 'launchTime' => Time.now,\n 'monitoring' => { 'state' => false },\n 'placement' => { 'availabilityZone' => availability_zones,\n 'groupName' => self.aws_identifier,\n 'tenancy' => 'default' },\n 'privateDnsName' => nil,\n 'productCodes' => [],\n 'reason' => nil,\n 'rootDeviceType' => 'instance-store',\n 'virtualizationType' => 'paravirtual',\n 'groupIds' => [],\n 'groupSet' => launch_configuration.security_groups,\n 'iamInstanceProfile' => launch_configuration.iam_role,\n 'networkInterfaces' => [],\n 'ownerId' => nil,\n 'privateIpAddress' => nil,\n 'reservationId' => Fog::AWS::Mock.reservation_id,\n 'stateReason' => {},\n 'ipAddress' => Fog::AWS::Mock.ip_address,\n 'privateIpAddress' => Fog::AWS::Mock.private_ip_address\n }\n end\n Aerosol::AWS.auto_scaling.data[:auto_scaling_groups][aws_identifier]\n .merge!('Instances' => asg_instances)\n all_instances.each do |instance|\n Aerosol::AWS.compute.data[:instances][instance['instanceId']] = instance\n end\n end", "def createEc2Instance\n\t\t name = @server[\"name\"]\n\t\t node = @server['mu_name']\n\t\t\tbegin\n\t\t\t\t@server['iam_role'] = MU::Server.createIAMProfile(\"Server-\"+name, base_profile: @server['iam_role'], extra_policies: @server['iam_policies'])\n\t\t\trescue Aws::EC2::Errors::RequestLimitExceeded => e\n\t\t\t\tsleep 10\n\t\t\t\tretry\n\t\t\tend\n\t\t\t@server['iam_role'] = @server['iam_role']\n\n\t\t\tbegin\n\t\t\t\[email protected]\n\t\t\trescue Aws::EC2::Errors::RequestLimitExceeded => e\n\t\t\t\tsleep 10\n\t\t\t\tretry\n\t\t\tend\n\n\t\t instance_descriptor = {\n\t\t :image_id => @server[\"ami_id\"],\n\t\t :key_name => @deploy.keypairname,\n\t\t :instance_type => @server[\"size\"],\n\t\t :disable_api_termination => true,\n\t\t :min_count => 1,\n\t\t :max_count => 1,\n\t\t\t\t:network_interfaces => [\n\t\t\t\t\t{\n\t\t\t\t\t\t:associate_public_ip_address => name[\"associate_public_ip\"]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t }\n\t\t\t\n\t\t\tif !@server['private_ip'].nil?\n\t\t\t\tinstance_descriptor[:private_ip_address] = @server['private_ip']\n\t\t\tend\n\n\t\t\tvpc_id=subnet_id=nat_host_name=nat_ssh_user = nil\n\t\t\tsubnet_retries = 0\n\t\t\tif !@server[\"vpc\"].nil?\n\t\t\t\tbegin\n\t\t\t\t\tvpc_id, subnet_ids, nat_host_name, nat_ssh_user = MU::VPC.parseVPC(@server['vpc'])\n\t\t\t\trescue Aws::EC2::Errors::ServiceError => e\n\t\t\t\t\tMU.log e.message, MU::ERR, details: @server\n\t\t\t\t\tif subnet_retries < 5\n\t\t\t\t\t subnet_retries = subnet_retries + 1\n\t\t\t\t\t sleep 15\n\t\t\t\t\t retry\n\t\t\t\t\tend\n\t\t\t\t\traise e\n\t\t\t\tend\n\t\t\t\tsubnet_id = subnet_ids.first\n\t\t\t\tif subnet_id.nil? or subnet_id.empty?\n\t\t\t\t\tMU.log \"Got null Subnet id out of #{@server['vpc']}\", MU::ERR\n\t\t\t\t\traise \"deploy failure\"\n\t\t\t\tend\n\n\t\t\t\tMU.log \"Deploying #{node} into VPC #{vpc_id} Subnet #{subnet_id}\"\n\n\t\t\t\tif !@server[\"vpc\"][\"nat_host_name\"].nil? or !@server[\"vpc\"][\"nat_host_id\"].nil?\n\t\t\t\t\tadmin_sg = MU::Server.punchAdminNAT(@server, node)\n\t\t\t\telse\n\t\t\t\t\tadmin_sg = MU::FirewallRule.setAdminSG(vpc_id: vpc_id, region: @server['region'])\n\t\t\t\tend\n\n\t\t\t\tinstance_descriptor[:subnet_id] = subnet_id\n\t\t\t\tnode_sg = MU::FirewallRule.createEc2SG(\n\t\t\t\t\t\t@server[\"name\"].upcase,\n\t\t\t\t\t\t@server[\"ingress_rules\"],\n\t\t\t\t\t\tdescription: \"SG holes for #{node}\",\n\t\t\t\t\t\tvpc_id: vpc_id,\n\t\t\t\t\t\tregion: @server['region']\n\t\t\t\t)\n\t\t\telse\n\t\t\t\tadmin_sg = MU::FirewallRule.setAdminSG(region: @server['region'])\n\t\t\t\tnode_sg = MU::FirewallRule.createEc2SG(\n\t\t\t\t\t\t@server[\"name\"].upcase,\n\t\t\t\t\t\t@server[\"ingress_rules\"],\n\t\t\t\t\t\tdescription: \"SG holes for #{node}\",\n\t\t\t\t\t\tregion: @server['region']\n\t\t\t\t)\n\t\t\tend\n\t\t\tsecurity_groups = Array.new\n\t\t\tsecurity_groups << admin_sg\n\t\t\tsecurity_groups << node_sg\n\t\t\tif !@server[\"add_firewall_rules\"].nil?\n\t\t\t\t@server[\"add_firewall_rules\"].each { |acl|\n\t\t\t\t\tsg = MU::FirewallRule.find(sg_id: acl[\"rule_id\"], name: acl[\"rule_name\"], region: @server['region'])\n\t\t\t\t\tif sg.nil?\n\t\t\t\t\t\tMU.log \"Couldn't find dependent security group #{acl} for server #{node}\", MU::ERR\n\t\t\t\t\t\traise \"deploy failure\"\n\t\t\t\t\tend\n\t\t\t\t\tsecurity_groups << sg.group_id\n\t\t\t\t}\n\t\t\tend\n\n\t\t\tinstance_descriptor[:security_group_ids] = security_groups\n\n\t\t if [email protected]? and [email protected]?\n\t\t instance_descriptor[:user_data] = Base64.encode64(@userdata)\n\t\t end\n\n\t\t if !@server[\"iam_role\"].nil?\n\t\t instance_descriptor[:iam_instance_profile] = { name: @server[\"iam_role\"]}\n\t\t end\n\n\t\t\tconfigured_storage = Array.new\n\t\t\tif @server[\"storage\"]\n\t\t\t\t@server[\"storage\"].each { |vol|\n\t\t\t\t\tconfigured_storage << MU::Server.convertBlockDeviceMapping(vol)\n\t\t\t\t}\n\t\t\tend\n\t\t\n\t\t\tMU::Server.waitForAMI(@server[\"ami_id\"], region: @server['region'])\n\n\t\t\tinstance_descriptor[:block_device_mappings] = configured_storage\n\t\t\tinstance_descriptor[:block_device_mappings].concat(@ephemeral_mappings)\n\n\t\t\tinstance_descriptor[:monitoring] = { enabled: @server['monitoring'] }\n\n\t\t\tMU.log \"Creating EC2 instance #{node}\"\n\t\t\tMU.log \"Instance details for #{node}: #{instance_descriptor}\", MU::DEBUG\n#\t\t\t\tif instance_descriptor[:block_device_mappings].empty?\n#\t\t\t\t\tinstance_descriptor.delete(:block_device_mappings)\n#\t\t\t\tend\n#pp instance_descriptor[:block_device_mappings]\n\t\t\tretries = 0\n\t\t\tbegin\n\t\t\t\tresponse = MU.ec2(@server['region']).run_instances(instance_descriptor)\n\t\t\trescue Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue, Aws::EC2::Errors::RequestLimitExceeded => e\n\t\t\t\tif retries < 10\n\t\t\t\t\tif retries > 7\n\t\t\t\t\t\tMU.log \"Seeing #{e.inspect} while trying to launch #{node}, retrying a few more times...\", MU::WARN, details: instance_descriptor\n\t\t\t\t\tend\n\t\t\t\t\tsleep 10\n\t\t\t\t\tretries = retries + 1\n\t\t\t\t\tretry\n\t\t\t\telse\n\t\t\t\t\traise e\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tinstance = response.instances.first\n\t\t\tMU.log \"#{node} (#{instance.instance_id}) coming online\"\n\n\n\t\t\treturn instance\n\n\t\tend", "def create\n @instance_action = InstanceAction.new(params[:instance_action])\n\n respond_to do |format|\n if @instance_action.save\n format.html { redirect_to @instance_action, notice: 'Instance action was successfully created.' }\n format.json { render json: @instance_action, status: :created, location: @instance_action }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_action.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66692275", "0.62857574", "0.6244871", "0.6199069", "0.6053712", "0.6033599", "0.5999574", "0.5984011", "0.5884817", "0.5844355", "0.5842025", "0.57820374", "0.57688624", "0.5767724", "0.57607335", "0.575", "0.57462853", "0.57270616", "0.5682304", "0.5658339", "0.55079955", "0.55079347", "0.54915166", "0.54868585", "0.5464837", "0.5463248", "0.543437", "0.5421593", "0.5417624", "0.5395822", "0.53911746", "0.538895", "0.5377646", "0.5377212", "0.53757757", "0.53738123", "0.537219", "0.53667766", "0.53580487", "0.53509045", "0.5334588", "0.5330605", "0.532999", "0.53202254", "0.53155243", "0.5314534", "0.5300494", "0.5299797", "0.52728486", "0.5246416", "0.52407867", "0.52388257", "0.52285093", "0.522374", "0.5222205", "0.52221715", "0.5219771", "0.52078724", "0.52042365", "0.5203339", "0.5181707", "0.51687986", "0.51681906", "0.5167383", "0.51531106", "0.5149387", "0.5140269", "0.5134463", "0.5127995", "0.5121746", "0.51078796", "0.509289", "0.5062205", "0.50546026", "0.5049034", "0.50319207", "0.50195444", "0.5013097", "0.50096077", "0.5009436", "0.50033396", "0.49959546", "0.4987825", "0.49848017", "0.4979992", "0.49738967", "0.49737906", "0.4971236", "0.4964295", "0.49561894", "0.4950869", "0.49410313", "0.49390256", "0.49320027", "0.4931804", "0.4926184", "0.49235064", "0.49199656", "0.4919328", "0.49160892" ]
0.6829213
0
PATCH/PUT /docker_instances/1 PATCH/PUT /docker_instances/1.json
def update respond_to do |format| if @docker_instance.update(docker_instance_params) format.html { redirect_to @docker_instance, notice: 'Docker instance was successfully updated.' } format.json { render :show, status: :ok, location: @docker_instance } else format.html { render :edit } format.json { render json: @docker_instance.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n end", "def set_docker_instance\n @docker_instance = DockerInstance.find(params[:id])\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update\n @updated_container = params([:container])\n @container = DeployedContainer.find(params[:container][:id])\n\n nova_ip = nil\n quantum_ip = nil\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n rescue\n token = Storage.find(cookies[:current_token]).data\n nova_ip = Storage.find(cookies[:nova_ip]).data\n quantum_ip = Storage.find(cookies[:quantum_ip]).data\n end\n end\n\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n # Make a note of how many networks this container already has\n networks_count = @container.deployed_networks.count\n # Define an array to keep track of how many existing networks have been sent back\n existing_networks = Array.new()\n @updated_container[\"deployed_networks\"].each do |network|\n if network[\"deployStatus\"] == false\n # This is a new network. Create it and store its data\n\n else\n # This is an existing network\n existing_networks << network[\"temp_id\"]\n end\n end\n \n if existing_networks.count < networks_count\n # Some existing networks were not sent back. Delete these networks\n end \n\n # Make a note of how many VMs this container already has\n vms_count = @container.deployed_vms.count\n # Define an array to keep track of how many existing VMs have been sent back\n existing_vms = Array.new()\n @updated_container[\"deployed_vms\"].each do |vm|\n if vm[\"deployStatus\"] == false\n # This is a new VM. Create it and store its data\n v = @container.deployed_vms.build()\n ports = Array.new()\n port_list = Array.new()\n vm[\"deployed_connected_networks\"].each do |network|\n port = quantum.create_port(network[\"openstack_id\"],'',\"compute:nova\")\n ports << port[\"port\"][\"id\"]\n data = {'uuid'=>network[\"openstack_id\"]}\n port_list << data\n connected_network = v.deployed_connected_networks.build()\n connected_network.openstack_id = network[\"openstack_id\"]\n connected_network.save \n end\n else\n # This is an existing VM\n existing_vms << vm[\"temp_id\"]\n end\n end\n \n if existing_vms.count < vms_count\n # Some existing vms were not sent back. Delete these vms\n end \n \n # Make a note of how many routers this container already has\n routers_count = @container.deployed_routers.count\n # Define an array to keep track of how many existing routers have been sent back\n existing_routers = Array.new()\n @updated_container[\"deployed_routers\"].each do |router|\n if router[\"deployStatus\"] == false\n # This is a new router. Create it and store its data\n else\n # This is an existing router\n existing_routers << router[\"temp_id\"] \n end\n end\n\n if existing_routers.count < routers_count\n # Some existing routers were not sent back. Delete these routers\n end \n\n @updated_container[\"deployed_conatiners\"].each do |container|\n # Do some magic. Possibly recursive magic.\n end\n\n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def update\n respond_to do |format|\n if @docker_cfg.update(docker_cfg_params)\n format.html { redirect_to @docker_cfg, notice: 'Docker cfg was successfully updated.' }\n format.json { render :show, status: :ok, location: @docker_cfg }\n else\n format.html { render :edit }\n format.json { render json: @docker_cfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def update!(**args)\n @batch = args[:batch] if args.key?(:batch)\n @container_image = args[:container_image] if args.key?(:container_image)\n @vpc_network = args[:vpc_network] if args.key?(:vpc_network)\n end", "def update\n if request.xhr?\n @instance = Instance.find(params[:id])\n else\n @instance = @provider.instances.find(params[:id])\n end\n respond_to do |format|\n if @instance.update_attributes(params[:instance])\n @instance.resize_instance(@provider.connect!)\n format.html { redirect_to @instance, notice: 'Instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container_type = args[:container_type] if args.key?(:container_type)\n @id = args[:id] if args.key?(:id)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @labels = args[:labels] if args.key?(:labels)\n @location = args[:location] if args.key?(:location)\n @network = args[:network] if args.key?(:network)\n @placement = args[:placement] if args.key?(:placement)\n @service_account = args[:service_account] if args.key?(:service_account)\n end", "def update!(**args)\n @autoscaling_spec = args[:autoscaling_spec] if args.key?(:autoscaling_spec)\n @disk_spec = args[:disk_spec] if args.key?(:disk_spec)\n @id = args[:id] if args.key?(:id)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @replica_count = args[:replica_count] if args.key?(:replica_count)\n @used_replica_count = args[:used_replica_count] if args.key?(:used_replica_count)\n end", "def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end", "def patch_kubernetes_virtual_machine_instance_type_with_http_info(moid, kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_virtual_machine_instance_type\",\n :header_params => 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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update!(**args)\n @containers = args[:containers] if args.key?(:containers)\n end", "def update\n @server_instance = ServerInstance.find(params[:id])\n\n respond_to do |format|\n if @server_instance.update_attributes(params[:server_instance])\n format.html { redirect_to @server_instance, notice: 'Server instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @container.update(container_params)\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { render :show, status: :ok, location: @container }\n else\n format.html { render :edit }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n end", "def update_kubernetes_virtual_machine_instance_type_with_http_info(moid, kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.update_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.update_kubernetes_virtual_machine_instance_type\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.update_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.update_kubernetes_virtual_machine_instance_type\",\n :header_params => 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: KubernetesApi#update_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n requires :identity, :settings_version, :tier\n\n data = service.update_instance(identity, settings_version, tier, settings)\n operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)\n operation.wait_for { ready? }\n reload\n end", "def docker_instance_params\n params.require(:docker_instance).permit(:name, :branch)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @instance = Instance.find(params[:id])\n\n respond_to do |format|\n if @instance.update_attributes(params[:instance])\n format.html { redirect_to @instance, notice: 'Instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container = args[:container] if args.key?(:container)\n @container_type = args[:container_type] if args.key?(:container_type)\n @deleted = args[:deleted] if args.key?(:deleted)\n @id = args[:id] if args.key?(:id)\n @last_updated = args[:last_updated] if args.key?(:last_updated)\n @last_updated_micros = args[:last_updated_micros] if args.key?(:last_updated_micros)\n @source_etag = args[:source_etag] if args.key?(:source_etag)\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @ec2_instance.update(ec2_instance_params)\n format.html { redirect_to @ec2_instance, notice: 'Ec2 instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @ec2_instance }\n else\n format.html { render :edit }\n format.json { render json: @ec2_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @container_runtime = args[:container_runtime] if args.key?(:container_runtime)\n @max_pods_per_node = args[:max_pods_per_node] if args.key?(:max_pods_per_node)\n end", "def update_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def update!(**args)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_type = args[:container_type] if args.key?(:container_type)\n @extended_data = args[:extended_data] if args.key?(:extended_data)\n @materialized = args[:materialized] if args.key?(:materialized)\n end", "def update_instances\n Instance.update_all( ['public_ip=NULL, dns_name=NULL'], ['provider_account_id=? and public_ip=? and instance_id != ?', provider_account_id, public_ip, instance_id ] )\n \tInstance.update_all( ['public_ip=?, dns_name=?', public_ip, name], ['provider_account_id=? and instance_id=?', provider_account_id, instance_id ] )\n end", "def patch_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def update(options)\n data = JSON.generate(:server => options)\n response = @compute.connection.csreq(\"PUT\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n # If we rename the instance, repopulate the object\n self.populate if options[:name]\n true\n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update!(**args)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @disk_spec = args[:disk_spec] if args.key?(:disk_spec)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @nfs_mounts = args[:nfs_mounts] if args.key?(:nfs_mounts)\n @python_package_spec = args[:python_package_spec] if args.key?(:python_package_spec)\n @replica_count = args[:replica_count] if args.key?(:replica_count)\n end", "def update!(**args)\n @container_port = args[:container_port] if args.key?(:container_port)\n end", "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container_id = args[:container_id] if args.key?(:container_id)\n @permission = args[:permission] if args.key?(:permission)\n end", "def update\n respond_to do |format|\n if @instance_eni.update(instance_eni_params)\n format.html { redirect_to @instance_eni, notice: 'Instance eni was successfully updated.' }\n format.json { render :show, status: :ok, location: @instance_eni }\n else\n format.html { render :edit }\n format.json { render json: @instance_eni.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n if @instance_type.update_attributes(params[:instance_type])\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n if @konfig.update_attributes(params[:konfig])\n format.html { redirect_to admin_konfig_path(@konfig), notice: 'Config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @konfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @config = args[:config] if args.key?(:config)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @name = args[:name] if args.key?(:name)\n @node_pool_autoscaling = args[:node_pool_autoscaling] if args.key?(:node_pool_autoscaling)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update\n # NOTE: API V1 dropped support for updating client keys via update (aka PUT),\n # but this code never supported key updating in the first place. Since\n # it was never implemented, we will simply ignore that functionality\n # as it is being deprecated.\n # Delete this comment after V0 support is dropped.\n payload = { name: name }\n payload[:validator] = validator unless validator.nil?\n\n # DEPRECATION\n # This field is ignored in API V1, but left for backwards-compat,\n # can remove after API V0 is no longer supported.\n payload[:admin] = admin unless admin.nil?\n\n begin\n new_client = chef_rest_v1.put(\"clients/#{name}\", payload)\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n new_client = chef_rest_v0.put(\"clients/#{name}\", payload)\n end\n\n Chef::ApiClientV1.from_hash(new_client)\n end", "def update!(**args)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @cpus = args[:cpus] if args.key?(:cpus)\n @enable_load_balancer = args[:enable_load_balancer] if args.key?(:enable_load_balancer)\n @image = args[:image] if args.key?(:image)\n @image_type = args[:image_type] if args.key?(:image_type)\n @labels = args[:labels] if args.key?(:labels)\n @memory_mb = args[:memory_mb] if args.key?(:memory_mb)\n @replicas = args[:replicas] if args.key?(:replicas)\n @taints = args[:taints] if args.key?(:taints)\n @vsphere_config = args[:vsphere_config] if args.key?(:vsphere_config)\n end", "def update options = {}\n\n group_opts = group_options(options) \n\n # tags must be updated using a separate request from the\n # other attributes, *sigh*\n if tags = group_opts.delete(:tags)\n tags.map(&:to_hash).each do |tag|\n tag[:resource_type] = 'auto-scaling-group'\n tag[:resource_id] = name\n end\n client.create_or_update_tags(:tags => tags)\n end\n\n unless group_opts.empty?\n client_opts = group_opts.merge(:auto_scaling_group_name => name)\n client.update_auto_scaling_group(client_opts)\n end\n\n nil\n\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @accelerators = args[:accelerators] if args.key?(:accelerators)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @confidential_instance_config = args[:confidential_instance_config] if args.key?(:confidential_instance_config)\n @disable_public_ip_addresses = args[:disable_public_ip_addresses] if args.key?(:disable_public_ip_addresses)\n @enable_nested_virtualization = args[:enable_nested_virtualization] if args.key?(:enable_nested_virtualization)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @pool_size = args[:pool_size] if args.key?(:pool_size)\n @pooled_instances = args[:pooled_instances] if args.key?(:pooled_instances)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shielded_instance_config = args[:shielded_instance_config] if args.key?(:shielded_instance_config)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @cloud_run = args[:cloud_run] if args.key?(:cloud_run)\n @kubernetes = args[:kubernetes] if args.key?(:kubernetes)\n end", "def update!(**args)\n @instance_size = args[:instance_size] if args.key?(:instance_size)\n end", "def update\n respond_to do |format|\n if @serverhascontainer.update(serverhascontainer_params)\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully updated.' }\n format.json { render :show, status: :ok, location: @serverhascontainer }\n else\n format.html { render :edit }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app_instance.update(app_instance_params)\n format.html { redirect_to @app_instance, notice: 'App instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @dry_run = args[:dry_run] if args.key?(:dry_run)\n @duration = args[:duration] if args.key?(:duration)\n @error_message = args[:error_message] if args.key?(:error_message)\n @instance_details_summary = args[:instance_details_summary] if args.key?(:instance_details_summary)\n @instance_filter = args[:instance_filter] if args.key?(:instance_filter)\n @name = args[:name] if args.key?(:name)\n @patch_config = args[:patch_config] if args.key?(:patch_config)\n @patch_deployment = args[:patch_deployment] if args.key?(:patch_deployment)\n @percent_complete = args[:percent_complete] if args.key?(:percent_complete)\n @rollout = args[:rollout] if args.key?(:rollout)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def doUpdate(startState)\n if (new_resource.rackID.nil? || new_resource.rackID.empty?)\n return\n end\n \n json = \"{\\\"rackId\\\" : \\\"#{new_resource.rackID}\\\"}\"\n \n response = putRequest(\"/hosts/#{new_resource.hostname}\", json)\n \n unless response.code.to_i.between?(200,299)\n raise Exception.new(\"Host update of #{new_resource.hostname} failed with #{response.code} code. Body: #{response.body}\")\n end\n \n unless response.body == startState\n new_resource.updated_by_last_action true\n end\nend", "def update!(**args)\n @allowed_projects = args[:allowed_projects] if args.key?(:allowed_projects)\n @cluster_hostname = args[:cluster_hostname] if args.key?(:cluster_hostname)\n @enable_private_endpoint = args[:enable_private_endpoint] if args.key?(:enable_private_endpoint)\n @service_attachment_uri = args[:service_attachment_uri] if args.key?(:service_attachment_uri)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def set_instance\n if Instance.exists?(params[:id])\n @instance = Instance.find(params[:id])\n else\n render json: { error: 'No se ejecuto nada con ese id', codigo: 707 }\n end\n end", "def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @container_stack = ContainerStack.find(params[:id])\n\n respond_to do |format|\n if @container_stack.update_attributes(params[:container_stack])\n format.html { redirect_to @container_stack, notice: 'Container stack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container_stack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @container = Container.get!(params[:id])\n\n respond_to do |format|\n if @container.update(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(edit_container_url(@container.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @gce_instance = args[:gce_instance] if args.key?(:gce_instance)\n end", "def patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\n :header_params => 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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n #@instance = Instance.find(params[:id])\n\n respond_to do |format|\n if @instance.update_attributes(params[:instance])\n format.html { redirect_to @instance, notice: '更新成功。' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_server(server_uuid, params)\n data = { \"server\" => params }\n json = JSON.generate data\n response = put \"server/#{server_uuid}\", json\n\n response\n end", "def update!(**args)\n @available_memory_mb = args[:available_memory_mb] if args.key?(:available_memory_mb)\n @entry_point = args[:entry_point] if args.key?(:entry_point)\n @environment_variables = args[:environment_variables] if args.key?(:environment_variables)\n @event_trigger = args[:event_trigger] if args.key?(:event_trigger)\n @https_trigger = args[:https_trigger] if args.key?(:https_trigger)\n @labels = args[:labels] if args.key?(:labels)\n @latest_operation = args[:latest_operation] if args.key?(:latest_operation)\n @max_instances = args[:max_instances] if args.key?(:max_instances)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @runtime = args[:runtime] if args.key?(:runtime)\n @service_account = args[:service_account] if args.key?(:service_account)\n @source_archive_url = args[:source_archive_url] if args.key?(:source_archive_url)\n @source_repository = args[:source_repository] if args.key?(:source_repository)\n @source_repository_url = args[:source_repository_url] if args.key?(:source_repository_url)\n @source_upload_url = args[:source_upload_url] if args.key?(:source_upload_url)\n @status = args[:status] if args.key?(:status)\n @timeout = args[:timeout] if args.key?(:timeout)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n @vpc_connector = args[:vpc_connector] if args.key?(:vpc_connector)\n end", "def update!(**args)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @creator = args[:creator] if args.key?(:creator)\n @image_version = args[:image_version] if args.key?(:image_version)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @instance_preemption_notice_received = args[:instance_preemption_notice_received] if args.key?(:instance_preemption_notice_received)\n @os_release = args[:os_release] if args.key?(:os_release)\n @version = args[:version] if args.key?(:version)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @available_memory_mb = args[:available_memory_mb] if args.key?(:available_memory_mb)\n @description = args[:description] if args.key?(:description)\n @entry_point = args[:entry_point] if args.key?(:entry_point)\n @environment_variables = args[:environment_variables] if args.key?(:environment_variables)\n @event_trigger = args[:event_trigger] if args.key?(:event_trigger)\n @https_trigger = args[:https_trigger] if args.key?(:https_trigger)\n @labels = args[:labels] if args.key?(:labels)\n @max_instances = args[:max_instances] if args.key?(:max_instances)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @runtime = args[:runtime] if args.key?(:runtime)\n @service_account_email = args[:service_account_email] if args.key?(:service_account_email)\n @source_archive_url = args[:source_archive_url] if args.key?(:source_archive_url)\n @source_repository = args[:source_repository] if args.key?(:source_repository)\n @source_upload_url = args[:source_upload_url] if args.key?(:source_upload_url)\n @status = args[:status] if args.key?(:status)\n @timeout = args[:timeout] if args.key?(:timeout)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n @vpc_connector = args[:vpc_connector] if args.key?(:vpc_connector)\n end", "def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @explanation_spec_override = args[:explanation_spec_override] if args.key?(:explanation_spec_override)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end", "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def send_patch_command(patch_instances, command)\n @ssm.send_command(\n instance_ids: patch_instances, # required\n document_name: 'AWS-RunShellScript', # required\n timeout_seconds: 600,\n comment: 'Patch It!',\n parameters: {\n 'commands' => [command]\n }\n )\n end", "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(@container) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def redeploy(opts)\n client = opts.k8s.to_api\n patch = {\n spec: {\n template: {\n metadata: {\n annotations: {\n \"kubectl.kubernetes.io/restartedAt\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')\n }\n }\n }\n }\n }\n\n client\n .api('apps/v1')\n .resource('deployments', namespace: opts[:k8s][:k8s_namespace])\n .merge_patch(opts[:k8s][:k8s_deployment], patch)\nend", "def update!(**args)\n @all = args[:all] if args.key?(:all)\n @group_labels = args[:group_labels] if args.key?(:group_labels)\n @instance_name_prefixes = args[:instance_name_prefixes] if args.key?(:instance_name_prefixes)\n @instances = args[:instances] if args.key?(:instances)\n @zones = args[:zones] if args.key?(:zones)\n end", "def update_container_with_http_info(container_id, container_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.update_container ...'\n end\n # verify the required parameter 'container_id' is set\n if @api_client.config.client_side_validation && container_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_id' when calling ContainersApi.update_container\"\n end\n # verify the required parameter 'container_body' is set\n if @api_client.config.client_side_validation && container_body.nil?\n fail ArgumentError, \"Missing the required parameter 'container_body' when calling ContainersApi.update_container\"\n end\n # resource path\n local_var_path = '/containers/{container_id}'.sub('{' + 'container_id' + '}', CGI.escape(container_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(container_body) \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#update_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n end", "def apply_updates_to_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_apply_updates_to_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def update\n @instance_name = InstanceName.find(params[:id])\n\n respond_to do |format|\n if @instance_name.update_attributes(params[:instance_name])\n flash[:notice] = 'InstanceName was successfully updated.'\n format.html { redirect_to(@instance_name) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instance_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instance.update(instance_params)\n format.html { redirect_to @instance, notice: 'Instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @instance }\n else\n format.html { render :edit }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instance.update(instance_params)\n format.html { redirect_to @instance, notice: 'Instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @instance }\n else\n format.html { render :edit }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @group_id = args[:group_id] if args.key?(:group_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n end", "def patch_kubernetes_cluster_with_http_info(moid, kubernetes_cluster, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_cluster ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_cluster\"\n end\n # verify the required parameter 'kubernetes_cluster' is set\n if @api_client.config.client_side_validation && kubernetes_cluster.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_cluster' when calling KubernetesApi.patch_kubernetes_cluster\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Clusters/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_cluster)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesCluster'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_cluster\",\n :header_params => 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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_cluster\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container_version = args[:container_version] if args.key?(:container_version)\n @container_version_header = args[:container_version_header] if args.key?(:container_version_header)\n end", "def 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 container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def update\n @instance_action = InstanceAction.find(params[:id])\n\n respond_to do |format|\n if @instance_action.update_attributes(params[:instance_action])\n format.html { redirect_to @instance_action, notice: 'Instance action was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update!(**args)\n @autoscaling_metric_specs = args[:autoscaling_metric_specs] if args.key?(:autoscaling_metric_specs)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end", "def update\n respond_to do |format|\n if @instance_eni_tag.update(instance_eni_tag_params)\n format.html { redirect_to @instance_eni_tag, notice: 'Instance eni tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @instance_eni_tag }\n else\n format.html { render :edit }\n format.json { render json: @instance_eni_tag.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.5964702", "0.58961076", "0.5888172", "0.58842486", "0.5882556", "0.57575846", "0.57229674", "0.5715818", "0.56957597", "0.56505954", "0.5632361", "0.55824476", "0.5564999", "0.55546474", "0.5550443", "0.55327386", "0.5493891", "0.54817617", "0.54778326", "0.5461803", "0.5443342", "0.5433016", "0.54290676", "0.54082805", "0.5405067", "0.54017234", "0.5400558", "0.53988636", "0.5396069", "0.5390115", "0.5385955", "0.5380985", "0.5369282", "0.5362843", "0.53408766", "0.53380924", "0.53111994", "0.5303916", "0.5303916", "0.52981615", "0.5297066", "0.528387", "0.52786714", "0.5260036", "0.5257157", "0.5233831", "0.5230516", "0.5229753", "0.52249545", "0.5223712", "0.5223243", "0.5207942", "0.5207942", "0.5207333", "0.5206879", "0.51891315", "0.51882684", "0.51872337", "0.51826006", "0.517856", "0.5176754", "0.51699", "0.5162048", "0.5162048", "0.5161877", "0.5155766", "0.51522285", "0.5150281", "0.51452214", "0.5143971", "0.51427484", "0.51392424", "0.5132109", "0.51314837", "0.51288545", "0.51239645", "0.5112782", "0.5112533", "0.50922066", "0.5092179", "0.5085818", "0.5083196", "0.5082955", "0.50772667", "0.50715125", "0.5069475", "0.5067543", "0.5067011", "0.5067011", "0.50637263", "0.5056567", "0.50523794", "0.50510025", "0.5047687", "0.5046409", "0.5044593", "0.5039815", "0.5028072", "0.5027821", "0.5025329" ]
0.7074607
0
DELETE /docker_instances/1 DELETE /docker_instances/1.json
def destroy @docker_instance.destroy respond_to do |format| format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @docker_cfg.destroy\n respond_to do |format|\n format.html { redirect_to docker_cfgs_url, notice: 'Docker cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def destroy\n begin\n #finds the current server that the container is on and sets it as Docker.ulr\n #@serverid = Serverhascontainer.where(container_id: @container.id)[0].server_id;\n #@currentServer = Server.where(id: @serverid)\n #Docker.url = 'tcp://' + @currentServer[0][\"ip\"] + \":\" + @currentServer[0][\"port\"]\n Docker.url = findServer()\n\n #removes the container from docker\n Docker::Container.get(Container.find(params[:id]).dockercontainer_id).remove;\n\n #removes the Server-container relation from the database\n @d = Serverhascontainer.where(container_id: @container.id) \n Serverhascontainer.destroy(@d[0].id);\n\n #removes the container from the database\n @container.destroy\n Docker.url = ''\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'deleted.' }\n format.json { head :no_content }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: You cannot remove a running container. Stop the container before attempting removal\" }\n end\n end\n end", "def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containerview.contents(@options[:container])\n container_contents = contents.body.split(/\\n/)\n container_contents.each do |content|\n containerview.delete_content(@options[:container], content)\n puts 'deleted ' + content\n end\n end\n containerview = containerview.delete(@options[:container])\n if containerview.code == '204'\n puts \"Container #{@options[:container]} deleted\"\n else\n @util.response_handler(containerview)\n end\n end", "def destroy\n #@instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_instance = ServerInstance.find(params[:id])\n @server_instance.destroy\n\n respond_to do |format|\n format.html { redirect_to server_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def delete_instance instance_id\n instances.delete_instance name: instance_path(instance_id)\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def destroy\n @instance.destroy\n respond_to do |format|\n format.html { redirect_to instances_url, notice: 'Instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance.destroy\n respond_to do |format|\n format.html { redirect_to instances_url, notice: 'Instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clean\n # TODO: help?\n # TODO: check for unknown args\n\n # Can give the following\n # Error response from daemon: conflict: unable to delete cfc459985b4b (cannot be forced)\n # image is being used by running container a7108a524a4d\n command = \"docker images -q -f='dangling=true' | xargs docker rmi --force\"\n run command\nend", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to(instances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_instance.destroy\n respond_to do |format|\n format.html { redirect_to test_instances_url, notice: 'Test instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @konfig = Konfig.find(params[:id])\n @konfig.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_konfigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @ec2_instance.destroy\n respond_to do |format|\n format.html { redirect_to ec2_instances_url, notice: 'Ec2 instance was successfully destroyed.' }\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 conf.delete 'api'\n end", "def destroy\n return if @name.nil?\n delete_rest \"vservers/#{@name}\"\n end", "def destroy\n @client.delete( name )\n end", "def destroy\n @inst.destroy\n respond_to do |format|\n format.html { redirect_to insts_url, notice: 'Inst was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_name = InstanceName.find(params[:id])\n @instance_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(instance_names_url) }\n format.xml { head :ok }\n end\n end", "def delete_instance instance_id\n execute do\n instances.delete_instance(\n instance_path(instance_id)\n )\n end\n end", "def delete_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_delete_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "def destroy\n @game_instance = GameInstance.find(params[:id])\n @game_instance.destroy\n\n respond_to do |format|\n format.html { redirect_to game_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_type = InstanceType.find(params[:id])\n @instance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_eni.destroy\n respond_to do |format|\n format.html { redirect_to instance_enis_url, notice: 'Instance eni was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy!\n response = @connection.dbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end", "def destroy\n @dungeon_instance = @current_user.dungeon_instances.find(params[:id])\n @dungeon_instance.destroy\n respond_to do |format|\n format.html { redirect_to dungeon_instances_url, notice: 'Dungeon instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @container_stack = ContainerStack.find(params[:id])\n @container_stack.destroy\n\n respond_to do |format|\n format.html { redirect_to container_stacks_url }\n format.json { head :no_content }\n end\n end", "def host_delete(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.http_delete\n end", "def destroy\n @instance_action = InstanceAction.find(params[:id])\n @instance_action.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end", "def 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 cleanup\n docker.stop_container\n docker.delete_container\n end", "def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end", "def destroy\n log_debug \"[ #{@node}/#{@environment} ] - Destroy Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container rm #{@container}\"\n end", "def destroy\n @measure_instance.destroy\n respond_to do |format|\n format.html { redirect_to measure_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy \n ec2 = self.class.new_ec2(@resource.value(:user), @resource.value(:password))\n ec2.terminate_instances({:instance_id => @property_hash[:instance_id]})\n ec2.delete_security_group({:group_name => @resource.value(:name)})\n end", "def destroy\n @level_container = LevelContainer.find(params[:id])\n @level_container.destroy\n\n respond_to do |format|\n format.html { redirect_to level_containers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to clusters_url }\n format.json { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete_instance_from_dashboard(appid, location)\n begin\n host, port = location.split(\":\")\n instance_info = [{\n 'appid' => appid,\n 'host' => host,\n 'port' => Integer(port)\n }]\n\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/apps/stats/instances\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url.path)\n request.body = JSON.dump(instance_info)\n response = http.request(request)\n Djinn.log_debug(\"Done sending instance info to AppDashboard!\")\n Djinn.log_debug(\"Instance info is: #{instance_info.inspect}\")\n Djinn.log_debug(\"Response is #{response.body}\")\n rescue Exception => exception\n # Don't crash the AppController because we weren't able to send over\n # the instance info - just continue on.\n Djinn.log_warn(\"Couldn't delete instance info to AppDashboard because\" +\n \" of a #{exception.class} exception.\")\n end\n end", "def delete_image(image_id)\n delete(\"cloud-instances/#{guid}/images/#{image_id}\")\n end", "def destroy\n @client.delete(@name)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n get_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_eni_tag.destroy\n respond_to do |format|\n format.html { redirect_to instance_eni_tags_url, notice: 'Instance eni tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def get_docker_node_destroy_command_for(node)\n \"docker kill #{node.id}; docker rm #{node.id}\"\nend", "def destroy\n @instancium.destroy\n respond_to do |format|\n format.html { redirect_to instancia_url, notice: 'Instancium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @container = @container_row.container\n @container_row.destroy\n respond_to do |format|\n flash[:success] = 'Row was successfully deleted.' \n format.html { redirect_to admin_container_url(@container) }\n format.json { head :no_content }\n end\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def destroy\n @run.destroy\n head 200\n end", "def destroy\n @robot_instance.destroy\n respond_to do |format|\n format.html { redirect_to robot_instances_url, notice: 'Robot instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_pvm_instance(instance_id)\n delete(\"cloud-instances/#{guid}/pvm-instances/#{instance_id}\")\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @insta_post.destroy\n respond_to do |format|\n format.html { redirect_to insta_posts_url, notice: 'Insta post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def docker_rm\n sh 'docker rm --force brownbag', verbose: false\nrescue RuntimeError => error\n puts error.message\nend", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end", "def destroy\n @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 @institucion.destroy\n respond_to do |format|\n format.html { redirect_to institucions_url, notice: 'Empresa se ha eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_game_instance = Game::GameInstance.find(params[:id])\n @game_game_instance.destroy\n\n respond_to do |format|\n format.html { redirect_to game_game_instances_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n end", "def delete(instance) # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + instance\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end", "def destroy\n @instagrampic.destroy\n respond_to do |format|\n format.html { redirect_to instagrampics_url, notice: 'Instagrampic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_label_set.destroy\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, notice: 'Image label set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n results = submit_cmd('delete app instance',:db, \" -env #{self.belongs_to.env} -app_instance #{self.name}\")\n\n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \t raise \"update attribute failed\" \n\t else\n\t \t self.belongs_to.appTemplates.delete(self)\n\t end\n\n end", "def destroy\n @database = Database.find(params[:id])\n if @database.started\n @database_client = RdsServer.find(@database.name)\n @database_client.destroy\n end\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :ok }\n end\n end", "def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\nend", "def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end", "def delete_storage(request, params)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n # --- Delete the Image ---\n rc = image.delete\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return \"\", 204\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\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 @vmimage.destroy\n respond_to do |format|\n format.html { redirect_to vmimages_url }\n format.json { head :no_content }\n end\n end", "def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end", "def destroy\n @api_state.destroy\n\n head :no_content\n end" ]
[ "0.68750197", "0.68050814", "0.67170155", "0.66775703", "0.66538495", "0.66162044", "0.65888125", "0.6586511", "0.65755445", "0.6561942", "0.6534104", "0.6531095", "0.64382535", "0.64339375", "0.63985187", "0.63976926", "0.63849646", "0.63735545", "0.6371583", "0.6343241", "0.63430756", "0.6306626", "0.626905", "0.62645465", "0.6251469", "0.62350553", "0.6226586", "0.61962944", "0.61952865", "0.6191339", "0.618986", "0.6183821", "0.6182776", "0.6152795", "0.6145122", "0.612281", "0.61205596", "0.61181164", "0.6111569", "0.61065066", "0.61012787", "0.6100636", "0.6088059", "0.60857725", "0.6085155", "0.60840416", "0.6069168", "0.60659975", "0.60656", "0.6063504", "0.60552377", "0.6052996", "0.6046971", "0.604697", "0.60468745", "0.6045299", "0.60435396", "0.60421246", "0.6033939", "0.6029656", "0.60245204", "0.60219324", "0.6015995", "0.60128695", "0.60111374", "0.60110873", "0.60060596", "0.600588", "0.5999439", "0.5985742", "0.5970268", "0.59700006", "0.59691036", "0.59655076", "0.5965179", "0.5965139", "0.59581226", "0.59552556", "0.59397995", "0.5935104", "0.59276", "0.592177", "0.5921548", "0.5919901", "0.5918143", "0.59144366", "0.5909996", "0.5909505", "0.5908571", "0.590743", "0.5906666", "0.5897391", "0.58951163", "0.58928925", "0.58899206", "0.5883047", "0.5882623", "0.58821315", "0.58809847", "0.58778846" ]
0.8178466
0
Use callbacks to share common setup or constraints between actions.
def set_docker_instance @docker_instance = DockerInstance.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 docker_instance_params params.require(:docker_instance).permit(:name, :branch) 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 every test to pass before coding runner below
def runner welcome card_sum = 0 card_sum += initial_round until card_sum > 21 card_sum = hit?(card_sum) display_card_total(card_sum) end end_game(card_sum) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def test_cases; end", "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end", "def running_test_case; end", "def all_tests_pass\n cucumber_guard = ::Guard.guards({ :name => 'cucumber', :group => 'puppet_tests'}).first\n cucumber_passed = cucumber_guard.instance_variable_get(\"@failed_paths\").empty?\n rspec_guard = ::Guard.guards({ :name => 'rspec', :group => 'puppet_tests'}).first\n rspec_passed = rspec_guard.instance_variable_get(\"@failed_paths\").empty?\n return rspec_passed && cucumber_passed\nend", "def my_tests\n end", "def tests; end", "def tests; end", "def passed_checks\n all_checks_which_pass\n end", "def passes\n count - failures - errors - skips\n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def all_external_test_runs_passed?(test_types = nil)\n external_tests_blocking(test_types).empty?\n end", "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def test_steps; end", "def test_steps; end", "def uninit_ok_tests\n if (!@num_tests_run.nil? && !@num_tests_failed.nil?)\n @num_tests_ok += @num_tests_run - @num_tests_failed\n end\n end", "def before_test(test); end", "def before_test(test); end", "def generate_alltest\n\n end", "def running_test_step; end", "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "def testing_begin(files)\n end", "def unitTests\n\t\ttotalTests = 12\n\t\ttotalFailed = 0\n\t\toutput = \"\"\n\t\t@debug = true\n\n\t\t#CLEAR DB BEFORE RUNNING TEST. DEFINITELY CRUDE BUT THE ONLY THING I COULD GET WORKING\n\t\tself.TESTAPI_resetFixture\n\n\t\t#Test1: \"Does not allow a non-registered user login\"\n\t\tresponse = self.login(\"NonUser\",\"pass0\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test1\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test2: \"Allows a user that supplies no password get added\"\n\t\tresponse = self.add(\"user2\",\"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test2\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test3: \"Allows a user with a username and password get added\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test3\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test4: \"Doesn't allow an already added user get added again\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test4\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test5: \"Doesn't allow a blank username get added\"\n\t\tresponse = self.add(\"\",\"pass5\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test5\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test6: \"It allows a username and password of 128 characters to get added\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test6\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test7: \"Does not allow a username greater than 128 characters\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"pass7\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test7\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test8: \"Does not allow a password greater than 128 characters\"\n\t\tresponse = self.add(\"user8\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -4\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test8\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test9: \"Allows a registered user with a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user3\", \"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test9\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test10: \"Allows a registered user without a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user2\", \"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test10\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test11: \"Doesn't allow a user with wrong password to login\"\n\t\tresponse = self.login(\"user3\", \"pass2\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test11\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test12: \"Sucessfully Deletes the DB with call to TESTAPI_reset_fixture\"\n\t\tresponse = self.TESTAPI_resetFixture\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test12\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t@debug = false\n\t\trender json: {:totalTests => totalTests, :nrFailed => totalFailed, :output => output}\n\t\t\n\tend", "def run\n test_using_random_sample\n test_using_first_of\n end", "def done\n puts 'Done running tests'\n end", "def all_failing\n all(\"#qunit-tests .fail\")\n end", "def passing_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :passed\n end\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def test_step; end", "def scenarios\n @runner.done_scenarios\n end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end", "def test_passed(array)\n last_item = array.length - 1\n test_name = array[last_item - 1]\n test_suite_verify(array[@class_name])\n printf \"%-40s PASS\\n\", test_name\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\"/>'\n end", "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def call(*tests, env:)\n summary = execute_all(tests, env)\n List.new(\n List.new(Symbol.new(\"success\"), List.new(*summary[:success])),\n List.new(Symbol.new(\"failures\"), List.new(*summary[:failures]))\n )\n end", "def failures; end", "def failures; end", "def failures; end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\[email protected] += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\[email protected] += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\[email protected] += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\[email protected] += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def test_case; end", "def print_results\n if [email protected]?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def test_contains_13_eachsuit\n assert true == false\n end", "def test_runnable_methods_random\n @assertion_count = 0\n\n random_tests_1 = sample_test_case 42\n random_tests_2 = sample_test_case 42\n random_tests_3 = sample_test_case 1_000\n\n assert_equal random_tests_1, random_tests_2\n refute_equal random_tests_1, random_tests_3\n end", "def test_setup\r\n \r\n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def test_truth\n end", "def start_tests(files)\n end", "def run(selected_tests)\n # Test names (ordered) to be performed in game, per tests suite\n # Hash< Symbol, Array<String> >\n in_game_tests = {}\n selected_tests.each do |tests_suite, suite_selected_tests|\n if @tests_suites[tests_suite].respond_to?(:run_test)\n # Simple synchronous tests\n suite_selected_tests.each do |test_name|\n # Store statuses after each test just in case of crash\n set_statuses_for(tests_suite, [[test_name, @tests_suites[tests_suite].run_test(test_name)]])\n end\n end\n # We run the tests from the game itself.\n in_game_tests[tests_suite] = suite_selected_tests if @tests_suites[tests_suite].respond_to?(:in_game_tests_for)\n end\n return if in_game_tests.empty?\n\n # Keep track of the mapping between tests suites and in-game tests, per in-game tests suite.\n # Associated info is:\n # * *tests_suite* (Symbol): The tests suite that has subscribed to the statuses of some in-game tests of the in-game tests suite.\n # * *in_game_tests* (Array<String>): List of in-game tests that the tests suite is interested in.\n # * *selected_tests* (Array<String>): List of selected tests for which in-game tests are useful.\n # Hash< Symbol, Array< Hash< Symbol, Object > > >\n in_game_tests_subscriptions = {}\n # List of all in-game tests to perform, per in-game tests suite\n # Hash< Symbol, Array< String > >\n merged_in_game_tests = {}\n # Get the list of in-game tests we have to run and that we will monitor\n in_game_tests.each do |tests_suite, suite_selected_tests|\n in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(suite_selected_tests)\n in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|\n selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)\n in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite] << {\n tests_suite: tests_suite,\n in_game_tests: selected_in_game_tests_downcase,\n selected_tests: suite_selected_tests\n }\n merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)\n merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq\n end\n end\n in_game_tests_runner = InGameTestsRunner.new(@config, @game)\n in_game_tests_runner.run(merged_in_game_tests) do |in_game_tests_suite, in_game_tests_statuses|\n # This is a callback called for each in-game test status change.\n # Update the tests results based on what has been run in-game.\n # Find all tests suites that are subscribed to those in-game tests.\n # Be careful that updates can be given for in-game tests suites we were not expecting\n if in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|\n selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])\n next if selected_in_game_tests_statuses.empty?\n\n tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]\n tests_suite.statuses = tests_suite.\n parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).\n select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }\n end\n end\n end\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def test_contains_four_eachface\n assert true == false\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\[email protected]\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\[email protected]\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\[email protected]\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend", "def passes; end", "def passes; end", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_intcode([2, 4, 4, 5, 99, 0]) === [2, 4, 4, 5, 99, 9801] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 4 \" + (generate_intcode([1, 1, 1, 4, 99, 5, 6, 0, 99]) === [30, 1, 1, 4, 2, 5, 6, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n\nend", "def run_all\n run_suite(@suite)\n end", "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def final_test_methods\n return []\n end", "def check_all_here\n end", "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end", "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end", "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend", "def testloop\n \n end", "def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend", "def integration_test()\n return [\"all\"]\n end", "def save_tests\n filtered_builds.each do |build|\n tests = test_failures(build['build_num'])\n tests.each do |test|\n save_test(test, build['build_num'])\n end\n end\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testing\n # ...\n end", "def passed?\n return @test_passed\n end", "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend", "def run\n checks.each(&:run)\n end", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def report_from(tests)\n tests.map do |test|\n report = [test.name, test.executed?]\n report << test.platform.name unless test.platform.nil?\n report << test.node unless test.node.nil?\n # Only report the first line of the error messages, as some contain callstacks\n report << test.errors.map { |error| error.split(\"\\n\").first } unless test.errors.empty?\n report\n end\n end", "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def run_fe_tests\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end" ]
[ "0.7273319", "0.7200172", "0.7192304", "0.7132192", "0.71287894", "0.7034781", "0.68627185", "0.682233", "0.6806946", "0.67918724", "0.67918724", "0.67662716", "0.6571297", "0.65539306", "0.6548272", "0.6544406", "0.6529377", "0.6458632", "0.6448801", "0.6448801", "0.644239", "0.64354736", "0.64354736", "0.6428359", "0.639423", "0.6364677", "0.6345847", "0.63377964", "0.63209057", "0.6300681", "0.6283028", "0.62755936", "0.6262033", "0.6258463", "0.6248563", "0.62380236", "0.6217513", "0.6200527", "0.62001824", "0.61981493", "0.6197284", "0.619525", "0.61937135", "0.61930954", "0.61929935", "0.61929935", "0.61929935", "0.61896145", "0.618581", "0.61725825", "0.61604625", "0.61578584", "0.614176", "0.61373043", "0.6134928", "0.6134928", "0.6133679", "0.6131875", "0.6119249", "0.6112156", "0.6106504", "0.60881996", "0.60880566", "0.6087573", "0.608298", "0.608298", "0.60821486", "0.6077335", "0.6075531", "0.6075159", "0.60717946", "0.6063009", "0.6051222", "0.605113", "0.60421765", "0.6023526", "0.6021822", "0.6020962", "0.6017385", "0.60144085", "0.601156", "0.6005938", "0.6002281", "0.6002281", "0.5999957", "0.5993143", "0.5993143", "0.5993143", "0.5986178", "0.5971315", "0.59688145", "0.59686357", "0.5965773", "0.59535813", "0.5953495", "0.5945442", "0.5943171", "0.5942409", "0.5941184", "0.59338015", "0.5927813" ]
0.0
-1
ActiveRecord::Blob class first destroy the record data and then calls the service.delete method with key as an argument. But the imagekit.io needs fileId to destroy the file which can be get from the metadata. So first destroy the remote file and then destroy the local blob record.
def remove_imagekit_file service.class.delete_ik_file(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy!\r\n self.class.service_instance.delete_blob(path)\r\n end", "def delete\n @service.delete_blob(self)\n end", "def destroy\n Rails.logger.debug {\"destroying gridfs file #{@id}\"}\n if persisted?\n Photo.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end\n end", "def destroy_image(key)\n return unless key.is_a?(String) && !key.empty?\n name, ext = key.split('.')\n self.transaction do\n record = find_by_name name\n # do nothing if not found\n return unless record\n if record.refcount > 1\n record.refcount -= 1\n record.save\n else\n if record.keep_till && record.keep_till > Time.now\n record.refcount = 0\n record.save\n else\n record.purge_image_data\n record.delete\n end\n end\n end\n cleanup_temporary_image\n end", "def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end", "def delete_blob(container, blob, key = nil, options = {})\n key ||= properties.key1\n\n url = File.join(properties.primary_endpoints.blob, container, blob)\n url += \"?snapshot=\" + options[:date] if options[:date]\n\n headers = build_headers(url, key, :blob, :verb => 'DELETE')\n\n response = ArmrestService.send(\n :rest_delete,\n :url => url,\n :headers => headers,\n :proxy => proxy,\n :ssl_version => ssl_version,\n :ssl_verify => ssl_verify\n )\n\n headers = Azure::Armrest::ResponseHeaders.new(response.headers)\n headers.response_code = response.code\n\n headers\n end", "def destroy\n @dataservice_blob = Dataservice::Blob.find(params[:id])\n authorize @dataservice_blob\n @dataservice_blob.destroy\n\n respond_to do |format|\n format.html { redirect_to(dataservice_blobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n file&.delete\n end", "def delete\n response = client[\"/vaults/#{vault_id}/blobs/#{blob_id}\"].delete\n response.code == 200\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end", "def deleteEssence\n \n begin\n \n # Gets @filename and @path\n getPathAndFilename \n name = @filename \n filepath = @path\n puts \"filepath: \" + filepath \n puts \"filename: \" + name\n \n # Find the device \n device = User.find_by_username(params[:username]).devices.find_by_dev_name(params[:devicename])\n \n # Essence can't be deleted from a virtual container\n if device.dev_type == \"virtual_container\"\n render :text => \"Error: Essence can't be deleted from a virtual container'\", :status => 409\n return \n end\n \n file = nil\n if device != nil\n file = device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", name, filepath])\n if file == nil\n puts \"FILE NOT FOUND: \" + name\n render :text => \"Error. File's metadata can not be found.\", :status => 404\n return\n end\n \n if params[:blob_hash]\n blob = file.blobs.find(:first, :conditions => [\"blob_hash = ?\", params[:blob_hash]])\n else\n blob = file.blobs.find_by_follower_id(nil)\n end\n end\n \n # Checks that the file's and it's version's metadata can be found in database.\n if file == nil or blob == nil\n puts \"Blob not found for file: \" + name\n render :text => \"Error. File's metadata can not be found.\", :status => 404\n return\n end\n \n if blob.uploaded == false\n render :text => \"Error: Essence of the file was not on the server.\", :status => 409\n return\n end\n \n # Remove the fileupload entry\n fup = Fileupload.find_by_blob_id(blob.id)\n if fup != nil\n fup.destroy\n end\n \n # Update blob not to be uploaded and upload_requested to nil\n blob.update_attribute(:uploaded, false)\n blob.update_attribute(:upload_requested, nil)\n \n \n # Remove the actual essence\n deletepath = \"public/devfiles/\" + file.device_id.to_s + \"/\" + blob.blob_hash + \"_\" + file.name\n \n if File.exists?(deletepath)\n FileUtils.rm_f(deletepath)\n puts \"deleted the essence...\"\n else\n puts \"Essence not found and could not be deleted...\"\n end\n \n rescue => exp\n putsE(exp)\n render :text => \"There was an error when trying to delete the essence from the server\", :status => 409\n return\n end\n \n render :text => \"Essence of the file deleted from the server\", :status => 200\n return\n end", "def destroy\n @riffblob.destroy\n respond_to do |format|\n format.html { render notice: 'Riffblob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end", "def delete(uuid, key)\n request(method: 'DELETE', uri: \"/files/#{uuid}/metadata/#{key}/\")\n end", "def delete_s3_file(file)\n\n bucket = \"prototype-jv\"\n s3_file_path = \"imageuploader/#{file}\"\n s3 = connect_to_s3()\n\n s3.delete_object({\n bucket: bucket,\n key: s3_file_path\n })\n\nend", "def delete_from_disk; end", "def delete_record\n self.remote_attributes = self.class.identify(self).delete_instance if persisted?\n @destroyed = true\n end", "def smart_destroy!\n # see if it's on the file system and destroy it if it's there\n s3_key = calc_s3_path\n Stash::Aws::S3.delete_file(s3_key: s3_key) if !s3_key.blank? && Stash::Aws::S3.exists?(s3_key: s3_key)\n\n if in_previous_version?\n # destroy any others of this filename in this resource\n self.class.where(resource_id: resource_id, upload_file_name: upload_file_name).where('id <> ?', id).destroy_all\n # and mark to remove from merritt\n update(file_state: 'deleted')\n else\n # remove all of this filename for this resource from the database\n self.class.where(resource_id: resource_id, upload_file_name: upload_file_name).destroy_all\n end\n\n resource.reload\n end", "def bucket_delete_object(key)\n http.delete(\"/#{key}\", bucket: bucket, key: key)\n end", "def delete(bucket, file); end", "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def delete\n @mapper.delete(@remote_key)\n\n forget\n end", "def delete_from_cloud\n S3Connection.new(:media).bucket.delete(s3_key) if s3_key\n end", "def destroy\n @image.destroy\n end", "def destroy\n @image.destroy\n end", "def delete_blob(container, blob, options={})\n query = { }\n query['snapshot'] = options[:snapshot] if options[:snapshot]\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n options[:delete_snapshots] = :include unless options[:delete_snapshots]\n\n headers = service_properties_headers\n headers['x-ms-delete-snapshots'] = options[:delete_snapshots].to_s if options[:delete_snapshots] && options[:snapshot] == nil\n\n call(:delete, uri, nil, headers)\n nil\n end", "def delete\n rpc_execute('unlink', [id], context) if persisted?\n @destroyed = true\n freeze\n end", "def delete_file(uid, info = {})\n grid_info = files_collection.find(filename: uid).first\n bucket.delete(grid_info[:_id]) if grid_info\n end", "def destroy(remote_path)\n get_adapter.delete_file(remote_path)\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def destroy\n run_callbacks :destroy do\n rpc_execute('unlink', [id], context)\n @destroyed = true\n freeze \n end\n end", "def clean_remote!\n resp = @connection.get_bucket(\n @storage.bucket, prefix: File.dirname(@remote_path)\n )\n keys = resp.body['Contents'].map {|item| item['Key'] }\n\n @connection.delete_multiple_objects(@storage.bucket, keys) unless keys.empty?\n end", "def destroy(file, bucket_as_string)\n object = bucket.objects.find(file)\n object.destroy\n end", "def destroy\n # The correct implementation, with garbage collection:\n # if params.has_key?(:container_id)\n # container = ActiveFedora::Base.load_instance(params[:container_id]) \n # container.file_objects_remove(params[:id])\n # FileAsset.garbage_collect(params[:id])\n # else\n \n # The dirty implementation (leaves relationship in container object, deletes regardless of whether the file object has other containers)\n ActiveFedora::Base.load_instance(params[:id]).delete \n flash[:notice] = \"Deleted #{params[:id]} from #{params[:container_id]}.\"\n \n if !params[:container_id].nil?\n redirect_params = {:controller => \"catalog\", :action => \"edit\", :id => params[:container_id], :anchor => \"file_assets\"}\n end\n redirect_params ||= {:action => 'index', :q => nil , :f => nil}\n \n redirect_to redirect_params\n \n end", "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_id = ?\", file_id)\nend", "def destroy(context={})\n rpc_execute('unlink', [self.id], context)\n end", "def delete_from_disk!\n if disk_filename.present?\n diskfile_s3 = diskfile\n Rails.logger.debug(\"Deleting #{diskfile_s3}\")\n RedmicaS3::Connection.delete(diskfile_s3)\n end\n\n Redmine::Thumbnail.batch_delete!(\n thumbnail_path('*').sub(/\\*\\.thumb$/, '')\n )\n end", "def destroy; delete end", "def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def delete(file_name)\n key = key_from_filename(file_name)\n puts \"Deleting object from s3 with key #{key}\"\n Aws::S3::Object.new(key: key, bucket_name: bucket, client: s3_client).tap do |obj|\n obj.delete\n obj.wait_until_not_exists\n end\n sync_down\n end", "def kill \n remote_data = @repo.to_s\n deleter = Deleter.new S3_STORE\n deleter.delete remote_data, @threads, &REPORTER\n end", "def delete\n @file = nil\n # file.delete\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def destroy\n @q_resource = QResource.find(params[:id])\n @q_resource.bfile.remove!\n @q_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to q_resources_url }\n format.json { head :ok }\n end\n end", "def delete\n raise HistoricalIntegrityViolation unless current?\n transaction do\n original_uri = @uri\n record = CloudKit.storage_adapter[@id]\n record['uri'] = \"#{@uri.string}/versions/#{@etag}\"\n record['archived'] = escape(true)\n @uri = wrap_uri(record['uri'])\n @archived = unescape(record['archived'])\n CloudKit.storage_adapter[@id] = record\n self.class.new(original_uri, @json, @remote_user, {:deleted => true}).save\n end\n reload\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def delete(record)\n record.del\n end", "def destroy\n\tCloudinary::Api.delete_resources([@foto.public_id])\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to @proyecto, notice: 'Foto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lob.destroy\n\n head :no_content\n end", "def destroy\n @image_dataset = ImageDataset.find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attachment.detach\n head :no_content\n end", "def destroy\n @picture.destroy\n\n head :no_content\n end", "def delete_avatar\n avatar = $bucket.object(\"uploads/avatars/#{id}.jpg\")\n avatar.delete if avatar.exists?\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def destroy\n Track.destroy(params[:id])\n delete_file BSON::ObjectId(params[:id])\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_record = FileRecord.find(params[:id])\n @file_record.destroy\n\n respond_to do |format|\n format.html { redirect_to file_records_url }\n format.json { head :no_content }\n end\n end", "def destroy(record)\n record.destroy\n end", "def delete_storage(request, params)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n # --- Delete the Image ---\n rc = image.delete\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return \"\", 204\n end", "def delete\n model.delete_attachment(@path)\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def delete_associated_image(parameters)\n eachImageField(parameters) do |image, fieldName|\n if image.present? and image[:assets].blank? and image[:id].blank?\n image_var = send(fieldName)\n image_var.destroy if image_var\n end\n end\n end", "def delete\n begin\n object = bucket.objects.find(@path)\n object.destroy\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def destroy_image(image_id)\n destroy_resource :image, image_id\n end", "def destroy_image(image_id)\n destroy_resource :image, image_id\n end", "def destroy\n \n @attachment = Attachment.find(params[:attachment_id])\n @attachment.destroy\n Keys.where(attachment_id: @attachment.id).destroy_all\n GetModel(params[:type]).where(file_id: @attachment.id).destroy_all\n \n respond_to do |format| \n format.html { redirect_to '/imports/'+params[:profile_id].to_s+'/csv/'+params[:type].to_s,notice: 'File has been deleted!' }\n end\n \n end", "def delete_file(f)\n #return false if !f.kind_of?(Fog::Storage::AWS::File) || !storage_provider.eql?(:aws)\n log \"Deleting: #{f.key}\"\n return f.destroy\n end", "def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end", "def delete(key)\n instrument :delete, key: key do\n map = find_map_by_key(key)\n if map\n client.image.image_delete(map.imgur_id)\n map.destroy!\n end\n end\n end", "def destroy\n File.delete(self.artifact)\n end", "def destroy_file(project_id, file_id)\n params = { query: [project_id, file_id] }\n\n data = endpoint(name: 'Files', params: params).do_delete\n\n RubyLokaliseApi::Generics::DeletedResource.new data.content\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end", "def destroy\n @attachment.file.purge\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: 'Attachment was successfully destroyed.' }\n end\n end", "def destroy(v_asset)\n File.delete(v_asset.path)\n end", "def destroy\n @remote_image_content = RemoteImageContent.find(params[:id])\n @remote_image_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(remote_image_contents_url) }\n format.xml { head :ok }\n end\n end", "def delete\n begin\n conn.delete(escaped_path)\n true\n rescue => e\n puts \"carrierwave-ucloud delete failed: #{e.inspect}\"\n nil\n end\n end", "def delete(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n delete_from_moab(storage_object_id, path, file_category)\n end", "def delete_image(image_id)\n delete(\"cloud-instances/#{guid}/images/#{image_id}\")\n end", "def destroy\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_path, notice: 'Destroyed successfully.' }\n format.json { head :no_content }\n end\n end", "def delete_blob(container, blob, options={})\n query = { }\n StorageService.with_query query, 'snapshot', options[:snapshot]\n StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n options[:delete_snapshots] = :include unless options[:delete_snapshots]\n\n headers = StorageService.common_headers\n StorageService.with_header headers, 'x-ms-delete-snapshots', options[:delete_snapshots].to_s if options[:delete_snapshots] && options[:snapshot] == nil\n add_blob_conditional_headers options, headers\n\n call(:delete, uri, nil, headers, options)\n nil\n end", "def destroy!(entity_set, id)\n query = service[entity_set].query\n url_chunk = query.find(id).to_s\n api_delete url_chunk\n true\n end", "def destroy!\n destroy_storage_snapshot(_id)\n end", "def destroy\n @family_image.destroy\n\n head :no_content\n end", "def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end", "def delete\n storage.delete(id)\n end", "def delete\n raise Couchbase::Error::MissingId, \"missing id attribute\" unless @id\n model.bucket.delete(@id)\n @id = nil\n self\n end", "def destroy\n @file_record.destroy\n respond_to do |format|\n format.html { redirect_to file_records_url, notice: 'File record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end", "def destroy\n @s3_image = S3Image.find(params[:id])\n @s3_image.destroy\n\n respond_to do |format|\n format.html { redirect_to s3_images_url }\n format.json { head :no_content }\n end\n end", "def delete_file\n File.unlink file\n end" ]
[ "0.7767731", "0.7396194", "0.7236817", "0.69665974", "0.69524175", "0.6906084", "0.69053084", "0.69009584", "0.6822038", "0.66167414", "0.65783256", "0.6578069", "0.65346766", "0.65346766", "0.65309423", "0.6524279", "0.64868706", "0.6481013", "0.64683735", "0.6445531", "0.64452803", "0.6439443", "0.6430672", "0.64221126", "0.64075387", "0.6401037", "0.63924277", "0.6382661", "0.6359782", "0.6359782", "0.63542396", "0.6344982", "0.63447136", "0.6338429", "0.63078517", "0.6285541", "0.6264633", "0.62644905", "0.6261506", "0.62463355", "0.6243367", "0.62402946", "0.62206095", "0.6208961", "0.6204785", "0.6201522", "0.62009186", "0.61828774", "0.61781526", "0.61736673", "0.61664504", "0.61629975", "0.616011", "0.61584955", "0.61584955", "0.6155497", "0.61447847", "0.6139805", "0.61304206", "0.61286086", "0.612447", "0.610944", "0.610173", "0.6095989", "0.6092655", "0.6090821", "0.60892576", "0.608814", "0.6081837", "0.6073596", "0.60711324", "0.6070043", "0.6070043", "0.60675085", "0.60664296", "0.6062489", "0.6060698", "0.6055288", "0.6055018", "0.6053495", "0.60479593", "0.6046646", "0.6045502", "0.6038021", "0.6036089", "0.60353947", "0.6035349", "0.6030341", "0.6029034", "0.6028633", "0.6022639", "0.60212016", "0.6018596", "0.6018404", "0.6008368", "0.60081404", "0.60067016", "0.6004757", "0.59983104", "0.59973633" ]
0.6002151
98
Needs to reload the record to reflect updated remote meta data.
def check_metadata self.reload end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload!\n if new_meta = job_class.get_meta(meta_id)\n @data = new_meta.data\n end\n self\n end", "def reload\n return if new_record?\n refresh\n end", "def _save_refresh\n _save_set_values(_refresh_get(this.server?(:default)) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end", "def _save_refresh\n _save_set_values(_refresh_get(this.server?(:default)) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end", "def reload\n model = self.class.find(to_remote)\n\n if model.errors?\n add_errors(model.errors)\n else\n copy_from(model)\n persist!\n end\n\n self\n end", "def follow_meta_refresh_self; end", "def follow_meta_refresh_self; end", "def meta_refresh; end", "def refresh!\n records true\n self\n end", "def load_metadata!(metadata)\n load_remote_metadata(metadata)\n persists!\n self\n end", "def updated_data; end", "def reload\n reset\n fetch\n end", "def reload\n reset\n fetch\n end", "def reload\n @new_info = {}\n read_data\n # run_callbacks_for(:after_load)\n self\n end", "def reload_if_exists(record) # :nodoc:\n record && record.reload\n end", "def follow_meta_refresh; end", "def follow_meta_refresh; end", "def reload\n super\n self.alt_identities_changed = false\n end", "def reload\n self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data\n end", "def reload!\n fetch_data!\n end", "def refresh\n # re-download the model from the server\n set_model\n end", "def follow_meta_refresh_self=(_arg0); end", "def activerecord_reload\n record.transaction { yield record.clone.reload(lock: true) }\n end", "def refresh_descriptive_metadata_from_ils\n resp = connection.post do |req|\n req.url \"#{object_path}/refresh_metadata\"\n end\n\n raise_exception_based_on_response!(resp) unless resp.success?\n\n true\n end", "def track_record_update\n true\n end", "def update_initial_metadata(metadata)\n end", "def refresh\n load if changed?\n end", "def _save_refresh\n super\n recalculate_values_hashes\n end", "def remote_update(*)\n super(changed)\n end", "def updated_data\n\tend", "def mte_prepare_updating; send_request_to_mite(\"update\"); end", "def _refresh(dataset)\n _refresh_set_values(_refresh_get(dataset) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end", "def _refresh(dataset)\n _refresh_set_values(_refresh_get(dataset) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end", "def set_new_record(record)\n replace(record)\n end", "def reload!\n callsite = Callsites[@callsite_key]\n rows_hash = rows_by_key(callsite.primary_key)\n sql = callsite.reload_sql(rows_hash.keys, @fetched_columns)\n new_rows = callsite.connection.send(:select, sql, \"#{callsite.model_class_name} Reload SlimScrooged\")\n new_rows.each do |row|\n if old_row = rows_hash[row[callsite.primary_key]]\n old_row.result_set = nil\n old_row.monitored_columns.merge!(row)\n end\n end\n end", "def reload\n requires :instance, :identity\n\n data = collection.get(self.instance, self.identity)\n merge_attributes(data.attributes)\n self\n end", "def reload\n requires :instance, :identity\n\n data = collection.get(instance, identity)\n merge_attributes(data.attributes)\n self\n end", "def _refresh_get(ds)\n # SEQUEL5: Remove\n if use_prepared_statements_for?(:refresh)\n _set_prepared_statement_server(model.send(:prepared_refresh)).call(pk_hash)\n else\n super\n end\n end", "def reload\n new_attributes = resource.find(self)._attributes_\n @_attributes_ = nil\n mass_assign(new_attributes)\n self\n end", "def reload\n self.attributes = Connection.get(create_route(:get)).body['data']\n self\n end", "def reload\n handle_response SurveyGizmo.get(handle_route(:get)) do\n if _response.ok?\n self.attributes = _response.data\n clean!\n else\n false\n end\n end\n end", "def refresh!\n load if changed?\n end", "def after_update_save(record)\n last_url_status = nil\n client_status = record.client_status.status.to_s\n if client_status == \"suspicious\"\n last_url_status = UrlStatus.find_by_status(\"suspicious\")\n elsif client_status == \"compromised\"\n last_url_status = UrlStatus.find_by_status(\"compromised\")\n elsif client_status == \"deleted\"\n last_url_status = UrlStatus.find_by_status(\"ignored\")\n elsif client_status == \"false_positive\"\n last_url_status = UrlStatus.find_by_status(\"visited\")\n elsif client_status == \"error\"\n last_url_status = UrlStatus.find_by_status(\"error\")\n end\n\n if !last_url_status.nil?\n # When we update the client status field, make sure last URL entry is also updated (if needed).\n last_url = Url.find(:first, :conditions => [\"urls.client_id = ?\", record.id], :order => \"urls.time_at DESC\")\n if !last_url.nil?\n last_url.url_status = last_url_status\n last_url.save!\n last_url.expire_caches\n end\n end\n return record\n end", "def reload\n raise \"Can't reload object without id\" if !@id || @id.to_i == 0\n new_obj = self.class.find(@id)\n self.database_fields = new_obj.database_fields\n self.class.table_fields.each {|key| self.send(\"#{key}=\", new_obj.send(key)) }\n end", "def reload!\n @data = reload.raw\n self\n end", "def reload\n new? ? self : store.find(uuid)\n end", "def on_successful_reload\n if replaying?\n self.change_the_past\n end\n end", "def reload!\n clear_changes_information\n self.exclude_from_save = false\n end", "def refresh\n self.first_name, self.last_name, self.email =\n @redis.hmget(\"contact:#{@id}\", 'first_name', 'last_name', 'email')\n self.media = @redis.hgetall(\"contact_media:#{@id}\")\n self.media_intervals = @redis.hgetall(\"contact_media_intervals:#{self.id}\")\n self.media_rollup_thresholds = @redis.hgetall(\"contact_media_rollup_thresholds:#{self.id}\")\n\n # similar to code in instance method pagerduty_credentials\n if service_key = @redis.hget(\"contact_media:#{@id}\", 'pagerduty')\n self.pagerduty_credentials =\n @redis.hgetall(\"contact_pagerduty:#{@id}\").merge('service_key' => service_key)\n end\n end", "def reload\n return false if !persisted?\n fresh_object = self.class.find(id)\n refresh_data fresh_object.instance_variable_get('@attributes')\n self\n end", "def update\n # TODO: implement update\n end", "def reload\n read\n @previous = nil\n self\n end", "def reload\n self.data = self.class.load_data\n self\n end", "def follow_meta_refresh=(_arg0); end", "def on_object_metadata_updated(event)\n return unless resource? event[:object]\n Hyrax.index_adapter.save(resource: event[:object])\n end", "def update_remote\n # TODO\n end", "def refresh\n set_attributes\n end", "def reload\n if self.class.embedded?\n klass = self.class\n self.attributes = klass._parent_klass.find(eval(klass._parent_name).id) # Post.find(post.id)\n .send(klass._inverse_relation) # .images\n .find(id).attributes # .find(id).attributes\n else\n super\n end\n end", "def follow_meta_refresh_self=(follow); end", "def update_data\n @store.get_data true\n end", "def after_save\n reload\n end", "def _refresh(dataset)\n super\n recalculate_values_hashes\n end", "def follow_meta_refresh=(follow); end", "def after_update_save(record); end", "def reload_data\n self.class.new reinit_endpoint.do_get\n end", "def reload!\n unload!\n versions\n get_json\n get_map\n last_updated\n third_party_links\n mappings\n end", "def update\n # don't need to update; hash is shared\n end", "def reload\n clear_memoizations!\n remove = data.keys.find_all do |k|\n ![:id, :name].include?(k.to_sym)\n end\n remove.each do |k|\n data.delete(k)\n end\n super\n end", "def reload\n raise Couchbase::Error::MissingId, 'missing id attribute' unless @id\n pristine = model.find(@id)\n update_attributes(pristine.attributes)\n @meta[:cas] = pristine.meta[:cas]\n clean!\n self\n 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 record.assign_attributes(data)\n record.save! if record.changed?\n end", "def sync_local_model_status(model, record)\n true\n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def update_bigrecord\n timestamp = self.respond_to?(:updated_at) ? self.updated_at.to_bigrecord_timestamp : Time.now.to_bigrecord_timestamp\n connection.update(self.class.table_name, id, clone_in_persistence_format, timestamp)\n end", "def reload_metadata()\n api_result = @session.execute!(\n :api_method => @session.drive.files.get,\n :parameters => { \"fileId\" => self.id })\n @api_file = api_result.data\n if @acl\n @acl = Acl.new(@session, self)\n end\n end", "def update_metadata\n response = Net::HTTP.post(URI('https://api.linkpreview.net'),\n { 'key' => ENV['LINKPREVIEW_API_KEY'],\n 'q' => self.url }.to_json)\n\n body = JSON.parse(response.body)\n self.title = body['title']\n self.image = body['image']\n self.description = body['description']\n save\n end", "def refresh\n update_attributes_from_id(@id)\n end", "def changed?(uploaded_file)\n record.reload\n super\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n item = @domain.get_attributes(@key)\n @attributes = item.attributes\n end", "def update!\n @source.headers.delete(:update)\n set_updated_time(Time.now)\n save\n end", "def update() end", "def reload\n old_data = @data.dup\n self.load\n @data = old_data.merge! @data\n end", "def reload!(conditions = {})\n unless new_record?\n reloaded_object = self.class.find(client, primary_key, scope_parameters, conditions)\n self.attributes.clear\n self.attributes = reloaded_object.attributes\n mark_as_saved!\n end\n\n self\n end", "def update ; end", "def reload!\n get('')[self.class.api_name].each do |attr, value|\n self.send :\"#{attr}=\",value\n end\n end", "def reload!\n self.attributes = self.class.real_get(key)\n self\n end", "def reload!\n self.attributes = self.class.real_get(key)\n self\n end", "def reload\n self.attributes = self.class.find(self.Id).attributes\n self\n end", "def reload!\n new_instance = instance(_id)\n update_instance_variables!(\n :public_addresses => new_instance.public_addresses,\n :private_addresses => new_instance.private_addresses,\n :state => new_instance.state\n )\n end" ]
[ "0.66971016", "0.66257024", "0.6438894", "0.6438894", "0.64217144", "0.64216363", "0.64216363", "0.63113016", "0.62837213", "0.6242441", "0.6206165", "0.6195001", "0.6195001", "0.61815614", "0.60881513", "0.60564905", "0.60564905", "0.604486", "0.60441405", "0.6034743", "0.60302806", "0.6020888", "0.6002401", "0.591303", "0.5901592", "0.5899935", "0.58972436", "0.58896714", "0.58862144", "0.5877256", "0.5862416", "0.5857462", "0.5857462", "0.5818455", "0.5815163", "0.58028984", "0.5802634", "0.5791691", "0.5760151", "0.575303", "0.57469267", "0.5741983", "0.5740783", "0.5737862", "0.57216746", "0.5720847", "0.5714656", "0.5706882", "0.5698192", "0.5661766", "0.56538314", "0.5649808", "0.56446993", "0.56405723", "0.56399846", "0.56332934", "0.56313455", "0.5629263", "0.56258684", "0.56212246", "0.5619699", "0.5615899", "0.5615215", "0.5603534", "0.55965453", "0.5591705", "0.55751604", "0.557298", "0.55684453", "0.55620486", "0.55620486", "0.55620486", "0.55620486", "0.55620486", "0.55620486", "0.55620486", "0.55620486", "0.5555618", "0.55509156", "0.55493647", "0.5544261", "0.5540802", "0.5540655", "0.5537178", "0.5532629", "0.5529852", "0.5529852", "0.5529852", "0.5529852", "0.5526179", "0.5522088", "0.5519873", "0.5516955", "0.5516953", "0.55104464", "0.54994655", "0.5498864", "0.5498864", "0.5496777", "0.5490917" ]
0.67446625
0
A full attribute hash, used by the SDK for writing. This is in an annoyingly different format than that which is returned by the SDK when getting an item.
def dynamo_attribute_from_value(attr_val) # { dynamo_attribute_key => { dynamo_attribute_value_type_key => convert_to_dynamo_value(attr_val) }} unless attr_val.nil? { dynamo_attribute_key => convert_to_dynamo_value(attr_val)} unless attr_val.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n guid.hash\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n @attrs\n end", "def md5\n @attributes[:md5]\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def id\n Digest::SHA256.hexdigest(instance_variable_get(:@original_attributes).to_json)\n end", "def id\n Digest::SHA256.hexdigest(instance_variable_get(:@original_attributes).to_json)\n end", "def hash\n fullname.hash\n end", "def hash\n id.hash + 32 * bs_request.hash\n end", "def hash\n return to_s.hash\n end", "def hexhash\n hash.to_s(16)\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_s.hash\n end", "def hash\n id.hash\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def hash\r\n id.hash\r\n end", "def hash #:nodoc:\n uuid.hash\n end", "def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end", "def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def raw_attributes\n @ldap_entry.attribute_names.each_with_object({}) do |key, hsh|\n hsh[key] = @ldap_entry[key]\n end\n end", "def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end", "def attributes_hash\n self.info.to_hash.symbolize_keys\n end", "def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end", "def hash\n return @id.hash\n end", "def to_hash\n attributes\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def attributes\n full_attributes.to_hash(self)\n end", "def sha\n id.sha\n end", "def hash\n @id.hash\n end", "def hash\n address.hash\n end", "def to_hash\n @attributes\n end", "def hash\n bytes.hash\n end", "def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end", "def hash\n @data[:asin].to_s.hash\n end", "def hash\n name.hash\n end", "def hash\n name.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def to_hash\n @attributes\n end", "def hashify(attribute)\n out = {}\n @items.each_pair do |key, value|\n out[key] = value[attribute]\n end\n out\n end", "def digest\n metadata[:digest]\n end", "def hash\n name.hash ^ version.hash\n end", "def serialize\n Base64.encode64(Marshal.dump(self.to_hash)).chop\n end", "def format_hash(event)\n event.attributes.symbolize_keys\n end", "def unique_hash\n\t\tif self.unique_token.blank?\n\t\t\tupdate_attribute(:unique_token, Devise.friendly_token[0,50].to_s)\n\t\tend\n\t\tDigest::SHA2.hexdigest(self.unique_token + id.to_s)\n\tend", "def hash\n [list_id, email, phone, gender, first_name, last_name, is_unsubscribed, is_blacklisted, _custom_attribute_].hash\n end", "def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end", "def hash\n data.hash\n end", "def sha\n result_hash['sha']\n end", "def hash\n value_id.hash\n end", "def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end", "def to_hash\n attributes.dup\n end", "def hash\n model.hash + key.hash\n end", "def to_hash\n @attributes\n end", "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "def hash\n [author, created, icon, id, integration_id, is_favorite, is_read_only, is_shared, modified, popularity, tags, title, type, url].hash\n end", "def hash\n element.hash\n end", "def hash\n \tcustom_unique_id.hash\n end", "def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end", "def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end", "def hash\n [height, id, is_mobile, name, width].hash\n end", "def to_hash\n hash = {}; self.attributes.each { |k,v| hash[k] = v }\n end", "def hash\n title.hash\n end", "def hash\n @string.hash\n end", "def hash\n @string.hash\n end", "def hash\n @string.hash\n end", "def hash\n [rel, href].hash\n end", "def hash\n @id\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n @id\n end", "def to_h\n Utils.deep_dup @attributes\n end", "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end", "def hash\n id\n end", "def id\n attributes[:id] || digest\n end", "def hash\n [id, alternate_id, type, first_name, surname, date_of_brith, date_of_birth, shipping_address, mailing_address, home_phone, mobile_phone, email_address, mailing_address_active, accounts, classifications, member_photo, gender, receive_email, receive_sms, password].hash\n end", "def hash_id\n @hid\n end", "def digest\n digest = ''\n @entries.each { |entry| digest << entry.digest << ' ' }\n digest\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def hash\n __record_id.hash\n end", "def id\n Digest::SHA2.hexdigest @payload.to_json\n end" ]
[ "0.70676976", "0.6741792", "0.6686655", "0.6686655", "0.6686655", "0.6560281", "0.6511229", "0.64984924", "0.6414638", "0.6406996", "0.6319517", "0.6319517", "0.6224321", "0.6178939", "0.6167137", "0.61554897", "0.6122845", "0.6121333", "0.60823137", "0.6044015", "0.60311973", "0.60113984", "0.60005945", "0.59990716", "0.59942585", "0.59912276", "0.5989473", "0.5989473", "0.5989473", "0.5989473", "0.5989473", "0.5989473", "0.5989473", "0.5989473", "0.5989473", "0.59894323", "0.59530544", "0.5948811", "0.5946362", "0.59197056", "0.5916516", "0.5904665", "0.5904037", "0.5901288", "0.5892495", "0.589146", "0.58712274", "0.58702815", "0.58671147", "0.58634615", "0.58623135", "0.585543", "0.58542633", "0.583948", "0.583948", "0.5839087", "0.5826945", "0.58181113", "0.5817922", "0.58061534", "0.5805379", "0.58023614", "0.57954836", "0.5795181", "0.5786039", "0.578543", "0.5780802", "0.57737416", "0.5765366", "0.57566607", "0.57449687", "0.5730023", "0.57228744", "0.5720135", "0.5717709", "0.57117325", "0.5704377", "0.5704063", "0.5703288", "0.57007444", "0.5700536", "0.5700536", "0.5700536", "0.56804323", "0.5677907", "0.5677031", "0.5666066", "0.5666066", "0.5661872", "0.5661343", "0.56581634", "0.56548387", "0.56505704", "0.5646834", "0.563308", "0.56299233", "0.5628652", "0.56274176", "0.56260604", "0.56248146", "0.56233174" ]
0.0
-1
DynamoDB's Ruby uses lowercase symbols (:n, :s, :b ...) for attribute values, but uses uppercase strings as keys for attribute definitions. Override this in the AttributeTypeHandler subclass for types which cannot be keys, in which case this should return nil.
def dynamo_attribute_definition_type dynamo_attribute_value_type_key.to_s.upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n super.map { |k, v| [ k.to_s.camelize(:lower).to_sym, v ] }.to_h\n end", "def normalize_keys\n transform_keys { |key| key.downcase.to_sym rescue key }\n end", "def normalize_key(key)\n key_mapping[EnumType.comparable(key)] || key.to_sym\n end", "def key(*args)\n key = super \n if converter_name = key.options[:as_string]\n key_name = key.name.to_sym \n available_as_string key_name, converter_name\n attr_protected \"#{key_name}_as_string\".to_sym if key.options[:protected] \n end\n key\n end", "def [](key)\n @attributes = Array.new if @attributes.nil?\n attributes_downcase [email protected](&:downcase)\n key.downcase!\n if attributes_downcase.include? key\n return get(key)\n else\n raise 'El atributo no ha sido encontrado en el objecto '+ key\n end\nend", "def normalized_key key\n key.downcase.parameterize.underscore.to_sym\n end", "def prepare_key(val)\n val.nil? ? val : val.to_s.downcase\n end", "def hash_key(key)\n key.downcase\n end", "def symbol_to_dynamo_attribute_value_type_key(type_obj, allow_array = true)\n SYMBOL_TYPES.merge(allow_array ? ARRAY_SYMBOL_TYPES : {})[type_obj] if type_obj.is_a?(Symbol)\n end", "def coerce_key(*attrs); end", "def only_basic_type(key)\n BasicTypes[key.camelcase(:lower)]\n end", "def key_type\r\n\t\treturn \" \" if repeat?(:SPACE)\r\n\t\tfor key in LETTERS\r\n\t\t\tnext unless repeat?(key)\r\n\t\t\treturn upcase? ? key.to_s[3].upcase : key.to_s[3].downcase\r\n\t\tend\r\n\t\tfor key in NUMBERS\r\n\t\t\treturn key.to_s[3] if repeat?(key)\r\n\t\tend\r\n\t\tfor key in NUMPADS\r\n\t\t\treturn key.to_s[3] if repeat?(key)\r\n\t\tend\r\n\t\t\r\n\t\treturn \"\"\r\n\tend", "def to_key( t )\n t.to_s.downcase\n end", "def read_and_symbolize_attribute (attr_name)\r\n value = read_attribute(attr_name)\r\n value.blank? ? nil : value.to_sym\r\n end", "def coerce_keys(*attrs); end", "def downcase_attributes\n ea = ''\n attr_list = []\n\n if self.class.respond_to?(:no_downcase_attributes) && self.class.no_downcase_attributes\n attr_list += self.class.no_downcase_attributes\n end\n\n attr_list += no_downcase_attributes if respond_to?(:no_downcase_attributes) && no_downcase_attributes\n\n attr_list.each do |e|\n ea += \"(#{e})?\"\n end\n\n ignore =\n /(item_type)?(notes)?(description)?(message)?(.+_notes)?(.+_description)?(.+_details)?(e_signed_document)?#{ea}/\n\n attributes.select { |k, _v| k.to_sym.in? self.class.permitted_params }\n .reject { |k, _v| k && k.match(ignore)[0].present? }\n .each do |k, v|\n send(\"#{k}=\".to_sym, v.downcase) if attributes[k].is_a? String\n end\n true\n end", "def convert_key(key)\n return key if Symbol === key \n String === key ? key.to_sym : key\n end", "def attributes_string_map\n @_attributes_string_map ||= {}.tap do |attr_hash|\n attributes_nil_hash.each_key { |k| attr_hash[k.to_sym] = k }\n end.freeze\n end", "def dynamo_attribute_value(val)\n case dynamo_attribute_value_type_key\n when :n\n val # TODO Determine ranges on numbers for dynamo\n when :ns\n val if val.any?\n when :s, :b\n val unless val.empty?\n when :ss, :bs\n x = val.select {|s| !s.empty? }\n x if x.any?\n end unless val == nil\n end", "def type_key\n type.demodulize.underscore\n end", "def keys(name)\n key_schema(name).each_with_object({}) do |s, h|\n h[s.key_type.downcase.to_sym] = s.attribute_name\n end\n end", "def [](key)\n key = key.to_s.downcase.to_sym if !key.is_a?(Symbol)\n @proc_attrs[key.downcase]\n end", "def key_types; end", "def key_types; end", "def downcase_keys\n end", "def key_types=(_arg0); end", "def canonical_name_attr(attr = nil)\n if attr\n @canonical_name_attr = attr.to_sym\n else\n @canonical_name_attr || CANONICAL_NAME_ATTR\n end\n end", "def to_attributes\n to_hash(downcase: true)\n end", "def to_attributes\n to_hash(downcase: true)\n end", "def to_attributes\n to_hash(downcase: true)\n end", "def human_attribute_name(attribute_key_name)\n attribute_key_name.gsub(/_/, \" \").capitalize unless attribute_key_name.nil?\n end", "def rubyize_keys\n transform_keys do |key|\n key\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n .to_sym\n end\n end", "def attribute_field_name(attr)\n attr.to_s.camelize(:lower)\n end", "def normalize_key(key)\n case key\n when Numeric, nil\n # nils never happen here in Ruby >= 2.3 since nils\n # skip the normalizer.\n key\n else\n key.to_s.downcase.strip\n .gsub(/(?:\\s+|-)/, '_')\n .gsub(/[^a-zA-Z0-9_]+/, '')\n .squeeze('_')\n .gsub(/_$/, '')\n .to_sym\n end\n end", "def javaize_key(key)\n key = key.to_s\n case key\n when 'acquirer_transaction_request'\n 'AcquirerTrxReq'\n when 'acquirer_status_request'\n 'AcquirerStatusReq'\n when 'directory_request'\n 'DirectoryReq'\n when 'issuer', 'merchant', 'transaction'\n key.capitalize\n when 'created_at'\n 'createDateTimeStamp'\n when 'merchant_return_url'\n 'merchantReturnURL'\n when 'token_code', 'expiration_period', 'entrance_code'\n key[0,1] + key.camelize[1..-1]\n when /^(\\w+)_id$/\n \"#{$1}ID\"\n else\n key\n end\n end", "def normalize_attrs(attrs)\n attrs.keys.find_all { |k, v| k != k.downcase }.each { |k, v|\n v = v.downcase if k == \"rel\" || k == \"type\"\n attrs.delete k\n attrs[k.downcase] = v\n }\n attrs\n end", "def camelize_key(key, first_upper: true)\n case key\n when Symbol\n Surrealist::StringUtils.camelize(key.to_s, first_upper: first_upper).to_sym\n when String\n Surrealist::StringUtils.camelize(key, first_upper: first_upper)\n else\n key\n end\n end", "def map_key_to_attribute(key)\n\t\t\t# By default, convert the key to snake case and find a matching attribute\n\t\t\tname = key.underscore\n\n\t\t\t@model_class.column_names.include?(name) ? name : nil\n\t\tend", "def alternate_key(key)\n case key\n when String then key.to_sym\n when Symbol then key.to_s\n end\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def [](symbol_or_string)\n attributes[symbol_or_string.to_s]\n end", "def normalize_key(k)\n k.to_s.gsub('-', '_').gsub(INVALID_PATTERN, '').to_sym\n end", "def key_coercions; end", "def attr_name_from_type_param(type)\n #ap \"type #{type}\"\n type\n .split(\":\")\n .last\n .gsub(/\\[.*:/, '')\n .gsub(/\\]/, '')\n .to_sym\n end", "def symbolyze_key(key)\n key.to_sym rescue key\n end", "def attribute_parse_naming\n OBJ_ATTRIBUTE_PARSE_NAMING\n end", "def __convert(key)\n case key\n when Symbol then key.to_s\n when String then key.to_sym\n else key\n end\n end", "def key_value\n @attrs[self.class.key_attribute.to_s]\nend", "def camelize_key(key, first_upper = true)\n if key.is_a? Symbol\n camelize(key.to_s, first_upper).to_sym\n elsif key.is_a? String\n camelize(key, first_upper)\n else\n key\n end\n end", "def camelize_key(key, first_upper = true)\n if key.is_a? Symbol\n camelize(key.to_s, first_upper).to_sym\n elsif key.is_a? String\n camelize(key, first_upper)\n else\n key\n end\n end", "def key_coercion(key); end", "def stringified_keys; end", "def human_attribute_name(attribute_key_name) #:nodoc:\n attribute_key_name.humanize\n end", "def convert_attribute_name name\n ATTRIBUTE_NAME_MAPPING[name] || name\n end", "def recursively_normalize_keys\n recursively_transform_keys { |key| key.downcase.to_sym rescue key }\n end", "def object_to_dynamo_attribute_value_type_key(type_obj, allow_array = true)\n if type_obj.is_a?(Enumerable) && allow_array && type_obj.any?\n contained_type = to_dynamo_attribute_value_type_key(type_obj.first, false)\n (contained_type.to_s + 's').to_sym if contained_type\n else\n CLASS_TYPES.select {|klass, dynamo_type| type_obj.ancestors.include?(klass)}.values.first if type_obj.respond_to? :ancestors\n end\n end", "def lookup_sym_attribute (attname, workitem, options={})\n\n result = lookup_downcase_attribute(attname, workitem, options)\n result = result.to_sym if result\n result\n end", "def dynamo_attribute_key\n @attr.dynamo_name\n end", "def attr\n @attr || header.downcase\n end", "def attr\n @attr || header.downcase\n end", "def keyify(str)\n str.gsub(' ','_').downcase.to_sym\n end", "def attributize_keys\n keys.each do |key|\n self[key.parameterize.underscore.to_sym] = delete(key)\n end\n self\n end", "def []= (key, value)\n key.downcase!\n attributes_downcase [email protected](&:downcase)\n if attributes_downcase.include? key\n set(key, value)\n else\n raise 'El atributo '+ key + ' no ha sido encontrado'\n end\nend", "def from_simple_key(key)\n key\n end", "def normalize_abbreviation_key(key); end", "def string(key, opts={})\n @attrs[key.to_sym] = Attributes::StringAttr.new(key, opts)\n end", "def camelize_keys!(first_letter = :upper)\n transform_keys! { |key| key.to_s.camelize(first_letter) rescue key }\n end", "def translate_setter_to_key ident\n matches_type? ident, \"setter\" or return\n key = ident[3..-1]\n key[0] = key[0].downcase\n key\n end", "def normalize_key(key)\n KEY_NORMALIZER.call(key)\n end", "def primary_key_string\n key_attributes.join(' ').parameterize\n end", "def attribute(key, type = nil)\n reader = :\"#{key}\"\n writer = :\"#{key}=\"\n\n define_method(reader) do\n self.attributes[reader]\n end\n\n define_method(writer) do |value|\n self.attributes[reader] = value\n end\n end", "def transform_keys(type)\n @_transform_keys = type.to_sym\n end", "def attributes_before_type_cast\n attributes.keys.inject({}) do |result, key|\n result[key] = attributes.before_type_cast(key)\n result\n end\n end", "def convert(key) # :nodoc:\n key.kind_of?(String) ? key.to_sym : key\n end", "def name ; self[:name].downcase end", "def literal_key(key)\n case key\n when TrueClass then \"'t'\"\n when FalseClass then \"'f'\"\n when Numeric then key\n else\n key = key.to_s\n key.start_with?(\"'\") && key.end_with?(\"'\") ? key : \"'#{key}'\"\n end\n end", "def att_from_receipt(atts, key)\n atts[key] || atts[key.underscore]\n end", "def key_to_cast(val, key)\n return key if val.key?(key)\n return key.to_sym if val.key?(key.to_sym)\n return key if defaults.key?(key)\n end", "def key_for(key)\n key.is_a?(String) ? key : serialize(key)\n end", "def key_for(key)\n key.is_a?(String) ? key : serialize(key)\n end", "def snake_sym(key)\n key.is_a?(String) ? key.gsub(/(.)([A-Z])/,'\\1_\\2').downcase.to_sym : key\n end", "def convenience_keys(dmi)\n dmi.each do |type, records|\n in_common = Mash.new\n next unless records.is_a?(Mash)\n next unless records.key?(\"all_records\")\n\n records[:all_records].each do |record|\n record.each do |field, value|\n next unless value.is_a?(String)\n\n translated = field.downcase.gsub(/[^a-z0-9]/, \"_\")\n next if SKIPPED_CONVENIENCE_KEYS.include?(translated.to_s)\n\n value = value.strip\n if in_common.key?(translated)\n in_common[translated] = nil unless in_common[translated] == value\n else\n in_common[translated] = value\n end\n end\n end\n in_common.each do |field, value|\n next if value.nil?\n\n dmi[type][field] = value.strip\n end\n end\n end", "def read_and_symbolize_attribute (attr_name)\n read_attribute(attr_name).to_sym rescue nil\n end", "def rubyify(entity)\n entity.map do |key, value|\n [key.to_s.gsub(/([A-Z])/) { '_' + $1.downcase }, value]\n end.to_h\n end", "def make_camelcase_keys\n json_data.mappable!\n end", "def normalize_keys(hash)\n hash.each{|k, v|\n hash.delete(k) unless @@valid_types.include?(v.class)\n if k.is_a?(String)\n hash.delete(k)\n hash[k.gsub(/\\-/, \"_\").to_sym] = v\n elsif !k.is_a?(Symbol) # elsunless\n hash.delete(k)\n end\n }\n return hash\nend", "def convert_key(key); end", "def convert_key(key); end", "def convert_key(key); end", "def ssdb_attr_key(name)\n \"#{self.class.name.tableize}:#{ssdb_attr_id}:#{name}\"\n end", "def map_attribute_names(data, attribute_map)\n data.transform_keys { |k| attribute_map.fetch(k, nil) }.reject { |key,_| key.nil? }\n end", "def attribute_type\n (float? || integer? || text? || boolean? ? field_type : 'string').to_sym\n end", "def key?(key)\n case key\n when String then super(key.intern)\n when Symbol then super(key)\n else super(key.to_s.intern)\n end\n end", "def normalize_key(key)\n self.class.normalize_key(key)\n end", "def lookup_downcase_attribute (attname, workitem, options={})\n\n result = lookup_string_attribute(attname, workitem, options)\n result = result.strip.downcase if result\n result\n end", "def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end", "def singularize_key\n ActiveSupport::Inflector.singularize(key)\n end", "def to_simple_key(key)\n key\n end", "def symbolize_keys; end", "def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end" ]
[ "0.65496284", "0.65174466", "0.63750446", "0.6283036", "0.6274528", "0.6253914", "0.6240106", "0.61326027", "0.6115173", "0.60837656", "0.60150737", "0.600186", "0.59969056", "0.5993615", "0.59907967", "0.5965298", "0.5951801", "0.5927734", "0.59234035", "0.5907286", "0.5896712", "0.5895337", "0.5891365", "0.5891365", "0.5881687", "0.58776814", "0.5866734", "0.5862248", "0.5862248", "0.5862248", "0.5841118", "0.5839844", "0.58027965", "0.5797719", "0.5789792", "0.5788579", "0.57862103", "0.57817435", "0.57802695", "0.5780189", "0.57745665", "0.5773347", "0.5760046", "0.57563156", "0.5755286", "0.57552046", "0.5738576", "0.5731899", "0.5729938", "0.5729938", "0.57279867", "0.57182485", "0.57112324", "0.5697151", "0.5695872", "0.5694835", "0.5692404", "0.56890863", "0.56886053", "0.56886053", "0.56818044", "0.5680683", "0.56791836", "0.5660196", "0.56484663", "0.5644441", "0.5640205", "0.5627439", "0.56196713", "0.56185067", "0.56007147", "0.5596912", "0.5596313", "0.55923986", "0.5589285", "0.5584944", "0.557989", "0.55767816", "0.556363", "0.556363", "0.55573386", "0.5556859", "0.5556643", "0.55442184", "0.55163866", "0.5515292", "0.55144227", "0.55144227", "0.55144227", "0.5511675", "0.55106753", "0.55105436", "0.5504928", "0.5485956", "0.5485454", "0.548324", "0.5472398", "0.54663026", "0.546595", "0.5464159" ]
0.66301763
0
Override this to produce a value suitable for storing in dynamo. This is the place to do type conversions.
def convert_to_dynamo_value(object_value); object_value; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_object_value(dynamo_value); dynamo_value; end", "def value\n to_type(@value)\n end", "def value\n @casted_value ||= type_cast_value(@value)\n end", "def typecast(value)\n value\n end", "def object_value(dynamo_data)\n dynamo_data[dynamo_attribute_key].send dynamo_attribute_value_type_key\n end", "def typecast(value)\n value\n end", "def cast_value\n value.mongoize\n end", "def value\n typecast.present? ? typecasted_value : super\n end", "def cast(value)\n value\n end", "def value; super.to_f; end", "def convert(value) value end", "def make_valuestring\n\t\treturn self.value\n\tend", "def value_t\n raise NotImplementedError, \"Subclass must implement 'value_t'\"\n end", "def value(value)\n custom? ? type.dump(value, self) : value\n end", "def value\n Native(val)\n end", "def value_transform value, type\n return nil if value.nil? || value.to_s.size == 0\n case type\n when :integer then value.to_i\n when :autoincrement then value.to_i\n when :string then value.to_s\n when :float then value.to_f\n when :bool then value.to_s\n when :symbol then value.to_s\n when :marshal then Marshal.dump(value)\n when :array then Yajl::Encoder.encode(value)\n when :hash then Yajl::Encoder.encode(value)\n when :time then Time.parse(value.to_s).strftime(\"%Y.%m.%d %H:%M:%S\")\n when :date then Date.parse(value.to_s).strftime(\"%Y-%m-%d\")\n else value\n end\n end", "def value_coercion(value); end", "def raw_value; end", "def type_cast_for_cql3(value, dest_type = nil)\n return nil if value.nil?\n return coder.dump(value) if encoded?\n\n case (dest_type || type)\n when :uuid then value.is_a?(::Cql::Uuid) ? value : self.class.value_to_uuid(value)\n when :time, :datetime, :timestamp then value.to_time.utc\n when :date then value.to_time.utc\n when :set then Set.new(list_to_cql3_value(value))\n when :list then list_to_cql3_value(value)\n when :map then map_to_cql3_value(value)\n else value\n end\n end", "def cast_value(value) # :doc:\n value\n end", "def type_cast(value, record = nil, dest_type = nil) # rubocop:disable Metrics/CyclomaticComplexity\n value = @default if value.nil?\n return nil if value.nil?\n return coder.load(value) if encoded?\n\n klass = self.class\n\n case dest_type || type\n when :string, :text then value.to_s\n when :ascii then value.force_encoding('ascii')\n when :integer, :long then klass.value_to_integer(value)\n when :float then value.to_f\n when :decimal then klass.value_to_decimal(value)\n when :datetime, :timestamp then klass.string_to_time(value)\n when :time then klass.string_to_dummy_time(value)\n when :date then klass.value_to_date(value)\n when :binary then klass.binary_to_string(value)\n when :boolean then klass.value_to_boolean(value)\n when :uuid, :timeuuid\n uuid = klass.value_to_uuid(value)\n uuid.is_a?(::Cql::Uuid) ? uuid.to_s : uuid\n when :list, :set\n wrap_collection(Array(value).map { |v| type_cast(v, record, @options[:holds]) }.reject(&:blank?), record)\n when :map\n wrap_collection(value.each { |k, v| value[k] = type_cast(v, record, @options[:holds]) }.stringify_keys, record)\n else value\n end\n end", "def cast_value(value)\n value\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_int\n ))\n end", "def value\n to_s\n end", "def object_value_from_dynamo_data(dynamo_record)\n dynamo_record[dynamo_attribute_key]\n end", "def serialize_value(v)\n case v\n when TZOffset, Geo::Coord, Reality::Link, Reality::Measure, Money::Currency\n v.inspect\n when Array\n v.map(&method(:serialize_value))\n when String, Numeric, Date, Time\n v\n else\n fail ArgumentError, \"Not a basic value in the entity: #{v.inspect}\"\n end\n end", "def value_types; end", "def to_data value\n @types.each { |type|\n if type.has_to_data?\n return type.to_data value\n end\n }\n \n raise NoMethodError, \"#to_data not defined\"\n end", "def raw_value\n to_s\n end", "def serialize_value(value)\r\n value\r\n end", "def value_from( value )\n #----------------------\n #raise MongoODM::Errors::TypeCastMissing.new(value, @type) unless @type.respond_to?(:type_cast)\n @type.from( value )\n end", "def type_cast(value, type = self.type)\n case type\n when :counter\n type_cast(value, :integer).to_i\n when :integer\n Kernel::Integer(value) rescue nil if value\n when :float\n Kernel::Float(value) rescue nil if value\n when :timestamp\n value = type_cast(value, :integer)\n Time.at(value) if value\n else\n value\n end\n end", "def value_raw\n @value\n end", "def to_d()\n #This is a stub, used for indexing\n end", "def typecast(value)\n if value.kind_of?(Range) then Range.new(typecast(value.first), typecast(value.last))\n elsif value.kind_of?(Array) then value.map{|v| typecast(v)}\n elsif primitive == BigDecimal then super(value).to_f\n elsif primitive == DateTime then Time.parse(super(value).to_s).to_i\n elsif primitive == Date then Time.parse(super(value).to_s).to_i\n elsif primitive == Time then super(value).to_i\n else\n super(value) # Good luck\n end\n end", "def type_cast(value)\r\n @column_definition.type_cast(value)\r\n end", "def raw_value\n @value\n end", "def value\n send property.type_field\n end", "def value() end", "def write_attribute_with_type_conversion(property, value)\n @_properties_before_type_cast ||= {}\n @_properties_before_type_cast[property.to_sym]=value if self.class._props.has_key? property.to_sym\n conv_value = self.class._converter(property.to_sym).to_java(value)\n write_attribute_without_type_conversion(property, conv_value)\n end", "def serialized\n @value\n end", "def value_type\n return @value_type\n end", "def type_cast_for_schema(value) # :nodoc:\n value.inspect\n end", "def to_str; value; end", "def to_s\n value\n end", "def cast_attribute(value, type_name)\n case type_name\n when :integer then value.to_i\n when :float then value.to_f\n when :boolean then !!value\n else value\n end\n end", "def untypecasted_value\n read_attribute(:value)\n end", "def cast_value(value) # :api: public\n value\n end", "def to_str() @value.to_s end", "def simple_value_type_code\n value_type_code\nend", "def get_field_deserializers()\n return super.merge({\n \"unit\" => lambda {|n| @unit = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def type_cast(value, type)\n return nil if value.nil?\n case type\n when :string then value\n when :text then value\n when :money then string_to_money(value)\n when :integer then value.to_i rescue value ? 1 : 0\n when :float then value.to_f\n when :datetime then string_to_time(value)\n when :timestamp then string_to_time(value)\n when :time then string_to_dummy_time(value)\n when :date then string_to_date(value)\n when :boolean then value_to_boolean(value)\n else value\n end\n end", "def custom_writer(key, value, convert = T.unsafe(nil)); end", "def get_value(object)\n case value_type\n when 'integer' then object.value_integer\n when 'float' then object.value_float\n when 'string' then object.value_string\n else raise_invalid_type\n end\n end", "def to_s\n value\n end", "def to_s\n value\n end", "def assign_value\n if assigned_attr = AttrName.find_by_id(self.attr_name_id)\n case assigned_attr.value_type\n when \"STRING\"\n self.string_val = self.raw_value\n when \"FLOAT\" #has a special case to remove the dollar symbol in front of it\n #remove_dollar_sign\n self.float_val = self.raw_value.to_f\n when \"DATETIME\"\n self.datetime_val = self.raw_value.to_datetime\n when \"BOOLEAN\"\n if self.raw_value == 'true'\n self.bool_val = true\n else\n self.bool_val = false\n end\n when \"INTEGER\"\n if assigned_attr.treat_as_price\n logger.debug \"Treating this as a price\"\n self.price_val_cents = Money.parse(self.raw_value).cents\n else\n self.int_val = self.raw_value.to_i\n end\n else\n self.string_val = self.raw_value\n end\n end\n end", "def write_attribute_with_type_conversion(property, value)\n @_properties_before_type_cast[property.to_sym]=value if self.class._decl_props.has_key? property.to_sym\n conv_value = self.class._converter(property.to_sym).to_java(value)\n write_attribute_without_type_conversion(property, conv_value)\n end", "def value\n _, _, type = @table.lookup_schema(cq)\n Util.from_bytes(type, raw)\n end", "def dump_field(value, options)\n return if value.nil? || (value.respond_to?(:empty?) && value.empty?)\n\n case options[:type].to_s.upcase\n when \"S\"\n value\n when \"SS\"\n value.flatten\n when \"N\"\n \"#{value.to_f}\"\n when \"D\"\n \"#{value.to_i}\"\n when \"NS\"\n Set[*value.map {|v| \"#{v.to_f}\" }]\n when \"DS\"\n Set[*value.map {|v| \"#{value.to_i}\" }]\n when \"B\"\n AWS::DynamoDB::Binary.new(value)\n when \"BS\"\n Set[*value.map{|v| AWS::DynamoDB::Binary.new(v) }]\n end\n end", "def to_s\n value\n end", "def __value(v); end", "def result\n # cast it to datetime for storage, to preserve milliseconds and date\n map_value(converted_value:\n RDF::Literal.new(\n value.value.to_datetime,\n datatype: PermissiveSchema.valkyrie_time\n ))\n end", "def to_s\n @value\n end", "def to_s\n @value\n end", "def to_s\n @value\n end", "def type_cast_for_solr(value, dest_type = nil)\n return nil if value.nil?\n return coder.dump(value) if encoded?\n\n case (dest_type || type)\n when :boolean then value ? 'true' : 'false'\n when :date, :time, :datetime, :timestamp then value.to_time.utc.strftime(Format::SOLR_TIME_FORMAT)\n when :list, :set then list_to_solr_value(value)\n when :map then map_to_solr_value(value)\n when :uuid, :timeuuid then value.to_s\n else value\n end\n end", "def casted_value\n case qtype.name\n when 'date' then date_value\n when 'time' then time_value\n when 'datetime' then datetime_value\n when 'integer' then value.blank? ? nil : value.to_i\n when 'decimal' then value.blank? ? nil : value.to_f\n else value.blank? ? nil : value\n end\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_id\n ))\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_id\n ))\n end", "def to_s\n @value\n end", "def value\n raise NotImplementedError\n end", "def type_cast_for_schema(value)\n cast(value).value.inspect\n end", "def to_s()\n @value.to_s\n end", "def to_s()\n @value.to_s\n end", "def value_for(value)\n return value.to_s(:db) if value.kind_of?(Time) \n return value.to_s(:db) if value.kind_of?(Date)\n return value.to_s\n end", "def value_type\n @type.value_type\n end", "def value!\n raise NotImplementedError\n end", "def typecast_value_string(value)\n value.to_s\n end", "def to_s\n @value\n end", "def type_cast_for_schema(value) # :nodoc:\n value.inspect\n end", "def to_s\n return @value.to_s\n end", "def to_d; end", "def serialize(value)\n value\n end", "def value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.value\n\t\telse\t\t\t\n\t\t\t@value\n\t\tend\n\tend", "def convert_value(value)\n value\n end", "def to_d\n in_native\n end", "def to_s\n @value.to_s\n end", "def to_s\n @value\n end", "def typecast\n @typecast ||= Settler.typecast_for(key)\n end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end" ]
[ "0.76428676", "0.701886", "0.6908685", "0.68884724", "0.6856077", "0.6853378", "0.67747927", "0.66775376", "0.66073084", "0.6497957", "0.6485203", "0.6456468", "0.6418363", "0.63628113", "0.63197905", "0.6308066", "0.62769896", "0.6250316", "0.6232659", "0.62255126", "0.6190378", "0.61873895", "0.61846644", "0.6184566", "0.6150639", "0.6120937", "0.6103689", "0.60961556", "0.60939986", "0.608386", "0.60769606", "0.60672396", "0.6066152", "0.6057808", "0.60366476", "0.6025832", "0.60118055", "0.60073113", "0.60006857", "0.5985532", "0.5983305", "0.597604", "0.596896", "0.5968252", "0.59597194", "0.59574574", "0.5956684", "0.5956457", "0.5951293", "0.59447694", "0.5939849", "0.5937899", "0.5937196", "0.5936568", "0.59361684", "0.59361684", "0.59345114", "0.5928204", "0.59267896", "0.5918156", "0.59157646", "0.59144545", "0.5912661", "0.5911626", "0.5911626", "0.5911626", "0.5910102", "0.5908894", "0.59054166", "0.59054166", "0.5898285", "0.5891116", "0.58898485", "0.58890176", "0.58890176", "0.5888697", "0.5880325", "0.587332", "0.58629817", "0.58612955", "0.58601314", "0.5855863", "0.58541363", "0.5845224", "0.5838224", "0.58297116", "0.5818655", "0.58167744", "0.5816758", "0.5815374", "0.58128", "0.58128", "0.58128", "0.58128", "0.58128", "0.58128", "0.58128", "0.58128", "0.58128", "0.58128" ]
0.76029176
1
Override this to convert a value out of dynamo back into something suitable for your application, such as deserializing, parsing, etc.
def convert_to_object_value(dynamo_value); dynamo_value; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_dynamo_value(object_value); object_value; end", "def cast_value\n value.mongoize\n end", "def untypecasted_value\n read_attribute(:value)\n end", "def deserialize_value(value)\r\n value\r\n end", "def convert(value) value end", "def value\n @casted_value ||= type_cast_value(@value)\n end", "def deserialize(value)\n cast(value)\n end", "def deserialize_value(column, value)\n value\n end", "def object_value_from_dynamo_data(dynamo_record)\n dynamo_record[dynamo_attribute_key]\n end", "def convert_after_read(value)\n sequel_json_column? ? value.to_hash : super\n end", "def cast(value)\n value\n end", "def cast_value(value)\n value\n end", "def cast_value(value) # :doc:\n value\n end", "def decoded_value\n case value_type\n when \"Fixnum\" then value.to_i\n when \"Float\" then value.to_f\n when \"Date\" then Date.parse(value)\n when \"Array\", \"Hash\" then JSON.parse(value)\n when \"Boolean\" then value == \"true\" ? true : false\n else value.to_s\n end\n end", "def object_value(dynamo_data)\n dynamo_data[dynamo_attribute_key].send dynamo_attribute_value_type_key\n end", "def typecast(value)\n value\n end", "def cast_value(value) # :api: public\n value\n end", "def convert_value(value)\n value\n end", "def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the value and return success\n return parse_string_value(@uncast_value) if @uncast_value.is_a? String\n # Convert the value to yaml otherwise\n v = @uncast_value.to_yaml unless @uncast_value.nil?\n self[:value] = v\n end", "def cast_value(value)\n case value\n when String then decode_and_initialize(value)\n when Hash then extract_model_klass(value).new(value)\n when nil then value\n else\n raise_cast_error(value) unless value.class.ancestors.include?(StoreModel::Model)\n\n value\n end\n rescue ActiveModel::UnknownAttributeError => e\n handle_unknown_attribute(value, e)\n end", "def typecast(value)\n value\n end", "def deserialize_value(column, v)\n return v if v.nil?\n case model.serialization_map[column] \n when :marshal\n Marshal.load(v.unpack('m')[0]) rescue Marshal.load(v)\n when :yaml\n YAML.load v if v\n when :json\n JSON.parse v if v\n else\n raise Error, \"Bad serialization format (#{model.serialization_map[column].inspect}) for column #{column.inspect}\"\n end\n end", "def deserialize(value)\n value\n end", "def serialize_value(v)\n case v\n when TZOffset, Geo::Coord, Reality::Link, Reality::Measure, Money::Currency\n v.inspect\n when Array\n v.map(&method(:serialize_value))\n when String, Numeric, Date, Time\n v\n else\n fail ArgumentError, \"Not a basic value in the entity: #{v.inspect}\"\n end\n end", "def serialize_value(value)\r\n value\r\n end", "def value_from( value )\n #----------------------\n #raise MongoODM::Errors::TypeCastMissing.new(value, @type) unless @type.respond_to?(:type_cast)\n @type.from( value )\n end", "def deserialize_value\n if @value.nil?\n @value = read_attribute :value\n end\n\n case value_type\n when SUPPORTED_TYPES[:Object] # or Hash, Array, etc.\n @value = YAML::load @value\n when SUPPORTED_TYPES[:Symbol]\n @value = @value.to_sym\n when SUPPORTED_TYPES[:Integer] # or Fixnum, Bignum\n @value = @value.to_i\n when SUPPORTED_TYPES[:Float]\n @value = @value.to_f\n when SUPPORTED_TYPES[:Complex]\n @value = Complex @value\n when SUPPORTED_TYPES[:Rational]\n @value = Rational @value\n when SUPPORTED_TYPES[:Boolean]\n @value = (@value == \"true\")\n else\n @value\n end\n end", "def serialize_value\n # Returning nil will prevent the row from being saved, to save some time since the EavHash that manages this\n # entry will have marked it for deletion.\n raise \"Tried to save with a nil value!\" if @value.nil? or @value.is_a? NilPlaceholder\n\n update_value_type\n if value_type == SUPPORTED_TYPES[:Object]\n write_attribute :value, YAML::dump(@value)\n else\n write_attribute :value, @value.to_s\n end\n\n read_attribute :value\n end", "def convert_attribute_value obj\n case obj\n when OpenCensus::Trace::TruncatableString\n TraceProtos::AttributeValue.new \\\n string_value: convert_truncatable_string(obj)\n when Integer\n TraceProtos::AttributeValue.new int_value: obj\n when true, false\n TraceProtos::AttributeValue.new bool_value: obj\n end\n end", "def unserialize_value(value)\n value\n end", "def convert_value(value)\n case value\n when VividMash, AttrArray\n value\n when Hash\n VividMash.new(value, __root__, __node__, __precedence__)\n when Array\n AttrArray.new(value, __root__, __node__, __precedence__)\n else\n value\n end\n end", "def value\n to_type(@value)\n end", "def cast_eav_value value, attribute # :nodoc:\n attributes = self.class_eav_attributes.stringify_keys\n return value unless attributes.keys.include?(attribute)\n return value if attributes[attribute] == String # no need for casting\n\n\n begin\n # for core types [eg: Integer '12']\n eval(\"#{attributes[attribute]} '#{value}'\")\n\n rescue\n begin\n # for BigDecimal [eg: BigDecimal.new(\"123.45\")]\n eval(\"#{attributes[attribute]}.new('#{value}')\")\n\n rescue\n begin\n # for date/time classes [eg: Date.parse(\"2011-03-20\")]\n eval(\"#{attributes[attribute]}.parse('#{value}')\")\n rescue\n value\n end\n\n end\n end\n end", "def value_coercion(value); end", "def decode(value)\n self.class.decode(value)\n end", "def decode(value)\n self.class.decode(value)\n end", "def value_transform value, type\n return nil if value.nil? || value.to_s.size == 0\n case type\n when :integer then value.to_i\n when :autoincrement then value.to_i\n when :string then value.to_s\n when :float then value.to_f\n when :bool then value.to_s\n when :symbol then value.to_s\n when :marshal then Marshal.dump(value)\n when :array then Yajl::Encoder.encode(value)\n when :hash then Yajl::Encoder.encode(value)\n when :time then Time.parse(value.to_s).strftime(\"%Y.%m.%d %H:%M:%S\")\n when :date then Date.parse(value.to_s).strftime(\"%Y-%m-%d\")\n else value\n end\n end", "def typecast_value_json(value)\n case value\n when JSONObject\n value\n when String\n if typecast_json_strings\n JSONString.new(value)\n else\n _wrap_json(_parse_json(value))\n end\n when *JSON_WRAP_CLASSES\n JSONDatabaseMethods.json_primitive_wrapper(value).new(value)\n when JSONBObject\n value = value.__getobj__\n JSONDatabaseMethods.json_primitive_wrapper(value).new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for json: #{value.inspect}\"\n end\n end", "def convert(value, type)\n begin\n case type\n when 'json' then JSON.parse(value)\n when 'base64' then JSON.parse(Base64.decode64(value))\n when 'integer' then Integer(value)\n when 'number' then Float(value)\n else\n value.to_s\n end\n rescue ArgumentError\n value.to_s\n end\n end", "def raw_cast(value)\n # We can strip value here but we do not want to squish it unless for number\n value = value.to_s.strip\n return nil if value.empty?\n\n case data_type\n when 'number'\n BigDecimal(remove_decimal_mark(value.squish))\n when 'date'\n # date_format likely will be '%m/%d/%Y', but if we got '19/8/2014',\n # then `strptime` will raise invalid date error\n # Sometimes we can get '27/11 /1981' also :(\n begin\n Date.strptime(value, @resultset.date_format)\n rescue StandardError\n # We could be getting back these date:\n # '17.12.95', '19/05/99', '27/11 /1981'\n # '1959-07-03' will be beyond us, so consider returning exact value\n value = value.gsub(/-|\\./, '/')\n split = value.split('/').map(&:strip)\n split[2] = \"19#{split[2]}\" if split[2].size == 2\n value = split.join('/')\n\n Date.strptime(\n Date.parse(value)\n .strftime(@resultset.date_format), @resultset.date_format\n )\n end\n when 'time'\n DateTime.strptime(\"1/1/-4712 #{value}\", @resultset.timestamp_format)\n when 'timestamp'\n DateTime.strptime(value, @resultset.timestamp_format)\n when 'container'\n # container may return value that include URI scheme already\n return URI.parse(value) if value.start_with?('http')\n URI.parse(\"#{@resultset.server.url}#{value}\")\n else\n value\n end\n rescue StandardError => e\n warn \"Could not coerce #{name}: #{value} due to #{e.message.force_encoding(\"UTF-8\")}\"\n value\n end", "def read\n value = super\n value = value.to_hash if value.respond_to?(:to_hash)\n value\n end", "def type_cast_for_schema(value)\n cast(value).value.inspect\n end", "def value\n typecast.present? ? typecasted_value : super\n end", "def type_cast(value, record = nil, dest_type = nil) # rubocop:disable Metrics/CyclomaticComplexity\n value = @default if value.nil?\n return nil if value.nil?\n return coder.load(value) if encoded?\n\n klass = self.class\n\n case dest_type || type\n when :string, :text then value.to_s\n when :ascii then value.force_encoding('ascii')\n when :integer, :long then klass.value_to_integer(value)\n when :float then value.to_f\n when :decimal then klass.value_to_decimal(value)\n when :datetime, :timestamp then klass.string_to_time(value)\n when :time then klass.string_to_dummy_time(value)\n when :date then klass.value_to_date(value)\n when :binary then klass.binary_to_string(value)\n when :boolean then klass.value_to_boolean(value)\n when :uuid, :timeuuid\n uuid = klass.value_to_uuid(value)\n uuid.is_a?(::Cql::Uuid) ? uuid.to_s : uuid\n when :list, :set\n wrap_collection(Array(value).map { |v| type_cast(v, record, @options[:holds]) }.reject(&:blank?), record)\n when :map\n wrap_collection(value.each { |k, v| value[k] = type_cast(v, record, @options[:holds]) }.stringify_keys, record)\n else value\n end\n end", "def serialize_value(value)\n value\n end", "def serialize_value(value)\n value\n end", "def coerce(value)\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n value\n end", "def serialized\n @value\n end", "def deserialize(value)\n Marshal.restore(value) rescue value\n end", "def deserialize(value)\n Marshal.restore(value) rescue value\n end", "def cast(value)\n if value.is_a?(MySQLBinUUID::Type::Data)\n # It could be a Data object, in which case we should add dashes to the\n # string value from there.\n add_dashes(value.to_s)\n elsif value.is_a?(String) && value.encoding == Encoding::ASCII_8BIT && strip_dashes(value).length != 32\n # We cannot unpack something that looks like a UUID, with or without\n # dashes. Not entirely sure why ActiveRecord does a weird combination of\n # cast and serialize before anything needs to be saved..\n undashed_uuid = value.unpack1('H*')\n add_dashes(undashed_uuid.to_s)\n else\n super\n end\n end", "def dynamo_attribute_from_value(attr_val)\n # { dynamo_attribute_key => { dynamo_attribute_value_type_key => convert_to_dynamo_value(attr_val) }} unless attr_val.nil?\n { dynamo_attribute_key => convert_to_dynamo_value(attr_val)} unless attr_val.nil?\n end", "def coerce_value(key, value)\n return value unless value\n klass = self.class.attributes[key][:class]\n \n if value.is_a?(String) and !value.empty?\n # In-built types\n if klass.kind_of?(Videojuicer::Resource::Types::Base)\n return klass.new(value).dump\n end\n \n # Dates\n if klass.respond_to?(:parse)\n return klass.parse(value) rescue raise \"Invalid date: #{value.inspect}\"\n end\n elsif value.is_a? Hash and value.any?\n if klass == DateTime\n if value.is_a?(Hash)\n year = value[:year]\n month = value[:month]\n day = value[:day]\n hour = value[:hour] or \"00\"\n minute = value[:minute] or \"00\"\n value = klass.parse(\"#{year}-#{month}-#{day}T#{hour}:#{minute}:00+00:00\")\n else\n raise ArgumentError, \"Please supply a DateTime, Hash keyed w/ [:day, :month, :year, :hour, :minute] or a String that can be coerced into a date\"\n end\n end\n end\n return value\n end", "def convert_value(value)\n value.class == Hash ? self.class.new(value) : value\n end", "def serialize(value)\n value\n end", "def raw_value; end", "def indifferent_value(value)\n value\n end", "def type_cast_for_cql3(value, dest_type = nil)\n return nil if value.nil?\n return coder.dump(value) if encoded?\n\n case (dest_type || type)\n when :uuid then value.is_a?(::Cql::Uuid) ? value : self.class.value_to_uuid(value)\n when :time, :datetime, :timestamp then value.to_time.utc\n when :date then value.to_time.utc\n when :set then Set.new(list_to_cql3_value(value))\n when :list then list_to_cql3_value(value)\n when :map then map_to_cql3_value(value)\n else value\n end\n end", "def value_raw\n @value\n end", "def convert(value)\n @path = []\n @values = {}\n to_data(value)\n end", "def convert(value)\n @path = []\n @values = {}\n to_data(value)\n end", "def convert(value)\n case value\n when java.util.List then value.to_a\n when java.util.Set then value.to_set\n when java.util.Map then value.to_hash\n else value\n end\n end", "def typecast_value_string(value)\n case value\n when Hash, Array\n raise Sequel::InvalidValue, \"invalid value for String: #{value.inspect}\"\n else\n value.to_s\n end\n end", "def typecast(value)\n if value.kind_of?(Range) then Range.new(typecast(value.first), typecast(value.last))\n elsif value.kind_of?(Array) then value.map{|v| typecast(v)}\n elsif primitive == BigDecimal then super(value).to_f\n elsif primitive == DateTime then Time.parse(super(value).to_s).to_i\n elsif primitive == Date then Time.parse(super(value).to_s).to_i\n elsif primitive == Time then super(value).to_i\n else\n super(value) # Good luck\n end\n end", "def map_value(converted_value:)\n calling_mapper.for(\n Property.new(\n value.subject,\n value.key,\n converted_value,\n value.adapter,\n value.resource\n )\n ).result\n end", "def serialize_value(column, v)\n return v if v.nil?\n case model.serialization_map[column] \n when :marshal\n [Marshal.dump(v)].pack('m')\n when :yaml\n v.to_yaml\n when :json\n JSON.generate v\n else\n raise Error, \"Bad serialization format (#{model.serialization_map[column].inspect}) for column #{column.inspect}\"\n end\n end", "def parse_value; end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column]) && !model.serialized?(column)\n value = nil if value == '' and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(Error::InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue Error::InvalidValue\n if raise_on_typecast_failure\n raise\n else\n value\n end\n end\n end", "def original_deserialized_value(column)\n if frozen?\n @original_deserialized_values[column] || deserialize_value(column, self[column])\n else\n (@original_deserialized_values ||= {})[column] ||= deserialize_value(column, self[column])\n end\n end", "def cast_value(v)\r\n return nil if v.nil?\r\n if @type == :date\r\n self.style = STYLE_DATE if self.style == 0\r\n v\r\n elsif (@type == :time && v.is_a?(Time)) || (@type == :time && v.respond_to?(:to_time))\r\n self.style = STYLE_DATE if self.style == 0\r\n # one simple little fix. I DO NOT WANT TIME IN LOCAL TIME!\r\n unless v.is_a?(Time)\r\n v = v.respond_to?(:to_time) ? v.to_time : v\r\n end\r\n v\r\n elsif @type == :float\r\n v.to_f\r\n elsif @type == :integer\r\n v.to_i\r\n elsif @type == :boolean\r\n v ? 1 : 0\r\n elsif @type == :iso_8601\r\n #consumer is responsible for ensuring the iso_8601 format when specifying this type\r\n v\r\n else\r\n @type = :string\r\n # TODO find a better way to do this as it accounts for 30% of\r\n # processing time in benchmarking...\r\n Axlsx::trust_input ? v.to_s : ::CGI.escapeHTML(v.to_s)\r\n end\r\n end", "def type_cast(value, type)\n return nil if value.nil?\n case type\n when :string then value\n when :text then value\n when :money then string_to_money(value)\n when :integer then value.to_i rescue value ? 1 : 0\n when :float then value.to_f\n when :datetime then string_to_time(value)\n when :timestamp then string_to_time(value)\n when :time then string_to_dummy_time(value)\n when :date then string_to_date(value)\n when :boolean then value_to_boolean(value)\n else value\n end\n end", "def cast(value)\n value.to_s.gsub(/\\A\\\"|\\\"\\z/, '')\n end", "def value(value)\n custom? ? type.dump(value, self) : value\n end", "def json_value=(value)\n value = value.map { |v| Base64.decode64(v) }\n super(value)\n end", "def convert_object(value)\n case value\n when RDFSource\n value\n when RDF::Literal\n if value.simple?\n value.object\n elsif value.has_datatype?\n RDF::Literal.datatyped_class(value.datatype.to_s) ? value.object : value\n else\n value\n end\n when RDF::Resource\n cast? ? make_node(value) : value\n else\n value\n end\n end", "def value\n if self[:value_type].present?\n case self[:value_type].to_sym\n when :string, :text\n self[:value].to_s\n when :password\n self[:value].to_s\n when :decimal\n BigDecimal.new(self[:value].to_s).round(2, BigDecimal::ROUND_HALF_UP)\n when :integer\n self[:value].to_i\n when :boolean\n (self[:value].to_s =~ /^[t|1]/i) != nil\n else\n self[:value].is_a?(String) ? YAML.load(self[:value]) : self[:value]\n end\n else\n self[:value]\n end\n end", "def typecast_value_jsonb(value)\n case value\n when JSONBObject\n value\n when String\n if typecast_json_strings\n JSONBString.new(value)\n else\n _wrap_jsonb(_parse_json(value))\n end\n when *JSON_WRAP_CLASSES\n JSONDatabaseMethods.jsonb_primitive_wrapper(value).new(value)\n when JSONObject\n value = value.__getobj__\n JSONDatabaseMethods.jsonb_primitive_wrapper(value).new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for jsonb: #{value.inspect}\"\n end\n end", "def typecast_to_primitive(value)\n if value.respond_to?(:to_date)\n value.to_date\n elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)\n typecast_hash_to_date(value)\n else\n ::Date.parse(value.to_s)\n end\n rescue ArgumentError\n value\n end", "def raw_value\n @value\n end", "def result\n Valkyrie::Persistence::Shared::JSONValueMapper.new(value).result.symbolize_keys\n end", "def deserialize(value)\n # expects same behavior as ActiveRecord::Type::String other than decryption\n # https://github.com/rails/rails/blob/5-0-stable/activemodel/lib/active_model/type/value.rb#L21-L23\n v = super(value)\n v.present? ? encryptor.decrypt_and_verify(v) : v\n end", "def type_cast_for_schema(value) # :nodoc:\n value.inspect\n end", "def normalize( value )\n value\n end", "def cast(sval)\n case sid\n when 'integer' then sval.to_i\n when 'string', 'text' then sval\n when 'boolean' then BoolTrueReps.member?(sval.to_s)\n when 'float' then sval.to_f\n when 'date' then sval && Date.parse(sval)\n else raise \"Don't know how to handle MetaPropertyType with sid '#{sid}'.\"\n end\n end", "def cast_value(value)\n case value_type\n when 'integer' then value.to_i\n when 'float' then value.to_f\n when 'string' then value.to_s\n else raise_invalid_type\n end\n end", "def converted_value\n if @converter\n @converter.call(@value)\n else\n @value\n end\n end", "def serialize(value)\n value\n end", "def get_field_deserializers()\n return super.merge({\n \"unit\" => lambda {|n| @unit = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def value_as_json\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: WAPI_wrapper: value_as_json: \" + @value.inspect\n c = @value.dup\n # Make sure Result has a non-nil value\n c['Result'] = \"\" unless c['Result']\n new_result = c['Result'].dup\n ## see if can tread new_result as json\n begin\n new_result = JSON.parse(new_result)\n rescue Exception => e\n # If there is a problem then just forget about the attempt to make it json\n end\n c['Result'] = new_result\n c.to_json\n end", "def serialize(value)\n value\n end", "def transform(value)\n value\n end", "def value\n Native(val)\n end", "def type_cast_for_schema(value) # :nodoc:\n value.inspect\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def type_cast_for_solr(value, dest_type = nil)\n return nil if value.nil?\n return coder.dump(value) if encoded?\n\n case (dest_type || type)\n when :boolean then value ? 'true' : 'false'\n when :date, :time, :datetime, :timestamp then value.to_time.utc.strftime(Format::SOLR_TIME_FORMAT)\n when :list, :set then list_to_solr_value(value)\n when :map then map_to_solr_value(value)\n when :uuid, :timeuuid then value.to_s\n else value\n end\n end", "def get_value(object)\n case value_type\n when 'integer' then object.value_integer\n when 'float' then object.value_float\n when 'string' then object.value_string\n else raise_invalid_type\n end\n end", "def typecast_to_primitive(value)\n DataMapper::Ext::Module.find_const(model, value.to_s)\n rescue NameError\n value\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n DearInventoryRuby.const_get(type).build_from_hash(value)\n end\n end", "def assign_value\n if assigned_attr = AttrName.find_by_id(self.attr_name_id)\n case assigned_attr.value_type\n when \"STRING\"\n self.string_val = self.raw_value\n when \"FLOAT\" #has a special case to remove the dollar symbol in front of it\n #remove_dollar_sign\n self.float_val = self.raw_value.to_f\n when \"DATETIME\"\n self.datetime_val = self.raw_value.to_datetime\n when \"BOOLEAN\"\n if self.raw_value == 'true'\n self.bool_val = true\n else\n self.bool_val = false\n end\n when \"INTEGER\"\n if assigned_attr.treat_as_price\n logger.debug \"Treating this as a price\"\n self.price_val_cents = Money.parse(self.raw_value).cents\n else\n self.int_val = self.raw_value.to_i\n end\n else\n self.string_val = self.raw_value\n end\n end\n end" ]
[ "0.80261844", "0.70328337", "0.6952075", "0.6781407", "0.6754817", "0.67406756", "0.6658484", "0.6648005", "0.66399866", "0.656494", "0.6496792", "0.6490786", "0.6465923", "0.6462184", "0.6455521", "0.6455499", "0.64459467", "0.64368844", "0.63951504", "0.63822037", "0.63679653", "0.6342655", "0.6316458", "0.6308196", "0.6288384", "0.6273339", "0.627244", "0.62579066", "0.6255647", "0.6250417", "0.6228495", "0.62266904", "0.618715", "0.61390215", "0.61229545", "0.61229545", "0.6111154", "0.61111397", "0.61109334", "0.60916305", "0.60856336", "0.60457516", "0.603676", "0.6033208", "0.60243475", "0.6007534", "0.6003832", "0.59936786", "0.5959108", "0.5959108", "0.5949218", "0.5939858", "0.593666", "0.5930255", "0.59161353", "0.59005904", "0.5884082", "0.5868911", "0.58664274", "0.5859877", "0.5859877", "0.5853774", "0.5851279", "0.5843562", "0.5831587", "0.5829114", "0.58232903", "0.58131033", "0.5812379", "0.5809727", "0.5800102", "0.5799936", "0.57971406", "0.5792506", "0.57877946", "0.57877684", "0.5781024", "0.57780814", "0.5775603", "0.5771614", "0.5766484", "0.57650745", "0.5764465", "0.5760887", "0.57515955", "0.5747984", "0.5738553", "0.5738274", "0.5733436", "0.572345", "0.5717591", "0.57145774", "0.57092714", "0.5708297", "0.5708297", "0.5694151", "0.5680955", "0.5678174", "0.5672422", "0.56676334" ]
0.83642954
0
Gets data out of the attribute value hash returned from the dynamo sdk
def object_value_from_dynamo_data(dynamo_record) dynamo_record[dynamo_attribute_key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_for_item(it)\n it.data[uuid]\n end", "def hash\n value_id.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def get_attribute_value(attribute)\n data[attribute]\n end", "def _read_attribute(key); end", "def hash_data(item)\n { item: item, barcode: item.sample.properties.fetch('Barcode ID') }\n end", "def hash\n @attrs\n end", "def hash\n @value.hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def data\n attributes['data']\n end", "def get\n\t\t\t@hash\n\t\tend", "def hash\n data.hash\n end", "def get_value(attribute_id)\n get_custom_value_hash\n return @custom_value_hash[attribute_id]\n end", "def attribute_value\n @attributes.each { | id, value | return value }\n end", "def hash\n value.hash\n end", "def data\n attributes.fetch(:data)\n end", "def data\n attributes.fetch(:data)\n end", "def get_hash_value(hash, key, attribute)\n hash[key][attribute]\n end", "def hash\n @data[:asin].to_s.hash\n end", "def dynamo_attribute_key\n @attr.dynamo_name\n end", "def object_value(dynamo_data)\n dynamo_data[dynamo_attribute_key].send dynamo_attribute_value_type_key\n end", "def get(att)\n @attributes[att] = key.call(\"HGET\", att)\n end", "def convert_to_dynamo_value(object_value); object_value; end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def read_attribute(key)\n @hash[key.to_s]\n end", "def hash\n [self.class, self.val, self.attribute].hash\n end", "def hash\n @hash.hash\n end", "def hash_key\n read_attribute(table_hash_key)\n end", "def dynamo_attribute(obj)\n dynamo_attribute_from_value dynamo_attribute_value(obj.send name)\n end", "def hash\n @hash\n end", "def key_for(data)\n data.hash\n end", "def read\n value = super\n value = value.to_hash if value.respond_to?(:to_hash)\n value\n end", "def get_attribute(name); end", "def get_attribute(name); end", "def data; Marshal.load(Base64.decode64(read_attribute(:data))); end", "def _read_attribute(attr)\n @attributes[attr]\n end", "def key_data; end", "def key_data; end", "def data\n self[:data].with_indifferent_access\n end", "def hash\n element.hash\n end", "def [](key)\n a = @attrs_hash[key.intern]\n if a\n a.value\n else\n nil\n end\n end", "def hash\n @table.hash\n end", "def read_attribute(key)\n @attributes[key]\n end", "def read_attribute(key)\n @attributes[key]\n end", "def hash\r\n id.hash\r\n end", "def hash\n return unless doc_value?\n result['doc']['hash']\n end", "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def attributes\n data[:attributes]\n end", "def hash\n\t\t[@id].hash\n\tend", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def key_value\n @attrs[self.class.key_attribute.to_s]\n end", "def convert_to_object_value(dynamo_value); dynamo_value; end", "def column_data(column)\n attributes[column.to_s]\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def attributes\n @cache[:attributes]\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def key\n @attributes[:key]\n end", "def key\n @attributes[:key]\n end", "def hash\n return @id.hash\n end", "def value\n attributes.fetch(:value)\n end", "def hash\n [searchable_id].hash\n end", "def [](key)\n attributes[key]\n end", "def key\n attributes[:key]\n end", "def hash\n dn.hash\n end", "def C_GetAttributeValue(*template)\n case template.length\n when 0\n return @pk.vendor_all_attribute_names.map{|attr|\n begin\n attributes(@pk.vendor_const_get(attr))\n rescue PKCS11::Error\n end\n }.flatten.compact\n when 1\n template = template[0]\n end\n template = to_attributes template\n @pk.C_GetAttributeValue(@sess, @obj, template)\n end", "def db_value(attribute,code)\n context = self.eh_params[:enum_contexts][attribute.to_s]\n self.eh_params[:db_codes][context][attribute.to_s].key(code)\n end", "def key_value\n @attrs[self.class.key_attribute.to_s]\nend", "def value\n @attributes[:value]\n end", "def data\n @data ||= @hash.to_s\n end", "def hash\n model.hash + key.hash\n end", "def read_attribute(key)\n @attributes[key.to_sym]\n end", "def [](key)\n attributes[key]\n end", "def [](key)\n attributes[key]\n end", "def [] key\n\t\t\t\t@attributes[key]\n\t\t\tend", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def broham_attr attr\n [ broham_info[attr] ].flatten.first\n end", "def attributes\n [@attribute,@value].inject(Hash.new([])) do |memo,c|\n case c \n when Sower::Relation::Statement, Sower::Relation::Attribute, Sower::Relation::Value::Base\n memo.merge!(c.attributes){|k,v,n| v | n}\n end\n memo\n end\n end", "def get attribute\n attributes[attribute]\n end", "def hash\n name.hash\n end", "def hash\n name.hash\n end", "def to_hash()\n @data\n end", "def result_attrs\n main_result[\"@attr\"] rescue {}\n end", "def get_hash_from_height(height)\n db.get(height_key(height))\n end", "def [](attr_name)\n @attributes.fetch_value(attr_name.to_s)\n end", "def get(attribute)\n @attributes[attribute.to_s]\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def md5\n @attributes[:md5]\n end" ]
[ "0.64458394", "0.6418478", "0.6265948", "0.6265948", "0.6265948", "0.62477744", "0.62364864", "0.62346596", "0.6230348", "0.61771125", "0.6169472", "0.61675084", "0.61655", "0.6141847", "0.6132852", "0.6100489", "0.60981876", "0.6060772", "0.6060772", "0.5977261", "0.5970301", "0.5963914", "0.5884638", "0.58813", "0.5876167", "0.5848359", "0.5844258", "0.58087003", "0.579521", "0.57803184", "0.57513046", "0.5745729", "0.57446253", "0.57412636", "0.57226336", "0.57226336", "0.5714918", "0.5710501", "0.57019615", "0.57019615", "0.56982857", "0.5691857", "0.5686802", "0.5681224", "0.5677847", "0.5677847", "0.56522244", "0.5647636", "0.5642899", "0.5642899", "0.5639798", "0.5635335", "0.5632654", "0.5624281", "0.56131506", "0.5585889", "0.55843097", "0.55841774", "0.5578242", "0.5578242", "0.55729836", "0.55729836", "0.5571182", "0.5571031", "0.556196", "0.55525726", "0.55503076", "0.553847", "0.553805", "0.55332077", "0.55173737", "0.5504926", "0.55033076", "0.5499748", "0.54994667", "0.54906714", "0.54906714", "0.548787", "0.54831636", "0.5482016", "0.5482016", "0.5482016", "0.5482016", "0.5482016", "0.5482016", "0.5482016", "0.5482016", "0.5482016", "0.5476433", "0.54734683", "0.54707336", "0.54593605", "0.5459192", "0.5454054", "0.5451725", "0.544784", "0.5442222", "0.5440768", "0.54374987", "0.54355884" ]
0.6621023
0
The string for the name of the field in dynamo
def dynamo_attribute_key @attr.dynamo_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_name\n @field.name\n end", "def field_name\n @gapi.field_name\n end", "def get_string_field(field_name)\n\t\tend", "def get_field_name\n\t\tend", "def field\n @field ||= quoted_field(field_name)\n end", "def field_name(ind)\n IBM_DB.field_name(@stmt, ind)\n end", "def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end", "def field_name\r\n @field_name ||= begin\r\n %r/(\\w+)Field$/.match(name)[1]\r\n rescue\r\n %r/(\\w+)$/.match(name)[1]\r\n end\r\n end", "def field\n raise \"Replace #field with the ElasticSearch field name\"\n end", "def field_name(field=nil)\n result = field_name_fragment\n result << \"[#{field}]\" if field\n result\n end", "def field(name); end", "def attr_name\n \"#{self.proxy.column_family_name}:#{key}\"\n end", "def attribute_field_name(attr)\n attr.to_s.camelize(:lower)\n end", "def name(value = nil)\n if value\n field_type.name(value)\n else\n # Return the name of the field\n @name\n end\n end", "def ssdb_attr_key(name)\n \"#{self.class.name.tableize}:#{ssdb_attr_id}:#{name}\"\n end", "def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end", "def resource_attribute_name(field, direction = :from)\n (transforms(direction)[field] || field).to_sym\n end", "def human_attribute_name(field_name, options={})\n \"\"\n end", "def field_name(object_name, attribute_name, postfix=nil)\n \"#{object_name}_#{attribute_name}#{postfix ? '_' + postfix.to_s : nil}\"\n end", "def field name\n @fields[name]\n end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def name\n @attribute.name\n end", "def field(name)\n attr_accessor name\n end", "def reflection_or_attribute_name; end", "def get_string(field)\n field['stringValue']\n end", "def name\n @custom_name || @attribute.to_s.humanize\n end", "def converted_field_name\n FIELD_NAMES_TABLE[@token.field_name] || @token.field_name\n end", "def get_string_value(field_name)\n\t\tend", "def name\n variant_suffixes = @field_variants.map { |variant| variant.suffix }.join\n \"*_#{@type.suffix}#{variant_suffixes}\"\n end", "def field_attribute(attr)\n return 'id' if attr == :_id\n # default, simply return name\n return attr unless attr.is_a? Hash\n # else, Hash\n return attr[:object] if attr.has_key? :object\n return attr[:array] if attr.has_key? :array\n return attr[:value] if attr.has_key? :value\n return attr[:link] if attr.has_key? :link\n\n attr.keys[0]\n end", "def get_field(field_name)\n\t\tend", "def to_field_name(name)\n # camelize strips leading underscores, which is undesirable.\n if name.to_s.starts_with?('_')\n \"_#{to_field_name(name.to_s[1..-1])}\"\n elsif Rails.config.camel_case\n name.to_s.camelize(:lower)\n else\n name.to_s\n end\n end", "def field_name\n return nil if virtual?\n @field_name ||= column ? quoted_field_name(column.name) : association.foreign_key\n end", "def json_storage_name\n (options[:json] || field_name).to_s.strip.downcase.to_sym\n end", "def [](field_name); end", "def encode_name(col)\n if col.name == 'id'\n :_id\n elsif col.name == 'type'\n :_type\n else\n col.name.to_sym\n end\n end", "def key_field\n 'key'\n end", "def get_field_name(options)\r\n field_name = options[:field_name]\r\n\r\n field_name\r\n end", "def name\n value\n end", "def define_field_name(field)\n (field.to_s + '_field').to_sym.tap do |field_method_name|\n field_method_names << field_method_name\n end\n end", "def name\n attrs[:name]\n end", "def dynamo_fields\n DynamoField.find(:all, :conditions=>['model = ?', self.to_s]).map(&:field_name)\n end", "def name_as_search_key\n QueryField.mapping(@name)\n end", "def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end", "def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end", "def converted_field_name\n FIELD_NAMES_TABLE[@field_name] || @field_name\n end", "def get_field(name)\n self[name]\n end", "def field_name_for_index(field, args = {})\n solr_name(field, args)\n end", "def collection_name\n 'string_fields'\n end", "def attr_name\n parameters.first.jump(:ident).first.to_sym\n end", "def name\n attributes.fetch(:name)\n end", "def item_name_for_resource(resource)\n sdb_type = simpledb_type(resource.model)\n \n item_name = \"#{sdb_type}+\"\n keys = keys_for_model(resource.model)\n item_name += keys.map do |property|\n resource.instance_variable_get(property.instance_variable_name)\n end.join('-')\n \n Digest::SHA1.hexdigest(item_name)\n end", "def readable_name\n \"(#{@type}) #{@name}\"\n end", "def format_name(attribute_name)\n attribute_name.to_s\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def attribute\n :\"#{name}_data\" if name\n end", "def get_accessor_name(name)\n unless name.is_a?(String)\n raise ArgumentError.new(\n \"Unexpected key: [#{name.inspect}] [required data type: String]\")\n end\n unless name =~ /^[0-9a-zA-Z\\-]+$/\n raise ArgumentError.new(\n \"A query string parameter key cannot contain characters \" +\n \"other than 0-9, a-z, A-Z or -.\")\n end\n name.gsub(\"-\", \"_\")\n end", "def to_responsys_field(s)\n if @@system_fields.include?(s)\n s.to_s.upcase + \"_\"\n else\n s.to_s.upcase\n end\n end", "def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end", "def dynamic_custom_field_class_name(name)\n \"#{self.name}#{name.to_s.singularize.camelize}Field\"\n end", "def identifier_string\n name\n end", "def field key\n @fields.get key\n end", "def name(index)\n i = get_field_index_by_external_id(index,@fields[:name])\n fields(index, i).to_s unless i.nil?\n end", "def name(index)\n i = get_field_index_by_external_id(index,@fields[:name])\n fields(index, i).to_s unless i.nil?\n end", "def value_field\n \"string\"\n end", "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 field_name(relation)\n \"__#{relation}_ids\"\n end", "def sf_field(key)\n self.attributes[translate_rails_key(key)] || self.attributes[translate_rails_key(key) + \"__c\"]\n end", "def columnName_to_fieldname (name)\n return name.downcase.gsub(' ','-')\nend", "def dynamo_attribute(obj)\n dynamo_attribute_from_value dynamo_attribute_value(obj.send name)\n end", "def local_name\n \"#{key}_value\"\n end", "def key_name\n data[:key_name]\n end", "def column_name; end", "def name\n definition[:name]\n end", "def translation_for(field)\n object.class.human_attribute_name(field)\n end", "def field_human_name(field)\n I18n.translate(\"#{model_name}.attributes.#{field}\", :count => 1, :default => Inflections.humanize(field), :scope => :models)\n end", "def name\n self[:name]\n end", "def string_field_names\n # database_field_names.join(', ')\n database_field_names.to_s[1...-1]\n end", "def name_field\n category_ids = AttributeCategory.where(\n user_id: user_id,\n entity_type: self.class.name.downcase\n ).pluck(:id)\n\n # Todo these two queries should be able to be joined into one\n AttributeField.find_by(\n user_id: user_id,\n attribute_category_id: category_ids,\n field_type: 'name'\n )\n end", "def field_name\n self.well_info.field_name\n end", "def column_name\n Name.new(\"#{name}_id\")\n end", "def field_names\n attribute_names.map(&:to_sym)\n end", "def get_char_field(field_name)\n\t\tend", "def nice_name(node)\n name = attr(node)\n defect_fields[name] || name\n end", "def name\n object[\"name\"]\n end", "def property_name\n property.identifing_name\n end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def dynamo_attribute_definition_type\n dynamo_attribute_value_type_key.to_s.upcase\n end", "def name\n @values['name']\n end", "def name\n self['name']\n end", "def name_attribute(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n %(name=\"#{name_base}#{extra}\")\n end", "def name_key\n return base_key + \".name\"\n end", "def name\n @name.to_s\n end", "def name\n @name.to_s\n end" ]
[ "0.75596917", "0.73883694", "0.7318507", "0.7192372", "0.715136", "0.69608676", "0.69309056", "0.6922584", "0.6893304", "0.68780804", "0.6867596", "0.6854278", "0.6849706", "0.6784067", "0.6774963", "0.6773497", "0.6765429", "0.67558837", "0.6750166", "0.67350596", "0.6715508", "0.6715508", "0.6715508", "0.6715508", "0.6715508", "0.6715508", "0.6715508", "0.66881436", "0.66263944", "0.66067195", "0.6590178", "0.6567998", "0.65531975", "0.6518554", "0.6507948", "0.64848", "0.64702195", "0.6463562", "0.64488155", "0.64440197", "0.6440495", "0.64290917", "0.6415905", "0.6413208", "0.64098233", "0.640493", "0.6401032", "0.63980377", "0.63960975", "0.63778085", "0.63570833", "0.63449574", "0.63425064", "0.6339792", "0.6324479", "0.6320247", "0.6312886", "0.63086593", "0.62994844", "0.62811977", "0.6258749", "0.62568384", "0.6237527", "0.6225917", "0.62255627", "0.62108356", "0.62085426", "0.6203561", "0.61993533", "0.61993533", "0.61788327", "0.61702114", "0.61598", "0.61506486", "0.61442417", "0.61364263", "0.61297905", "0.6129088", "0.61201406", "0.61197245", "0.6119506", "0.6114074", "0.6111856", "0.61115634", "0.61087495", "0.6103626", "0.6102502", "0.61023617", "0.61017317", "0.6101145", "0.60883147", "0.6081206", "0.60799754", "0.6077122", "0.607684", "0.60740423", "0.6063205", "0.60579103", "0.6050641", "0.6050641" ]
0.7062308
5
GET /memories GET /memories.xml
def index authorize! :view_memories, current_account if can? :manage_account, current_account @memories = current_account.memories else @memories = current_account.memories.where('access=?', 'public') end order = filter_sortable_column_order %w{sort_time name} order ||= '-sort_time' @tags = @memories.tag_counts_on(:tags).sort_by(&:name) if params[:tag] @memories = @memories.tagged_with(params[:tag]) end @memories = @memories.order(order) respond_with @memories end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @memories = Memory.all\n end", "def index\n @memories = Memory.paginate(page: params[:page], per_page: 4)\n end", "def index\n @memos = Memo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @memos }\n end\n end", "def show\n @memory_models = MemoryModels.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @memory_models }\n end\n end", "def show\n @memory = current_account.memories.find(params[:id])\n authorize! :view, @memory\n respond_with @memory\n end", "def show\n @memories = @occasion.memories.paginate(:page => params[:page], :per_page => 5)\n end", "def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end", "def index\n @memos = @book.memos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memos }\n end\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def index\n #@histories = History.all\n @histories = History.find( :all, :limit => 100, :order => \"id DESC\" )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end", "def index\n @mlog = MlogEntry.all\n @mlog_entries = @mlog.order(updated_at: :desc).page params[:page]\n @type_data = get_type_data(@mlog)\n @total_size = get_total_size(@type_data)\n @collections = getMinCollections\n @min_accessions = getMinAccessions\n end", "def index\n @memorizationpages = Memorizationpage.all\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\r\n @medical_histories = MedicalHistory.all\r\n end", "def index\r\n @medical_histories = MedicalHistory.all\r\n end", "def show\n @rx_memory = RxMemory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rx_memory }\n end\n end", "def index\n @medicamentos = Medicamento.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @medicamentos }\n end\n end", "def index\n @master_memorials = Master::Memorial.all\n end", "def index\n @page_title = \"Power Units\"\n @power_units = PowerUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @power_units }\n end\n end", "def index\n @mem_groups = MemGroup.page(params[:page]).per(10)\n end", "def index\n @text_memories = TextMemory.all\n end", "def index\n @text_memories = TextMemory.all\n end", "def show\n @article = Article.find(params[:id])\n\n @memos = Memo.find_all_by_article_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @memory = Memory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @memory }\n end\n end", "def index\n @mobs_nanos = MobsNano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @mobs_nanos.to_xml }\n end\n end", "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rooms }\n end\n end", "def index\n @screens = Screen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @screens }\n end\n end", "def show\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @memo }\n end\n end", "def show\n @memories = @pet.memories.paginate(:page => params[:page], :per_page => 5)\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end", "def new\n @memory_models = MemoryModels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @memory_models }\n end\n end", "def show\n @mileage = Mileage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mileage }\n end\n end", "def show\n @mailee_list = Mailee::List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mailee_list }\n end\n end", "def index\n @med_insts = MedInst.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @med_insts }\n end\n end", "def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @directories }\n end\n end", "def index\n @mensagens = Mensagem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mensagens }\n end\n end", "def index\n @materials = Material.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @materials }\n end\n end", "def index\n @loans = Loan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @loans }\n end\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def index\n @magazines = Magazine.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @magazines }\n end\n end", "def index\n @views = @ministry.views.find(:all, :order => _(:title, :view))\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @views.to_xml }\n end\n end", "def index\n @amenities = Amenity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @amenities }\n end\n end", "def index\n puts \"===> MC.index 0\"\n @musicians = Musician.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @musicians }\n end\n end", "def index\n @mileagelogs = Mileagelog.all\n end", "def index\n @miles = Mile.all\n end", "def index\n @modeles = Modele.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @modeles }\n end\n end", "def index\n @content_managers = BigCms::ContentManager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @content_managers }\n end\n end", "def show\n @machine_mileage = MachineMileage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @machine_mileage }\n end\n end", "def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end", "def show\n @mobs_nano = MobsNano.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @mobs_nano.to_xml }\n end\n end", "def show\n @menutree = Menutree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @menutree }\n end\n end", "def list\n get('/')\n end", "def show\n @metabolite = Metabolite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @metabolite }\n end\n end", "def index\n @lists = List.find(:all)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @lists }\n end\n end", "def index\n @house_menus = HouseMenu.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @house_menus }\n end\n end", "def index\n @node_histories = NodeHistory.all\n end", "def metars(params={})\n perform_get('/metars.xml', params)\n end", "def index\n @ministries = Ministry.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def show\n @tx_memory = TxMemory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tx_memory }\n end\n end", "def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mall }\n end\n end", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def index\n @stats = Stat.where(:match_id => params[:match_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stats }\n end\n end", "def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def index\n @mentorships = Mentorship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mentorships }\n end\n end", "def index\n @pm_elements = PmElement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pm_elements }\n end\n end", "def index\n @atoms = Atom.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @atoms }\n end\n end", "def index\n #Page.all is fine for small sets of data, for larger sets pagination would be best\n @pages = data_cache('pages', 10.minutes) do\n Page.all\n end\n respond_to do |format|\n format.json { render action: 'index', status: :ok, location: api_pages_url(@pages) }\n format.xml { render xml: @pages, location: api_pages_url(@pages) }\n end\n end", "def movies\n get('Movies')\n end", "def index\n @list_cats = ListCat.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_cats }\n end\n end", "def index\n @media_histories = MediaHistory.all\n end", "def index\n @karma = Karma.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @karma }\n end\n end", "def index\n @stories = Story.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end", "def index\n session[:current_tab] = \"Manage\"\n session[:current_sub_tab] = \"Resources\"\n @machines = Machine.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @machines }\n format.atom\n end\n end", "def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end", "def index\n @travel_claim_mileage_rates = TravelClaimMileageRate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @travel_claim_mileage_rates }\n end\n end", "def index\n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @movies }\n end\n end", "def index\n @materia = Materium.where(:year => session[:current_year]).order(:nombre, :nivel)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @materia }\n end\n end", "def index\n @quantity_units = QuantityUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quantity_units }\n end\n end", "def index\n @memory_slots = MemorySlot.all\n end", "def index\n @mm_teams = MmTeam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mm_teams }\n end\n end", "def index\n @mm_teams = MmTeam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mm_teams }\n end\n end", "def index\n @m2s = M2.all\n end", "def index\n @musicas = Musica.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @musicas }\n end\n end", "def accessories\n render json: { collections: Collection.published_accessories }\n end", "def index\n @thing_lists = ThingList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @thing_lists }\n end\n end", "def index\n @mementos = Memento.all\n end", "def list\n\t@storecunsumptions = Storecunsumption.paginate :page => params[:page], :per_page => 10\n\t\trespond_to do |format|\t\t\n\t\tformat.html \n\t\tformat.xml { render :xml => @storecunsumptions }\t\t#Render to XML File\n\t\tend\n\tend", "def new\n authorize! :create, Memory\n @memory = current_account.memories.new\n @memory.access = 'public'\n respond_with @memory\n end", "def show\n @memory = Memory.find(params[:id])\n \n Spira.add_repository! :hardware, RDF::Mongo::Repository.new\n @memory_rdf = SPARQL.execute(\"SELECT * WHERE { <#{MemoryRdf.for(@memory.item).subject.to_s}> ?p ?o }\", MemoryRdf.repository)\n \n @recommendations = Semantics::Recommendations.new.for_memory(@memory)\n\n @computer = Semantics::Recommendations.new.build_computer(@memory)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @memory }\n end\n end", "def index\n @neural_populations = NeuralPopulation.find(:all, :limit=>250)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @neural_populations }\n end\n end", "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "def index\n @warehouse_lists = get_warehouse_lists(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @warehouse_lists }\n end\n end", "def index\n @shots = Shot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shots }\n end\n end", "def index\n @membres = Membre.all\n end" ]
[ "0.7115413", "0.68196136", "0.6785562", "0.63610965", "0.633174", "0.6312043", "0.62222296", "0.6158267", "0.6106193", "0.60824776", "0.60257673", "0.6006439", "0.60056925", "0.59629506", "0.59629506", "0.59323996", "0.59323996", "0.58919036", "0.58869827", "0.58821416", "0.58811784", "0.5875099", "0.5874772", "0.5874772", "0.58587915", "0.5836042", "0.5823547", "0.58175725", "0.5807169", "0.57915723", "0.57572573", "0.5745971", "0.57342064", "0.573185", "0.571686", "0.57138294", "0.5706565", "0.5686974", "0.5682478", "0.5681907", "0.56800723", "0.5667576", "0.56667525", "0.5661745", "0.56593096", "0.56565565", "0.56558007", "0.565457", "0.5638969", "0.5636591", "0.5630144", "0.56275743", "0.5626926", "0.56255466", "0.5623986", "0.56145805", "0.5606552", "0.5599806", "0.55847", "0.5577092", "0.55645984", "0.5563437", "0.5561179", "0.5559184", "0.55567974", "0.55565566", "0.55560285", "0.5552395", "0.55508345", "0.5550646", "0.5538685", "0.5534451", "0.5531967", "0.5531284", "0.5527402", "0.5515092", "0.55140173", "0.5510775", "0.54959625", "0.5493576", "0.5486356", "0.54850155", "0.54824525", "0.54816985", "0.5481532", "0.5469539", "0.5469539", "0.5466722", "0.54651535", "0.5464638", "0.54636735", "0.5461949", "0.546112", "0.5453742", "0.544451", "0.544271", "0.544241", "0.5441262", "0.5440569", "0.5439398" ]
0.68316025
1
GET /memories/1 GET /memories/1.xml
def show @memory = current_account.memories.find(params[:id]) authorize! :view, @memory respond_with @memory end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @memories = Memory.all\n end", "def index\n @memos = Memo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @memos }\n end\n end", "def show\n @memory_models = MemoryModels.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @memory_models }\n end\n end", "def index\n @memories = Memory.paginate(page: params[:page], per_page: 4)\n end", "def index\n authorize! :view_memories, current_account\n if can? :manage_account, current_account\n @memories = current_account.memories\n else\n @memories = current_account.memories.where('access=?', 'public')\n end\n order = filter_sortable_column_order %w{sort_time name}\n order ||= '-sort_time'\n @tags = @memories.tag_counts_on(:tags).sort_by(&:name)\n if params[:tag] \n @memories = @memories.tagged_with(params[:tag])\n end\n @memories = @memories.order(order)\n respond_with @memories\n end", "def show\n @rx_memory = RxMemory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rx_memory }\n end\n end", "def show\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @memo }\n end\n end", "def show\n @memories = @occasion.memories.paginate(:page => params[:page], :per_page => 5)\n end", "def show\n @memory = Memory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @memory }\n end\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n @article = Article.find(params[:id])\n\n @memos = Memo.find_all_by_article_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @mobs_nano = MobsNano.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @mobs_nano.to_xml }\n end\n end", "def new\n @memory_models = MemoryModels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @memory_models }\n end\n end", "def show\n @tx_memory = TxMemory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tx_memory }\n end\n end", "def show\n @mileage = Mileage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mileage }\n end\n end", "def show\n @machine_mileage = MachineMileage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @machine_mileage }\n end\n end", "def index\n #@histories = History.all\n @histories = History.find( :all, :limit => 100, :order => \"id DESC\" )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def index\n @memos = @book.memos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memos }\n end\n end", "def show\n @metabolite = Metabolite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @metabolite }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mall }\n end\n end", "def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end", "def show\n @mriperformance = Mriperformance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mriperformance }\n end\n end", "def index\n @medicamentos = Medicamento.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @medicamentos }\n end\n end", "def show\n @mailee_list = Mailee::List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mailee_list }\n end\n end", "def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @medio }\n end\n end", "def index\n @master_memorials = Master::Memorial.all\n end", "def index\n @mobs_nanos = MobsNano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @mobs_nanos.to_xml }\n end\n end", "def show\n @memory = Memory.find(params[:id])\n \n Spira.add_repository! :hardware, RDF::Mongo::Repository.new\n @memory_rdf = SPARQL.execute(\"SELECT * WHERE { <#{MemoryRdf.for(@memory.item).subject.to_s}> ?p ?o }\", MemoryRdf.repository)\n \n @recommendations = Semantics::Recommendations.new.for_memory(@memory)\n\n @computer = Semantics::Recommendations.new.build_computer(@memory)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @memory }\n end\n end", "def index\n @memorizationpages = Memorizationpage.all\n end", "def index\n @materials = Material.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @materials }\n end\n end", "def get_memory_rasd_item(id)\n request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{id}/virtualHardwareSection/memory\"\n )\n end", "def index\n @page_title = \"Power Units\"\n @power_units = PowerUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @power_units }\n end\n end", "def index\n @med_insts = MedInst.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @med_insts }\n end\n end", "def index\n @mem_groups = MemGroup.page(params[:page]).per(10)\n end", "def index\n @mlog = MlogEntry.all\n @mlog_entries = @mlog.order(updated_at: :desc).page params[:page]\n @type_data = get_type_data(@mlog)\n @total_size = get_total_size(@type_data)\n @collections = getMinCollections\n @min_accessions = getMinAccessions\n end", "def new\n authorize! :create, Memory\n @memory = current_account.memories.new\n @memory.access = 'public'\n respond_with @memory\n end", "def index\n @stats = Stat.where(:match_id => params[:match_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stats }\n end\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end", "def show\n @materium = Materium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @materium }\n end\n end", "def show\n @memories = @pet.memories.paginate(:page => params[:page], :per_page => 5)\n end", "def show\n @menutree = Menutree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @menutree }\n end\n end", "def show\n @imovel = Imovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imovel }\n end\n end", "def show\n @frequentmag = Frequentmag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end", "def show\n @marmita = Marmita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @marmita }\n end\n end", "def show\n @mri_scan = MriScan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mri_scan }\n end\n end", "def new\n @rx_memory = RxMemory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rx_memory }\n end\n end", "def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def index\n @screens = Screen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @screens }\n end\n end", "def index\n @magazines = Magazine.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @magazines }\n end\n end", "def show\n @promos = Promos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @promos }\n end\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def new\n @memory = Memory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @memory }\n end\n end", "def index\n puts \"===> MC.index 0\"\n @musicians = Musician.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @musicians }\n end\n end", "def index\n @views = @ministry.views.find(:all, :order => _(:title, :view))\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @views.to_xml }\n end\n end", "def metar(id)\n perform_get(\"/metars/#{id}.xml\")\n end", "def show\n @mylist = Mylist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mylist }\n end\n end", "def index\r\n @medical_histories = MedicalHistory.all\r\n end", "def index\r\n @medical_histories = MedicalHistory.all\r\n end", "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rooms }\n end\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "def show\n @musica = Musica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @musica }\n end\n end", "def index\n @mensagens = Mensagem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mensagens }\n end\n end", "def show\n @man = Man.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @man }\n end\n end", "def index\n @text_memories = TextMemory.all\n end", "def index\n @text_memories = TextMemory.all\n end", "def index\n @modeles = Modele.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @modeles }\n end\n end", "def show\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @memo }\n end\n end", "def show\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @memo }\n end\n end", "def show\n @simulation = Rails.cache.read 'sim'\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simulation }\n end\n end", "def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end", "def show\n @mortgage = Mortgage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mortgage }\n end\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def show\n @membre = Membre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @membre }\n end\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def show\n @moto_model = MotoModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_model }\n end\n end", "def index\n @ministries = Ministry.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def show\n @gemm = Gemm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gemm }\n end\n end", "def show\n @measurement = Measurement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def show\n @mazo = Mazo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mazo }\n end\n end", "def index\n @pm_elements = PmElement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pm_elements }\n end\n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministerio }\n end\n end", "def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end", "def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end", "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to(memories_url) }\n format.xml { head :ok }\n end\n end", "def index\n @materia = Materium.where(:year => session[:current_year]).order(:nombre, :nivel)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @materia }\n end\n end", "def show\n @machine_information = MachineInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @machine_information }\n end\n end", "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "def show\n @medhistory = Medhistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medhistory }\n end\n end", "def index\n @m2s = M2.all\n end", "def index\n @atoms = Atom.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @atoms }\n end\n end", "def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @material }\n end\n end", "def index\n @membres = Membre.all\n end", "def show\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @medicamento }\n end\n end", "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagem }\n end\n end", "def show\n @drum_machine = DrumMachine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drum_machine }\n end\n end" ]
[ "0.6799529", "0.6764979", "0.6593381", "0.6550932", "0.63519", "0.62966657", "0.61530864", "0.6135297", "0.6117443", "0.6069675", "0.6008877", "0.5988488", "0.59492135", "0.5942312", "0.5935805", "0.5930901", "0.5892192", "0.588354", "0.5871794", "0.5861447", "0.5849239", "0.5846573", "0.582383", "0.5812172", "0.5746244", "0.5745171", "0.57422733", "0.5729579", "0.57252574", "0.57007366", "0.5699317", "0.5696907", "0.5692092", "0.5688537", "0.56857336", "0.56853044", "0.5672245", "0.5644312", "0.5639786", "0.56348765", "0.56167006", "0.5607446", "0.5603331", "0.5597467", "0.5593006", "0.5591402", "0.5587973", "0.5584755", "0.5584755", "0.55750453", "0.5571433", "0.55642694", "0.5558041", "0.5558041", "0.55437243", "0.55403614", "0.55399936", "0.5529617", "0.55279803", "0.5526817", "0.5526817", "0.5524655", "0.55188924", "0.55170155", "0.5511959", "0.5510682", "0.550953", "0.54981863", "0.54981863", "0.54907256", "0.5487223", "0.5487223", "0.54793257", "0.54667294", "0.54632556", "0.5457859", "0.54575527", "0.5441335", "0.5440088", "0.5436949", "0.5434366", "0.5431952", "0.54286736", "0.5420603", "0.5408198", "0.540438", "0.5399459", "0.5396699", "0.5396692", "0.53932375", "0.53923756", "0.5389798", "0.5380331", "0.53773195", "0.5371383", "0.53688097", "0.5363633", "0.53623605", "0.5359948", "0.5359276" ]
0.63960534
4
GET /memories/new GET /memories/new.xml
def new authorize! :create, Memory @memory = current_account.memories.new @memory.access = 'public' respond_with @memory end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @memory_models = MemoryModels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @memory_models }\n end\n end", "def new\n @memory = Memory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @memory }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @mileage = Mileage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mileage }\n end\n end", "def new\n @mall = Mall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mall }\n end\n end", "def new\n @tx_memory = TxMemory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx_memory }\n end\n end", "def new\n @menutree = Menutree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menutree }\n end\n end", "def new\n @man = Man.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @man }\n end\n end", "def new\n @imovel = Imovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @imovel }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @noami = Noami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noami }\n end\n end", "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @metabolite = Metabolite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @metabolite }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end", "def new\n @machine_historic = MachineHistoric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_historic }\n end\n end", "def new\n @promos = Promos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promos }\n end\n end", "def new\n @machine_mileage = MachineMileage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_mileage }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @resource }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @page }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end", "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end", "def new\n @rx_memory = RxMemory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rx_memory }\n end\n end", "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def new\n @mapping = Mapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mapping }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine }\n end\n end", "def new\n @p_stat = PStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p_stat }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @population = Population.new(:access_level => 'creator')\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @population }\n end\n end", "def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @universe = Universe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @universe }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @marmita = Marmita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @marmita }\n end\n end", "def new\n @local = Local.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @local }\n end\n end", "def new\n @mill = Mill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mill }\n end\n end", "def new\n @poem = Poem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def new\n @poem = Poem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def new\n @accessory = Accessory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @accessory }\n end\n end", "def new\n @accessory = Accessory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @accessory }\n end\n end", "def new\n @house = House.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house }\n end\n end", "def new\n @mriperformance = Mriperformance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mriperformance }\n end\n end", "def new\n @matter = Matter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @matter }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\n end", "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @room }\n end\n end", "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @room }\n end\n end", "def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sm }\n end\n end", "def new\n @machine = Machine.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def new\n @medio = Medio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @medio }\n end\n end", "def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def new\n @temp = Temp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temp }\n end\n end", "def new\n @frequentmag = Frequentmag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end", "def new\n @shelf = Shelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelf }\n end\n end", "def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n #TODO\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end", "def new\n @mbook = Admin::Mbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mbook }\n end\n end", "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @mortgage = Mortgage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mortgage }\n end\n end", "def new\n @ministry = Ministry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministry }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def new\n @localmap = Localmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @localmap }\n end\n end", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end", "def new\n @materium = Materium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @materium }\n end\n end", "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end", "def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @store }\n end\n end", "def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end", "def new\n @ministries = Ministries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @page }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end" ]
[ "0.72044355", "0.6867924", "0.68360865", "0.68360865", "0.6828115", "0.6819418", "0.6804412", "0.6779119", "0.67190415", "0.6692919", "0.66653115", "0.66644466", "0.66552806", "0.6649544", "0.6642455", "0.6622863", "0.6622267", "0.66117525", "0.6605893", "0.66031224", "0.660062", "0.6599437", "0.65883756", "0.65883756", "0.6585127", "0.6580749", "0.6580749", "0.6579301", "0.6568479", "0.6562874", "0.6539501", "0.6538305", "0.65325516", "0.6532281", "0.65308917", "0.65269357", "0.6519646", "0.6519646", "0.6519646", "0.6519646", "0.6519646", "0.6519646", "0.65186995", "0.65146774", "0.6501208", "0.65011126", "0.6499242", "0.64988685", "0.6498551", "0.6496322", "0.64962155", "0.64962155", "0.6492464", "0.6492464", "0.64907014", "0.6487869", "0.64815587", "0.64814293", "0.64790416", "0.64790416", "0.64788747", "0.64760375", "0.64720994", "0.64715236", "0.64708674", "0.6470746", "0.64699936", "0.64695364", "0.6461229", "0.6456491", "0.6455841", "0.6453837", "0.6450968", "0.64488804", "0.64480764", "0.6440291", "0.643796", "0.6435492", "0.64331836", "0.64331836", "0.64331836", "0.64331836", "0.64331836", "0.64331836", "0.64331836", "0.64331836", "0.6432216", "0.6432216", "0.64230865", "0.64222425", "0.6418254", "0.6416993", "0.6410833", "0.64104533", "0.6409725", "0.64090985", "0.6407255", "0.64031035", "0.64021015", "0.6399085" ]
0.6976083
1
POST /memories POST /memories.xml
def create @memory = current_account.memories.new(memory_params[:memory]) authorize! :create, Memory @memory.user = current_account if @memory.save add_flash :notice, 'Memory was successfully created.' respond_with @memory, :location => params[:destination].blank? ? memories_path : params[:destination] else respond_with @memory end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @memory_models = MemoryModels.new(params[:memory_models])\n\n respond_to do |format|\n if @memory_models.save\n flash[:notice] = 'MemoryModels was successfully created.'\n format.html { redirect_to(@memory_models) }\n format.xml { render :xml => @memory_models, :status => :created, :location => @memory_models }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @memory_models.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @memory = Memory.new(params[:memory])\n\n respond_to do |format|\n if @memory.save\n format.html { redirect_to @memory, :notice => 'Memory was successfully created.' }\n format.json { render :json => @memory, :status => :created, :location => @memory }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @memory = Memory.new(memory_params)\n\n respond_to do |format|\n if @memory.save\n format.html { redirect_to @memory, notice: 'Memory was successfully created.' }\n format.json { render :show, status: :created, location: @memory }\n else\n format.html { render :new }\n format.json { render json: @memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @memory = Memory.new(memory_params)\n\n respond_to do |format|\n if @memory.save\n format.html { redirect_to @memory, notice: \"Memory was successfully created.\" }\n format.json { render :show, status: :created, location: @memory }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @memories = Memory.all\n end", "def new\n authorize! :create, Memory\n @memory = current_account.memories.new\n @memory.access = 'public'\n respond_with @memory\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n @tx_memory = TxMemory.new(params[:tx_memory])\n\n respond_to do |format|\n if @tx_memory.save\n format.html { redirect_to(@tx_memory, :notice => 'Tx memory was successfully created.') }\n format.xml { render :xml => @tx_memory, :status => :created, :location => @tx_memory }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tx_memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @memory_models = MemoryModels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @memory_models }\n end\n end", "def index\n authorize! :view_memories, current_account\n if can? :manage_account, current_account\n @memories = current_account.memories\n else\n @memories = current_account.memories.where('access=?', 'public')\n end\n order = filter_sortable_column_order %w{sort_time name}\n order ||= '-sort_time'\n @tags = @memories.tag_counts_on(:tags).sort_by(&:name)\n if params[:tag] \n @memories = @memories.tagged_with(params[:tag])\n end\n @memories = @memories.order(order)\n respond_with @memories\n end", "def create\n @rx_memory = RxMemory.new(params[:rx_memory])\n\n respond_to do |format|\n if @rx_memory.save\n format.html { redirect_to(@rx_memory, :notice => 'Rx memory was successfully created.') }\n format.xml { render :xml => @rx_memory, :status => :created, :location => @rx_memory }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rx_memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @memos = Memo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @memos }\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def index\n @memories = Memory.paginate(page: params[:page], per_page: 4)\n end", "def create\n @master_memorial = Master::Memorial.new(master_memorial_params)\n\n respond_to do |format|\n if @master_memorial.save\n format.html { redirect_to master_memorials_path, notice: 'Memorial was successfully created.' }\n format.json { render :show, status: :created, location: @master_memorial }\n else\n format.html { render :new }\n format.json { render json: @master_memorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @menutree = Menutree.new(params[:menutree])\n\n respond_to do |format|\n if @menutree.save\n flash[:notice] = 'Menutree was successfully created.'\n format.html { redirect_to(@menutree) }\n format.xml { render :xml => @menutree, :status => :created, :location => @menutree }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menutree.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def new\n @memory = Memory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @memory }\n end\n end", "def create\n @memo = Memo.new(params[:memo])\n\n respond_to do |format|\n if @memo.save\n format.html { redirect_to(@memo, :notice => 'Memo was successfully created.') }\n format.xml { render :xml => @memo, :status => :created, :location => @memo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @memo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def memory_params\n params.require(:memory).permit(:published, :denied, :title, :description)\n end", "def create\n @text_memory = current_user.text_memories.new(text_memory_params)\n\n respond_to do |format|\n if @text_memory.save\n format.html { redirect_to @text_memory, notice: 'Text memory was successfully created.' }\n format.json { render :show, status: :created, location: @text_memory }\n else\n format.html { render :new }\n format.json { render json: @text_memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @memorizationpage = Memorizationpage.new(memorizationpage_params)\n\n respond_to do |format|\n if @memorizationpage.save\n format.html { redirect_to @memorizationpage, notice: 'Memorizationpage was successfully created.' }\n format.json { render :show, status: :created, location: @memorizationpage }\n else\n format.html { render :new }\n format.json { render json: @memorizationpage.errors, status: :unprocessable_entity }\n end\n end\n end", "def memory_params\n params.require(:memory).permit(:description, :image)\n end", "def index\n # MemoryForm作成\n # 3つのテキストボックス作成のために配列を用意しておく\n @memory_textboxes = (1..3).map do\n Memory.new\n end\n # Suggest用インデックス\n @memories_index = Memory.my_memory_index(current_user.id)\n\n @memories = Memory.paginate :page => params[:p], :per_page =>20,\n :conditions => [\"user_id = ?\", current_user.id],\n :order => \"created_at DESC\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @memories }\n end\n end", "def memory_params\n params.require(:memory).permit(:immortal_id, :in_diary, :lost)\n end", "def create\n @memo = @book.memos.build(params[:memo])\n\n respond_to do |format|\n if @memo.save\n format.html { redirect_to @book, notice: 'Memo was successfully created.' }\n format.json { render json: @memo, status: :created, location: @memo }\n else\n format.html { render 'books/show' }\n format.json { render json: @memo.errors, status: :unprocessable_entity }\n end\n end\n end", "def memory_params\n params.require(:memory).permit(:ram_type, :name, :link, :dollar_price, :euro_price, :sticks, :capacity, :score, :spreadsheet, :picture)\n end", "def create\n @machine_mileage = MachineMileage.new(params[:machine_mileage])\n\n respond_to do |format|\n if @machine_mileage.save\n format.html { redirect_to(@machine_mileage, :notice => 'Machine mileage was successfully created.') }\n format.xml { render :xml => @machine_mileage, :status => :created, :location => @machine_mileage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @machine_mileage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @tx_memory = TxMemory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx_memory }\n end\n end", "def index\n @memorizationpages = Memorizationpage.all\n end", "def create\n @memo = Memo.new(memo_params)\n @memo.save\n @memos = Memo.all.order(id: \"DESC\")\n memo_list = []\n for memo in @memos\n user = memo.user.name\n memo_list << {\n memo: memo,\n user: user\n }\n end\n render json: memo_list\n # render json: @memos\n end", "def create\n @mileagelog = Mileagelog.new(mileagelog_params)\n\n respond_to do |format|\n if @mileagelog.save\n format.html { redirect_to @mileagelog, notice: 'Mileagelog was successfully created.' }\n format.json { render :show, status: :created, location: @mileagelog }\n else\n format.html { render :new }\n format.json { render json: @mileagelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @rx_memory = RxMemory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rx_memory }\n end\n end", "def create\n @mailee_list = Mailee::List.new(params[:mailee_list])\n\n respond_to do |format|\n if @mailee_list.save\n format.html { redirect_to(@mailee_list, :notice => 'Mailee list was successfully created.') }\n format.xml { render :xml => @mailee_list, :status => :created, :location => @mailee_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mailee_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @memory_slot = MemorySlot.new(memory_slot_params)\n\n respond_to do |format|\n if @memory_slot.save\n format.html { redirect_to @memory_slot, notice: 'Memory slot was successfully created.' }\n format.json { render :show, status: :created, location: @memory_slot }\n else\n format.html { render :new }\n format.json { render json: @memory_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to(memories_url) }\n format.xml { head :ok }\n end\n end", "def create\n @mill = Mill.new(params[:mill])\n\n respond_to do |format|\n if @mill.save\n format.html { redirect_to @mill, notice: 'Mill was successfully created.' }\n format.json { render json: @mill, status: :created, location: @mill }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @text_memory = TextMemory.new(text_memory_params)\n\n respond_to do |format|\n if @text_memory.save\n format.html { redirect_to @text_memory, notice: 'Text memory was successfully created.' }\n format.json { render :show, status: :created, location: @text_memory }\n else\n format.html { render :new }\n format.json { render json: @text_memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def memory_params\n params.require(:memory).permit(:text, :title, :date, :subtitle)\n end", "def memory_params\n params.require(:memory).permit(:title, :caption, :date, :label, :address, :latitude, :longitude, :avatar)\n end", "def post\n resource.post(request, response)\n end", "def create\n @medhistory = Medhistory.new(params[:medhistory])\n\n respond_to do |format|\n if @medhistory.save\n format.html { redirect_to @medhistory, :notice => 'Medhistory was successfully created.' }\n format.json { render :json => @medhistory, :status => :created, :location => @medhistory }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medhistory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def POST; end", "def index\n @memos = @book.memos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memos }\n end\n end", "def create\n \r\n current_user.readings.create(:listing_id => params[:listing_id])\r\n respond_to do |format|\r\n #need to call create on a listing to increment counter\n format.xml { head :ok }\r\n end\r\n \n end", "def create\n @mobs_nano = MobsNano.new(params[:mobs_nano])\n\n respond_to do |format|\n if @mobs_nano.save\n flash[:notice] = 'MobsNano was successfully created.'\n format.html { redirect_to mobs_nano_url(@mobs_nano) }\n format.xml { head :created, :location => mobs_nano_url(@mobs_nano) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mobs_nano.errors.to_xml }\n end\n end\n end", "def create\n @documentacion = Documentacion.new(documentacion_params)\n @documentacion.mem = @mem\n\n respond_to do |format|\n if @documentacion.save\n format.html { redirect_to @documentacion.mem, notice: 'Documentación subida correctamente.' }\n format.json { render :show, status: :created, location: @documentacion }\n else\n #format.html { render :new }\n format.json { render json: @documentacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @items_mob = ItemsMob.new(params[:items_mob])\n\n respond_to do |format|\n if @items_mob.save\n flash[:notice] = 'ItemsMob was successfully created.'\n format.html { redirect_to items_mob_url(@items_mob) }\n format.xml { head :created, :location => items_mob_url(@items_mob) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @items_mob.errors.to_xml }\n end\n end\n end", "def create\n @memo = Memo.new(params[:memo])\n\n respond_to do |format|\n if @memo.save\n format.html { redirect_to \"/#{@memo.model_name}/#{@memo.model_id}/edit/\", notice: 'Memo was successfully created.' }\n format.json { render json: @memo, status: :created, location: @memo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @memo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @men_accessory = MenAccessory.new(men_accessory_params)\n\n respond_to do |format|\n if @men_accessory.save\n format.html { redirect_to @men_accessory, notice: 'Men accessory was successfully created.' }\n format.json { render :show, status: :created, location: @men_accessory }\n else\n format.html { render :new }\n format.json { render json: @men_accessory.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def personal_memory_params\n params.require(:personal_memory).permit(:title, :memory, :location, :time, :user_id, :date)\n end", "def ems\n GatewayMessage.store( params[:xml] )\n render :text => 'OK'\n end", "def create\n @hikiyama = Hikiyama.new(params[:hikiyama])\n\n respond_to do |format|\n if @omatsuri.hikiyamas << @hikiyama\n flash[:notice] = 'Hikiyama was successfully created.'\n format.html { redirect_to(@omatsuri) }\n format.xml { render :xml => @hikiyama, :status => :created, :location => @omatsuri }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hikiyama.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @mstore = Mstore.new(mstore_params)\n\n respond_to do |format|\n if @mstore.save\n format.html { redirect_to @mstore, notice: 'Mstore was successfully created.' }\n format.json { render :show, status: :created, location: @mstore }\n else\n format.html { render :new }\n format.json { render json: @mstore.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @medical_history = MedicalHistory.new(medical_history_params)\r\n\r\n respond_to do |format|\r\n if @medical_history.save\r\n format.html { redirect_to @medical_history, notice: 'Historial medico creado con exito.' }\r\n format.json { render :show, status: :created, location: @medical_history }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def index\n @text_memories = TextMemory.all\n end", "def index\n @text_memories = TextMemory.all\n end", "def create\n @mall = Mall.new(params[:mall])\n\n respond_to do |format|\n if @mall.save\n format.html { redirect_to(@mall, :notice => 'Mall was successfully created.') }\n format.xml { render :xml => @mall, :status => :created, :location => @mall }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mall.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @mile = Mile.new(mile_params)\n\n respond_to do |format|\n if @mile.save\n format.html { redirect_to @mile, notice: 'Mile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mile }\n else\n format.html { render action: 'new' }\n format.json { render json: @mile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medio = Medio.new(params[:medio])\n\n respond_to do |format|\n if @medio.save\n flash[:notice] = 'Medio was successfully created.'\n format.html { redirect_to(@medio) }\n format.xml { render :xml => @medio, :status => :created, :location => @medio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @machine_mileage = MachineMileage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_mileage }\n end\n end", "def create\n @memo = Memo.new(memo_params)\n @memo.add_category(params[:category_new])\n\n respond_to do |format|\n if @memo.save\n format.html { redirect_to @memo, notice: 'Memo was successfully created.' }\n format.json { render :show, status: :created, location: @memo }\n else\n format.html { render :new }\n format.json { render json: @memo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @forms_menutree = FormsMenutree.new(params[:forms_menutree])\n\n respond_to do |format|\n if @forms_menutree.save\n flash[:notice] = 'FormsMenutree was successfully created.'\n format.html { redirect_to(@forms_menutree) }\n format.xml { render :xml => @forms_menutree, :status => :created, :location => @forms_menutree }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @forms_menutree.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @metabolite = Metabolite.new(params[:metabolite])\n\n respond_to do |format|\n if @metabolite.save\n flash[:notice] = 'Metabolite was successfully created.'\n format.html { redirect_to(@metabolite) }\n format.xml { render :xml => @metabolite, :status => :created, :location => @metabolite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @metabolite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def persist_in_xml\n\nend", "def create\n @turbo_memoid = TurboMemoid.new(params[:turbo_memoid])\n\n respond_to do |format|\n if @turbo_memoid.save\n format.html { redirect_to @turbo_memoid, notice: 'Turbo memoid was successfully created.' }\n format.json { render json: @turbo_memoid, status: :created, location: @turbo_memoid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turbo_memoid.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to memories_url }\n format.json { head :ok }\n end\n end", "def create\n @materium = Materium.new(params[:materium])\n\n respond_to do |format|\n if @materium.save\n format.html { redirect_to(@materium, :notice => 'Materium was successfully created.') }\n format.xml { render :xml => @materium, :status => :created, :location => @materium }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @materium.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def create\n @promos = Promos.new(params[:promos])\n\n respond_to do |format|\n if @promos.save\n flash[:notice] = 'Promos was successfully created.'\n format.html { redirect_to(@promos) }\n format.xml { render :xml => @promos, :status => :created, :location => @promos }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @promos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @mileage = Mileage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mileage }\n end\n end", "def create\n @memento = Memento.new(memento_params)\n\n respond_to do |format|\n if @memento.save\n format.html { redirect_to @memento, notice: 'Memento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @memento }\n else\n format.html { render action: 'new' }\n format.json { render json: @memento.errors, status: :unprocessable_entity }\n end\n end\n end", "def memory_params\n params.require(:memory).permit(:brand, :name, :speed, :size, :color, :cas_latency, :price)\n end", "def create\n megam_rest.post_appdefn(to_hash)\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(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def manage\n @memorials = Memorial.find_all_by_user_id(@session[:user].id)\n end", "def create\n @node_history = NodeHistory.new(node_history_params)\n\n respond_to do |format|\n if @node_history.save\n format.html { redirect_to @node_history, notice: 'Node history was successfully created.' }\n format.json { render :show, status: :created, location: @node_history }\n else\n format.html { render :new }\n format.json { render json: @node_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def index\n @mem_groups = MemGroup.page(params[:page]).per(10)\n end", "def update\n @memory = current_account.memories.find(params[:id])\n authorize! :update, @memory\n params[:memory].delete(:user_id)\n if @memory.update_attributes(memory_params[:memory])\n add_flash :notice, 'Memory was successfully updated.'\n respond_with @memory, :location => memories_path\n else\n respond_with @memory\n end\n end", "def create\n @mbook = Admin::Mbook.new(params[:mbook])\n\n respond_to do |format|\n if @mbook.save\n flash[:notice] = 'Admin::Mbook was successfully created.'\n format.html { redirect_to(@mbook) }\n format.xml { render :xml => @mbook, :status => :created, :location => @mbook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mbook.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_rest\n @item_usage = ItemUsage.new(params[:item_usage])\n\n respond_to do |format|\n if @item_usage.save\n flash[:notice] = 'ItemUsage was successfully created.'\n format.html { redirect_to(@item_usage) }\n format.xml { render :xml => @item_usage, :status => :created, :location => @item_usage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @mlog = MlogEntry.all\n @mlog_entries = @mlog.order(updated_at: :desc).page params[:page]\n @type_data = get_type_data(@mlog)\n @total_size = get_total_size(@type_data)\n @collections = getMinCollections\n @min_accessions = getMinAccessions\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def create\n @moretinymobtrail = Moretinymobtrail.new(params[:moretinymobtrail])\n\n respond_to do |format|\n if @moretinymobtrail.save\n format.html { redirect_to @moretinymobtrail, notice: 'Moretinymobtrail was successfully created.' }\n format.json { render json: @moretinymobtrail, status: :created, location: @moretinymobtrail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymobtrail.errors, status: :unprocessable_entity }\n end\n end\n end", "def nmap_save()\n print_status \"Nmap: saving nmap log file\"\n fh = self.nmap_log[0]\n nmap_data = fh.read(fh.stat.size)\n saved_path = store_local(\"nmap.scan.xml\", \"text/xml\", nmap_data, \"nmap_#{Time.now.utc.to_i}.xml\")\n print_status \"Saved NMAP XML results to #{saved_path}\"\nend", "def index\n @master_memorials = Master::Memorial.all\n end", "def new\n @menutree = Menutree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menutree }\n end\n end", "def createNode\n if !session[:user_id] and !session[:am].nil?\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n roomname = params[:createnode][\"roomname\"]\n collectionname = params[:createnode][\"collectionname\"]\n nodename = params[:createnode][\"nodename\"]\n\n #hash map key is CASE SENSITIVE\n configuration = Hash.new(\"configuration\")\n configuration[\"persistItems\"] = ((params[:createnode][\"persistitems\"]) == \"true\")? true:false\n configuration[\"userDependentItems\"] = ((params[:createnode][\"userdependentitems\"]) == \"true\")? true:false\n configuration[\"publishModel\"] = (params[:createnode][\"publishmodel\"]).to_i\n configuration[\"lazySubscription\"] = ((params[:createnode][\"lazysubscription\"]) == \"true\")? true:false\n configuration[\"allowPrivateMessages\"] = ((params[:createnode][\"allowprivatemessages\"]) == \"true\")? true:false\n configuration[\"modifyAnyItem\"] =( (params[:createnode][\"modifyanyitem\"]) == \"true\")? true:false\n configuration[\"accessModel\"] = (params[:createnode][\"accessmodel\"]).to_i\n configuration[\"itemStorageScheme\"] = (params[:createnode][\"itemstoragescheme\"]).to_i\n configuration[\"sessionDependentItems\"] = ((params[:createnode][\"sessiondependentitems\"]) == \"true\")? true:false\n configuration[\"p2pDataMessaging\"] =((params[:createnode][\"p2pdatamessaging\"]) == \"true\")? true:false\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n\n myroominfo = am.getRoomInfo(roomname)\n if(!myroominfo.nil? and myroominfo.isConnected == true)\n result = am.createNode(roomname, collectionname, nodename, configuration)\n flash[:result] = \"createNode result success: \" + result + \" \" + acc.roomURL + \" \" + collectionname + \" \" + nodename\n else\n result = \"Room is shutdown, this feature only available when room is started.\"\n flash[:notice] = result\n end\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n\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 set_memorial\n @memorial = Memorial.find(params[:id])\n end", "def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end" ]
[ "0.6091765", "0.5966113", "0.5909013", "0.59001017", "0.5876687", "0.5805373", "0.5751909", "0.5682716", "0.5625541", "0.55786455", "0.55786043", "0.5555427", "0.55526555", "0.55523294", "0.5503384", "0.54861456", "0.54226923", "0.5407255", "0.5358719", "0.53322107", "0.5321765", "0.5306251", "0.5270462", "0.52683914", "0.5257496", "0.52390957", "0.5238983", "0.52375454", "0.5215574", "0.5215321", "0.5214225", "0.51932037", "0.5174666", "0.515872", "0.5144557", "0.5131178", "0.5128904", "0.50897163", "0.5068364", "0.5064071", "0.5051351", "0.50435543", "0.5042523", "0.5039061", "0.50382864", "0.50177103", "0.49985614", "0.49913707", "0.4983258", "0.49815086", "0.49767324", "0.49767324", "0.49767324", "0.49767324", "0.49767324", "0.49767324", "0.49767324", "0.49661514", "0.49654052", "0.49638787", "0.4931952", "0.492448", "0.4916257", "0.4916257", "0.4907677", "0.49027812", "0.49026915", "0.49016273", "0.4900199", "0.48989743", "0.4896219", "0.48927552", "0.48891464", "0.4887567", "0.48841074", "0.48826575", "0.48804504", "0.48796755", "0.4878459", "0.48745206", "0.48571983", "0.48482195", "0.48435023", "0.48415583", "0.48409364", "0.483194", "0.48279336", "0.48227116", "0.48178318", "0.4814045", "0.4813906", "0.48132527", "0.4809242", "0.48024", "0.48023152", "0.47967637", "0.4796693", "0.47948804", "0.4794691", "0.47900325" ]
0.61654025
0
PUT /memories/1 PUT /memories/1.xml
def update @memory = current_account.memories.find(params[:id]) authorize! :update, @memory params[:memory].delete(:user_id) if @memory.update_attributes(memory_params[:memory]) add_flash :notice, 'Memory was successfully updated.' respond_with @memory, :location => memories_path else respond_with @memory end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @memory = Memory.find(params[:id])\n\n respond_to do |format|\n if @memory.update_attributes(params[:memory])\n flash[:notice] = 'Memory was successfully updated.'\n format.html { redirect_to(@memory) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @memory = Memory.find(params[:id])\n\n respond_to do |format|\n if @memory.update_attributes(params[:memory])\n format.html { redirect_to @memory, :notice => 'Memory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @memory_models = MemoryModels.find(params[:id])\n\n respond_to do |format|\n if @memory_models.update_attributes(params[:memory_models])\n flash[:notice] = 'MemoryModels was successfully updated.'\n format.html { redirect_to(@memory_models) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @memory_models.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tx_memory = TxMemory.find(params[:id])\n\n respond_to do |format|\n if @tx_memory.update_attributes(params[:tx_memory])\n format.html { redirect_to(@tx_memory, :notice => 'Tx memory was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tx_memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @memory.update(memory_params)\n format.html { redirect_to @memory, notice: 'Memory was successfully updated.' }\n format.json { render :show, status: :ok, location: @memory }\n else\n format.html { render :edit }\n format.json { render json: @memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rx_memory = RxMemory.find(params[:id])\n\n respond_to do |format|\n if @rx_memory.update_attributes(params[:rx_memory])\n format.html { redirect_to(@rx_memory, :notice => 'Rx memory was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rx_memory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @memory.update(memory_params)\n format.html { redirect_to @memory, notice: \"Memory was successfully updated.\" }\n format.json { render :show, status: :ok, location: @memory }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n if @memo.update_attributes(params[:memo])\n format.html { redirect_to(@memo, :notice => 'Memo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @memo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def set_memory\n @memory = Memory.find(params[:id])\n end", "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to(memories_url) }\n format.xml { head :ok }\n end\n end", "def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n respond_to do |format|\n if @memory.update(memory_params)\n format.html {redirect_to @memory, notice: 'Memory was successfully updated.'}\n else\n format.html {render :edit} \n end\n end\n end", "def update\n respond_to do |format|\n if @memory_slot.update(memory_slot_params)\n format.html { redirect_to @memory_slot, notice: 'Memory slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @memory_slot }\n else\n format.html { render :edit }\n format.json { render json: @memory_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to(@ministerio, :notice => 'Ministerio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mobs_nano = MobsNano.find(params[:id])\n\n respond_to do |format|\n if @mobs_nano.update_attributes(params[:mobs_nano])\n flash[:notice] = 'MobsNano was successfully updated.'\n format.html { redirect_to mobs_nano_url(@mobs_nano) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mobs_nano.errors.to_xml }\n end\n end\n end", "def update\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n if @mill.update_attributes(params[:mill])\n format.html { redirect_to @mill, notice: 'Mill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n if @memo.update_attributes(params[:memo])\n format.html { redirect_to @memo, notice: 'Memo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @memo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @turbo_memoid = TurboMemoid.find(params[:id])\n\n respond_to do |format|\n if @turbo_memoid.update_attributes(params[:turbo_memoid])\n format.html { redirect_to @turbo_memoid, notice: 'Turbo memoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @turbo_memoid.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n @memo = Memo.find(params[:id])\n\n respond_to do |format|\n if @memo.update_attributes(params[:memo])\n format.html { redirect_to \"/#{@memo.model_name}/#{@memo.model_id}/edit/\", notice: 'Memo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @memo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @promos = Promos.find(params[:id])\n\n respond_to do |format|\n if @promos.update_attributes(params[:promos])\n flash[:notice] = 'Promos was successfully updated.'\n format.html { redirect_to(@promos) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @promos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n enforce_permissions!('update', params[:id])\n\n param = params[:xml].presence || params[:metadata_file].presence\n\n if param\n xml_ds = XmlDatastream.new\n xml_ds.load_xml(param)\n else\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n redirect_to controller: 'catalog', action: 'show', id: params[:id]\n return\n end\n\n @object = retrieve_object!(params[:id])\n @errors = nil\n\n unless can? :update, @object\n raise Hydra::AccessDenied.new(t('dri.flash.alert.edit_permission'), :edit, '')\n end\n\n @object.update_metadata xml_ds.xml\n if @object.valid?\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n begin\n raise DRI::Exceptions::InternalError unless @object.attached_files[:descMetadata].save\n rescue RuntimeError => e\n logger.error \"Could not save descMetadata for object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n else\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n @errors = @object.errors.full_messages.inspect\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['descMetadata','properties'])\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: params[:id] }\n format.json { render json: @object }\n format.text do\n response = if @errors\n t('dri.flash.alert.invalid_object', error: @errors)\n else\n t('dri.flash.notice.metadata_updated')\n end\n\n render text: response\n end\n end\n end", "def update\n @mileage = Mileage.find(params[:id])\n\n respond_to do |format|\n if @mileage.update_attributes(params[:mileage])\n format.html { redirect_to(@mileage, :notice => 'Mileage was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mileage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @memo.update(memo_params)\n @memos = Memo.all.order(id: \"DESC\")\n memo_list = []\n for memo in @memos\n user = memo.user.name\n memo_list << {\n memo: memo,\n user: user\n }\n end\n render json: memo_list\n # render json: @memos\n end", "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to memories_url }\n format.json { head :ok }\n end\n end", "def update\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n if @medio.update_attributes(params[:medio])\n flash[:notice] = 'Medio was successfully updated.'\n format.html { redirect_to(@medio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @memories = Memory.all\n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to(@mall, :notice => 'Mall was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mall.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 set_memorial\n @memorial = Memorial.find(params[:id])\n end", "def index\n @memos = Memo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @memos }\n end\n end", "def update\n @machine_mileage = MachineMileage.find(params[:id])\n\n respond_to do |format|\n if @machine_mileage.update_attributes(params[:machine_mileage])\n format.html { redirect_to(@machine_mileage, :notice => 'Machine mileage was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @machine_mileage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_memorial\n \t@memorial = Memorial.find(params[:id])\n \tend", "def update\n @magazine = Magazine.find(params[:id])\n\n respond_to do |format|\n if @magazine.update_attributes(params[:magazine])\n flash[:notice] = 'Magazine was successfully updated.'\n format.html { redirect_to(@magazine) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @magazine.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @menutree = Menutree.find(params[:id])\n\n respond_to do |format|\n if @menutree.update_attributes(params[:menutree])\n flash[:notice] = 'Menutree was successfully updated.'\n format.html { redirect_to(@menutree) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @menutree.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @marmita = Marmita.find(params[:id])\n\n respond_to do |format|\n if @marmita.update_attributes(params[:marmita])\n format.html { redirect_to(@marmita, :notice => 'Marmita was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @marmita.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(resource_name, id, params, locale = nil)\n params_name = resource_name.to_s.split('/').last.singularize\n\n query = { query: { params_name => params } }\n\n query[:query][:locale] = locale if locale\n\n response = Locomotive::Mounter::EngineApi.put(\"/#{resource_name}/#{id}.json\", query)\n data = response.parsed_response\n\n if response.success?\n self.raw_data_to_object(data)\n else\n message = data\n\n message = data.map do |attribute, errors|\n \" #{attribute} => #{[*errors].join(', ')}\" #.colorize(color: :red)\n end.join(\"\\n\") if data.respond_to?(:keys)\n\n raise WriterException.new(message)\n\n # data.each do |attribute, errors|\n # self.log \"\\t\\t #{attribute} => #{[*errors].join(', ')}\".colorize(color: :red)\n # end if data.respond_to?(:keys)\n # nil\n end\n end", "def update\n @metabolite = Metabolite.find(params[:id])\n\n respond_to do |format|\n if @metabolite.update_attributes(params[:metabolite])\n flash[:notice] = 'Metabolite was successfully updated.'\n format.html { redirect_to(@metabolite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @metabolite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @materium = Materium.find(params[:id])\n\n respond_to do |format|\n if @materium.update_attributes(params[:materium])\n format.html { redirect_to(@materium, :notice => 'Materium was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @materium.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end", "def update\n @frequentmag = Frequentmag.find(params[:id])\n\n respond_to do |format|\n if @frequentmag.update_attributes(params[:frequentmag])\n format.html { redirect_to(@frequentmag, :notice => 'Frequentmag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequentmag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @moretinymap = Moretinymap.find(params[:id])\n\n respond_to do |format|\n if @moretinymap.update_attributes(params[:moretinymap])\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mazo = Mazo.find(params[:id])\n\n respond_to do |format|\n if @mazo.update_attributes(params[:mazo])\n format.html { redirect_to(@mazo, :notice => 'Mazo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mazo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \n @machine = Machine.find(params[:id])\n \n respond_to do |format|\n if @machine.update_attributes(params[:machine])\n \n flash[:notice] = 'Machine was successfully updated.'\n format.html { redirect_to machines_path() }\n format.xml { head :ok }\n format.atom { head :ok } \n else\n format.html { @machines = Machine.all \n render :action => \"index\" }\n format.xml { render :xml => @machine.errors, :status => :unprocessable_entity }\n format.atom { render :xml => @machine.errors.to_xml, :status => :not_acceptable }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opml_metadata = OpmlMetadata.find(params[:id])\n\n respond_to do |format|\n if @opml_metadata.update_attributes(params[:opml_metadata])\n flash[:notice] = 'OpmlMetadata was successfully updated.'\n format.html { redirect_to(@opml_metadata) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opml_metadata.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @myspace = Myspace.find(params[:id])\n\n respond_to do |format|\n if @myspace.update_attributes(params[:myspace])\n format.html { redirect_to @myspace, notice: 'Myspace was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myspace.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @memory = current_account.memories.new(memory_params[:memory])\n authorize! :create, Memory\n @memory.user = current_account\n if @memory.save\n add_flash :notice, 'Memory was successfully created.'\n respond_with @memory, :location => params[:destination].blank? ? memories_path : params[:destination]\n else\n respond_with @memory\n end\n end", "def new\n authorize! :create, Memory\n @memory = current_account.memories.new\n @memory.access = 'public'\n respond_with @memory\n end", "def update\n respond_to do |format|\n if @mile.update(mile_params)\n format.html { redirect_to @mile, notice: 'Mile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mile.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @master_memorial.update(master_memorial_params)\n format.html { redirect_to @master_memorial, notice: 'Memorial was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_memorial }\n else\n format.html { render :edit }\n format.json { render json: @master_memorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moto_model = MotoModel.find(params[:id])\n\n respond_to do |format|\n if @moto_model.update_attributes(params[:moto_model])\n format.html { redirect_to(@moto_model, :notice => 'Moto model was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @moto_model.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mailee_list = Mailee::List.find(params[:id])\n\n respond_to do |format|\n if @mailee_list.update_attributes(params[:mailee_list])\n format.html { redirect_to(@mailee_list, :notice => 'Mailee list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mailee_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\r\n @uom = Uom.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @uom.update_attributes(params[:uom])\r\n format.html { redirect_to(@uom, :notice => 'Uom was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n \r\n end\r\n end\r\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n if @metum.update_attributes(params[:metum])\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interface = Interface.find(params[:id])\n @virtualmachine = Virtualmachine.find(@interface.virtualmachine_id)\n position_networkcard = `cat /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml | grep -n \"slot='0x#{@interface.pci_slot}\" | cut -d ':' -f1`\n begin_networkcard = position_networkcard.to_i - 4\n end_networkcard = position_networkcard.to_i + 1\n\n delete_networkcard = `sed -i '#{begin_networkcard},#{end_networkcard}d' /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml`\n filesize = `cat /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml | wc -l`\n filesize = filesize.to_i - 2 \n\n #inserts interface definition\n\n #place xml insertions here\n respond_to do |format|\n if @interface.update_attributes(params[:interface])\n interface_network_id = @interface.network_id\n @network = Network.find(interface_network_id)\n ifacedata = \"<interface type='network'>\\n<mac address='#{@interface.macaddress}'/>\\n<source network='#{@network.name}'/>\\n<model type='pcnet'/>\\n<address type='pci' domain='0x0000' bus='0x00' slot='0x#{@interface.pci_slot}' function='0x0'/>\\n</interface>\"\n write_at(\"/etc/libvirt/qemu/#{@virtualmachine.hostname}.xml\", filesize, ifacedata)\n format.html { redirect_to @interface, :notice => 'Interface was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interface.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @m1.update(m1_params)\n format.html { redirect_to @m1, notice: 'M1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @m1 }\n else\n format.html { render :edit }\n format.json { render json: @m1.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, **args); end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to @mall, notice: 'Mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(request)\n error = validate(request)\n return error if error\n\n code =\n if data_store.exists?(request.rest_path)\n set_data(request, request.rest_path, request.body, :data_store_exceptions)\n 200\n else\n name = request.rest_path[4]\n data_store.create(request.rest_path[0..3], name, request.body, :create_dir)\n 201\n end\n already_json_response(code, request.body)\n end", "def persist_in_xml\n\nend", "def update\n @imovel = Imovel.find(params[:id])\n\n respond_to do |format|\n if @imovel.update_attributes(params[:imovel])\n format.html { redirect_to(@imovel, :notice => 'Imovel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @imovel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @text_memory.update(text_memory_params)\n format.html { redirect_to @text_memory, notice: 'Text memory was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_memory }\n else\n format.html { render :edit }\n format.json { render json: @text_memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @text_memory.update(text_memory_params)\n format.html { redirect_to @text_memory, notice: 'Text memory was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_memory }\n else\n format.html { render :edit }\n format.json { render json: @text_memory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n if @medio.update_attributes(params[:medio])\n format.html { redirect_to @medio, :notice => 'Medio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @noami = Noami.find(params[:id])\n\n respond_to do |format|\n if @noami.update_attributes(params[:noami])\n format.html { redirect_to(@noami, :notice => 'Noami was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @noami.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ministry = Ministry.find(params[:id])\n\n respond_to do |format|\n if @ministry.update_attributes(params[:ministry])\n flash[:notice] = 'Ministry was successfully updated.'\n format.html { redirect_to(@ministry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.62417144", "0.5981071", "0.5956824", "0.5720279", "0.5678719", "0.56699955", "0.5663539", "0.5594048", "0.5581706", "0.5503542", "0.5426321", "0.54036367", "0.54036367", "0.54036367", "0.54036367", "0.54036367", "0.54036367", "0.54036367", "0.53663146", "0.53498006", "0.5342534", "0.53340566", "0.53187984", "0.5271597", "0.52629787", "0.5260749", "0.5252131", "0.52351743", "0.5234271", "0.5227751", "0.522155", "0.520078", "0.51977664", "0.51913565", "0.5180863", "0.5176392", "0.5173558", "0.51486397", "0.51428485", "0.51199627", "0.51108634", "0.50923526", "0.5090179", "0.5085549", "0.5078606", "0.50689024", "0.5048207", "0.50438744", "0.5034239", "0.50307304", "0.502961", "0.5024941", "0.502217", "0.5022061", "0.5011278", "0.49928743", "0.49889678", "0.49872804", "0.49800807", "0.4974917", "0.4971373", "0.49695233", "0.49686268", "0.49655512", "0.49604756", "0.495955", "0.4958446", "0.4957937", "0.49488127", "0.49480715", "0.4946542", "0.49412546", "0.49316543", "0.49305567", "0.49201038", "0.49199826", "0.49031004", "0.49012873", "0.4898505", "0.48977673", "0.4892104", "0.48891678", "0.48848364", "0.4874683", "0.48721436", "0.48709428", "0.48706812", "0.48689157", "0.48687288", "0.48650292", "0.48598737", "0.48587233", "0.4855227", "0.4853999", "0.48509225", "0.48509225", "0.48445362", "0.48439428", "0.48412848", "0.48388496" ]
0.6059317
1
DELETE /memories/1 DELETE /memories/1.xml
def destroy @memory = current_account.memories.find(params[:id]) authorize! :delete, @memory @memory.destroy respond_to do |format| format.html { go_to(memories_url) } format.any { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to(memories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tx_memory = TxMemory.find(params[:id])\n @tx_memory.destroy\n\n respond_to do |format|\n format.html { redirect_to(tx_memories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @memo = Memo.find(params[:id])\n @memo.destroy\n\n respond_to do |format|\n format.html { redirect_to(memos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rx_memory = RxMemory.find(params[:id])\n @rx_memory.destroy\n\n respond_to do |format|\n format.html { redirect_to(rx_memories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @memory = Memory.find(params[:id])\n @memory.destroy\n\n respond_to do |format|\n format.html { redirect_to memories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @metabolite = Metabolite.find(params[:id])\n @metabolite.destroy\n\n respond_to do |format|\n format.html { redirect_to(metabolites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @memo = Memo.find(params[:id])\n @memo.destroy\n\n respond_to do |format|\n format.html { redirect_to memos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall = Mall.find(params[:id])\n @mall.destroy\n\n respond_to do |format|\n format.html { redirect_to(malls_url) }\n format.xml { head :ok }\n end\n end", "def destroy; delete end", "def destroy\n @memory.destroy\n respond_to do |format|\n format.html { redirect_to memories_url, notice: 'Memory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @memory.destroy\n respond_to do |format|\n format.html { redirect_to memories_url, notice: \"Memory was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def rm path\n end", "def rm(*path)\n super; on_success{ nil }\n end", "def destroy\n @memo = @book.memos.find(params[:id])\n @memo.destroy\n\n respond_to do |format|\n format.html { redirect_to book_url(@book) }\n format.json { head :no_content }\n end\n end", "def delete(name); end", "def delete(name); end", "def destroy\n @menutree = Menutree.find(params[:id])\n @menutree.destroy\n\n respond_to do |format|\n format.html { redirect_to(menutrees_url) }\n format.xml { head :ok }\n end\n end", "def delete_from_disk; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy\n @promos = Promos.find(params[:id])\n @promos.destroy\n\n respond_to do |format|\n format.html { redirect_to(promos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def del\n delete\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n file_store = FileStore.find_by_sha1_hash!(params[:id])\n if user['id'] == file_store.user_id || user['role'] == 'admin' ||\n (user['uname'] == 'file_store' && user['role'] == 'system')\n file_store.destroy\n head :no_content\n else\n render_error 403\n end\n end", "def destroy\n @stat.destroy\n\n head :no_content\n end", "def delete(name)\n\n end", "def destroy\n @my = My.find(params[:id])\n @my.destroy\n\n respond_to do |format|\n format.html { redirect_to(mies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @materium = Materium.find(params[:id])\n @materium.destroy\n\n respond_to do |format|\n format.html { redirect_to(materia_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @memo = Memo.find(params[:id])\n @memo.destroy\n @memos = Memo.find(:all, :conditions => [\"p_next = ?\", @p_current], :order=>'t_next DESC')\n @memos_delayed = Memo.find(:all, :conditions => [\"p_next < ?\", @p_current], :order=>'t_next DESC')\n\n respond_to do |format|\n format.html { redirect_to(memos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @miscellaneous_child = MiscellaneousChild.find(params[:id])\n @miscellaneous_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_children_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mazo = Mazo.find(params[:id])\n @mazo.destroy\n\n respond_to do |format|\n format.html { redirect_to(mazos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @medio = Medio.find(params[:id])\n @medio.destroy\n\n respond_to do |format|\n format.html { redirect_to(medios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mobs_nano = MobsNano.find(params[:id])\n @mobs_nano.destroy\n\n respond_to do |format|\n format.html { redirect_to mobs_nanos_url }\n format.xml { head :ok }\n end\n end", "def destroy\n name, type = resource[:name].split('/')\n case type\n when 'MX'\n @dnsres.each do |res|\n preference = res.preference\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} MX #{preference} #{target}.\n send\")\n end\n when 'SRV'\n @dnsres.each do |res|\n priority = res.priority\n weight = res.weight\n port = res.port\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n rdata = @dnsres.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} #{type} #{rdata}\n send\")\n end\n end", "def destroy\r\n end", "def destroy\r\n end", "def delete\n \n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @yml_file = Cmtool::YmlFile.find(params[:id])\n @yml_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(cmtool.yml_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::YmlFile.model_name.human)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @folder = Folder.find(session[:folder_id])\n Searcher.open(Const.get('searcher_db')) do |db|\n db.erase(@content)\n end\n @content.destroy\n\n respond_to do |format|\n #format.html { redirect_to(contents_url) }\n format.html { redirect_to(@folder) }\n format.xml { head :ok }\n end\n end", "def destroy\n @machine_mileage = MachineMileage.find(params[:id])\n @machine_mileage.destroy\n\n respond_to do |format|\n format.html { redirect_to(machine_mileages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n @membre = Membre.find(params[:id])\n @membre.destroy\n\n respond_to do |format|\n format.html { redirect_to(membres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mriperformance = Mriperformance.find(params[:id])\n @mriperformance.destroy\n\n respond_to do |format|\n format.html { redirect_to(mriperformances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @master_memorial.destroy\n respond_to do |format|\n format.html { redirect_to master_memorials_url, notice: 'Memorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete\n end", "def delete\n \n end", "def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diagramm = Diagramm.find(params[:id])\n @diagramm.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagramme_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @memo.destroy\n respond_to do |format|\n format.html { redirect_to memos_url, notice: 'Memo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @memo.destroy\n respond_to do |format|\n format.html { redirect_to memos_url, notice: 'Memo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(name)\n @ctx.delete(@path + name)\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to action: 'myspace' }\n format.json { head :no_content }\n end\n\n #Rails.cache.delete_matched /articles\\/index/\n #Rails.cache.delete_matched Regexp.new(\"#{@article.id}\")\n #Rails.cache.delete_matched /articles\\/content/\n\n end", "def destroy\n\t\t\n\tend", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def destroy\n @children = Children.find(params[:id])\n @children.destroy\n\n respond_to do |format|\n format.html { redirect_to(childrens_url) }\n format.xml { head :ok }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n @massmail = Massmail.find(params[:id])\n @massmail.destroy\n\n respond_to do |format|\n format.html { redirect_to(massmails_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @turbo_memoid = TurboMemoid.find(params[:id])\n @turbo_memoid.destroy\n\n respond_to do |format|\n format.html { redirect_to turbo_memoids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # no op\n end", "def destroy\n\n end", "def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end", "def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hikiyama = Hikiyama.find(params[:id])\n @hikiyama.destroy\n\n respond_to do |format|\n format.html { redirect_to(@omatsuri) }\n format.xml { head :ok }\n end\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def destroy\n end", "def destroy\n @mall = Mall.find(params[:id])\n @mall.destroy\n\n respond_to do |format|\n format.html { redirect_to malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(childmasters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mill = Mill.find(params[:id])\n @mill.destroy\n\n respond_to do |format|\n format.html { redirect_to mills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moto_model = MotoModel.find(params[:id])\n @moto_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy \n get_system\n @nav_entry = NavEntry.find(params[:id])\n @nav_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(system_url(@system)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @medicion = Medicion.find(params[:id])\n @medicion.destroy\n\n respond_to do |format|\n format.html { redirect_to(medicions_url) }\n format.xml { head :ok }\n end\n end", "def destroy \r\n\r\n end" ]
[ "0.71606076", "0.6744775", "0.6728058", "0.6698001", "0.6697423", "0.66447955", "0.62601215", "0.6259028", "0.62158287", "0.62131137", "0.619885", "0.618305", "0.61690277", "0.61683583", "0.61507", "0.61292183", "0.6107319", "0.6107319", "0.6094037", "0.60761666", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60410225", "0.60203975", "0.6017684", "0.6016178", "0.6013769", "0.60071087", "0.6004943", "0.6003312", "0.6002165", "0.59985805", "0.59881157", "0.5984056", "0.59825706", "0.59823793", "0.5929247", "0.5926512", "0.5917601", "0.59171164", "0.59149456", "0.59085083", "0.5903743", "0.5903743", "0.5901686", "0.5894189", "0.5891456", "0.58841133", "0.58818537", "0.58809304", "0.58774626", "0.58768076", "0.58753866", "0.5869482", "0.58664006", "0.58664006", "0.58633065", "0.5860455", "0.5856393", "0.5853073", "0.58524966", "0.58522785", "0.5850711", "0.5849959", "0.58491164", "0.58491164", "0.5847522", "0.5842233", "0.58401924", "0.5837016", "0.58316374", "0.5830498", "0.5828239", "0.5828239", "0.5828239", "0.5828239", "0.5828239", "0.58258045", "0.58257765", "0.58224124", "0.5818194", "0.5817764", "0.58177036", "0.5816836", "0.5812009", "0.5809518", "0.5806297", "0.58039576", "0.5803532", "0.5797814", "0.5794883", "0.5794828", "0.57933384" ]
0.662709
6
Write a program that prints a greeting message. This program should contain a method called greeting that takes a name as its parameter and returns a string.
def greetings(name) puts "Hello #{name.capitalize}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greeting(name)\n puts \"Hello #{name}, welcome to the program!\"\nend", "def greeting(name)\n print \"hello \" + name + \" what the fuck is your problem?\"\nend", "def greeting(name)\n\tputs \"Hello \" + name + \". Have a nice day!\"\nend", "def greeting(name)\n\tp \"hello\" + \" \" + name\nend", "def greeting(name)\n\tp \"hello\" + \" \" + name\nend", "def greeting(name)\n\tputs \"Hello, \" + name + \". How are you doing?\"\nend", "def greeting(name)\n\t\tputs \" Hi there #{name}, how are you doing today?\"\n\tend", "def greeting(name)\n puts \"Hello #{name}\"\n end", "def greeting(name)\r\n print \"Hello there, #{name}!\"\r\nend", "def greet(name)\n print \"Hello, #{name} how are you doing today?\"\nend", "def greeting(name)\n puts \"Hello, \" + name + \", I like cats!\"\nend", "def greeting(name) \n puts \"Hello, \"+name\nend", "def greeting(name)\n puts \"Aloha \" + name\nend", "def greeting_a_person(name)\n puts \"Hello #{name}\"\nend", "def greeting(name)\n puts \"Hello, #{name}. Nice to meet you.\"\nend", "def greeter(name)\n puts \"Hello #{name}! How are you today?\"\nend", "def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end", "def greet\n puts \"Hello! My name is #{name}!\"\n end", "def greet(name)\n puts \"hello \" + name\nend", "def greeting(name)\n puts \"Hello, #{name}.\"\nend", "def greeting(name)\n puts \"Hello, #{name}\"\nend", "def greeting(name)\n puts \"Hello, #{name}\"\nend", "def greeting\n puts \"Welcome to the world of practical effects\"\n end", "def greet(name)\n puts \"Hello, #{name}\"\nend", "def greeting(name)\n\t\"Hello, #{name}\"\nend", "def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end", "def greeting\n puts \"Hi, my name is #{@name}.\"\n end", "def greeting (name)\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{@name}!\"\n end", "def greeting \r\n puts \"Hi, Ruby programmer!\"\r\nend", "def greeting(name)\n \"Hello, \" + name\nend", "def greeting(name)\nputs \"Hello #{name}. It's nice to meet you.\"\nend", "def greeting(name)\r\n\tp \"hello \" +\"\"+ name\r\nend", "def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend", "def greeting(person)\n puts \"Hello, \" + person\nend", "def greetings\n\tputs \"Greetings friend!\"\nend", "def greet(name)\n\t\"Hello, #{name}!\"\nend", "def greeting\n puts \"Hello World\"\nend", "def greeting \n puts \"Hello World\"\nend", "def say_hello(name)\n puts \"Hello, #{name}!\"\n end", "def greeting(name)\n \"Howdy #{name}, welcome back!\"\nend", "def greeting\n puts 'Greetings, honorable gentleman.'\nend", "def say_hello_personal(name)\n\tputs \"Hello \" + name\nend", "def greet(person)\n puts \"Hello, \" + person\nend", "def greet(person)\n puts \"Hello, \" + person\nend", "def greeting\n puts 'Hello!'\nend", "def greeting\n puts 'Hello!'\nend", "def greeting\n puts 'Hello!'\nend", "def greeting\n puts 'Hello!'\nend", "def greeting\n puts 'Hello!'\nend", "def greeter (name)\n return \"Hello #{name}\"\n end", "def greeting\n puts \"Hello!\"\nend", "def greeting\n puts \"Hello!\"\nend", "def greeting\n puts \"Hi my name is #{@name}\"\n end", "def greeting(name)\n puts \"Hi \" + name\n namet\nend", "def greeting\n puts \"hello\"\nend", "def welcome(greeting)\n puts \"Welcome to Ruby!\"\n \nend", "def say_hello(name)\n puts \"Good afternoon, #{name}. How are you?\"\nend", "def greeting(name)\n \"Hello there, \" + name + \"!\"\nend", "def greet (name)\n\treturn \"Hello, #{name}\"\nend", "def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end", "def greeting(name)\n \"Hello, #{name}!\"\nend", "def sayHello(name)\n puts \"Hello, #{name}\"\nend", "def greet name\t\t\t# name is a \"parameter\" of the method.\n\tputs \"Hello #{name}!\"\nend", "def greet(first_name, last_name)\n p \"Hey \" + first_name + \", your last name is \" + last_name\nend", "def greet(first_name, last_name)\n p \"Hey \" + first_name + \", your last name is \" + last_name\nend", "def greeting(name=\"rubyist\")\n \"Welcome, #{name}! Ready to code?\"\nend", "def greet\n puts \"Hello, #{@name}!\"\n end", "def greet person\n puts \"Hello, #{person}!\"\nend", "def greeting(name)\n \"Hello #{name}!\"\nend", "def greeting(name)\n \"Hello #{name}!\"\nend", "def greet\n\t\tputs \"Hi, my name is #{@name}\"\n\tend", "def greeting\n\tputs \"Please enter your name:\"\n\tname = gets.chomp\n\tputs \"Hello\" + \" \" + name\nend", "def greeting\r\n name = \"Bob\"\r\n puts \"hello, #{name}!\"\r\nend", "def greet person\n\t'Hello, ' + person + '!'\nend", "def welcome (name)\n\tputs \"Hello #{name}!\"\nend", "def greet(first, last)\n p \"Hi, \" + last + \", \" + first\nend", "def greet(who)\n\t\"Hello, #{who}!\"\nend", "def greet(who)\n\t\"Hello, #{who}!\"\nend", "def greet(who)\n\t\"Hello, #{who}!\"\nend", "def greet(first_name, last_name)\n p 'Hey ' + first_name + ', your last name is ' + last_name\nend", "def greet(first_name, last_name)\n p \"Hey \" + first_name + \", your last name is \" + last_name\nend", "def greeting(greeting, name)\n puts \"#{greeting}, #{name}\"\nend", "def greeting(name)\n puts \"Good day \"+name.capitalize\nend", "def greeting(name)\n \"Hello, \" + name + \". How are you doing?\"\nend", "def say_hello(name)\n \"Hello, #{name}.\"\n end", "def say_hello(name)\n puts \"Hello #{name}!\"\nend", "def say_greeting\r\n greeting = \"\\t\\t Welcome to the Virtual Crazy 8-Ball game!\" +\r\n \"\\n\\n\\n\\n\\n\\n\\t To play: \" +\r\n \"\\n\\t Simply ask any question you desire to have answered and press ENTER.\" +\r\n \"\\n\\t The 8-Ball will work its magic to determine your fortune! \" +\r\n \"\\n\\t You may ask as many questions as you like and submit 'q' to end the game.\" +\r\n \"\\n\\n\\n\\n\\n\\n\\nPress Enter to continue. \\n\\n: \"\r\n print greeting\r\n end", "def greeting(name)\n \"Hello,\" + name + \". How are you doing?\"\nend", "def greet(name)\n return puts \"Hello, #{name} how are you doing today?\"\nend", "def greeting\n\t\t#make a greeting for both student and teacher\n\t\tputs \"Hi, my name is #{@name}!\"\n\tend", "def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend", "def greeting(name)\n \"Good Morning #{name}!\"\nend", "def say_greeting\n system 'say \"Good Luck\"'\n end", "def hello(name)\n puts \"Hello, \" + name + \"!\"\nend", "def greeting\n\t\tputs \"Welcome to the Secret Number Game \\n\"\n\t\tputs \"Written by AxleMax\\n\\n\"\n\tend", "def greet_me\n puts \"Hello\"\nend", "def greet (name)\n \"Hello, #{name}!\"\nend", "def greet\n puts \"# Welcome to Mastermind!\"\n puts \"# Good luck!\"\n end", "def greeting(name)\n \"Hello \" + name.capitalize + \"!\"\nend", "def greeting(name)\n \"Hi my name is #{name}, nice to meet you!\"\nend", "def say_hello(name, num)\n\t\tputs \"Greetings, #{name}.\"\n\t\tputs \"you are number #{num}.\"\n\tend" ]
[ "0.8355077", "0.8237434", "0.8092483", "0.8079213", "0.8079213", "0.80635774", "0.80542254", "0.8041203", "0.803089", "0.79517186", "0.78680205", "0.7828249", "0.78250694", "0.78155804", "0.7797733", "0.77777797", "0.7766429", "0.77566206", "0.7753752", "0.77497584", "0.7706518", "0.7706518", "0.7702225", "0.7650342", "0.76481384", "0.7582554", "0.7570107", "0.75522846", "0.75435257", "0.7540766", "0.7540673", "0.753788", "0.75014", "0.7496567", "0.74719113", "0.7462686", "0.74618566", "0.7460029", "0.74397784", "0.74382913", "0.7430712", "0.74305224", "0.74283534", "0.74283534", "0.7423333", "0.7423333", "0.7423333", "0.7423333", "0.7423333", "0.7404904", "0.7402281", "0.7402281", "0.74021804", "0.7397598", "0.73975", "0.738272", "0.7369326", "0.73611987", "0.7356642", "0.734755", "0.7343775", "0.73313856", "0.7298807", "0.7298478", "0.7298478", "0.7296871", "0.7294745", "0.72901344", "0.7281891", "0.7281891", "0.7281454", "0.72724813", "0.7268149", "0.72652006", "0.72626007", "0.7261278", "0.7259205", "0.7259205", "0.7259205", "0.7258683", "0.72542506", "0.72506756", "0.7243946", "0.7224355", "0.7210252", "0.7207582", "0.72050065", "0.7198593", "0.7193632", "0.71929854", "0.7188291", "0.71831876", "0.71782887", "0.7159295", "0.7149272", "0.71377856", "0.71361405", "0.7127429", "0.71114635", "0.7104116", "0.71002644" ]
0.0
-1
Write a program that includes a method called multiply that takes two arguments and returns the product of the two numbers.
def multiply(num1, num2) num1 * num2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(num1, num2)\n product = num1 * num2\n puts product\nend", "def multiply(num1,num2)\n product = num1 * num2\n puts product\nend", "def multiply(num1, num2)\n puts num1 * num2\nend", "def multiply(a, b)\n puts a*b\nend", "def multiply(num1, num2)\n num1 ** num2\nend", "def multiply(a,b)\n puts a*b\nend", "def multiply(num1, num2)\n return num1 * num2\nend", "def multiply(num1, num2)\n\tnum1 * num2\nend", "def multiply(num1, num2)\n\tnum1 * num2\nend", "def multiply(num1, num2)\n\treturn num1 * num2\nend", "def multiply(num1, num2)\n p num1 * num2\nend", "def multiply(num1, num2)\n return num1 * num2\nend", "def multiply(num1, num2)\n print num1 * num2\nend", "def multiply(num1, num2)\n num1 * num2\n end", "def multiply(num1, num2)\n\treturn num1*num2\nend", "def multiply (num1, num2)\n return num1 * num2\nend", "def multiply(a, b)\r\n a * b\r\n end", "def multiply(a, b)\n\ta * b\nend", "def multiply(num1,num2)\n\tnum1 * num2\nend", "def multiply(num1, num2)\n num1*num2\nend", "def multiply(num1, num2)\n num1*num2\nend", "def multiply(number1, number2)\n number1 * number2\n end", "def multiply(a, b)\n a * b\nend", "def multiply(number_1, number_2)\n product = number_1 * number_2\n puts \"#{number_1} * #{number_2} = #{product}\"\n puts \"Hooray for math!\"\nend", "def multiply(a, b)\n return a * b\nend", "def multiply(a, b)\n return a * b\nend", "def multiply(a,b)\n\treturn a * b\nend", "def multiply(num_a, num_b)\n num_a * num_b\nend", "def multiply(num_a, num_b)\n num_a * num_b\nend", "def multiply(num1,num2)\n num1 * num2\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(a, b)\n a * b\nend", "def multiply(num_1, num_2)\n num_1 * num_2\nend", "def multiply(num_1, num_2)\n num_1 * num_2\nend", "def multiply(a, b)\nend", "def multiply(number1, number2)\n number1 * number2\nend", "def multiply(number1, number2)\n number1 * number2\nend", "def multiply(number1, number2)\n number1 * number2\nend", "def multiply(number1, number2)\n number1 * number2\nend", "def multiply(a b)\n a * b\nend", "def multiply(num_1, num_2)\n num_1*num_2\nend" ]
[ "0.85417473", "0.8510501", "0.85090566", "0.8498431", "0.84594536", "0.8457658", "0.84546375", "0.84519905", "0.84519905", "0.8451737", "0.84453964", "0.8434526", "0.8426326", "0.8421011", "0.8416704", "0.8406636", "0.84050006", "0.8400107", "0.83973855", "0.83797866", "0.83797866", "0.83782256", "0.8375615", "0.8365984", "0.83625174", "0.83625174", "0.83609307", "0.83595616", "0.83595616", "0.8357837", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8353879", "0.8351142", "0.8351142", "0.83392936", "0.833829", "0.833829", "0.833829", "0.833829", "0.833548", "0.8333758" ]
0.84118396
54
Relays (send or broadcast) the JSON message hash to the receiver (web socket or channel). origin_client_id is the client id of the sender of the qeemono JSON message (message). In this method the message is actually sent to the receiver. The receiver can be a web socket (aka client) or a channel. If sent to a channel the actual sending to the destination clients is done in the Ruby block passed to the EM::Channelsubscribe method which is called in Qeemono::ChannelManagersubscribe.
def relay(origin_client_id, receiver, message) relay_internal(origin_client_id, receiver, message, false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_message(origin_client_id, message, &block)\n parse_message_internal(origin_client_id, message, false, &block)\n end", "def handle_message(event)\n sender = @users[event['sender']]\n timestamp = event['origin_server_ts'] || Time.now.to_i\n content = event['content']\n message = Message.new sender, timestamp, content\n broadcast(:message, @room, message)\n Events.processed event\n end", "def send_msg_to_client ws, req_id, module_id, msg\n msg = compose_request req_id, module_id, msg\n ws.send ['client', msg].to_json\n end", "def relay_message(to, data)\n encrypted_message = data['message']\n\n ActionCable.server.broadcast(\n broadcasting_name(to),\n message: encrypted_message,\n uid: to)\n end", "def handle_load_client_data(origin_client_id, params)\n client_id = params[:owner].to_sym\n key = params[:key].to_sym\n value = ClientData.where(owner_client_id: client_id).where(key: key).any_of({public: true}, {owner_client_id: origin_client_id}).first.value\n relay(Qeemono::Notificator::SERVER_CLIENT_ID, @qsif[:client_manager].web_socket(:client_id => origin_client_id), {:method => :load_client_data_result, :params => {:value => value}})\n end", "def handle_store_client_data(origin_client_id, params)\n key = params[:key].to_sym\n value = params[:value].to_s\n public = params[:public] == 'true' || false\n\n ClientData.create(owner_client_id: origin_client_id.to_sym,\n key: key,\n value: value,\n public: public)\n notify(:type => :info, :code => 4000, :receivers => @qsif[:client_manager].web_socket(:client_id => origin_client_id), :params => {:client_id => origin_client_id})\n end", "def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end", "def process_message(message, connection)\n if(message.is_a?(FrameType::Message))\n distribution.register_message(message, connection.identifier)\n message.origin = current_actor\n end\n message\n end", "def originator\n @originator ||= original_message.sender\n end", "def on_message\n websocket_client.on(:message) do |event|\n websocket_response = websocket_response_data_class.new(\n data: event.data,\n bot_params_class: bot_params_class\n )\n\n bot.handle_data(websocket_response.bot_params) do |message|\n websocket_request = websocket_request_data_class.new(message: message, data: websocket_response.bot_params)\n websocket_client.send(websocket_request.data_to_send)\n end\n end\n end", "def relay(from_user, to_user_name, body, client_timestamp)\n message = { relays: [\n { from: from_user.name, body: body, client_ts: client_timestamp }] }\n @users.each do |user|\n next unless user.name == to_user_name\n session = user.session\n session.respond message if session\n end\n end", "def received(message)\n if message.respond_to?(:encoding) && message.encoding != 'UTF-8'\n message.force_encoding 'UTF-8'\n end\n data = JSON.parse message, :symbolize_names => true\n\n case data[:type]\n when 'text'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.message @user, data[:text], name_color, data[:client_ts]\n when 'av-invite', 'av-accept', 'av-close'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n av_message data\n when 'sync'\n @last_event_id = data[:last_event_id].to_i\n sync_events\n when 'ping'\n respond pong: { nonce: data[:nonce], client_ts: data[:client_ts] }\n when 'relay'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.relay @user, data[:to], data[:body], data[:client_ts]\n end\n end", "def _send_message(msg, opts = {}, block = nil)\n if (block)\n # register callback for responses to 'mid'\n debug \"(#{id}) register callback for responses to 'mid: #{msg.mid}'\"\n @lock.synchronize do\n @context2cbk[msg.mid.to_s] = { block: block, created_at: Time.now }\n end\n end\n end", "def onmessage(msg)\n msg = JSON.parse msg\n event = msg['event'].gsub(/^pusher:/, 'pusher_')\n\n if event =~ /^client-/\n msg['socket_id'] = @socket_id\n\n Channel.send_client_message msg\n elsif respond_to? event, true\n send event, msg\n end\n\n rescue JSON::ParserError\n error({ code: '5001', message: \"Invalid JSON\" })\n end", "def send_message message\n raise \"not on the reactor thread\" unless EM.reactor_thread?\n transition_on_send message_name(message), message do |msg|\n send_object msg\n end\n end", "def process_msg_from_client ws, ws_context, msg\n if !ws_context[:registered]\n ws.close\n return\n end\n if ws_context[:type] != 'client'\n return\n end\n if msg[:command]\n # a command from client\n @console_service.command(msg[:command], msg[:module_id], msg[:body]) { |err, res|\n if is_request? msg\n if resp = compose_response(msg, err, res)\n ws.send ['client', resp].to_json\n end\n else\n # notify should not have a callback\n end\n }\n else\n # a request or a notify from client\n @console_service.execute(msg[:module_id], :client_handler, msg[:body]) { |err, res|\n if is_request? msg\n if resp = compose_response(msg, err, res)\n ws.send ['client', resp].to_json\n end\n else\n # notify should not have a callback\n end\n }\n end\n end", "def on_message client, data\n controller(client).on_message(data)\n end", "def set_originator(message)\n # no originator. For jobs that are only called from within other\n # jobs, there is no need to override this method.\n end", "def send_message(user_id, message_content)\n\t\tfull_route = self.endpoint_route.gsub(USER_ID_KEY, user_id)\n\n\t\tdata = message_content.clone\n\t\tdata[\"token\"] = self.webhook_token\n\t\tquery = self.get_query(data)\n\n\t\turl = \"#{ full_route }?#{ query }\"\n\n\t\tresponse = HTTParty.get(url, body: data.to_json, headers: JSON_HEADERS)\n\t\tif response.code < 200 || response.code >= 300\n\t\t\traise \"Error\\nWebook HTTP Status: #{ response['code'] }. #{ response['message'] }\"\n\t\tend\n\tend", "def send_message body, opts={}\n require 'base64'\n body = body.to_json unless body.kind_of?(String)\n sqs_outbound_queue.send_message Base64.strict_encode64(encrypt_message(body)), opts\n end", "def send_message(event, from_ws, msg)\n push payload(event, from_ws, msg)\n end", "def broadcast(msg, cb)\n\n # de-encapsulate\n encap = Base64.urlsafe_decode64 msg['data']\n encap = Marshal.load encap\n name, msg, to, except = encap[:n], encap[:m], encap[:t], encap[:e]\n\n info { 'Broadcasting message for %s.' % name }\n\n @reaction.registry.each { |channel_id|\n next unless accept(to, channel_id) and not accept(except, channel_id)\n channel = \"/#{name}/#{channel_id}\"\n info { \"Pushing to channel #{channel_id}.\" }\n @reaction.get_client.publish(channel, msg)\n }\n\n end", "def send_message(message)\n send_queue_message(\n address, (valid_json?(message) ? message : message.to_json), sqs\n )\n end", "def message_received(client, msg)\n content = JSON.parse msg.data\n\n kind = content['type'] || 'empty message'\n\n OutputLogger.logger.info \"Received a message of the #{kind} type.\"\n OutputLogger.logger.debug content\n\n method = \"on_#{content['type']}\"\n\n send(method, content, client) if respond_to?(method)\n end", "def broadcast_data(message)\n @client.broadcast_to_handshaked_connections(message)\n end", "def send_message(recipient_user_name, msg)\n raise RuntimeError.new(\"Attempt to send message but not connected\") if @ws.nil?\n\n @ws.send({request: \"message\", recipient_user_name: recipient_user_name, msg: msg}.to_json)\n end", "def send_to(receiver, message)\n message = Message.coerce(message)\n message.prepend '' # separator frame\n message.prepend receiver # receiver envelope\n self << message\n end", "def broadcast_message(message, rclient)\n\t\[email protected] do |client|\n\t\t\tclient.puts message unless client == rclient\n\t\tend\n\tend", "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end", "def SendMessage(senderId, message)\n\t\t#headers = {\"Content-Type\" => \"application/json\"}\n\n\n\t\t#TODO: put page access token in config file\n\t\taccessToken = ENV[\"FB_PAGE_ACCESS_TOKEN\"]\n\t\tbaseURI = \"#{ENV[\"FB_GRAPH_API_BASE_URI\"]}\"\n\n\t\tparams ={\n\t\t\trecipient: {id: senderId},\n\t\t\tmessage: {text: message},\n\t\t\taccess_token: accessToken\n\t\t}\n\n\t\tRestClient.post baseURI, params.to_json, content_type: 'application/json', accept: 'application/json'\n\tend", "def originator\n @originator = self.original_message.sender if @originator.nil?\n return @originator\n end", "def forward\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message\n end", "def correlation_id=(correlation_id); @message_impl.setCorrelationId correlation_id; end", "def dispatch message, client\n host, the_class, query = discover_resource message[\"resource\"].clone\n if @config.gateway.forward && host != @config.hostname && host != 'localhost'\n # May be we should gateway this message, if this wasn't aimed at us\n message.to.send @config.strategy.outbound\n else\n # Is there a reverse gateway token there?\n if @config.gateway.reverse && message.gateway == 'reverse'\n if clients.has_key? message.token.first\n begin \n clients[message.token.first].send message.to.json\n @config.logger.debug message.to.string\n rescue Exception => exception\n @config.logger.error exception.message\n @config.logger.debug exception.backtrace.to_s\n end\n else\n if respond_to? :client_not_found\n client_not_found message.token.first, message\n else\n raise ClientNotFoundError, \"Client #{message.token.first} is not registered in this server\"\n end\n end\n else\n if the_class.ancestors.include? JSTP::Controller\n resource = the_class.new message, query, self, client\n resource.send message[\"method\"].downcase.to_sym\n else\n if @config.environment == :development\n raise NotAControllerError, \"The resource class #{the_class} for #{message[\"resource\"].join(\"/\")} was found, but is not a JSTP::Controller\"\n else\n raise NotPermittedError, \"The selected resource is forbidden for this type of request\"\n end\n end\n end\n end\n end", "def send_message(payload) \n to_user_id = payload['to_user_id']\n body = payload['body']\n message = Message.create!(\n from_user_id: current_user.id,\n to_user_id: to_user_id,\n body: body\n )\n\n MessageBroadcastJob.perform_later(message)\n end", "def send_message(_user_id, message, extra_data = {})\n messages.create!({sender_id: _user_id, body: message}.merge(extra_data))\n end", "def chat(message)\n final_message = nil\n if message.is_a?(Hash)\n final_message = message.to_json\n else\n final_message = JSON.dump(action: 'message', message: message)\n end\n log_to_file(\"#{self.class} sends JSON #{final_message}\")\n send_data(final_message)\n end", "def call(message)\n if message.command == 'MESSAGE'\n handler.call(JSON.parse(message.body, symbolize_names: true))\n end\n rescue => e\n log.error(e.message) { \"\\n#{e.backtrace.inspect}\" }\n ensure\n ack(message)\n log.info('Processed') { %(#{message.headers['message-id']} from \"#{message.headers['destination']}\") }\n end", "def send_message(data)\n\n #this is called by js script client side\n\n #The data local variable contains a hash \n #so we can access the message's body quite \n #easily to save it to the database:\n\n \n message_params = data['message'].each_with_object({}) do |el, hash|\n hash[el.values.first] = el.values.last\n end\n \n #creates a message based on passed params, \n #after message is saved to database it broadcasts itself to clients\n #(receive method on conversation js)\n \n Message.create(message_params)\n \n \n #or\n #current_user.messages.create(body: data['message'])\n \n #builds a hash that’s based on a passed data \n # and sends data to the front-end using the ActionCable.server.broadcast \n # method to the specified channel. \n # Data sent from this method is visible in the received method on the front-end.\n #ActionCable.server.broadcast(\n # \"conversations-#{current_user.id}\",\n # message: message_params\n #)\n\n\n\n #or (from medium tut)\n\n #sender = get_sender(data)\n #room_id = data['room_id']\n #message = data['message']\n\n #raise 'No room_id!' if room_id.blank?\n #convo = get_convo(room_id) # A conversation is a room\n #raise 'No conversation found!' if convo.blank?\n #raise 'No message!' if message.blank?\n\n # adds the message sender to the conversation if not already included\n #convo.users << sender unless convo.users.include?(sender)\n # saves the message and its data to the DB\n #Message.create!(\n # conversation: convo,\n # sender: sender,\n # content: message\n #)\n end", "def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end", "def handle_message(message)\n maybe_print(message)\n msg = MessageHandlerMessage.new(message, self)\n route_message(msg)\n rescue => e\n sender = msg.try(:sender) || \"UNKNOWN-SENDER\"\n send_error(sender, e)\n end", "def encoderequest(sender, target, msg, requestid, filter={})\n serialized = Marshal.dump(msg)\n digest = makehash(serialized)\n \n @log.debug(\"Encoding a request for '#{target}' with request id #{requestid}\")\n request = {:body => serialized,\n :hash => digest,\n :senderid => @config.identity,\n :requestid => requestid,\n :msgtarget => target,\n :filter => filter,\n :msgtime => Time.now.to_i}\n\n # if we're in use by a client add the callerid to the main client hashes\n request[:callerid] = callerid if @initiated_by == :client\n\n Marshal.dump(request)\n end", "def chat(data)\n # uid of the intended recipient\n # only the intended recipient will be able to decrypt\n to = data['to'].to_s\n\n if ConnectedList.include?(to)\n relay_message(to, data)\n else\n intended_recipient_not_found(to)\n end\n end", "def set_fields_from_hash(message)\n @sender = message['fromUuid'] || ''\n @payload = message['payload'] || {}\n @message_type = payload['message_type'].to_s.downcase || ''\n @time_stamp = payload['time_stamp'] || nil\n @handled = false\n end", "def handle(channel_id, msg_id, data)\n channel_config, message_config, text =\n prepare_message(channel_id, msg_id, data)\n chats = channel_config.chat_ids\n connector = channel_config.connector\n\n if message_allowed?(message_config, data)\n chats.map { |chat| connector.send_message(chat, text, message_config) }\n else\n logger.warn \"#{channel_id}/#{msg_id}: \" \\\n \"Skip sending message. Because it's not allowed\"\n []\n end\n end", "def on_message(event)\n message = JSON.parse(event.data)\n\n if message['id']\n message['command'] = 'response_received'\n elsif message['message']\n command, *args = *message['message']\n message = {'command' => command, 'args' => args}\n end\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end", "def handle_message(message, ip, transport)\n payload = message.payload\n\n @message_hooks[payload.class].each do |hook|\n hook.call(payload)\n end\n @message_signal.broadcast\n end", "def do_send(message)\n if message.instance_of?(Hurricane::Message)\n destination = message.destination\n if destination.instance_of?(String)\n destination = Erlang::Atom.new(destination)\n end\n\n data = Erlang::Tuple.new([\n Erlang::Atom.new(message.type),\n destination,\n message.tag,\n message.data,\n message.timeout])\n else\n data = message\n end\n\n super(data)\n end", "def hsdq_send_callback(message)\n hsdq_send(message.merge(type: :callback))\n end", "def message( msg, sender )\n @clients.each do |client|\n client.sock.puts \"#{sender}: #{msg}\" unless sender.port == client.port\n end\n log( \"[message] #{sender}: #{msg}\" )\n end", "def publish(message, destination, opts = {}, code = 0, &blk)\n payload, sender = Gilmour::Protocol.create_request(message, code)\n\n EM.defer do # Because publish can be called from outside the event loop\n begin\n send_message(sender, destination, payload, opts, &blk)\n rescue Exception => e\n GLogger.debug e.message\n GLogger.debug e.backtrace\n end\n end\n sender\n end", "def send_message(payload)\n message = Message.new(user: current_user, chat_id: payload[\"id\"], body: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat_#{payload['id']}\", message: render(message) if message.save\n end", "def send_message(message)\n self.broadcast({\n type: \"chat_message\",\n message: message\n })\n end", "def register(client_id, message_handlers, options={})\n receiver = receiver(client_id)\n message_handler_names = []\n message_handlers = [message_handlers] unless message_handlers.is_a? Array\n message_handlers.each do |message_handler|\n if check(client_id, message_handler)\n handled_methods = message_handler.handled_methods || []\n handled_methods = [handled_methods] unless handled_methods.is_a? Array\n handled_methods_as_strings = []\n handled_methods.each do |method|\n handled_methods_as_strings << method.to_s\n (@registered_message_handlers_for_method[method.to_sym] ||= []) << message_handler\n end\n message_handler_name = message_handler.name.to_s\n @registered_message_handlers << message_handler\n @registered_message_handlers_by_fq_name[message_handler.fq_name] = message_handler\n message_handler.qsif = @qsif_public # Set the public service interface so that it is available in the message handler\n message_handler_names << message_handler_name\n notify(:type => :debug, :code => 5000, :receivers => receiver, :params => {:message_handler_name => message_handler_name, :handled_methods => handled_methods_as_strings.inspect, :modules => message_handler.modules.inspect, :message_handler_class => message_handler.class, :version => message_handler.version })\n end\n end\n notify(:type => :debug, :code => 5010, :receivers => receiver, :params => {:amount => @registered_message_handlers.size})\n end", "def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end", "def send_message(receiver, message)\r\n Message.create!(:sender => self, :receiver => receiver, :subject => message.subject, :body => message.body)\r\n end", "def send_message(receiver, message)\r\n Message.create!(:sender => self, :receiver => receiver, :subject => message.subject, :body => message.body)\r\n end", "def encoderequest(sender, target, msg, requestid, filter={})\n @log.debug(\"Encoding a request for '#{target}' with request id #{requestid}\")\n request = {:body => msg,\n :senderid => @config.identity,\n :requestid => requestid,\n :msgtarget => target,\n :filter => filter,\n :msgtime => Time.now.to_i}\n\n # if we're in use by a client add the callerid to the main client hashes\n request[:callerid] = callerid if @initiated_by == :client\n\n YAML.dump(request)\n end", "def reply_chain_message_id=(value)\n @reply_chain_message_id = value\n end", "def produce( message )\n @client.set( @name, message )\n return ::Qup::Message.new( message.object_id, message )\n end", "def send_message_notification\n message = MessageBlueprint.render_as_json(self)\n ActionCable.server.broadcast \"conversation_#{ self.conversation_id }_notification_channel\", message\n # receiver = self.conversation.user_one_id == self.user_id ? self.conversation.user_two_id : self.conversation.user_one_id\n # response = self.attributes.merge(user: self.user&.name)\n # ActionCable.server.broadcast \"user_#{ receiver }_notification_channel\", response.as_json.to_s\n end", "def reply(env, message)\n self.send(env[:sender], [env[:conn_id]], message)\n end", "def send_message\n rkey = 'recipient-variables'\n set_multi_simple rkey, JSON.generate(@recipient_variables)\n @message[rkey] = @message[rkey].first if @message.key?(rkey)\n\n response = @client.send_message(@domain, @message).to_h!\n message_id = response['id'].gsub(/\\>|\\</, '')\n @message_ids[message_id] = count_recipients\n reset_message\n end", "def handle_client(client)\n unless @reactor.address_allowed? client.ip\n client.close\n @log.warn { \"Terminated connection from unauthorized client #{client.ip}\" }\n return\n end\n\n client.say(\"ChainReactor v#{VERSION}\")\n\n client_string = ''\n while l = client.read\n client_string += l\n end\n\n @log.debug { \"Read from client #{client.ip}: #{client_string}\" }\n @log.info { \"Finished reading from client #{client.ip}, closing connection\" }\n\n client.close\n\n @reactor.react(client.ip,client_string)\n\n end", "def forward\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message\n end", "def create\n @message = Message.new(message_params.merge(read: false))\n\n if @message.sender == @message.message_thread.seller\n @message.receiver = @message.message_thread.buyer\n else\n @message.receiver = @message.message_thread.seller\n end\n\n respond_to do |format|\n if @message.save\n MessageBroadcastController.publish('/messages', @message.detailed_attributes)\n format.json { render json: @message.attributes, status: :created }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def sender_message=(value)\n @sender_message = value\n end", "def onmessage(msg)\n Slanger::Statsd.increment(\"messages\")\n Slanger::Statsd.gauge(\"message_size\", msg.bytesize)\n\n msg = Oj.load(msg)\n\n msg[\"data\"] = Oj.load(msg[\"data\"]) if msg[\"data\"].is_a? String\n\n case msg[\"event\"]\n when /\\Aclient-/\n msg[\"socket_id\"] = socket_id\n Channel.send_client_message(msg)\n when \"pusher:ping\"\n pusher_ping(msg)\n when \"pusher:pong\"\n pusher_pong(msg)\n when \"pusher:subscribe\"\n pusher_subscribe(msg)\n when \"pusher:unsubscribe\"\n pusher_unsubscribe(msg)\n end\n rescue JSON::ParserError, Oj::ParseError\n send_error({ code: 5001, message: \"Invalid JSON\" })\n rescue Exception => e\n puts \"Error: #{e.class.name}: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n send_error({ code: 500, message: \"Internal Error\" })\n end", "def message_create(originator, recipients, body, params = {})\n # Convert an array of recipients to a comma-separated string.\n recipients = recipients.join(',') if recipients.is_a?(Array)\n\n Message.new(request(\n :post,\n 'messages',\n params.merge(originator: originator.to_s,\n body: body.to_s,\n recipients: recipients)\n ))\n end", "def publish(message, destination, code = nil, &blk)\n payload, sender = Gilmour::Protocol.create_request(message, code)\n send(sender, destination, payload, &blk)\n end", "def process\n {\n \"type\": \"message\",\n \"channel\": channel,\n \"text\": message\n }.to_json\n end", "def on_message data\n begin\n data = JSON.parse data\n rescue Exception => e\n puts e\n response << {event: :error, message: \"Unknown Error\"}.to_json\n response.close\n return false\n end\n broadcast :_send_message, {event: :chat, from: params[:name], message: data['message'], at: Time.now}.to_json\n end", "def send_message(queue, msg)\n queue.send_message(msg.to_json)\n end", "def send_message(friend_object, bitch_object, &block)\n Message.new(self, friend_object, bitch_object).send(&block)\n end", "def publish(message)\n logger.debug \"Publishing #{message.inspect} directly to #{self.name}\"\n Publisher.publish(@clients.values, message, :type => \"channel\", :channel => self.name)\n end", "def gateway_message(data)\n {\n data: data,\n timestamp: Time.now.to_i,\n proto_version: 1,\n }\n end", "def gateway_message(data)\n {\n data: data,\n timestamp: Time.now.to_i,\n proto_version: 1,\n }\n end", "def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end", "def distribute(client)\n client.account.messages.create(\n :from => '+16412438808',\n :to => contact.Phone_Number,\n :body => message.contents)\n end", "def onmessage(&block)\n super( &proc do |msg|\n msg = JSON.parse(msg)\n Hammer.logger.debug \"Websocket recieved: #{msg}\" if config[:logger][:show_traffic]\n block.call msg\n end)\n end", "def update\n\t\t\t# assumes body is JSON - more handling could be done using the params (which hold parsed JSON data).\n\t\t\tbroadcast :_push, request[:body] \n\t\t\t{message: 'write_chat', data: {id: params[:id], token: cookies['example_token'], example_data: 'message sent.'}}.to_json\n\t\tend", "def message(message)\n subject message.subject\n reply_to message.sender.email\n recipients message.recipient.email\n sent_on Time.now\n body :message => message, :link => my_message_url(message.thread.code)\n end", "def send_message(*args, **kwargs)\n bot = kwargs.fetch(:bot) { args.fetch(0) }\n args[0] = id\n kwargs[:chat_id] = id\n bot.send_message(*args, **kwargs)\n end", "def notify module_id, msg\n msg[:client_id] = @client_id\n msg[:username] = @username\n @ws.send ['client', compose_request(nil, module_id, msg)].to_json\n end", "def message_create(originator, recipients, body, params={})\n # Convert an array of recipients to a comma-separated string.\n recipients = recipients.join(',') if recipients.kind_of?(Array)\n\n Message.new(request(\n :post,\n 'messages',\n params.merge({\n :originator => originator.to_s,\n :body => body.to_s,\n :recipients => recipients })))\n end", "def send_message(other_user, room_id, content)\n from_messages.create!(to_id: other_user.id, room_id: room_id, content: content)\n end", "def edit_message(message_id, builder: nil, content: nil, embeds: nil, allowed_mentions: nil)\n builder ||= Builder.new\n\n yield builder if block_given?\n\n data = builder.to_json_hash.merge({ content: content, embeds: embeds, allowed_mentions: allowed_mentions }.compact)\n RestClient.patch(\"#{@url}/messages/#{message_id}\", data.compact.to_json, content_type: :json)\n end", "def receive_message (is_client, pseudo_user_ids, received_msgtype)\n logger.debug \"new mail: #{self.to_json}\"\n\n # find password in mix encrypted message. mix encryption. rsa encrypted random password in key and message encrypted with this random password\n server = Server.find_by_new_did(self.from_did)\n logger.debug2 \"received mix encrypted message\"\n private_key = OpenSSL::PKey::RSA.new SystemParameter.private_key\n password_rsa_enc = Base64.decode64(self.key)\n password = private_key.private_decrypt(password_rsa_enc, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)\n logger.secret2 \"password = #{password}\"\n\n # decrypt message\n message_json_enc_base64 = self.message\n message_json_enc = Base64.decode64(message_json_enc_base64)\n message_json = message_json_enc.decrypt(:symmetric, :password => password)\n\n logger.secret2 \"message_json = #{message_json}\"\n message = JSON.parse(message_json)\n\n if message['msgtype'] == 'users'\n return \"Cannot receive users message. Server secret was not found. Server secret should have been received in login request\" if !server.secret\n error = server.receive_compare_users_message(message['users'], is_client, pseudo_user_ids, received_msgtype) # false: server side of communication\n return error ? error : nil\n end\n\n if message['msgtype'] == 'online'\n error = server.receive_online_users_message(message['users'], is_client, received_msgtype) # false: server side of communication\n return error ? error : nil\n end\n\n if message['msgtype'] == 'sha256'\n error = server.receive_sha256_changed_message(message['seq'], message['users'])\n return error ? error : nil\n end\n\n if message['msgtype'] == 'pubkeys'\n error = server.receive_public_keys_message(message['users'], is_client, received_msgtype) # false: server side of communication\n return error ? error : nil\n end\n\n if message['msgtype'] == 'client'\n error = server.receive_client_messages(message['messages'], is_client, received_msgtype) # false: server side of communication\n return error ? error : nil\n end\n\n if message['msgtype'] == 'verify_gifts'\n error, self.keep_message = server.receive_verify_gifts_message(message)\n return error ? error : nil\n end\n\n if message['msgtype'] == 'verify_comments'\n error, self.keep_message = server.receive_verify_comments_msg(message)\n return error ? error : nil\n end\n\n logger.error2 \"mstype #{message[\"msgtype\"]} not implemented\"\n\n return nil\n\n end", "def direct_message!(id, message)\n log \"Store direct message\"\n # This is the data about a message that we store in the database:\n m = {\n :created_at => message.created_at,\n :recipient => {\n :name => message.recipient.name,\n :profile_image_url => message.recipient.profile_image_url,\n :screen_name => message.recipient.screen_name,\n },\n :sender => {\n :name => message.sender.name,\n :profile_image_url => message.sender.profile_image_url,\n :screen_name => message.sender.screen_name,\n },\n :text => message.text,\n }\n redis.rpush(id, Marshal.dump(m))\n end", "def forward_message_id=(*args); end", "def cpg_message(sender, message)\n\t\tmessage = CorosyncCommander::Execution::Message.from_cpg_message(sender, message)\n\n\t\t# This is the possible message classifications\n\t\t# Command echo (potentially also a command to us)\n\t\t# Response echo\n\t\t# Command to us\n\t\t# Response to us\n\t\t# Command to someone else\n\t\t# Response to someone else\n\n\t\tif message.type == 'command' and sender == @cpg.member then\n\t\t\t# It's a command echo\n\t\t\texecution_queue = nil\n\t\t\t@execution_queues.sync_synchronize(:SH) do\n\t\t\t\texecution_queue = @execution_queues[message.execution_id]\n\t\t\tend\n\t\t\tif !execution_queue.nil? then\n\t\t\t\t# someone is listening\n\t\t\t\tmessage_echo = message.dup\n\t\t\t\tmessage_echo.type = 'echo'\n\t\t\t\tmessage_echo.content = @cpg_members\n\t\t\t\texecution_queue << message_echo\n\t\t\tend\n\t\telsif message.type == 'leader reset' then\n\t\t\t# The sender is requesting we reset their leader position\n\t\t\t# For remote node, act as if the node left.\n\t\t\t# For the local node, act as if we just joined.\n\t\t\tif sender != @cpg.member then\n\t\t\t\t@leader_pool.sync_synchronize(:EX) do\n\t\t\t\t\t@leader_pool.delete(sender)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@leader_pool.sync_synchronize(:EX) do\n\t\t\t\t\t@leader_pool.replace(@cpg_members.to_a)\n\t\t\t\tend\n\t\t\tend\n\t\telsif message.type != 'command' and message.recipients.include?(@cpg.member) then\n\t\t\t# It's a response to us\n\t\t\texecution_queue = nil\n\t\t\t@execution_queues.sync_synchronize(:SH) do\n\t\t\t\texecution_queue = @execution_queues[message.execution_id]\n\t\t\tend\n\t\t\tif !execution_queue.nil? then\n\t\t\t\t# someone is listening\n\t\t\t\texecution_queue << message\n\t\t\tend\n\t\tend\n\n\t\tif message.type == 'command' and (message.recipients.size == 0 or message.recipients.include?(@cpg.member)) then\n\t\t\t# It's a command to us\n\t\t\tbegin\n\t\t\t\t# see if we've got a registered callback\n\t\t\t\tcommand_callback = nil\n\n\t\t\t\tcommand_name = message.content[0]\n\t\t\t\tcommand_callback = @command_callbacks[command_name]\n\t\t\t\tif command_callback.nil? then\n\t\t\t\t\traise NotImplementedError, \"No callback registered for command '#{command_name}'\"\n\t\t\t\tend\n\n\t\t\t\tcommand_args = message.content[1]\n\t\t\t\treply_value = command_callback.call(message.sender, *command_args)\n\t\t\t\tmessage_reply = message.reply(reply_value)\n\t\t\t\[email protected](message_reply)\n\t\t\trescue => e\n\t\t\t\t$stderr.puts \"Exception: #{e} (#{e.class})\\n#{e.backtrace.join(\"\\n\")}\"\n\t\t\t\tmessage_reply = message.reply([e.class, e.to_s, e.backtrace])\n\t\t\t\tmessage_reply.type = 'exception'\n\t\t\t\[email protected](message_reply)\n\t\t\tend\n\t\tend\n\tend", "def send_message(payload)\n message = Message.new(author: current_user, text: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat\", message: render(message) if message.save\n end", "def send_reply(conversation_id, params)\n cleaned = params.permit(:author_id,\n :sender_name,\n :subject,\n :body,\n :text,\n :attachments,\n { options: [:tags, :archive] },\n :channel_id,\n :to,\n :cc,\n :bcc)\n create_without_response(\"conversations/#{conversation_id}/messages\", cleaned)\n end", "def process_message(message, connection)\n discard = false\n if(message.is_a?(FrameType::Message))\n message.origin = current_actor\n message.connection = connection\n retried = false\n begin\n distribution.register_message(message, connection.identifier)\n rescue KeyError => e\n if(!retried && queue.scrub_duplicate_message(message))\n retried = true\n retry\n else\n error \"Received message is currently in flight and not in wait queue. Discarding! (#{message})\"\n discard = true\n end\n end\n end\n discard ? nil : message\n end", "def format_message\n message = Message.new\n\n message.id = @id\n message.text = @raw_data['text'] ||= ''\n media = @raw_data['media']\n message.type = media ? media['type'] : 'text'\n message.raw_from = @raw_data['from']['peer_id']\n message.from_type = @raw_data['from']['peer_type']\n message.raw_to = @raw_data['to']['peer_id']\n message.to_type = @raw_data['to']['peer_type']\n\n from = @client.contacts.find { |c| c.id == message.raw_from }\n to = @client.contacts.find { |c| c.id == message.raw_to }\n to = @client.chats.find { |c| c.id == message.raw_to } if to.nil?\n\n message.from = from\n message.to = to\n\n @message = message\n\n if @message.from.nil?\n user = @raw_data['from']\n user = TelegramContact.pick_or_new(@client, user)\n @client.contacts << user unless @client.contacts.include?(user)\n @message.from = user\n end\n\n if @message.to.nil?\n type = @raw_data['to']['peer_type']\n case type\n when 'chat', 'encr_chat'\n chat = TelegramChat.pick_or_new(@client, @raw_data['to'])\n @client.chats << chat unless @client.chats.include?(chat)\n if type == 'encr_chat' then\n @message.to = chat\n else\n @message.from = chat\n end\n when 'user'\n user = TelegramContact.pick_or_new(@client, @raw_data['to'])\n @client.contacts << user unless @client.contacts.include?(user)\n @message.to = user\n end\n end\n end", "def handle_message(metadata, payload)\n @consumer_channel.push payload\n end", "def process_message(message)\n # Extract fields from message\n begin\n data = JSON.parse message\n rescue JSON::ParserError\n Logger.error log_message(\"JSON Parse error on cluster message: '\" + msg + \"'\")\n return \n end\n sender = data['sender']\n return if sender == node_id # Ignore own messages\n destination = data['destination']\n if (destination.nil? || destination == node_id)\n # This is a broadcast, or a message to our node, we need to process it\n event = data['event'].to_sym\n if event == :election_enquiry && is_master? && sender < node_id\n # We are the master, and the enquirer doesn't have an node_id\n # higher than us. Reply to this enquiry telling it we are the master.\n Logger.debug log_message\"Sending master enquiry reply to: \" + sender\n send_enquiry_reply(sender)\n elsif event == :election_enquiry_reply && sender > node_id\n # The master replied, accept it\n accept_master(sender)\n elsif event == :election_victory && sender < node_id\n # Some node claims to be the master, but its node_id is lower than ours ;\n # Tell all nodes we are the real master.\n Logger.info log_message\"Another node claimed to be the master: \" + sender + \". Sending new victory message to correct it.\"\n send_victory\n elsif event == :election_victory && sender > node_id && (sender > master_id || master_last_seen_unix_timestamp < Time.now.to_i - 60)\n # Some node claims to be the master, and its node_id is greater than ours\n # and its node_id is greater than the currently known master, or the master is\n # outdated. Accept the node as new master\n accept_master(sender)\n elsif event == :master_alive && sender == master_id \n # Master is alive\n @master_last_seen_unix_timestamp = Time.now.to_i \n refesh_master_timeout\n end\n end\n end", "def route(mqtt_message)\n topic = mqtt_message.topic\n message = build_message(mqtt_message)\n\n # Replies are received through the reply_to topic and should contain\n # the original message id. If message is a reply but no handler is\n # registered, message is dropped and not sent to the global handler list\n if reply?(topic, message)\n handle_reply(message)\n else\n handle(topic, message)\n end\n end", "def create\n user = User.find_by(token: params[:token])\n new_message_params = {\n text: message_params[:text],\n conversation_id: message_params[:conversation_id],\n user_id: user.id,\n username: user.username\n }\n @message = Message.new(new_message_params)\n conversation = Conversation.find(message_params[:conversation_id])\n\n if @message.save\n # render json: @message, status: :created, location: @message\n serialized_data = ActiveModelSerializers::Adapter::Json.new(\n MessageSerializer.new(@message)\n ).serializable_hash\n MessagesChannel.broadcast_to conversation, serialized_data\n head :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def process(msg)\n headers = msg[\"headers\"]\n federation = headers[\"federation\"]\n\n Log.info(\"Federation received %s from %s\" % [federation[\"req\"], headers[\"mc_sender\"]])\n\n federation[\"reply-to\"] = headers.delete(\"reply-to\")\n headers[\"reply-to\"] = collective_source_name\n\n record_seen(headers)\n\n Log.debug(\"federation => collective: %s\" % [headers])\n\n @outbox << {\n :targets => federation.delete(\"target\"),\n :req => federation[\"req\"],\n :data => JSON.dump(msg)\n }\n end" ]
[ "0.6396157", "0.5633048", "0.5466951", "0.541618", "0.5351561", "0.52735054", "0.5224363", "0.51919067", "0.51678246", "0.5089629", "0.5086707", "0.5023725", "0.49872816", "0.49752948", "0.4944641", "0.4943584", "0.49298522", "0.4894096", "0.48817024", "0.48723805", "0.48668507", "0.4860228", "0.4857184", "0.4856107", "0.4846415", "0.48139706", "0.48092526", "0.4802558", "0.47942036", "0.47814867", "0.47799456", "0.47749484", "0.4774722", "0.47674757", "0.47494328", "0.4731609", "0.47281927", "0.4727386", "0.47048104", "0.46903387", "0.46890914", "0.46780586", "0.4669817", "0.46650556", "0.46498692", "0.46478754", "0.46403146", "0.4633863", "0.4633316", "0.46316946", "0.463027", "0.4606185", "0.45989814", "0.4592567", "0.45641604", "0.45624802", "0.45624802", "0.4562063", "0.4557744", "0.45548558", "0.45480877", "0.45428553", "0.4537429", "0.45356292", "0.45309424", "0.45277366", "0.451873", "0.45149705", "0.45039177", "0.44995645", "0.4499181", "0.44977787", "0.44958818", "0.4495737", "0.44946438", "0.44885117", "0.44885117", "0.44825268", "0.44790912", "0.44748157", "0.44706625", "0.44625452", "0.4462172", "0.446176", "0.4461641", "0.4461601", "0.4440166", "0.44388023", "0.44311798", "0.4427056", "0.44256437", "0.44250402", "0.4423541", "0.44107255", "0.44050303", "0.44042554", "0.44032305", "0.44028792", "0.43959567", "0.4391342" ]
0.72194684
0
Returns true if all mandatory keys are existent in the qeemono JSON message (message) and no error during parsing occurred; otherwise false is returned. Additionally, optional keys like the originator (sender) client id (:client_id), the protocol version (:version), and the sequencer id (:seq_id) are added to the qeemono JSON message if not existent. If some error occurs an exception is raised. If no error occurs the given block is executed.
def parse_message(origin_client_id, message, &block) parse_message_internal(origin_client_id, message, false, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_keys?(message)\n [:sender, :sent_to, :type, :uid] - message.keys == []\n end", "def required_alert_keys?(json)\n %w[title description artifacts].all? { |key| json.key? key }\n end", "def valid?\n mandatory_keys = %w[message stacktrace]\n return false unless mandatory_keys.all? { |key| @payload.key?(key) }\n return false if @payload['stacktrace'].empty?\n\n true\n end", "def has_required_keys?(instance, required_keys, ignore_keys, indent: 3)\n success = true\n\n required_keys[\"name\"] = {\n \"type\" => \"String\",\n \"required\" => true\n }\n\n required_keys.each do |key, data|\n next if ignore_keys.include?(key)\n\n if !instance.key?(key)\n bad \"#{key} is missing\", indent: indent\n success = false\n end\n end\n\n success\n end", "def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end", "def valid?(json: {})\n json.present? && json[:license_ref].present? && json[:start_date].present?\n end", "def document_has_required_fields?\n [value_field, reverse_shelfkey_field, shelfkey_field, combined_key_field].each do |field|\n return false if @original_document[field].blank?\n end\n true\n end", "def optional?\n required.empty? && required_keywords.empty?\n end", "def catch_all_required?\n catch_all.is_a?(Hash) and catch_all['required']\n end", "def all_expected_fields_received?\n @signature_fields ||= %w(idterminal idcomercio idtransaccion importe moneda coderror codautorizacion firma).map{|value| value = value.to_sym}\n [email protected]? && @fields.areset?(@signature_fields)\n end", "def body_hash_required?\n false\n end", "def missing_mandatory_params?(params)\n mandatory_params.each { |mandatory_param| @missing_params << mandatory_param if params[mandatory_param].to_s.empty? }\n return !@missing_params.empty?\n end", "def valid?(json:)\n return false unless json.present?\n\n json[:type].present? && json[:identifier].present?\n end", "def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end", "def has_key?(key)\n self.body.is_a?(Hash) && self.body.has_key?(key)\n end", "def validated?\n\t\t%w(to to_name from from_name subject body).each do |key|\n\t\t\treturn false if content[key].nil?\n\t\tend\n\t\ttrue\n\tend", "def valid?(message)\n super do |payload|\n payload.get(:data, :code_fetcher, :info, :commit_sha) &&\n !payload.get(:data, :code_fetcher, :asset)\n end\n end", "def valid_create?\n param! :sales_order_item_id, Integer, required: true, blank: false\n param! :inventory_id, Integer, required: true, blank: false\n param! :metadata, Hash, blank: false\n end", "def key_not_found?\n ->(body) { body =~ /#{INVALID[:key_not_found]}/ }\n end", "def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end", "def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end", "def evernote_params_found?\n unless @evernote_params\n log.error(\"required evernote configuration not found!\")\n false\n else true\n end\n end", "def ensure_par(req, msg = '%<name>s is mandatory: please provide %<flag>s')\n req.each do |k, v|\n raise (msg % { name: k, flag: v }) if self[k].nil?\n end\n end", "def required?\n @schema['required'] ? true : false\n end", "def any?\n REQUIRED_KEYS.any? do |key|\n attributes[key].any?\n end\n end", "def validate_peer_data!(data)\n\t\t\t[:uuid,:host,:port].each{|k|\n\t\t\t\tdata[k] || fail(\"Peer data does not meet requirements. #{k} is a required field. See Hive documentation.\")\n\t\t\t}\n\t\t\tkeys = peer_fields.keys\n\t\t\tdata.keys.each{|k|\n\t\t\t\tkeys.include?(k) || warn(\"Provided key #{k} will not be stored with peer data\")\n\t\t\t}\n\t\t\ttrue\n\t\tend", "def valid_item_for_redis_key? args, key\n (args.has_key?(key) && !args[key].nil?) || redis_fields_config[key] == :autoincrement\n end", "def keys_valid?\n valid = true\n msg = []\n required_keys = %w(EMAIL_SMTP_DOMAIN EMAIL_SMTP_PORT FEEDBACK_FROM_EMAIL FEEDBACK_SMTP_AUTH_USER FEEDBACK_SMTP_AUTH_PASSWORD FEEDBACK_TO_EMAIL BACKUP_TYPE SERVER_NAME S3_BUCKET_PREFIX S3_BUCKET_SEPARATOR S3CMD_PATH ROOT_DIR TMP_DIR LOG_DIR BACKUP_SERVER_TIME)\n mysql_keys = %w(MYSQL_USER MYSQL_PASSWORD)\n mitb_keys = %w(MAIL_IN_A_BOX_BACKUP_DIRECTORY MAIL_IN_A_BOX_S3_DIRECTORY)\n missing_keys = []\n keys = required_keys\n if variable_is_true?('HAS_MYSQL')\n keys << mysql_keys\n end\n if variable_is_true?('HAS_MAIL_IN_A_BOX')\n keys << mitb_keys\n end\n keys.flatten!\n keys.each do |key|\n if !variable_exists? key\n missing_keys << key\n end\n end\n\n if missing_keys.length > 0\n msg << \"ERROR: the following keys are missing values: #{missing_keys.join(', ')}\"\n valid = false\n end\n\n\n # make sure the required directories exist\n if !File.exists? ENV['TMP_DIR']\n msg << \"ERROR: the tmp directory '#{ENV['TMP_DIR']}' does not exist and must be created before running this script\"\n valid = false\n end\n if !File.exists? ENV['LOG_DIR']\n msg << \"ERROR: the log directory '#{ENV['LOG_DIR']}' does not exist and must be created before running this script\"\n valid = false\n end\n if variable_is_true?('HAS_MAIL_IN_A_BOX') && !File.exists?(ENV['MAIL_IN_A_BOX_BACKUP_DIRECTORY'])\n msg << \"ERROR: the Mail-In-A-Box backup directory '#{ENV['MAIL_IN_A_BOX_BACKUP_DIRECTORY']}' does not exist and must be created before running this script\"\n valid = false\n end\n\n return valid, msg\nend", "def valid?\n return false if @input_currency.nil?\n return false if @sender.nil?\n return false if @recipients.nil?\n true\n end", "def is_mandatory\n igetset(:is_mandatory) { false }\n end", "def valid? job_data\n job_data[\"identifier\"] && job_data[\"data\"]\n rescue\n false\n end", "def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend", "def valid?(extra_tokens = nil)\n extra_tokens = [extra_tokens] if extra_tokens.kind_of?(Hash)\n if @key == @client.key\n return check_signature(@client.secret)\n elsif extra_tokens\n extra_tokens.each do |token|\n return check_signature(token[:secret]) if @key == token[:key]\n end\n end\n Pusher.logger.warn \"Received webhook with unknown key: #{key}\"\n return false\n end", "def valid?(message)\n super do |payload|\n (!block_given? || yield(payload)) &&\n payload.get(:data, :stacks, :builder) &&\n payload.get(:data, :stacks, :asset) &&\n allowed?(payload)\n end\n end", "def if_present(params = {}, &block); validation_chain.if_present(params, &block); end", "def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end", "def validate_each!(with: nil, message: 'not valid', **options, &block)\n before_validation do\n real_block = get_block_from_options(with, &block)\n keys.each do |key|\n JSONAPIonify::Continuation.new(**options).check(self, key, self[key]) do\n errors.add key, message unless real_block.call(self, key, self[key])\n end\n end\n end\n end", "def valid?(options)\n (@required_options - options.keys).size == 0\n end", "def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end", "def valid_contact_params?(params)\n r = false\n if !params[:sender_name].blank? and !params[:sender_address].blank? and !params[:message_title].blank? and !params[:message_content].blank? and ((params[:spamcode]).to_i==session[:spamcode])\n r = true\n end\n r\n end", "def valid_job?(job)\n self.class.required_keys.all? { |key| job.has_key?(key) }\n end", "def valid?(message)\n super do |payload|\n payload.get(:data, :github_kit, :commit_comment) ||\n payload.get(:data, :github_kit, :status)\n end\n end", "def validateParams \r\n\t \r\n\t \tif [email protected]? && [email protected]? && [email protected]?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end", "def any_unrecognized_keys?(expected, given)\n unrecognized_keys(expected, given).any?\n end", "def invalid_params?\n @invalid_params.keys.length == 0\n end", "def check_command_group\n if clientdata?\n response_bad_sequence\n end\n end", "def has_keypair?\n options.has_key?(:keypair) && options[:keypair] && !options[:keypair].empty?\n end", "def check_required(validation:, key:, schema:)\n return false unless validation[:required] && schema.nil?\n\n error! key, \"was required\"\n true\n end", "def sent?\n id.present? && error.blank?\n end", "def did_anyone_buy_this_thing?\n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items Present')\n return false\n\n end\n end", "def validate!(key, with: nil, message: 'is not valid', **options, &block)\n before_validation do\n if has_key? key\n JSONAPIonify::Continuation.new(**options).check(self, key, self[key]) do\n real_block = get_block_from_options(with, &block)\n errors.add key, message unless real_block.call(self, key, self[key])\n end\n end\n end\n end", "def should_not_contain!(*keys, **options, &block)\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n if invalid_keys.present?\n invalid_keys.each do |key|\n warnings.add(key, 'is not permitted')\n end\n end\n end\n end\n end", "def must_not_contain_deep!(*keys, **options, &block)\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n all_invalid_keys = []\n keys += self.keys.select(&block) if block_given?\n is_invalid = proc do |hash|\n invalid_keys = hash.keys.map(&:to_sym) & keys.map(&:to_sym)\n all_invalid_keys += invalid_keys\n children = hash.values.select { |v| v.respond_to?(:keys) && v.respond_to?(:values) }\n invalid_keys.present? | children.map { |c| is_invalid.call c }.reduce(:|)\n end\n if is_invalid.call(self)\n errors.add('*', \"cannot contain keys #{keys_to_sentence(*all_invalid_keys.uniq)}\")\n end\n end\n end\n end", "def validate_mandatory_fields\n validate_for_card unless self.cc_number.blank?\n validate_for_transaction_tag unless self.transaction_tag.blank?\n validate_for_track1 unless self.track1.blank?\n validate_for_track2 unless self.track2.blank?\n end", "def trigger?\n !key.nil? && !key.name.nil?\n end", "def valid?(message)\n super do |_|\n # only care that it's an HTTP request\n message[:message][:request] &&\n message[:message][:connection]\n end\n end", "def valid?\n @errors = []\n \n if !item_id.nil? && item_id !~ GUID_REGEX\n @errors << ['line_item_id', 'must be blank or a valid Xero GUID']\n end\n \n unless description\n @errors << ['description', \"can't be blank\"]\n end\n \n @errors.size == 0\n end", "def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend", "def must_contain_one_of!(*keys, **options, &block)\n self.permitted_keys = [*permitted_keys, *keys].uniq\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n valid_keys = keys.map(&:to_sym) & self.keys.map(&:to_sym)\n unless valid_keys.present?\n errors.add('*', \"must contain one of: #{keys_to_sentence(*self.keys)}\")\n end\n end\n end\n end", "def valid?\n return false if @key.nil?\n return false if @name.nil?\n return false if @event_code.nil?\n return false if @event_type.nil?\n return false if @start_date.nil?\n return false if @end_date.nil?\n return false if @year.nil?\n return false if @event_type_string.nil?\n true\n end", "def valid?\n return false if @beez_up_order_item_id.nil?\n return false if @order_item_order_item_type.nil?\n return true\n end", "def validate(composite_object)\n # Get the hash value from the composite object\n return if composite_object.hash.key?(@key)\n\n # Do unless_presence_of check\n if @unless_presence_of\n return if composite_object.hash.key?(@unless_presence_of)\n end\n\n error_messages.push(\"Required Key Missing: #{@key}, at: #{composite_object.location}.\")\n end", "def valid_insert?(data)\n return false if data.nil?\n return false if data.keys.length == 0\n\n # Required fields\n @fields.each do |k,s|\n return false if s.has_key?(:required) and s[:required] == true and !data.has_key?(k)\n end\n\n # Only valid fields, length checking\n data.each_key do |k|\n return false if [email protected]_key?(k)\n return false if @fields[k].has_key?(:length) and\n !data[k].nil? and\n data[k].length > @fields[k][:length]\n end\n\n return true\n end", "def quickie_parsable?\n @quickie.present? && @parsed_quickie.present?\n end", "def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end", "def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end", "def contains_expected_keys?(data, *expected_keys)\n expected_keys.each do |expected_key|\n return false until data.keys.include? expected_key\n end\n return true\nend", "def valid?\n self.errors = []\n \n BOOL_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n unless val.nil? == true || val == true || val == false\n self.errors.push field=>ERRORS[:bool]\n end\n end\n \n if self.key_data.nil?\n self.errors.push ERRORS[:data_nil] \n return false\n end\n\n if self.key_type.nil?\n self.errors.push ERRORS[:type_nil] \n return false\n end\n\n if not self.key_data.match \"^#{B64_REGEX}$\"\n self.errors.push ERRORS[:data_char] \n end\n\n if self.key_data.size < 30\n self.errors.push ERRORS[:data_short] \n end\n\n if self.key_data.size > 1000\n self.errors.push ERRORS[:data_long] \n end\n \n if self.key_data.size % 4 != 0\n self.errors.push ERRORS[:data_modulus] \n end\n\n return self.errors.empty?\n end", "def collect_key_record_data?(serializer, key)\n option_keys = collect_options_keys[key]\n return false if option_keys.blank?\n option_keys.each do |option_key|\n return true if (evaluate_option_root_first(serializer, option_key)).present?\n end\n false\n end", "def valid_message?(response)\n _command, identifier, @group = response.args\n\n return unless valid_group?(response, identifier)\n\n return unless valid_user?(response, identifier)\n\n true\n end", "def message_exists?(response)\n response.respond_to?(:name) && response.name == 'EXISTS'\n end", "def parse_ok?\n return false if @severity.nil? || @severity.length != 1\n return false if @fields.nil? || @fields.length < ChainLog::Formatter::NUM_FIELDS\n true\n end", "def credential_data_valid? data\n data.each do |hash|\n hash.each do |k,v|\n abort <<-MSG unless KEYS.include? k\nProbably have a typo in #{CREDENTIAL_FILE}: #{k}\nValid yaml keys: #{KEYS.join(\", \")}.\n MSG\n abort \"Please fill in #{k} in #{CREDENTIAL_FILE}\" unless v\n end\n end\n\n return true\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @metadata.nil?\n return false\n end\n\n \n \n \n \n \n \n \n \n end", "def valid?(message)\n prefix, command, parameters = parse message\n \n # Maximum of fifteen command parameters\n return false if parameters.length > 15\n\n # There MUST be NO whitespace between the colon and the prefix.\n return false if message =~ /^:\\s/\n\n # The command MUST either be a valid IRC command or a three digit number \n # represented in ASCII text.\n return false unless command =~ /^([A-Z]+|\\d{3})$/\n\n # IRC messages are always lines of characters terminated with a CR-LF \n # (Carriage Return - Line Feed)\n return false unless message.end_with? \"\\r\\n\"\n \n # Messages SHALL NOT exceed 512 characters in length, counting all \n # characters including the trailing CR-LF.\n return false if message.length > 512\n \n # NUL (%x00) is not allowed within messages.\n return false if message.include? \"\\x00\"\n\n # Hostnames can not be longer than 63 characters.\n hostname = prefix.split(\"@\")[1] || (prefix if prefix.include? \".\") || \"\"\n return false if hostname.length > 63\n\n return true\n end", "def check_response_hash(body)\n body.keys.include?('offers') && ### Check if offers key exists\n body[:offers].is_a?(Array) && ### Check if offers is an Array\n (body[:offers].first.nil? || ### Check if first elem of offers is nil or\n (body[:offers].first.keys.include?('title') && ### If the first elem exists check if first elem contains the key title\n body[:offers].first.keys.include?('payout') && ### check if first elem contains the key payout\n body[:offers].first.keys.include?('thumbnail') && ### check if first elem contains the key thumbnail\n body[:offers].first[:thumbnail].is_a?(Hash) && ### check if value corresponding to the key thumbnail is a Hash\n body[:offers].first[:thumbnail].keys.include?('lowres'))) ### check if value corresponding to the key thumbnail contains the key lowres\n end", "def empty?\n to_hash[name].respond_to?(:empty?) && to_hash[name].empty?\n end", "def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end", "def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end", "def required_credentials?(credentials = {})\n credentials_error unless REQUIRED_KEYS.all? { |k| credentials[k] }\n end", "def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end", "def has_missing_required_arg?\n !missing_required_arguments.empty?\n end", "def required?\n spec['Required']\n end", "def mandatory_params\n return {}\n end", "def validate_for_sent?\n [\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n #:first_name,\n #:last_name,\n :serial_number\n ].detect { |attr| self.send(attr).blank? }.nil?\n end", "def required_params_present?\n\n render json: {error: 'Missing required parameter: result'},\n status: :bad_request and return false unless params[:result]\n\n render json: {error: 'Missing required parameter: result.result_type'},\n status: :bad_request and return false unless params[:result][:result_type]\n\n # Manual Results are required to provide the execution id.\n # All other results are required to provide the project_id\n if params['result']['result_type'] == 'manual'\n render json: {error: 'Missing required parameter: result.execution_id'},\n status: :bad_request and return false unless params[:result][:execution_id]\n else\n render json: {error: 'Missing required parameter: result.project_id'},\n status: :bad_request and return false unless params[:result][:project_id]\n end\n\n\n render json: {error: 'Missing required parameter: result.testcase_id'},\n status: :bad_request and return false unless params[:result][:testcase_id]\n\n render json: {error: 'Missing required parameter: result.environment_id'},\n status: :bad_request and return false unless params[:result][:environment_id]\n\n\n render json: {error: 'Missing required parameter: result.status'},\n status: :bad_request and return false unless params[:result][:status]\n\n true\n end", "def has_missing_params?(required_params)\n required_params.each do |param|\n return true if params[param].blank?\n end\n false\n end", "def valid_guce_params?\n if @order_id == nil || @amount == nil || not_a_number?(@amount)\n return false\n else\n return true\n end\n end", "def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n end", "def _pv_required(opts, key, is_required=true)\n if is_required\n if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||\n (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)\n true\n else\n raise Exceptions::ValidationFailed, \"Required argument #{key} is missing!\"\n end\n end\n end", "def key_set?\n !attributes['key'].nil?\n end", "def email_message_sections\n if email_message\n errors.add(:value, 'email_message missing sections') if JSON.parse(@email_message.to_json).keys.size.eql?(0)\n end\n end", "def valid?(is_contact:, json: {})\n return false unless json.present?\n\n return false unless json[:name].present? || json[:mbox].present?\n\n is_contact ? true : json[:roles].present?\n end", "def required?(in_reply)\n return true if in_reply && required_in_select_form && required_in_select_form.include?(in_reply)\n required == \"required\"\n end", "def valid_recommendation_hash? input\n (input[:action] == RECOMMEND_ACTION && input[:customer_name] && input[:invitee_name]) ||\n (input[:action] == ACCEPT_ACTION && input[:customer_name])\n end", "def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end", "def validate_key_exists(*args)\n args.each do |key|\n validators << lambda do |message|\n raise Refinery::InvalidMessageError, \"Key does not exist in message: #{key}\" unless message[key]\n end\n end\n end", "def valid?\n metadata && id && name rescue false\n end", "def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end", "def valid_create?\n param! :order_reference_id, String, required: true, blank: false\n param! :customer_name, String, blank: false\n param! :amount, Float, blank: false\n param! :discount, Float, blank: false\n param! :source, String, blank: false\n param! :barcode, String, blank: false\n param! :shipping_label_url, String, blank: false\n param! :sales_order_items, Array, blank: false, required: true do |array|\n array.param! :sku_id, Integer, required: true, blank: false\n array.param! :quantity, Integer, required: true, blank: false\n array.param! :price, Float, required: true, blank: false\n array.param! :discount, Float, required: true, blank: false\n end\n end", "def valid?\n\t\tunless self.has_valid_payload?\n\t\t\tself.log.error \"Corrupted payload in block %d (hash mismatch)\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\treturn true if self.genesis?\n\n\t\tunless self.previous_hash_valid?\n\t\t\tself.log.error \"Hash mismatch in block %d\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\tunless self.has_valid_proof?\n\t\t\tself.log.error \"Invalid proof-of-work in block %d\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\treturn true\n\tend" ]
[ "0.6255635", "0.6224626", "0.6027533", "0.58262444", "0.56628567", "0.56574786", "0.55944353", "0.5533318", "0.5478522", "0.54676586", "0.54034764", "0.5377904", "0.5342022", "0.53010494", "0.5219694", "0.5183437", "0.5175279", "0.5167227", "0.5166309", "0.51385164", "0.5135765", "0.51205003", "0.5120078", "0.5114512", "0.5108831", "0.51058614", "0.509731", "0.50971967", "0.50874877", "0.50655395", "0.505601", "0.5050403", "0.5030744", "0.50260043", "0.50199586", "0.4996791", "0.49896798", "0.4978742", "0.49734026", "0.49623132", "0.49617186", "0.495529", "0.493437", "0.4915432", "0.49152026", "0.4892615", "0.48882365", "0.48840436", "0.48773298", "0.4874046", "0.4872095", "0.48660022", "0.48658597", "0.48646748", "0.48632875", "0.4858328", "0.48532838", "0.48480976", "0.48442551", "0.48403892", "0.48378113", "0.48346856", "0.48334572", "0.48241755", "0.4823689", "0.48221338", "0.48208278", "0.48179385", "0.48168275", "0.48112997", "0.4811201", "0.4810108", "0.48067933", "0.48028153", "0.47927707", "0.4779221", "0.47787368", "0.4778426", "0.4778426", "0.47757125", "0.47741506", "0.4773576", "0.47712854", "0.47646362", "0.47640416", "0.47611532", "0.4758244", "0.47539568", "0.47532862", "0.47486877", "0.47446805", "0.47436875", "0.47400886", "0.47342777", "0.47334325", "0.4731051", "0.4729082", "0.47108337", "0.47107854", "0.47067297", "0.47012398" ]
0.0
-1
Return a Container Application within a container project Returns information about a specific Container Application within a project.
def get_container_application(container_application_id, opts = {}) data, _status_code, _headers = get_container_application_with_http_info(container_application_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app\n @container.app\n end", "def get_container_application_with_http_info(container_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application ...'\n end\n # verify the required parameter 'container_application_id' is set\n if @api_client.config.client_side_validation && container_application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_application_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application\"\n end\n # resource path\n local_var_path = '/fabric/container-applications/{container-application-id}'.sub('{' + 'container-application-id' + '}', container_application_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplication')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def application\n return @application\n end", "def application\n Application.new self[:application]\n end", "def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end", "def application\n @application ||= parent.application if parent\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 current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end", "def show\n @application = Application.find(params[:id])\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def show\n @application = Application.find(params[:id])\n end", "def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end", "def inspect\n \"<Application name=#{@name} id=#{@id}>\"\n end", "def lookup(app_name)\n unless @metadata.key?(app_name)\n data = YAML.load_file(\"./data/applications/#{app_name}.yaml\")\n @metadata[app_name] = data['cots::app_metadata']\n end\n @metadata[app_name]\n end", "def app_name\n c.application\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def current_application\n # Get from last year for Postgresql\n @current_application ||= self.applications.current.first\n end", "def set_project_application\n @project_application = ProjectApplication.find(params[:id])\n end", "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def application\n @ref.application.to_ruby\n end", "def get_container_application_instance_with_http_info(container_application_instance_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance ...'\n end\n # verify the required parameter 'container_application_instance_id' is set\n if @api_client.config.client_side_validation && container_application_instance_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_application_instance_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance\"\n end\n # resource path\n local_var_path = '/fabric/container-application-instances/{container-application-instance-id}'.sub('{' + 'container-application-instance-id' + '}', container_application_instance_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplicationInstance')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application_instance\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n respond_with @application = Application.find(params[:id])\n end", "def resource_application\n return @resource_application\n end", "def application\n # If we have a doorkeeper_token, derive the Application from it.\n # If not, we're in case #1 above and the Application should be nil.\n @application ||= @doorkeeper_token.try(:application)\n end", "def project_only_application?\n Clusters::Cluster::PROJECT_ONLY_APPLICATIONS.include?(application_name)\n end", "def details(escrow_service_application_id)\n API::request(:get, \"escrow_service_applications/#{escrow_service_application_id}\")\n end", "def find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end", "def set_application\n @application = CollaborationApplication.find(params[:id])\n end", "def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end", "def main_app\n @main_app\n end", "def application_path\n if environment.container?\n applications_path.join(application_name_as_snake_case)\n else\n Pathname.new('app')\n end\n end", "def app\n App.load(self.app_id)\n end", "def index\n @project_applications = ProjectApplication.all\n end", "def get_container\n container_id_key = params.keys.find_all { |key| key =~ /\\w+_id/ }.last\n container_class = eval(container_id_key.humanize.titleize.delete(' '))\n @container = container_class.find_by_id(params[container_id_key])\n redirect_with_error 'Invalid project id' unless @container\n end", "def get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end", "def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\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 current_application(request)\n app_selector.call(request, applications)\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def app_name\n ApplicationService.application_name\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 app\n @options[:app]\n end", "def application_name\n return @application_name\n end", "def application=(value)\n @application = value\n end", "def current_application\n Wasko::Applescript.run do\n \"get name of (info for (path to frontmost 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 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 application\n self\n end", "def set_application\n @application = Oread::Application.find(params[:id])\n end", "def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end", "def catalog application\n type=CatalogType.find :first , :conditions => { :application => application}\n catalog=nil\n if type\n catalog=type.active_catalog\n end\n catalog\n end", "def get id\n apps.select do |app|\n app.id == id\n end.first\n end", "def app\n @app\n end", "def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end", "def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end", "def applications_list\n get \"applications\"\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 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 project\n service.project\n end", "def application_id\n return @application_id\n end", "def app(id_or_name_or_package_id)\n all_available_apps.find do |app|\n [app.name, app.id, app.package_id].include?(id_or_name_or_package_id)\n end\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", "def typus_application\n Typus::Configuration.config[name][\"application\"] || \"Unknown\"\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 show\n #表示は誰でもできる\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 app_with_name name\n AX::Application.new name\n end", "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def client_application\n @client_application ||= new_client_application\n end", "def project(name)\n @projects.find { |p| p.name == name }\n end", "def get_instance(payload)\n ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def client_app(client_id)\n Doorkeeper::Application.all.find { |app| app.uid == client_id }\n end", "def app\n Hanami.app\n end", "def project\n project_obj_files = Dir[\"*.yaml\"]\n unless project_obj_files.empty?\n AimsProject::Project.load(project_obj_files.first)\n else\n raise AimsProject::AimsProjectException.new(\"Sorry, I can't tell what project this is. Please move to the project root directory.\")\n end\nend", "def add_application(appname)\n app = self[appname]\n if !app\n app = Application.new(appname)\n @applications << app\n end\n yield app if block_given?\n return app\n end", "def info(name)\n\t\tdoc = xml(get(\"/apps/#{name}\"))\n\t\tattrs = { :collaborators => list_collaborators(name) }\n\t\tdoc.elements.to_a('//app/*').inject(attrs) do |hash, element|\n\t\t\thash[element.name.to_sym] = element.text; hash\n\t\tend\n\tend", "def applications\n get(PLURAL_PATH, RESOURCE)\n end", "def application_instance\n target\n end", "def [](ns)\n namespaces = ns.to_s.split(\":\").compact\n rtn = @applications.find {|a| a.name == namespaces.shift }\n begin\n while (!namespaces.empty?)\n rtn = rtn[namespaces.shift]\n end\n rescue\n return nil\n end\n return rtn\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def explain_application_info(org_text)\n retval = {} # Default\n return retval unless org_text\n\n if org_text.match('Application = ')\n appl = SyspApplication.get_cached_instance(org_text.split(' ')[2].to_i)\n if appl\n retval[:short_info] = appl.name\n retval[:long_info] = \"#{appl.description} >> Team: #{appl.developmentteam.name}\"\n else\n retval[:short_info] = \"Application not found for #{org_text}\"\n end\n end\n\n if org_text.match('ID_WSMethod = ')\n ws = Wsmethod.get_cached_instance(org_text.split(' ')[2].to_i)\n if ws\n retval[:short_info] = ws.name\n retval[:long_info] = \"#{ws.name}\"\n else\n retval[:short_info] = \"WSMethod not found for #{org_text}\"\n end\n end\n\n if org_text.match('ID_OFMsgType = ')\n mt = Ofmessagetype.get_cached_instance(org_text.split(' ')[2].to_i, session[:database].hash)\n if mt\n retval[:short_info] = mt.name\n retval[:long_info] = \"#{mt.description} >> Domain: #{mt.domain.name}\"\n else\n retval[:short_info] = \"OFMessagetype not found for #{org_text}\"\n end\n end\n\n\n\n retval\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def applications\n Application.for(self)\n end", "def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end", "def application(name)\n Typus::Configuration.config.collect { |i| i.first if i.last[\"application\"] == name }.compact.uniq.sort\n end", "def application\n\t\t\tIowa.app\n\t\tend", "def find_project_from_deployment_name(name)\n if project_name = available_deployments[name]\n return project_name\n else \n raise OroGen::DeploymentModelNotFound, \"#{client} has no deployment called #{name}\"\n end\n end", "def app_const\n Module.const_get(app_name)\n end", "def get_app(what, app, id)\n apps = all(case what.keys[0]\n when :study\n %Q{div.app a[href*=\"/?study_id=#{id}\"]}\n when :study_group\n %Q{div.app a[href*=\"/?studygroup_id=#{id}\"]}\n when :site\n raise \"don't know how to search for site apps\"\n when :team\n raise \"don't know how to search for team apps\"\n else\n nil\n end)\n apps.detect { |a| a['text'] == app }\n end", "def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end", "def app\n @app\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def app_info\n \"#{app_name} v#{app_version}\"\n end", "def find_project\n identifier = get_project_identifier\n project = Project.find_by_identifier(identifier.downcase)\n raise ActiveRecord::RecordNotFound, \"No project found with identifier '#{identifier}'\" if project.nil?\n return project\n end" ]
[ "0.6412242", "0.62636536", "0.62615454", "0.6135576", "0.5972415", "0.593051", "0.5892886", "0.5892133", "0.58571845", "0.58524406", "0.5801672", "0.5788559", "0.57761794", "0.57700455", "0.5765077", "0.5757923", "0.5710487", "0.5703222", "0.5700002", "0.56757206", "0.56635743", "0.5648189", "0.5638541", "0.5634894", "0.56214225", "0.56164056", "0.5613665", "0.56113106", "0.55971056", "0.55884665", "0.5570565", "0.55696833", "0.55689704", "0.55558115", "0.5539545", "0.5536134", "0.55275005", "0.5522978", "0.5520136", "0.5508405", "0.55071396", "0.5492707", "0.5489991", "0.54895437", "0.54859316", "0.54666615", "0.5463749", "0.54570395", "0.5438837", "0.54384977", "0.54384977", "0.543223", "0.5428169", "0.54214483", "0.54205096", "0.5410099", "0.54086155", "0.54049486", "0.5393656", "0.5380443", "0.5378197", "0.53681195", "0.5364541", "0.53549695", "0.53449786", "0.5337911", "0.53351945", "0.5325235", "0.53250957", "0.5323909", "0.5320173", "0.53098834", "0.5303325", "0.5303291", "0.5303038", "0.5302557", "0.5298361", "0.5292451", "0.52897114", "0.5279275", "0.5274702", "0.52612215", "0.52536047", "0.52535635", "0.52472264", "0.52426636", "0.52420825", "0.52347744", "0.523132", "0.522695", "0.52184135", "0.52166295", "0.5216083", "0.5215972", "0.5215533", "0.5213335", "0.5209564", "0.5209564", "0.52091515", "0.5200752" ]
0.61661774
3
Return a Container Application within a container project Returns information about a specific Container Application within a project.
def get_container_application_with_http_info(container_application_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application ...' end # verify the required parameter 'container_application_id' is set if @api_client.config.client_side_validation && container_application_id.nil? fail ArgumentError, "Missing the required parameter 'container_application_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application" end # resource path local_var_path = '/fabric/container-applications/{container-application-id}'.sub('{' + 'container-application-id' + '}', container_application_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ContainerApplication') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app\n @container.app\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def get_container_application(container_application_id, opts = {})\n data, _status_code, _headers = get_container_application_with_http_info(container_application_id, opts)\n data\n end", "def application\n return @application\n end", "def application\n Application.new self[:application]\n end", "def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\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 application\n @application ||= parent.application if parent\n end", "def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end", "def show\n @application = Application.find(params[:id])\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def show\n @application = Application.find(params[:id])\n end", "def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end", "def inspect\n \"<Application name=#{@name} id=#{@id}>\"\n end", "def lookup(app_name)\n unless @metadata.key?(app_name)\n data = YAML.load_file(\"./data/applications/#{app_name}.yaml\")\n @metadata[app_name] = data['cots::app_metadata']\n end\n @metadata[app_name]\n end", "def app_name\n c.application\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def current_application\n # Get from last year for Postgresql\n @current_application ||= self.applications.current.first\n end", "def set_project_application\n @project_application = ProjectApplication.find(params[:id])\n end", "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def application\n @ref.application.to_ruby\n end", "def get_container_application_instance_with_http_info(container_application_instance_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance ...'\n end\n # verify the required parameter 'container_application_instance_id' is set\n if @api_client.config.client_side_validation && container_application_instance_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_application_instance_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance\"\n end\n # resource path\n local_var_path = '/fabric/container-application-instances/{container-application-instance-id}'.sub('{' + 'container-application-instance-id' + '}', container_application_instance_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplicationInstance')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application_instance\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n respond_with @application = Application.find(params[:id])\n end", "def resource_application\n return @resource_application\n end", "def application\n # If we have a doorkeeper_token, derive the Application from it.\n # If not, we're in case #1 above and the Application should be nil.\n @application ||= @doorkeeper_token.try(:application)\n end", "def project_only_application?\n Clusters::Cluster::PROJECT_ONLY_APPLICATIONS.include?(application_name)\n end", "def details(escrow_service_application_id)\n API::request(:get, \"escrow_service_applications/#{escrow_service_application_id}\")\n end", "def set_application\n @application = CollaborationApplication.find(params[:id])\n end", "def find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end", "def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end", "def main_app\n @main_app\n end", "def application_path\n if environment.container?\n applications_path.join(application_name_as_snake_case)\n else\n Pathname.new('app')\n end\n end", "def app\n App.load(self.app_id)\n end", "def index\n @project_applications = ProjectApplication.all\n end", "def get_container\n container_id_key = params.keys.find_all { |key| key =~ /\\w+_id/ }.last\n container_class = eval(container_id_key.humanize.titleize.delete(' '))\n @container = container_class.find_by_id(params[container_id_key])\n redirect_with_error 'Invalid project id' unless @container\n end", "def get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end", "def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\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 current_application(request)\n app_selector.call(request, applications)\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def app_name\n ApplicationService.application_name\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 app\n @options[:app]\n end", "def application_name\n return @application_name\n end", "def application=(value)\n @application = value\n end", "def current_application\n Wasko::Applescript.run do\n \"get name of (info for (path to frontmost 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 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 application\n self\n end", "def set_application\n @application = Oread::Application.find(params[:id])\n end", "def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end", "def catalog application\n type=CatalogType.find :first , :conditions => { :application => application}\n catalog=nil\n if type\n catalog=type.active_catalog\n end\n catalog\n end", "def app\n @app\n end", "def get id\n apps.select do |app|\n app.id == id\n end.first\n end", "def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end", "def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end", "def applications_list\n get \"applications\"\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 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 project\n service.project\n end", "def application_id\n return @application_id\n end", "def app(id_or_name_or_package_id)\n all_available_apps.find do |app|\n [app.name, app.id, app.package_id].include?(id_or_name_or_package_id)\n end\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", "def typus_application\n Typus::Configuration.config[name][\"application\"] || \"Unknown\"\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 show\n #表示は誰でもできる\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 app_with_name name\n AX::Application.new name\n end", "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def client_application\n @client_application ||= new_client_application\n end", "def project(name)\n @projects.find { |p| p.name == name }\n end", "def app\n Hanami.app\n end", "def get_instance(payload)\n ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def client_app(client_id)\n Doorkeeper::Application.all.find { |app| app.uid == client_id }\n end", "def project\n project_obj_files = Dir[\"*.yaml\"]\n unless project_obj_files.empty?\n AimsProject::Project.load(project_obj_files.first)\n else\n raise AimsProject::AimsProjectException.new(\"Sorry, I can't tell what project this is. Please move to the project root directory.\")\n end\nend", "def add_application(appname)\n app = self[appname]\n if !app\n app = Application.new(appname)\n @applications << app\n end\n yield app if block_given?\n return app\n end", "def info(name)\n\t\tdoc = xml(get(\"/apps/#{name}\"))\n\t\tattrs = { :collaborators => list_collaborators(name) }\n\t\tdoc.elements.to_a('//app/*').inject(attrs) do |hash, element|\n\t\t\thash[element.name.to_sym] = element.text; hash\n\t\tend\n\tend", "def applications\n get(PLURAL_PATH, RESOURCE)\n end", "def application_instance\n target\n end", "def [](ns)\n namespaces = ns.to_s.split(\":\").compact\n rtn = @applications.find {|a| a.name == namespaces.shift }\n begin\n while (!namespaces.empty?)\n rtn = rtn[namespaces.shift]\n end\n rescue\n return nil\n end\n return rtn\n end", "def explain_application_info(org_text)\n retval = {} # Default\n return retval unless org_text\n\n if org_text.match('Application = ')\n appl = SyspApplication.get_cached_instance(org_text.split(' ')[2].to_i)\n if appl\n retval[:short_info] = appl.name\n retval[:long_info] = \"#{appl.description} >> Team: #{appl.developmentteam.name}\"\n else\n retval[:short_info] = \"Application not found for #{org_text}\"\n end\n end\n\n if org_text.match('ID_WSMethod = ')\n ws = Wsmethod.get_cached_instance(org_text.split(' ')[2].to_i)\n if ws\n retval[:short_info] = ws.name\n retval[:long_info] = \"#{ws.name}\"\n else\n retval[:short_info] = \"WSMethod not found for #{org_text}\"\n end\n end\n\n if org_text.match('ID_OFMsgType = ')\n mt = Ofmessagetype.get_cached_instance(org_text.split(' ')[2].to_i, session[:database].hash)\n if mt\n retval[:short_info] = mt.name\n retval[:long_info] = \"#{mt.description} >> Domain: #{mt.domain.name}\"\n else\n retval[:short_info] = \"OFMessagetype not found for #{org_text}\"\n end\n end\n\n\n\n retval\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def applications\n Application.for(self)\n end", "def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end", "def application(name)\n Typus::Configuration.config.collect { |i| i.first if i.last[\"application\"] == name }.compact.uniq.sort\n end", "def application\n\t\t\tIowa.app\n\t\tend", "def find_project_from_deployment_name(name)\n if project_name = available_deployments[name]\n return project_name\n else \n raise OroGen::DeploymentModelNotFound, \"#{client} has no deployment called #{name}\"\n end\n end", "def app_const\n Module.const_get(app_name)\n end", "def app\n @app\n end", "def get_app(what, app, id)\n apps = all(case what.keys[0]\n when :study\n %Q{div.app a[href*=\"/?study_id=#{id}\"]}\n when :study_group\n %Q{div.app a[href*=\"/?studygroup_id=#{id}\"]}\n when :site\n raise \"don't know how to search for site apps\"\n when :team\n raise \"don't know how to search for team apps\"\n else\n nil\n end)\n apps.detect { |a| a['text'] == app }\n end", "def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def app_info\n \"#{app_name} v#{app_version}\"\n end", "def find_project\n identifier = get_project_identifier\n project = Project.find_by_identifier(identifier.downcase)\n raise ActiveRecord::RecordNotFound, \"No project found with identifier '#{identifier}'\" if project.nil?\n return project\n end" ]
[ "0.6413513", "0.62612426", "0.616299", "0.61356246", "0.59723204", "0.59294903", "0.58932036", "0.5892956", "0.5856151", "0.58512676", "0.5799907", "0.5785492", "0.5775512", "0.5768937", "0.57613087", "0.5756969", "0.5710843", "0.57035387", "0.56996", "0.5675529", "0.5663067", "0.5647906", "0.5637679", "0.56367004", "0.5620696", "0.5615875", "0.5613462", "0.56101984", "0.5596671", "0.55879265", "0.55688745", "0.5568314", "0.5567311", "0.55553997", "0.55395514", "0.5534193", "0.552799", "0.55234754", "0.5516514", "0.5507328", "0.55061066", "0.5491755", "0.5489429", "0.54893565", "0.54862165", "0.5465573", "0.54636574", "0.54568756", "0.5438998", "0.543782", "0.543782", "0.5432691", "0.54266536", "0.5421581", "0.54209995", "0.54085135", "0.54074943", "0.5401994", "0.53931624", "0.5379417", "0.53771436", "0.53686243", "0.5366605", "0.5354291", "0.53418565", "0.53378516", "0.53358865", "0.5324622", "0.53242755", "0.5323946", "0.5317557", "0.5309566", "0.5303666", "0.5303077", "0.53023034", "0.5300992", "0.52997035", "0.52915984", "0.52903605", "0.5279043", "0.5275413", "0.52603894", "0.52538127", "0.5252226", "0.5246802", "0.5243511", "0.5241258", "0.5234975", "0.5232166", "0.5227645", "0.52189225", "0.5216033", "0.5215089", "0.52146417", "0.52142566", "0.52125746", "0.5209794", "0.5209794", "0.5209246", "0.520012" ]
0.62629676
1
Return a container application instance Returns information about a specific container application instance.
def get_container_application_instance(container_application_instance_id, opts = {}) data, _status_code, _headers = get_container_application_instance_with_http_info(container_application_instance_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance(payload)\n ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def application_instance\n target\n end", "def app\n @container.app\n end", "def get_instance(payload)\n AppManifestInstance.new(@version, payload, app_sid: @solution[:app_sid])\n end", "def application\n return @application\n end", "def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end", "def application\n Application.new self[:application]\n end", "def inspect\n \"<Application name=#{@name} id=#{@id}>\"\n end", "def app\n App.load(self.app_id)\n end", "def get_instance instance_id\n instances.get_instance name: instance_path(instance_id)\n end", "def show\n @application = Application.find(params[:id])\n end", "def show\n @application = Application.find(params[:id])\n end", "def get_container_application_instance_with_http_info(container_application_instance_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance ...'\n end\n # verify the required parameter 'container_application_instance_id' is set\n if @api_client.config.client_side_validation && container_application_instance_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_application_instance_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance\"\n end\n # resource path\n local_var_path = '/fabric/container-application-instances/{container-application-instance-id}'.sub('{' + 'container-application-instance-id' + '}', container_application_instance_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplicationInstance')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application_instance\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_app_instance\n @app_instance = AppInstance.find(params[:id])\n end", "def get_instance(item)\n return InstanceManager.get_instance(item)\n end", "def app\n @options[:app]\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {},\n Mastodon::Instance)\n end", "def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {}, Mastodon::Instance)\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end", "def app\n @app\n end", "def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end", "def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end", "def application\n # If we have a doorkeeper_token, derive the Application from it.\n # If not, we're in case #1 above and the Application should be nil.\n @application ||= @doorkeeper_token.try(:application)\n end", "def application\n @application ||= parent.application if parent\n end", "def context\n unless @instance_context\n @instance_context = AppManifestContext.new(@version , @params['app_sid'])\n end\n @instance_context\n end", "def get_container_application(container_application_id, opts = {})\n data, _status_code, _headers = get_container_application_with_http_info(container_application_id, opts)\n data\n end", "def me\n require 'open-uri'\n begin\n instance_id = open('http://169.254.169.254/latest/meta-data/instance-id').read\n instance instance_id\n rescue OpenURI::HTTPError => e\n nil\n end\n end", "def app\n app_class.new\n end", "def app_with_pid pid\n AX::Application.new pid\n end", "def application\n self\n end", "def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end", "def show\n respond_with @application = Application.find(params[:id])\n end", "def app\n @app\n end", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def instance(instance_id)\n instances([instance_id])[0]\n end", "def app\n Hanami.app\n end", "def resource_application\n return @resource_application\n end", "def current_application\n # Get from last year for Postgresql\n @current_application ||= self.applications.current.first\n end", "def application_id\n return @application_id\n end", "def info\n container.info\n end", "def get_instance_system(code)\n return code[1][1]\n end", "def get_instance instance_id\n execute do\n instances.get_instance(\n instance_path(instance_id)\n )\n end\n end", "def current_application\n Wasko::Applescript.run do\n \"get name of (info for (path to frontmost application))\"\n end\n end", "def application\n @ref.application.to_ruby\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def container_instance(task_arn)\n instance = []\n @client.describe_tasks(cluster: @cluster, tasks: [task_arn])[0].each do |e|\n instance << e[:container_instance_arn]\n end\n instance[0]\n end", "def appEM\n EmbracerApp.instance\nend", "def container\n return nil if container_type.blank? || container_id.blank?\n container_type.constantize.where(id: container_id).first\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 get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end", "def lookup(app_name)\n unless @metadata.key?(app_name)\n data = YAML.load_file(\"./data/applications/#{app_name}.yaml\")\n @metadata[app_name] = data['cots::app_metadata']\n end\n @metadata[app_name]\n end", "def instance(name)\n apps[name] ||= new\n end", "def instance(name)\n apps[name] ||= new\n end", "def show\n if @user.application.present?\n @application = @user.application\n end\n end", "def app_name\n c.application\n end", "def get_instance_by_id(id)\n get_instances_description.select {|a| a.instance_id == id}[0] rescue nil\n end", "def lookup_instance_id\n metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'\n instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )\n end", "def get id\n apps.select do |app|\n app.id == id\n end.first\n end", "def get_instance_id(instance_info)\n # puts \"look up instanceId in #{instance_info.inspect}\"\n instance_info['instancesSet']['item'][0]['instanceId']\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def container\n @container ||= find_or_create_container\n end", "def app_id\n @app.id\n end", "def show\n #表示は誰でもできる\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 @app = App.find_by(uid: params[:uid]) \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 find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end", "def main_app\n @main_app\n end", "def get_container_application_with_http_info(container_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application ...'\n end\n # verify the required parameter 'container_application_id' is set\n if @api_client.config.client_side_validation && container_application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_application_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application\"\n end\n # resource path\n local_var_path = '/fabric/container-applications/{container-application-id}'.sub('{' + 'container-application-id' + '}', container_application_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplication')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def instance instance_id\n ensure_service!\n grpc = service.get_instance instance_id\n Instance.from_grpc grpc, service\n rescue Google::Cloud::NotFoundError\n nil\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ApplicationInstance #{values}>\"\n end", "def default_app()\n @apps[0]\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", "def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end", "def application_name\n return @application_name\n end", "def app_name\n ApplicationService.application_name\n end", "def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end", "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end", "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def app(name=nil)\n if @app.nil? && name.nil? && Remotely.apps.size == 1\n name = Remotely.apps.first.first\n end\n\n (name and @app = name) or @app\n end", "def app_with_name name\n AX::Application.new name\n end", "def app\n @app ||= LiuLunch\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def get_instance(payload)\n ConferenceInstance.new(@version, payload)\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def app_identifier\n return @app_identifier\n end", "def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end", "def details(escrow_service_application_id)\n API::request(:get, \"escrow_service_applications/#{escrow_service_application_id}\")\n end", "def get_zapp_instance\n #puts \"#{plant}\"\n #puts \"#{env}\"\n return plant_attributes[@plant.intern][@env.intern][:host] + \":\" +\n\t\tplant_attributes[@plant.intern][@env.intern][:soap_port] if not plant_attributes[@plant.intern][@env.intern][:host].empty?\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Microvisor.V1.AppManifestInstance #{values}>\"\n end", "def get_instance(payload)\n CpsInstance.new(@version, payload, )\n end", "def instance\n @@instance\n end", "def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end" ]
[ "0.69512665", "0.6897422", "0.68099475", "0.6725789", "0.6423067", "0.6388604", "0.6372137", "0.6352633", "0.62013894", "0.6196321", "0.6171778", "0.61308265", "0.6094984", "0.6048397", "0.60243315", "0.6015017", "0.6004326", "0.59988546", "0.5992356", "0.59265554", "0.5917712", "0.59135586", "0.58821", "0.58789146", "0.5873393", "0.58709234", "0.58523315", "0.58445984", "0.5840771", "0.5835844", "0.5827166", "0.5814331", "0.57878864", "0.57868105", "0.577991", "0.57748413", "0.5741347", "0.5726244", "0.5724003", "0.572216", "0.569843", "0.5660242", "0.5650701", "0.56455976", "0.5645045", "0.56380427", "0.5624647", "0.5614804", "0.56007224", "0.55714923", "0.55560994", "0.5544829", "0.5544829", "0.5539958", "0.55360585", "0.5532779", "0.5531548", "0.5527802", "0.55235535", "0.5518405", "0.5507338", "0.5506786", "0.5499245", "0.54843175", "0.5480945", "0.5476239", "0.54761994", "0.5468081", "0.54670405", "0.54662067", "0.5464347", "0.5461098", "0.54581463", "0.54494214", "0.5447124", "0.54440975", "0.5438213", "0.5435707", "0.5430162", "0.54203814", "0.54203385", "0.5419891", "0.54064876", "0.54007894", "0.5395597", "0.539322", "0.53867656", "0.53808343", "0.53808343", "0.53808343", "0.53783846", "0.5374293", "0.5366635", "0.53646797", "0.53599703", "0.53516954", "0.53370386", "0.5331545", "0.53148466", "0.53146607" ]
0.6551504
4
Return a container application instance Returns information about a specific container application instance.
def get_container_application_instance_with_http_info(container_application_instance_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance ...' end # verify the required parameter 'container_application_instance_id' is set if @api_client.config.client_side_validation && container_application_instance_id.nil? fail ArgumentError, "Missing the required parameter 'container_application_instance_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application_instance" end # resource path local_var_path = '/fabric/container-application-instances/{container-application-instance-id}'.sub('{' + 'container-application-instance-id' + '}', container_application_instance_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ContainerApplicationInstance') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application_instance\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_instance(payload)\n ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def application_instance\n target\n end", "def app\n @container.app\n end", "def get_instance(payload)\n AppManifestInstance.new(@version, payload, app_sid: @solution[:app_sid])\n end", "def get_container_application_instance(container_application_instance_id, opts = {})\n data, _status_code, _headers = get_container_application_instance_with_http_info(container_application_instance_id, opts)\n data\n end", "def application\n return @application\n end", "def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end", "def application\n Application.new self[:application]\n end", "def inspect\n \"<Application name=#{@name} id=#{@id}>\"\n end", "def app\n App.load(self.app_id)\n end", "def get_instance instance_id\n instances.get_instance name: instance_path(instance_id)\n end", "def show\n @application = Application.find(params[:id])\n end", "def show\n @application = Application.find(params[:id])\n end", "def set_app_instance\n @app_instance = AppInstance.find(params[:id])\n end", "def get_instance(item)\n return InstanceManager.get_instance(item)\n end", "def app\n @options[:app]\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {},\n Mastodon::Instance)\n end", "def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end", "def instance\n perform_request_with_object(:get, '/api/v1/instance', {}, Mastodon::Instance)\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end", "def app\n @app\n end", "def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end", "def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end", "def application\n # If we have a doorkeeper_token, derive the Application from it.\n # If not, we're in case #1 above and the Application should be nil.\n @application ||= @doorkeeper_token.try(:application)\n end", "def application\n @application ||= parent.application if parent\n end", "def context\n unless @instance_context\n @instance_context = AppManifestContext.new(@version , @params['app_sid'])\n end\n @instance_context\n end", "def get_container_application(container_application_id, opts = {})\n data, _status_code, _headers = get_container_application_with_http_info(container_application_id, opts)\n data\n end", "def me\n require 'open-uri'\n begin\n instance_id = open('http://169.254.169.254/latest/meta-data/instance-id').read\n instance instance_id\n rescue OpenURI::HTTPError => e\n nil\n end\n end", "def app\n app_class.new\n end", "def app_with_pid pid\n AX::Application.new pid\n end", "def application\n self\n end", "def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end", "def show\n respond_with @application = Application.find(params[:id])\n end", "def app\n @app\n end", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def instance(instance_id)\n instances([instance_id])[0]\n end", "def app\n Hanami.app\n end", "def resource_application\n return @resource_application\n end", "def current_application\n # Get from last year for Postgresql\n @current_application ||= self.applications.current.first\n end", "def application_id\n return @application_id\n end", "def info\n container.info\n end", "def get_instance_system(code)\n return code[1][1]\n end", "def get_instance instance_id\n execute do\n instances.get_instance(\n instance_path(instance_id)\n )\n end\n end", "def current_application\n Wasko::Applescript.run do\n \"get name of (info for (path to frontmost application))\"\n end\n end", "def application\n @ref.application.to_ruby\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def container_instance(task_arn)\n instance = []\n @client.describe_tasks(cluster: @cluster, tasks: [task_arn])[0].each do |e|\n instance << e[:container_instance_arn]\n end\n instance[0]\n end", "def appEM\n EmbracerApp.instance\nend", "def container\n return nil if container_type.blank? || container_id.blank?\n container_type.constantize.where(id: container_id).first\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 get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end", "def lookup(app_name)\n unless @metadata.key?(app_name)\n data = YAML.load_file(\"./data/applications/#{app_name}.yaml\")\n @metadata[app_name] = data['cots::app_metadata']\n end\n @metadata[app_name]\n end", "def instance(name)\n apps[name] ||= new\n end", "def instance(name)\n apps[name] ||= new\n end", "def show\n if @user.application.present?\n @application = @user.application\n end\n end", "def app_name\n c.application\n end", "def get_instance_by_id(id)\n get_instances_description.select {|a| a.instance_id == id}[0] rescue nil\n end", "def lookup_instance_id\n metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'\n instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )\n end", "def get id\n apps.select do |app|\n app.id == id\n end.first\n end", "def get_instance_id(instance_info)\n # puts \"look up instanceId in #{instance_info.inspect}\"\n instance_info['instancesSet']['item'][0]['instanceId']\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def container\n @container ||= find_or_create_container\n end", "def app_id\n @app.id\n end", "def show\n #表示は誰でもできる\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 @app = App.find_by(uid: params[:uid]) \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 find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end", "def main_app\n @main_app\n end", "def get_container_application_with_http_info(container_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.get_container_application ...'\n end\n # verify the required parameter 'container_application_id' is set\n if @api_client.config.client_side_validation && container_application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_application_id' when calling ManagementPlaneApiFabricContainerApplicationsApi.get_container_application\"\n end\n # resource path\n local_var_path = '/fabric/container-applications/{container-application-id}'.sub('{' + 'container-application-id' + '}', container_application_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplication')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#get_container_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def instance instance_id\n ensure_service!\n grpc = service.get_instance instance_id\n Instance.from_grpc grpc, service\n rescue Google::Cloud::NotFoundError\n nil\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ApplicationInstance #{values}>\"\n end", "def default_app()\n @apps[0]\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", "def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end", "def application_name\n return @application_name\n end", "def app_name\n ApplicationService.application_name\n end", "def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end", "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end", "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def app(name=nil)\n if @app.nil? && name.nil? && Remotely.apps.size == 1\n name = Remotely.apps.first.first\n end\n\n (name and @app = name) or @app\n end", "def app_with_name name\n AX::Application.new name\n end", "def app\n @app ||= LiuLunch\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def get_instance(payload)\n ConferenceInstance.new(@version, payload)\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def app_identifier\n return @app_identifier\n end", "def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end", "def details(escrow_service_application_id)\n API::request(:get, \"escrow_service_applications/#{escrow_service_application_id}\")\n end", "def get_zapp_instance\n #puts \"#{plant}\"\n #puts \"#{env}\"\n return plant_attributes[@plant.intern][@env.intern][:host] + \":\" +\n\t\tplant_attributes[@plant.intern][@env.intern][:soap_port] if not plant_attributes[@plant.intern][@env.intern][:host].empty?\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Microvisor.V1.AppManifestInstance #{values}>\"\n end", "def get_instance(payload)\n CpsInstance.new(@version, payload, )\n end", "def instance\n @@instance\n end", "def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end" ]
[ "0.69512665", "0.6897422", "0.68099475", "0.6725789", "0.6551504", "0.6423067", "0.6388604", "0.6372137", "0.6352633", "0.62013894", "0.6196321", "0.6171778", "0.61308265", "0.6048397", "0.60243315", "0.6015017", "0.6004326", "0.59988546", "0.5992356", "0.59265554", "0.5917712", "0.59135586", "0.58821", "0.58789146", "0.5873393", "0.58709234", "0.58523315", "0.58445984", "0.5840771", "0.5835844", "0.5827166", "0.5814331", "0.57878864", "0.57868105", "0.577991", "0.57748413", "0.5741347", "0.5726244", "0.5724003", "0.572216", "0.569843", "0.5660242", "0.5650701", "0.56455976", "0.5645045", "0.56380427", "0.5624647", "0.5614804", "0.56007224", "0.55714923", "0.55560994", "0.5544829", "0.5544829", "0.5539958", "0.55360585", "0.5532779", "0.5531548", "0.5527802", "0.55235535", "0.5518405", "0.5507338", "0.5506786", "0.5499245", "0.54843175", "0.5480945", "0.5476239", "0.54761994", "0.5468081", "0.54670405", "0.54662067", "0.5464347", "0.5461098", "0.54581463", "0.54494214", "0.5447124", "0.54440975", "0.5438213", "0.5435707", "0.5430162", "0.54203814", "0.54203385", "0.5419891", "0.54064876", "0.54007894", "0.5395597", "0.539322", "0.53867656", "0.53808343", "0.53808343", "0.53808343", "0.53783846", "0.5374293", "0.5366635", "0.53646797", "0.53599703", "0.53516954", "0.53370386", "0.5331545", "0.53148466", "0.53146607" ]
0.6094984
13
Return the list of container application instance Returns information about all container application instance.
def list_container_application_instances(opts = {}) data, _status_code, _headers = list_container_application_instances_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @app_instances = AppInstance.all\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def instances()\n return @instances\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def instances\n @instances ||= []\n end", "def app_list\n host_os_family.app_list( self )\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def applications_list\n get \"applications\"\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end", "def list\n attrcheck = { 'compartment' => @options[:compartment] }\n @validate.validate(@options, attrcheck)\n opts = {}\n opts[:availability_domain] = @options[:availability_domain] if @options[:availability_domain]\n opts[:display_name] = @options[:display_name] if @options[:display_name]\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::ComputeClient.new\n request = request.list_instances(@options[:compartment], opts)\n request.data\n end", "def instances\n end", "def containers\n TestLab::Container.all\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end", "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "def get_instances_description\n instances\n end", "def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end", "def apps\n return @apps\n end", "def index\n @containers = Container.all\n end", "def apps\n @apps.keys\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def apps\n collect\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def index\n @instances = Instance.all\n end", "def index\n @instances = Instance.all\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def all_servers\n if is_zz?\n return app_config[:all_servers]\n end\n\n return @all_servers if @all_servers != nil\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_servers = []\n instances.each do |instance|\n @all_servers << instance['private_hostname']\n end\n # add ourselves if we have no info, running on dev box\n @all_servers << this_host_name if @all_servers.empty?\n\n @all_servers\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 running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def applications\n get(PLURAL_PATH, RESOURCE)\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 applications\n instantiate_models Application, session.get('operations/application')\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 @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 instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\n end", "def index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "def index\n @app_instances = parent_organization.app_instances.active.where(\"updated_at.gt\" => Time.at(timestamp)).select do |i|\n # force owner assignment to avoid a refetch in ability can?(:access,i)\n i.owner = parent_organization\n can?(:access,i)\n end\n end", "def available_instances\n @available_instances ||= {}\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def client_applications\n return @client_applications\n end", "def index\n @app_servers = AppServer.all\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def list_container_applications(opts = {})\n data, _status_code, _headers = list_container_applications_with_http_info(opts)\n data\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def applications\n @applications ||= [default_application]\n end", "def list_instances(an_array)\n SystemRepository.__list_instances(an_array)\n end", "def applications\n Application.for(self)\n end", "def app_servers\n return super unless chef_managed\n require 'aws-sdk-ec2'\n servers = Aws::EC2::Client.new.describe_instances(\n filters: [\n {name: 'tag:aws:cloudformation:stack-name', values: [stack_name]},\n {name: 'tag:aws:cloudformation:logical-id', values: ['Frontends']},\n {name: 'instance-state-name', values: ['running']}\n ]\n ).reservations.map(&:instances).flatten.map {|i| [\"fe-#{i.instance_id}\", i.private_dns_name]}.to_h\n servers.merge(self[:app_servers])\n end", "def containers\n return @containers\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def vm_instances\n @conn.vminstances\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def index\n respond_with @applications = Application.all\n end", "def active_instances; end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def app_servers\n return super unless CDO.chef_managed\n require 'aws-sdk'\n servers = Aws::EC2::Client.new.describe_instances(\n filters: [\n {name: 'tag:aws:cloudformation:stack-name', values: [CDO.stack_name]},\n {name: 'tag:aws:cloudformation:logical-id', values: ['Frontends']},\n {name: 'instance-state-name', values: ['running']}\n ]\n ).reservations.map(&:instances).flatten.map {|i| [\"fe-#{i.instance_id}\", i.private_dns_name]}.to_h\n servers.merge(super)\n end", "def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end", "def instances\n @controller.instance_variable_get(:\"@#{plural_instance_name}\")\n end", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def ls\n show_fields = options[:l] ? %w[name appid stateflags sizeondisk] : %w[name]\n output = @apps.map do |id, app|\n app.select{ |field| show_fields.include?(field) }\n end\n\n puts output.map{ |o| o.values.join(\"\\t\")}.join(\"\\n\")\n end", "def active_instances\n Instance.running_for_laboratory(self)\n end", "def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end", "def index\n @client_applications = ClientApplication.all\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def all(options={})\n application_filter = []\n if options.key?('ApplicationName')\n application_filter << options['ApplicationName']\n end\n\n # Initialize with empty array\n data = []\n\n applications = service.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']\n applications.each { |application|\n application['ConfigurationTemplates'].each { |template_name|\n begin\n options = {\n 'ApplicationName' => application['ApplicationName'],\n 'TemplateName' => template_name\n }\n settings = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']\n if settings.length == 1\n # Add to data\n data << settings.first\n end\n rescue Fog::AWS::ElasticBeanstalk::InvalidParameterError\n # Ignore\n end\n\n }\n }\n\n load(data) # data is an array of attribute hashes\n end", "def app\n @container.app\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 existing_instances(filter=\"\")\r\n instances_raw = `ps xao pid,pgid,command | grep '#{process_name} #{name_grep_string} #{filter}' | grep -iv #{Process.pid} | awk '{print $1 \"\\t\" $2 \"\\t\" $3}'`\r\n instances_raw.split(\"\\n\").map do |row|\r\n pid, group, command = row.split(\"\\t\")\r\n ProcessInfo.new(pid.to_i, group.to_i, command)\r\n end\r\n end", "def list_of_instances\n super\n end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def index\n @driver_applications = DriverApplication.all\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def apps_single_app_mode_list\n return @apps_single_app_mode_list\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def instances; end", "def instances; end", "def index\n @herga_applications = HergaApplication.all\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "def list_apps\n render :text => app_configs.keys\n end" ]
[ "0.70741653", "0.68802667", "0.686303", "0.6844367", "0.6828871", "0.68145436", "0.6807638", "0.6773848", "0.67506623", "0.67151296", "0.6690729", "0.6690729", "0.6588561", "0.6568741", "0.65001595", "0.6460871", "0.64605767", "0.6438094", "0.640327", "0.63563186", "0.6343829", "0.63206595", "0.6311531", "0.62752944", "0.62716293", "0.62491876", "0.6232283", "0.62307394", "0.62145483", "0.62082624", "0.6178382", "0.6172648", "0.61429745", "0.6135392", "0.613337", "0.613337", "0.61331433", "0.61284333", "0.6127117", "0.60915005", "0.6081192", "0.60711896", "0.6069639", "0.6068113", "0.6065252", "0.6065252", "0.6065252", "0.6065252", "0.60648507", "0.60536915", "0.60434234", "0.6039098", "0.6037693", "0.60363007", "0.60342693", "0.60303766", "0.60252166", "0.601953", "0.6018332", "0.601004", "0.5999554", "0.5993813", "0.5993345", "0.598651", "0.59756655", "0.59694153", "0.59557974", "0.5954746", "0.59529495", "0.594799", "0.5942548", "0.59343505", "0.58784145", "0.5868483", "0.5866689", "0.58647", "0.586345", "0.586345", "0.5862956", "0.58602613", "0.5858346", "0.5855902", "0.58428323", "0.58343613", "0.58267844", "0.5824777", "0.58204377", "0.5794919", "0.57725924", "0.5766251", "0.5764104", "0.5756481", "0.5749237", "0.5747231", "0.5745779", "0.5732867", "0.5732867", "0.57310814", "0.5722784", "0.5722344" ]
0.72023904
0
Return the list of container application instance Returns information about all container application instance.
def list_container_application_instances_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.list_container_application_instances ...' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiFabricContainerApplicationsApi.list_container_application_instances, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiFabricContainerApplicationsApi.list_container_application_instances, must be greater than or equal to 0.' end # resource path local_var_path = '/fabric/container-application-instances' # query parameters query_params = {} query_params[:'container_application_id'] = opts[:'container_application_id'] if !opts[:'container_application_id'].nil? query_params[:'container_cluster_id'] = opts[:'container_cluster_id'] if !opts[:'container_cluster_id'].nil? query_params[:'container_project_id'] = opts[:'container_project_id'] if !opts[:'container_project_id'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ContainerApplicationInstanceListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiFabricContainerApplicationsApi#list_container_application_instances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_container_application_instances(opts = {})\n data, _status_code, _headers = list_container_application_instances_with_http_info(opts)\n data\n end", "def index\n @app_instances = AppInstance.all\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def instances()\n return @instances\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def instances\n @instances ||= []\n end", "def app_list\n host_os_family.app_list( self )\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def applications_list\n get \"applications\"\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def list\n attrcheck = { 'compartment' => @options[:compartment] }\n @validate.validate(@options, attrcheck)\n opts = {}\n opts[:availability_domain] = @options[:availability_domain] if @options[:availability_domain]\n opts[:display_name] = @options[:display_name] if @options[:display_name]\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::ComputeClient.new\n request = request.list_instances(@options[:compartment], opts)\n request.data\n end", "def instances\n end", "def containers\n TestLab::Container.all\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end", "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "def get_instances_description\n instances\n end", "def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end", "def apps\n return @apps\n end", "def index\n @containers = Container.all\n end", "def apps\n @apps.keys\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def apps\n collect\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def index\n @instances = Instance.all\n end", "def index\n @instances = Instance.all\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def describe_all_instances\n @os_aws.describe_all_instances\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 all_servers\n if is_zz?\n return app_config[:all_servers]\n end\n\n return @all_servers if @all_servers != nil\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_servers = []\n instances.each do |instance|\n @all_servers << instance['private_hostname']\n end\n # add ourselves if we have no info, running on dev box\n @all_servers << this_host_name if @all_servers.empty?\n\n @all_servers\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def applications\n get(PLURAL_PATH, RESOURCE)\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 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 applications\n instantiate_models Application, session.get('operations/application')\n end", "def instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\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 index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "def index\n @app_instances = parent_organization.app_instances.active.where(\"updated_at.gt\" => Time.at(timestamp)).select do |i|\n # force owner assignment to avoid a refetch in ability can?(:access,i)\n i.owner = parent_organization\n can?(:access,i)\n end\n end", "def available_instances\n @available_instances ||= {}\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def client_applications\n return @client_applications\n end", "def index\n @app_servers = AppServer.all\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def list_container_applications(opts = {})\n data, _status_code, _headers = list_container_applications_with_http_info(opts)\n data\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def applications\n @applications ||= [default_application]\n end", "def list_instances(an_array)\n SystemRepository.__list_instances(an_array)\n end", "def applications\n Application.for(self)\n end", "def app_servers\n return super unless chef_managed\n require 'aws-sdk-ec2'\n servers = Aws::EC2::Client.new.describe_instances(\n filters: [\n {name: 'tag:aws:cloudformation:stack-name', values: [stack_name]},\n {name: 'tag:aws:cloudformation:logical-id', values: ['Frontends']},\n {name: 'instance-state-name', values: ['running']}\n ]\n ).reservations.map(&:instances).flatten.map {|i| [\"fe-#{i.instance_id}\", i.private_dns_name]}.to_h\n servers.merge(self[:app_servers])\n end", "def containers\n return @containers\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def vm_instances\n @conn.vminstances\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def index\n respond_with @applications = Application.all\n end", "def active_instances; end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end", "def app_servers\n return super unless CDO.chef_managed\n require 'aws-sdk'\n servers = Aws::EC2::Client.new.describe_instances(\n filters: [\n {name: 'tag:aws:cloudformation:stack-name', values: [CDO.stack_name]},\n {name: 'tag:aws:cloudformation:logical-id', values: ['Frontends']},\n {name: 'instance-state-name', values: ['running']}\n ]\n ).reservations.map(&:instances).flatten.map {|i| [\"fe-#{i.instance_id}\", i.private_dns_name]}.to_h\n servers.merge(super)\n end", "def instances\n @controller.instance_variable_get(:\"@#{plural_instance_name}\")\n end", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def ls\n show_fields = options[:l] ? %w[name appid stateflags sizeondisk] : %w[name]\n output = @apps.map do |id, app|\n app.select{ |field| show_fields.include?(field) }\n end\n\n puts output.map{ |o| o.values.join(\"\\t\")}.join(\"\\n\")\n end", "def active_instances\n Instance.running_for_laboratory(self)\n end", "def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end", "def index\n @client_applications = ClientApplication.all\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def all(options={})\n application_filter = []\n if options.key?('ApplicationName')\n application_filter << options['ApplicationName']\n end\n\n # Initialize with empty array\n data = []\n\n applications = service.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']\n applications.each { |application|\n application['ConfigurationTemplates'].each { |template_name|\n begin\n options = {\n 'ApplicationName' => application['ApplicationName'],\n 'TemplateName' => template_name\n }\n settings = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']\n if settings.length == 1\n # Add to data\n data << settings.first\n end\n rescue Fog::AWS::ElasticBeanstalk::InvalidParameterError\n # Ignore\n end\n\n }\n }\n\n load(data) # data is an array of attribute hashes\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 app\n @container.app\n end", "def existing_instances(filter=\"\")\r\n instances_raw = `ps xao pid,pgid,command | grep '#{process_name} #{name_grep_string} #{filter}' | grep -iv #{Process.pid} | awk '{print $1 \"\\t\" $2 \"\\t\" $3}'`\r\n instances_raw.split(\"\\n\").map do |row|\r\n pid, group, command = row.split(\"\\t\")\r\n ProcessInfo.new(pid.to_i, group.to_i, command)\r\n end\r\n end", "def list_of_instances\n super\n end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def index\n @driver_applications = DriverApplication.all\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def apps_single_app_mode_list\n return @apps_single_app_mode_list\n end", "def instances; end", "def instances; end", "def index\n @herga_applications = HergaApplication.all\n end", "def list_apps\n render :text => app_configs.keys\n end", "def index\n @sequence_instances = SequenceInstance.all\n end" ]
[ "0.7200382", "0.70771295", "0.6882792", "0.68627363", "0.6846671", "0.6831928", "0.68171144", "0.68112445", "0.6777662", "0.6752903", "0.6716031", "0.66912186", "0.66912186", "0.6590937", "0.6571754", "0.65021604", "0.6462238", "0.6461963", "0.6440176", "0.6406511", "0.63565016", "0.63464874", "0.6323019", "0.63113415", "0.627813", "0.6273665", "0.6253052", "0.6233124", "0.6231977", "0.62144166", "0.6209511", "0.61783785", "0.6173872", "0.6146296", "0.61371505", "0.61371505", "0.61368984", "0.6136833", "0.61304504", "0.61287886", "0.6090704", "0.60823095", "0.60734606", "0.6070619", "0.6070267", "0.60673016", "0.60671645", "0.60671645", "0.60671645", "0.60671645", "0.60549706", "0.60453284", "0.6040958", "0.6040197", "0.6037022", "0.6034414", "0.60324377", "0.602405", "0.6017265", "0.6017068", "0.6012335", "0.59987813", "0.5996039", "0.5993247", "0.59869283", "0.59743786", "0.5973744", "0.59567165", "0.5956531", "0.5956444", "0.594986", "0.5945645", "0.5934968", "0.5881373", "0.5868968", "0.5868855", "0.5866761", "0.5866124", "0.5866124", "0.58658755", "0.58621424", "0.5860144", "0.585736", "0.58439726", "0.5835281", "0.5825295", "0.58247507", "0.58217835", "0.5798331", "0.57756877", "0.57686913", "0.5765535", "0.5757726", "0.5752143", "0.57494104", "0.57481843", "0.5736049", "0.5736049", "0.57327807", "0.57250124", "0.5723311" ]
0.0
-1
Return the List of Container Applications Returns information about all Container Applications.
def list_container_applications(opts = {}) data, _status_code, _headers = list_container_applications_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applications_list\n get \"applications\"\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\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 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 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 app_list\n host_os_family.app_list( self )\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end", "def applications\n @applications ||= [default_application]\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 applications\n get(PLURAL_PATH, RESOURCE)\n end", "def index\n respond_with @applications = Application.all\n end", "def client_applications\n return @client_applications\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 list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\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 apps\n return @apps\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def apps\n @apps.keys\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def apps\n collect\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def get_applications(opts = {})\n data, _status_code, _headers = get_applications_with_http_info(opts)\n data\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def known_client_applications\n return @known_client_applications\n end", "def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @client_applications = ClientApplication.all\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 list_container_application_instances(opts = {})\n data, _status_code, _headers = list_container_application_instances_with_http_info(opts)\n data\n end", "def applications\n instantiate_models Application, session.get('operations/application')\n end", "def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end", "def apps\n unless @apps\n load!\n end\n\n @apps\n end", "def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\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 list_apps\n render :text => app_configs.keys\n end", "def get_application_list(opts = {})\n data, _status_code, _headers = get_application_list_with_http_info(opts)\n data\n end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def applications\n Application.for(self)\n end", "def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\n end", "def apps_single_app_mode_list\n return @apps_single_app_mode_list\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 index\n @jobapplications = Jobapplication.all\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 list_container_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.list_container_applications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiFabricContainerApplicationsApi.list_container_applications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiFabricContainerApplicationsApi.list_container_applications, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/fabric/container-applications'\n\n # query parameters\n query_params = {}\n query_params[:'container_cluster_id'] = opts[:'container_cluster_id'] if !opts[:'container_cluster_id'].nil?\n query_params[:'container_project_id'] = opts[:'container_project_id'] if !opts[:'container_project_id'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ContainerApplicationListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiFabricContainerApplicationsApi#list_container_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end", "def installed_apps\n return @installed_apps\n end", "def installed_apps\n return @installed_apps\n end", "def index\n @job_applications = JobApplication.all\n end", "def index\n @agent_applications = AgentApplication.all\n end", "def index\n @applications = @opportunity.applications\n end", "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end", "def index\n @user_applications = UserApplication.all\n end", "def apps\n apps_found = []\n server_xml = Liberty.server_xml(@app_dir)\n if Liberty.web_inf(@app_dir)\n apps_found = [@app_dir]\n elsif server_xml\n apps_found = Dir.glob(File.expand_path(File.join(server_xml, '..', '**', '*.war')))\n Liberty.expand_apps(apps_found)\n end\n apps_found\n end", "def index\n set_meta_tags title: 'Collections - Repositories | Admin | Settings'\n # oread_application_ownerships\n @applications = Oread::Application.order(name: :asc)\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def applications\n apps = {}\n Dir[File.join(@path, '*')].each do |store_dir|\n name = File.basename(store_dir)\n \n apps[name] = ApplicationConfiguration.new name, store_dir\n end\n \n apps\n end", "def client_applications=(value)\n @client_applications = value\n end", "def index\n @apps = Addon.all\n end", "def aps_application_names(start = 0, count = 1)\n a = redis.smembers(:aps_applications)\n return a if count == 0\n a[start..(start + count)] || []\n end", "def apps(criteria = {})\n all_available_apps.filter_with_criteria(criteria)\n end", "def app_catalogs()\n return MicrosoftGraph::AppCatalogs::AppCatalogsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @driver_applications = DriverApplication.all\n end", "def mobile_apps\n return @mobile_apps\n end", "def dock_apps(user = CURRENTUSER)\n\n\tplist = CFPropertyList::List.new(:file => \"/Users/#{user}/Library/Preferences/com.apple.dock.plist\")\n\tresults=CFPropertyList.native_types(plist.value)\n\tapps=[]\n\tfor key, value in results['persistent-apps']\n\t\tfor key, value in key\n\t\t\tif value.class == Hash\n\t\t\t\tfor x, y in value\n\t\t\t\t\tif x == \"file-label\"\n\t\t\t\t\t\tapps.push(y)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn apps\nend", "def index\n @apps = Application.order(:name).all\n end", "def ls\n show_fields = options[:l] ? %w[name appid stateflags sizeondisk] : %w[name]\n output = @apps.map do |id, app|\n app.select{ |field| show_fields.include?(field) }\n end\n\n puts output.map{ |o| o.values.join(\"\\t\")}.join(\"\\n\")\n end", "def managed_apps\n return @managed_apps\n end", "def index\n @project_applications = ProjectApplication.all\n end", "def index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end", "def index\n @applications = @application_scope\n end", "def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end", "def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end", "def index\n @containers = Container.all\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 find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\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 darwin_app_list; end", "def index\n @merchant_applications = MerchantApplication.all\n end", "def show\n @app_resouces = @app_list.app_resouces.all\n end", "def index\n @job_applications = @job_applications_active\n end", "def index\n @parent_apps = ParentApp.all\n end", "def index\n @cotiz_apps = CotizApp.all\n end", "def containers\n TestLab::Container.all\n end", "def registered_applications\n @registered_applications ||= current_user.registered_applications.all\n end", "def get_apps(scope)\n\t\tcase scope\n\t\twhen :added\n\t\t\treturn ClientApplication.select(\"client_applications.*\").\n\t\t\tjoins(:oauth_tokens).\n\t\t\twhere(\"oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null and oauth_tokens.type = 'AccessToken'\").\n\t\t\twhere(\"client_applications.id = oauth_tokens.client_application_id and oauth_tokens.user_id = #{id}\").\n\t\t\tgroup(\"client_applications.id\").\n\t\t\torder(\"oauth_tokens.authorized_at DESC\")\n\t\t\n\t\twhen :created\n\t\t\treturn apps\n\t\tend\n\tend" ]
[ "0.78616524", "0.7678432", "0.7557101", "0.74325347", "0.72949404", "0.72949404", "0.7161362", "0.7102965", "0.70759654", "0.70349514", "0.6901106", "0.68714505", "0.6860461", "0.67731696", "0.67603207", "0.6759043", "0.6711178", "0.6661583", "0.66463166", "0.66190475", "0.661268", "0.6610799", "0.6610799", "0.6610799", "0.6610799", "0.65485835", "0.6542891", "0.65423155", "0.65423155", "0.6530484", "0.6507557", "0.6507557", "0.65047467", "0.64643794", "0.64643794", "0.6461206", "0.6427084", "0.63540345", "0.63371146", "0.63153946", "0.631416", "0.6310178", "0.62963325", "0.62749696", "0.62603796", "0.6252507", "0.62488246", "0.6232966", "0.6217547", "0.6204262", "0.6166521", "0.6164943", "0.61647713", "0.61641175", "0.61380345", "0.6081991", "0.60713595", "0.6031627", "0.6010393", "0.6010393", "0.6006975", "0.60054284", "0.600206", "0.5998671", "0.598446", "0.59789085", "0.59661525", "0.59556645", "0.59354204", "0.59257555", "0.5921658", "0.5918261", "0.5914827", "0.59070474", "0.59000516", "0.58990425", "0.5897745", "0.5849965", "0.584292", "0.5822481", "0.58113563", "0.5810826", "0.58041", "0.5798401", "0.5767783", "0.5758982", "0.5750801", "0.57379293", "0.5729666", "0.5724524", "0.57243204", "0.5722641", "0.5714716", "0.57099", "0.5708094", "0.5703024", "0.5675696", "0.56652564", "0.56641364", "0.56597286" ]
0.7863949
0
Return the List of Container Applications Returns information about all Container Applications.
def list_container_applications_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiFabricContainerApplicationsApi.list_container_applications ...' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiFabricContainerApplicationsApi.list_container_applications, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiFabricContainerApplicationsApi.list_container_applications, must be greater than or equal to 0.' end # resource path local_var_path = '/fabric/container-applications' # query parameters query_params = {} query_params[:'container_cluster_id'] = opts[:'container_cluster_id'] if !opts[:'container_cluster_id'].nil? query_params[:'container_project_id'] = opts[:'container_project_id'] if !opts[:'container_project_id'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ContainerApplicationListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiFabricContainerApplicationsApi#list_container_applications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_container_applications(opts = {})\n data, _status_code, _headers = list_container_applications_with_http_info(opts)\n data\n end", "def applications_list\n get \"applications\"\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\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 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 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 app_list\n host_os_family.app_list( self )\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end", "def applications\n @applications ||= [default_application]\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 applications\n get(PLURAL_PATH, RESOURCE)\n end", "def index\n respond_with @applications = Application.all\n end", "def client_applications\n return @client_applications\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 list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\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 apps\n return @apps\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def apps\n @apps.keys\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def apps\n collect\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def get_applications(opts = {})\n data, _status_code, _headers = get_applications_with_http_info(opts)\n data\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def known_client_applications\n return @known_client_applications\n end", "def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @client_applications = ClientApplication.all\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 list_container_application_instances(opts = {})\n data, _status_code, _headers = list_container_application_instances_with_http_info(opts)\n data\n end", "def applications\n instantiate_models Application, session.get('operations/application')\n end", "def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end", "def apps\n unless @apps\n load!\n end\n\n @apps\n end", "def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\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 list_apps\n render :text => app_configs.keys\n end", "def get_application_list(opts = {})\n data, _status_code, _headers = get_application_list_with_http_info(opts)\n data\n end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def applications\n Application.for(self)\n end", "def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\n end", "def apps_single_app_mode_list\n return @apps_single_app_mode_list\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 index\n @jobapplications = Jobapplication.all\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 # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end", "def installed_apps\n return @installed_apps\n end", "def installed_apps\n return @installed_apps\n end", "def index\n @job_applications = JobApplication.all\n end", "def index\n @agent_applications = AgentApplication.all\n end", "def index\n @applications = @opportunity.applications\n end", "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end", "def index\n @user_applications = UserApplication.all\n end", "def apps\n apps_found = []\n server_xml = Liberty.server_xml(@app_dir)\n if Liberty.web_inf(@app_dir)\n apps_found = [@app_dir]\n elsif server_xml\n apps_found = Dir.glob(File.expand_path(File.join(server_xml, '..', '**', '*.war')))\n Liberty.expand_apps(apps_found)\n end\n apps_found\n end", "def index\n set_meta_tags title: 'Collections - Repositories | Admin | Settings'\n # oread_application_ownerships\n @applications = Oread::Application.order(name: :asc)\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def applications\n apps = {}\n Dir[File.join(@path, '*')].each do |store_dir|\n name = File.basename(store_dir)\n \n apps[name] = ApplicationConfiguration.new name, store_dir\n end\n \n apps\n end", "def client_applications=(value)\n @client_applications = value\n end", "def index\n @apps = Addon.all\n end", "def aps_application_names(start = 0, count = 1)\n a = redis.smembers(:aps_applications)\n return a if count == 0\n a[start..(start + count)] || []\n end", "def apps(criteria = {})\n all_available_apps.filter_with_criteria(criteria)\n end", "def app_catalogs()\n return MicrosoftGraph::AppCatalogs::AppCatalogsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @driver_applications = DriverApplication.all\n end", "def mobile_apps\n return @mobile_apps\n end", "def dock_apps(user = CURRENTUSER)\n\n\tplist = CFPropertyList::List.new(:file => \"/Users/#{user}/Library/Preferences/com.apple.dock.plist\")\n\tresults=CFPropertyList.native_types(plist.value)\n\tapps=[]\n\tfor key, value in results['persistent-apps']\n\t\tfor key, value in key\n\t\t\tif value.class == Hash\n\t\t\t\tfor x, y in value\n\t\t\t\t\tif x == \"file-label\"\n\t\t\t\t\t\tapps.push(y)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn apps\nend", "def index\n @apps = Application.order(:name).all\n end", "def ls\n show_fields = options[:l] ? %w[name appid stateflags sizeondisk] : %w[name]\n output = @apps.map do |id, app|\n app.select{ |field| show_fields.include?(field) }\n end\n\n puts output.map{ |o| o.values.join(\"\\t\")}.join(\"\\n\")\n end", "def managed_apps\n return @managed_apps\n end", "def index\n @project_applications = ProjectApplication.all\n end", "def index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end", "def index\n @applications = @application_scope\n end", "def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end", "def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end", "def index\n @containers = Container.all\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 find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\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 darwin_app_list; end", "def index\n @merchant_applications = MerchantApplication.all\n end", "def show\n @app_resouces = @app_list.app_resouces.all\n end", "def index\n @job_applications = @job_applications_active\n end", "def index\n @parent_apps = ParentApp.all\n end", "def index\n @cotiz_apps = CotizApp.all\n end", "def containers\n TestLab::Container.all\n end", "def registered_applications\n @registered_applications ||= current_user.registered_applications.all\n end", "def get_apps(scope)\n\t\tcase scope\n\t\twhen :added\n\t\t\treturn ClientApplication.select(\"client_applications.*\").\n\t\t\tjoins(:oauth_tokens).\n\t\t\twhere(\"oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null and oauth_tokens.type = 'AccessToken'\").\n\t\t\twhere(\"client_applications.id = oauth_tokens.client_application_id and oauth_tokens.user_id = #{id}\").\n\t\t\tgroup(\"client_applications.id\").\n\t\t\torder(\"oauth_tokens.authorized_at DESC\")\n\t\t\n\t\twhen :created\n\t\t\treturn apps\n\t\tend\n\tend" ]
[ "0.7863949", "0.78616524", "0.7678432", "0.7557101", "0.74325347", "0.72949404", "0.72949404", "0.7161362", "0.7102965", "0.70759654", "0.70349514", "0.6901106", "0.68714505", "0.6860461", "0.67731696", "0.67603207", "0.6759043", "0.6711178", "0.6661583", "0.66463166", "0.66190475", "0.661268", "0.6610799", "0.6610799", "0.6610799", "0.6610799", "0.65485835", "0.6542891", "0.65423155", "0.65423155", "0.6530484", "0.6507557", "0.6507557", "0.65047467", "0.64643794", "0.64643794", "0.6461206", "0.6427084", "0.63540345", "0.63371146", "0.63153946", "0.631416", "0.6310178", "0.62963325", "0.62749696", "0.62603796", "0.6252507", "0.62488246", "0.6232966", "0.6217547", "0.6204262", "0.6166521", "0.6164943", "0.61647713", "0.61641175", "0.61380345", "0.6081991", "0.6031627", "0.6010393", "0.6010393", "0.6006975", "0.60054284", "0.600206", "0.5998671", "0.598446", "0.59789085", "0.59661525", "0.59556645", "0.59354204", "0.59257555", "0.5921658", "0.5918261", "0.5914827", "0.59070474", "0.59000516", "0.58990425", "0.5897745", "0.5849965", "0.584292", "0.5822481", "0.58113563", "0.5810826", "0.58041", "0.5798401", "0.5767783", "0.5758982", "0.5750801", "0.57379293", "0.5729666", "0.5724524", "0.57243204", "0.5722641", "0.5714716", "0.57099", "0.5708094", "0.5703024", "0.5675696", "0.56652564", "0.56641364", "0.56597286" ]
0.60713595
57
Marks a word as forbidden for identifiers.
def not_keyword(string) (str(string) >> identifier_match.absent?).absent? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end", "def reserved(words)\n lang_eval { @reserved = words }\n nil\n end", "def forbidden_keyword_validation\n errors.add :value, I18n.t('errors.messages.exclusion') if value =~ /(#{blocked_keywords.split(',').map(&:strip).join('|')})/\n end", "def legal(word)\n @illegal_words[word] == nil && @legal_limbo[word] == nil\n end", "def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end", "def check_bad_word(o)\n @@bad_word_visitor.visit_this_0(self, o)\n end", "def uncountable(word, term: :noun)\n @uncountables[term] << word\n end", "def hide_word \n\t\[email protected] do \n\t\t\t@secret_word += \"-\" \n\t\tend\n\t\t@secret_word\n\tend", "def illegal_words\n @words.select{ |word| word.length > @width }\n end", "def hide(word)\r\n\t\tword.length.times {@hidden_word << \"_\" }\r\n\t\t@hidden_word\r\n\tend", "def hide_word(word)\n word.split('').map { '_' }.join\n end", "def setWord(word) # CoreLabel.java:336\n raise NotImplementedError\n end", "def unkify(word)\n unless @word_counts.include? word\n word = UNK_TOKEN\n end \n return word\n end", "def badword_QualifiedName(o)\n if o.value == 'bigly'\n acceptor.accept(Issues::INVALID_WORD, o, :text => o.value)\n end\n end", "def hide_word(chosen_word)\n blank_word = chosen_word.gsub(/\\w/,\"_\")\n end", "def setsecretword word\r\n\t\t @secretword = word\r\n\t\t templ = createtemplate\r\n\t\t\t\t\tword_templ = templ.gsub(\"[\",\"\").gsub(\"]\",\"\")\r\n\t\t\t\t\ti=0\r\n\t\t\t\t\[email protected]\r\n\t\t\t\t\twhile i < sec_word_array.length do\r\n\t\t\t\t\t\tif sec_word_array[i] == \" \"\r\n\t\t\t\t\t @resulta[i] = \" \"\r\n\t\t\t\t\t else\r\n\t\t\t\t\t \t@resulta[i] = \"_\"\r\n\t\t\t\t end\r\n\t\t\t\t i+=1\r\n\t\t\t\t end\r\n\t\t end", "def reserved_word?(str)\n RESERVED_WORDS.include?(str.downcase)\n end", "def store_valid_word(word)\n @words << word\n @word_index[word] = @last_letter\n end", "def allow_short_words\n not @emphasis[:ignore_short_words]\n end", "def remove_protection(pyro_word)\n pyro_word.gsub(/!/,'')\n end", "def identifier_valid?(key)\n key = key.to_s\n ForbiddenChars.each_char do |char|\n return false if key.include?(char)\n end\n end", "def secret_word=(word)\n @secret_word = word.upcase\n @secret_word_length = word.length\n end", "def check_word(word)\n valid_words.include?(word)\n end", "def submit_word(word)\n letters_present_for(word) && @dictionary.include?(word)\n end", "def not_reserved\n errors.add(:name, 'is reserved') if self.name.downcase.in?(self.class.reserved_names)\n end", "def reject?(word)\n config.rejects.include?(word)\n end", "def add_adjective!(word)\n new_word = Unicode.downcase(word)\n new_word[-2..-1] = \"ая\"\n @redis.rpush(\"store:adjectives\", new_word) \n end", "def is_valid_word?(word)\n DICTIONARY.include?(word)\n end", "def highlight_blacklisted_words\n params[:comment_text]&.gsub(/(#{Regexp.union(BLACKLISTED_WORDS).source})/i) { |s| \"<<#{s}>>\" }\n end", "def word_not_changed\n errors.add(:word, :cant_be_changed) if @tag && @tag.word != self.word\n end", "def define_word(word)\n REDIS.lrange(word, 0, -1)\n end", "def must_form_word(letter_vars)\n raise 'The word is too long.' if letter_vars.size > MAX_WORD_LENGTH\n # Create a variable for the word with the dictionary's words as\n # domain and add the constraint.\n word = int_var @dictionary.words_of_size(letter_vars.size)\n letter_vars.to_number(BASE).must == word\n @words << word\n end", "def hide_word\t\n\t\thidden_word\n\tend", "def invalid_word? word\n\t\tstopwords_list.collect{ |w| w if w.include? word.to_s.strip }.uniq.any?\n\tend", "def disallowSide(side)\n self.allowedSides = self.allowedSides & ~side\n end", "def avoid!\n @to_avoid << @name.downcase\n end", "def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end", "def uncountable(*words)\n @uncountables.add(words)\n end", "def uncountable?(word)\n Noun[word].uncountable?\n end", "def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+|[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+$/\n word.gsub!(regex, \"\")\n \n next if word.length == 0\n \n # Convert to lowercase\n word = word.mb_chars.downcase.to_s\n current_word = word\n \n while word.length > 0 do\n if Match.find_by_word_and_text_id(word, @text)\n break\n else\n if word.length == 1\n @missing.push(\"#{current_word}#{lemma}\")\n break\n else\n if word.last == \"*\"\n word.chomp!(\"*\") # Remove wildcard character, if present\n word = word[0..-2] # Remove last character\n end\n word << \"*\" # Add wildcard character\n end\n end\n end\n end\n end", "def escape_special_characters(word)\n LUCENE_SPECIAL_CHARS.each do |c|\n word.gsub!(c, \"\\\\#{c}\")\n end\n\n # need to use a block since doing gsub without a block with a '+' doesn't work\n word.gsub!('+') {|m| '\\+'}\n end", "def words=(v)\n Axlsx.validate_int v\n @words = v\n end", "def set_word\n @word = current_user.words.includes(:flags).friendly.find(params[:id])\n rescue ActiveRecord::RecordNotFound => ex\n # set temporary word if given :id is a word (not integer)\n # only in case of show action\n temp_id = params[:id]\n if (temp_id.to_i.to_s != temp_id) && (params[:action] == \"show\")\n params[:word] = {word: temp_id}\n params[:id] = nil\n @word = current_user.words.build(word_params)\n else\n raise ex\n end\n end", "def unless_valid_underscored_identifier(str)\n if str =~ /[^0-9a-z_]/ || str =~ /^[0-9]/\n yield\n end\n end", "def modified_word(word)\n idx = rand(-1...word.length)\n str = word[idx]\n tmp_word = if idx.even?\n word.insert(idx,str)\n else\n word.delete(str)\n end\n return tmp_word unless dictionary.dict.include?(tmp_word)\n modified_word(word)\n end", "def forbidden\n head :forbidden\n end", "def deny!(kind, name, attributes = {})\n deny(kind, name, attributes).save\n end", "def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend", "def set_suspicious_keyword\n @suspicious_keyword = SuspiciousKeyword.find(params[:id])\n end", "def add_word(word)\n \n end", "def _excluded_words\n Lexhub.configuration.excluded_words\n end", "def allow(ids); end", "def word=(word)\n @word=word\n end", "def mark_invalid_identifiers(value)\n return value.map { |v| send(__method__, v) } if value.is_a?(Array)\n type, id_part = value.to_s.split(':', 2)\n if id_part.nil? # No type prefix.\n value\n elsif (identifier = PublicationIdentifier.create(id_part, type))&.valid?\n identifier.to_s\n else\n tip = \"This is not a valid #{type.upcase} identifier.\" # TODO: I18n\n html_span(value, class: 'invalid', title: tip)\n end\n end", "def wrong_guess(letter)\n @possible_letters.delete(letter)\n @dictionary.reject_words_that_contain(letter)\n end", "def deny(kind, name, attributes = {})\n new attributes.merge(:kind => kind, :name => name, :allow => false)\n end", "def remove_from_whitelist(word)\n params = {\n :method => WebPurify::Constants.methods[:remove_from_whitelist],\n :word => word\n }\n parsed = WebPurify::Request.query(text_request_base, @query_base, params)\n return parsed[:success]=='1'\n end", "def allow(key)\n @status[key] = :allowed\n end", "def id_safe(text)\n\t\ttext.gsub(/[ .?!]/, ' ' => '-', '.' => '', '?' => '', '!' => '').gsub(/-{2,}/, '-').downcase.to_s\n\tend", "def acronym(word)\n @acronyms[word.downcase] = word\n define_acronym_regex_patterns\n end", "def correct word\n known [word] or known(variation_words word) or [word]\n end", "def mask_article(string, words)\n words.each { |x| string.gsub!(x, strike(x))}\n string\nend", "def prohibit(key)\n @status[key] = :prohibited\n end", "def legal?(word)\n\t\tself.is_length(word) && self.letters?(word) && self.duplicates?(word) # Will return true or false if given word is legal/not legal\n\tend", "def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend", "def mysql_ignore(words)\r\n return false unless words\r\n return true if superset?(@semantic_matcher.mysql_stop_words,words)\r\n # if all words are #'s ignore it\r\n words.each do |word|\r\n return false unless word.match(/\\d+/)\r\n end\r\n true\r\n end", "def mask_article(str, words_array)\n new_str = str\n words_array.each do |word|\n new_str.gsub! word, strike(word) if new_str.include? word\n end\n\n new_str\nend", "def find_pyro_word(english_word)\n translated = RULES.inject(english_word) { |word, rule|\n # wrap the regex in extra pattern than will stop it from being replaced if anything is wrapped in !..!\n word.gsub(protect_regex(rule.match), rule.result)\n }\n remove_protection(translated)\n end", "def set_word\n dic = File.read(\"dic.txt\").downcase.split\n dic.reject! {|word| word.length<5 || word.length>12}\n word = dic.sample\n end", "def setWord(word, value)\n @bits[word] = value\n end", "def set_worker_word(worker, word)\n # puts \"######### #{worker} ######## #{word}\"\n\n # Load hash of who has done what\n worker_words = YAML::Store.new(AMT_WORKER_WORD_LIST)\n worker_words.transaction do\n # Set to array if she be not exist and add the word to the list\n worker_words[worker] = [] unless worker_words[worker]\n worker_words[worker] << word if(!worker_words[worker].include?(word))\n end\n end", "def denied_titles\n %w(Steez Onkyo Edifier Logitech Sony VicTsing Lightbeats Eupatorium WHARNCLIFFE\n Audio-Technica Senbowe SoundBot FOCUS-Lucia-Bose Sennheiser Kindle Skullcandy\n Beats Fitbit\n CoolStream Tenergy Einstein CableJive Meily ASICS JAM YCC BMR)\n end", "def mark_word dw, idx, dir\n dw.dir = get_direction_in_text dir\n dw.place = calculate_coordinate_in_grid idx\n end", "def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end", "def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end", "def suppress name\n name = /#{name}/ unless name.is_a? Regexp\n (@suppressed[@current] ||= []) << name\n end", "def word=(word)\n write_attribute(:word, word.present? ? word.to_s.strip.mb_chars.downcase.to_s : word)\n end", "def censor(sentence, curse_words)\n words = sentence.split(\" \")\n\n asterisked_words = words.map do |word|\n if curse_words.include?(word.downcase)\n asterisked_word(word)\n else\n word\n end\n end\n\n asterisked_words.join(\" \")\nend", "def word_params\n params.require(:word).permit!\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def set_Word(value)\n set_input(\"Word\", value)\n end", "def synonym(existing_word, *synonyms)\n existing_word = existing_word.to_s\n raise \"'#{existing_word}' is not in the vocabulary\" if type(existing_word).nil?\n reduced_form = reduce(existing_word)\n [synonyms].flatten.each do |syn|\n syn = syn.to_s\n existing_definition = @type_map[syn]\n if existing_definition.nil?\n @type_map[syn] = reduced_form\n elsif existing_definition != reduced_form\n raise \"'#{syn}' is already defined and is incompatible as a synonym of #{existing_word}\"\n end\n end\n end", "def in_a_word\n WORDS[self]\n end", "def add_word(word)\r\n \r\n end", "def treat_reserved_as_conflict; end", "def kill_word(*)\n first_non_letter = current_buffer.index(/\\P{L}/, current_buffer.point) || current_buffer.length\n word_beginning = current_buffer.index(/\\p{L}/, first_non_letter) || current_buffer.length\n current_buffer.slice!(current_buffer.point, word_beginning - current_buffer.point)\n true\nend", "def tag!(word_or_words, user)\n arr_of_words(word_or_words).each do |word|\n raise StandardError if Tag.exists?(_tag_conditions(user, word))\n t = Tag.create(_tag_conditions(user, word))\n taggings << t.id\n tag_words << word unless tag_words.include?(word)\n end\n save\n tags\n end", "def forbidden!\n render_api_error!('403 Forbidden', 403)\n end", "def wikify(word)\n begin\n word = word.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n word = word.gsub(/\\s/, '')\n word.underscore\n rescue => e\n puts e.inspect\n puts e.backtrace\n end\n end", "def reserved_words=(_arg0); end", "def replace_correct_letters\n result = @secret_word\n @secret_word.split('').each do |letter|\n unless @characters_guessed_correctly.include? letter\n result = result.gsub(letter, '_')\n end\n end\n @word_guessed = result\n result\n end", "def add_noun!(word)\n @redis.rpush(\"store:nouns\", Unicode.downcase(word))\n end", "def role_name_must_be_whitelisted\n unless role_name.present? &&\n Employable::RoleStories.role_names.include?(role_name.to_sym)\n role_names_to_sentence = Employable::RoleStories.role_names.to_sentence(\n two_words_connector: ' or ',\n last_word_connector: ', or '\n )\n errors.add(:role_name, \"must be one of \\\"#{role_names_to_sentence}\\\"\")\n end\n end" ]
[ "0.63714725", "0.6279902", "0.6228516", "0.6198688", "0.6157733", "0.60355353", "0.5936666", "0.5930061", "0.5857756", "0.5852166", "0.5827314", "0.581316", "0.58029705", "0.5734699", "0.56894755", "0.5661616", "0.5655303", "0.56150174", "0.55704474", "0.55484295", "0.5524326", "0.5516498", "0.5473963", "0.5452593", "0.5440012", "0.5426539", "0.5382289", "0.5374344", "0.53624135", "0.53440714", "0.53400403", "0.5332007", "0.53266317", "0.530677", "0.5306667", "0.5306117", "0.530335", "0.5265364", "0.522845", "0.5221739", "0.51870376", "0.5184944", "0.51840985", "0.51716894", "0.51701236", "0.515507", "0.51365966", "0.51353586", "0.5125574", "0.51206505", "0.5119658", "0.51133555", "0.51002526", "0.51001155", "0.50911534", "0.508633", "0.50820285", "0.5079678", "0.5078428", "0.5070519", "0.5062416", "0.50602925", "0.5055688", "0.50539464", "0.50510305", "0.50508827", "0.5033348", "0.5031357", "0.50258154", "0.50152236", "0.5010137", "0.50067824", "0.49978545", "0.499554", "0.49936917", "0.4992394", "0.49808547", "0.49767956", "0.49767798", "0.497118", "0.497118", "0.497118", "0.497118", "0.497118", "0.497118", "0.497118", "0.497118", "0.497118", "0.49686134", "0.49645063", "0.49638808", "0.4954958", "0.4953108", "0.49430788", "0.4934419", "0.49289227", "0.49203348", "0.49094042", "0.49045274", "0.4900336" ]
0.51536924
46
GET /project_developers/1 GET /project_developers/1.json
def show @project_developer = ProjectDeveloper.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @project_developer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if(current_user.has_role?(:developer))\n @projects = Project.joins(:developers).where(\"users.id= #{current_user.id}\")\n else\n @projects = Project.all\n end\n render json: @projects\n end", "def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end", "def list\n get 'projects'\n end", "def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end", "def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end", "def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end", "def show\n @project = Project.find(params[:id])\n\t@user = User.find(@project.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @developers = @project.developers.where(project_developers: { is_creator: false })\n end", "def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end", "def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end", "def project_info(project_key)\n request = ServiceHelper.new base_url: @jira_url, path: \"rest/api/3/project\"\n request.auth 'basic', @jira_user, @jira_token\n request.headers.add 'Accept', 'application/json'\n request.append_to_route project_key\n response = request.get\n raise Exception, response.body unless response.ok?\n\n response.parsed_body\n end", "def project\n request :project\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end", "def show \n project= Project.find(params[:id])\n\n render json: project\n end", "def index\n #@projects = Project.all\n PivotalTracker::Client.token = current_user.setting.pt_api_key\n logger.debug current_user.setting.pt_api_key\n @projects = PivotalTracker::Project.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end", "def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end", "def show\n @project = Project.find(params[:id], :include => {:gem_versions => :gem})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end", "def show\n respond_with(@project) do |format|\n format.json { render json: @project.as_json }\n format.html\n end\n end", "def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end", "def show\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end", "def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n @current_project = CurrentProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_project }\n end\n end", "def show\n @project = Project.find_by(id: params[:id])\n if @project\n render :json => @project\n else\n render :json => 422\n end\n end", "def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects }\n #format.json { render json: @project.as_json(:include => [:client, :project_participants] ) }\n end\n end", "def get_projects\n me = request('/services/v5/me')\n me['projects']\n end", "def projects\n request(method: 'getAllProjects')\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @show_project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @show_project }\n end\n end", "def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def details\n get(\"project/details\")[\"project\"]\n end", "def projects\n resource 'projects'\n end", "def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def show \n render :json => Project.find_by_id(params[:id])\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n render json: Project.where(id: params.fetch(:id))\n end", "def show\n render json: @project\n end", "def index\n @projects = Project.all\n render json: @projects, status: :ok\n end", "def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end", "def new\n @project_developer = ProjectDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_developer }\n end\n end", "def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end", "def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show \n respond_to do |format|\n format.json {\n\n @project = Project.find_by_id(params[:id])\n\n if @project\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n @projects = Project.all\n render json: @projects\n end", "def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def show\n\n render json: Project.all\n\n end", "def show\n @project = ProjectDecorator.find_by_name(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end", "def show\n @user = @project.user\n @route = @project.route\n @grade = @route.grade\n respond_to do |format|\n format.html\n format.json { render json: @project }\n end\n end", "def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end", "def show\n # Rails.logger.debug params\n @workspace = Kaiju::WorkspaceJson.as_json(\n params[:id], request.base_url, project_id: params[:project_id], user_id: current_user.id\n )\n @project = Kaiju::ProjectJson.as_json(params[:project_id], request.base_url, user_id: current_user.id)\n @user = Kaiju::UserJson.as_json(current_user.id, request.base_url)\n\n respond_to do |format|\n format.html\n format.json { render json: JSON.pretty_generate(@workspace) }\n end\n end", "def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end", "def show\n @projectresource = Projectresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectresource }\n end\n end", "def listProjects \n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/projects')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\n\nend", "def show\n @signspot_project = Signspot::Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @signspot_project }\n end\n end", "def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end", "def show\n @past_project = PastProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @past_project }\n end\n end", "def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end", "def show\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n render json: Project.build_project_object(@project, current_user.id), status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:id]}\" }, status: 404\n end\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n end", "def set_api_project\n @project = Project.find(params[:id])\n end", "def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end", "def index\n @projects = Service::JIRA.projects\n respond_with(@projects) do |format|\n format.json { render json: @projects.to_a.sort_by(&:name).map(&:attrs).to_json }\n end\n end", "def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end", "def project\n @client.project(:id => project_id)\n end", "def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n puts \"Project name: #{project[\"project\"][\"meta\"][\"title\"].bright} Project PID: #{pid.match(\"[^\\/]{32}\").to_s.bright}\"\r\n end\r\n end", "def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end", "def projects\n records \"project\", \"/project/list\"\n end", "def index\n @user = get_user\n @projects = Project.all\n # render :inline => @projects.to_json\n end", "def index\n @projects = Project.all\n render json: @projects, layout: false\n end", "def projects\n @projects ||= begin\n user = api('user')\n api(\"users/#{user['id']}/projects\").sort_by { |p| p['id'] }\n end\nend", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end" ]
[ "0.7242238", "0.72193015", "0.72064775", "0.71052754", "0.7093152", "0.70486575", "0.70313406", "0.70287514", "0.7005226", "0.69446915", "0.6918673", "0.6914748", "0.6888663", "0.6880406", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.6868041", "0.68593746", "0.6856879", "0.6848217", "0.6827394", "0.6825431", "0.6815954", "0.68006706", "0.679653", "0.67855346", "0.6760159", "0.67594665", "0.67578053", "0.67419153", "0.67363364", "0.6736214", "0.6724048", "0.6720469", "0.67155373", "0.67124754", "0.67117184", "0.6709221", "0.67032224", "0.66940457", "0.6684061", "0.66830534", "0.66830385", "0.6682052", "0.66815406", "0.66753024", "0.6670416", "0.6669246", "0.665983", "0.66551065", "0.6649351", "0.66370726", "0.6634457", "0.6629444", "0.66290516", "0.66276085", "0.6621955", "0.66136765", "0.6613263", "0.661116", "0.66105694", "0.66023403", "0.6600582", "0.6591889", "0.65881777", "0.6581207", "0.65653735", "0.65638953", "0.65634555", "0.6558796", "0.6548923", "0.65481734", "0.6538494", "0.65376204", "0.6529377", "0.6524816", "0.6522637", "0.6520619", "0.65169305", "0.65104675", "0.6508662", "0.6508662", "0.6508662", "0.6508662", "0.6508662", "0.6508662", "0.6508662", "0.6507353" ]
0.7353545
0
GET /project_developers/new GET /project_developers/new.json
def new @project_developer = ProjectDeveloper.new respond_to do |format| format.html # new.html.erb format.json { render json: @project_developer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\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 @project = current_user.projects.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\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 @project = Project.new\n\n respond_to do |format|\n format.html\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\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 @ourproject = Ourproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ourproject }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end", "def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n authorize! :create, Project\n \n @project = Project.new\n puts @project\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 @project = Project.new :company_id => params[:company_id]\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 @projectresource = Projectresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectresource }\n end\n end", "def new\n @current_project = CurrentProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @current_project }\n end\n end", "def new_project\n if current_admin.present? || current_client.present?\n @project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n else\n redirect_to new_admin_session_path and return\n end\n end", "def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end", "def new\n authenticate_user!\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = @client.projects.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html { render layout: 'project'}\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new(:user_id => current_user[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\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 new\n @past_project = PastProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @past_project }\n end\n end", "def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end", "def new\n session[:return_to] ||= request.referer\n @project = Project.new\n @project.user_id = current_user.id\n\n # we use list of projects and contexts on the view, need to prepare them\n @projects = Project.all_active_projects(params[:context_id],current_user.id )\n @contexts = Context.where(\"user_id = ?\",current_user.id)\n\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 @signspot_project = Signspot::Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @signspot_project }\n end\n end", "def new\n\n @project = Project.new\n @main_projects = Project.roots.where(creator_id: current_user.id)\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 @project = Project.new\n #@project.build_ci\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 @user = User.find( params[:user_id] )\n @project = Project.new( :title => \"New Project\" )\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n \t@pagenav = Page.find_all_by_published('true')\n @project = Project.new\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 @project =\n if params[:project]\n Project.where(name: params[:project][:name]).first || Project.new(project_params)\n else\n Project.new\n end\n\n respond_to do |format|\n format.html {\n redirect_to edit_embed_project_url(@project) if @project.persisted?\n }\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\[email protected] = current_user.provider_email\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 @project = Project.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @project_detail = ProjectDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_detail }\n end\n end", "def new\n @project = Project.new\n @project.client_id = params[:client_id]\n @project.created_by = current_user.id\n\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 @isgrey = true;\n @current_page = \"ADD PROJECT\"\n @project = Project.new\n @project_attachment = @project.project_attachments.build\n @slider_object = @project.slider_objects.build\n @project_field = @project.project_fields.build\n @project_other_field = @project.project_other_fields.build\n\n @types = Type.all\n @new_nav = true;\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 if signed_in?\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n else \n redirect_to \"/\"\n end\n end", "def new\n @campaign = Campaign.find(params[:campaign_id])\n @project = @campaign.projects.new(params[:project])\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 @project = Project.create\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n propose_nr = Integer(Project.order(\"nr desc\").first.nr) + 1\n @project = Project.new(:nr => propose_nr, :active => true)\n @project.tasks.new(:name => \"Project Mgmt\", :description => \"\")\n @project.tasks.new(:name => \"Pre-P\", :description => \"Moodboards | Examining project data, plans, briefing, etc.\")\n @project.tasks.new(:name => \"Web\", :description => \"Flatfinder/Boligvelger (eve-Estate) | CMS/Website (eve-Publisher) | Landingpage\")\n @project.tasks.new(:name => \"Undividable 3D work for exteriors\", :description => \"Modeling/texturing of buildings and their surroundings. Populating/detailing with plants, outdoor furniture, traffic, etc.\")\n @project.tasks.new(:name => \"Undividable 3D work for interiors\", :description => \"Modeling/texturing of X apartments. Setting up furniture, accessories, decoration according to moodboards.\")\n @project.tasks.new(:name => \"#{propose_nr}-01_e\", :description => \"Scene setup, lighting and detail adjustments, rendering with subsequent post-production/compositing.\")\n @project.tasks.order(:name)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @projects_person = ProjectsPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projects_person }\n end\n end", "def new\n @file_project = FileProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_project }\n end\n end", "def new\n @project = Project.find(params[:project_id])\n @project_entry = ProjectEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_entry }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @project }\n end\n end", "def new\n @workspaces = current_user.workspaces\n @project = Project.new\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\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 new\n @unfinished_project = UnfinishedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unfinished_project }\n end\n end", "def new\n @project = Project.new(:name => \"{#{t('project.pending_refresh')}}\",\n :feature_prefix => \"S\", :bug_prefix => \"D\", :chore_prefix => \"C\", :release_prefix => \"R\",\n :renumber_features => Constants::RENUMBER_NO, :renumber_chores => Constants::RENUMBER_NO,\n :renumber_bugs => Constants::RENUMBER_NO, :renumber_releases => Constants::RENUMBER_NO,\n :time_zone => current_user.time_zone)\n respond_with @project\n end", "def new\n project = current_project\n\n # TODO: replace with project.dup ?\n @project = duplicate_project(project)\n respond_to do |format|\n if is_admin?\n format.html # new.html.erb\n format.xml { render xml: @project }\n else\n format.html { redirect_to projects_path }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@doc = Doc.new\n\t\tbegin \n\t\t\t@project = get_project2(params[:project_id])\n\t\trescue => e\n\t\t\tnotice = e.message\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json {render json: @doc.to_hash}\n\t\tend\n\tend", "def new\n\t\t@project = Project.new({:project_state_type_id => ProjectStateType.find_by_code('preparation').id})\n\t\tputs @project.inspect\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @project }\n\t\tend\n\tend", "def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end", "def create\n @project = Project.new(project_params)\n @project.project_developers.new(developer_id: current_user.id, is_creator: true)\n respond_to do |format|\n if @project.save\n format.html { redirect_to add_developer_project_url(@project), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @client = Client.find(params[:client_id])\n @project = @client.projects.build\n \n respond_with(@project)\n end", "def new\n @assigned_project = AssignedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned_project }\n end\n end", "def new\n @project_tak = ProjectTak.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_tak }\n end\n end", "def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end", "def new\n @project = Salesforce::Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end" ]
[ "0.8223063", "0.8123179", "0.81114984", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.80880743", "0.8057708", "0.80322266", "0.8028154", "0.8011782", "0.8004371", "0.7972817", "0.7964663", "0.78569305", "0.7825317", "0.78229195", "0.78101414", "0.7789849", "0.7784492", "0.7754897", "0.77192223", "0.76950914", "0.76890963", "0.7687384", "0.76718664", "0.76562303", "0.7640465", "0.7638211", "0.7633119", "0.76186705", "0.76074815", "0.7592845", "0.7592346", "0.75903434", "0.7585486", "0.7564633", "0.7561421", "0.75589544", "0.7540473", "0.75395983", "0.75392175", "0.7522837", "0.7513299", "0.74836195", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7465109", "0.7432261", "0.74318707", "0.74226916", "0.7413228", "0.7400781", "0.7381295", "0.7372192", "0.7369924", "0.7361656", "0.73592186", "0.7349655", "0.733914", "0.73159134", "0.7306555", "0.7305447", "0.7303451", "0.7303451", "0.7303451", "0.7303451", "0.7303451", "0.7303451" ]
0.77727586
39
POST /project_developers POST /project_developers.json
def create @project_developer = ProjectDeveloper.new(params[:project_developer]) respond_to do |format| if @project_developer.save format.html { redirect_to @project_developer, notice: 'Project developer was successfully created.' } format.json { render json: @project_developer, status: :created, location: @project_developer } else format.html { render action: "new" } format.json { render json: @project_developer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(project_params)\n @project.project_developers.new(developer_id: current_user.id, is_creator: true)\n respond_to do |format|\n if @project.save\n format.html { redirect_to add_developer_project_url(@project), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def developer_project_params\n params.require(:developer_project).permit(:name, :github_url, :web_url, :image_url, :library, :detail, :admin_id)\n end", "def project_params\n params.permit(:id, :name, :description, developer_ids: [])\n end", "def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end", "def create\n @api_project = Project.new(api_project_params)\n\n respond_to do |format|\n if @api_project.save\n format.html { redirect_to @api_project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @api_project }\n else\n format.html { render :new }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def developer_params\n params.require(:developer).permit(:dev_name, projects_attribute: [:name, :started, :deadline, :description])\n end", "def project_params\n params.require(:project).permit(:name, :started, :deadline, :description, :developer_id)\n end", "def create\n @project = Project.new(project_params)\n @project.user_id = @user.id\n if @project.save\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end", "def project_params\n params[:project][:developer_ids] << current_user.id.to_s if params[:project].present? && params[:project][:developer_ids].present?\n params.require(:project).permit(:name, :description, developer_ids: [], todos_attributes: [:id, :title, :description, :_destroy])\n end", "def developer_params\n params.require(:developer).permit(:project_id, :name, :email, :password)\n end", "def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end", "def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def new\n @project_developer = ProjectDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_developer }\n end\n end", "def create\n @project = Project.new(project_params)\n @project.owner = current_user\n @pu = current_user.projectusers.new\n @pu.project = @project\n @pu.save\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_project_via_API_XML\r\n get \"/logout\"\r\n post \"/projects.xml\", :api_key=>'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n end", "def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @project.users << current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params.merge!(created_by_id: current_user.id, updated_by_id: current_user.id))\n authorize @project\n if @project.save\n render json: @project\n else\n render json: {errors: @project.errors.full_messages}, status: 422\n end\n end", "def create\n @project = Project.new(project_params.merge(school_id: current_user.school_id))\n if @project.save\n render :show, status: :created, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.find(current_user.id)\n @project = Project.new(project_params)\n\n @project.title = params[:title]\n @project.complete = false\n\n respond_to do |format|\n if @project.save\n @user.projects_users.create(project: @project, admin_user: true)\n\n format.html { redirect_to project_path(@project.id) }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n build_projects_user\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_village_project\n iframe_src = \"<iframe src='\" + root_url.sub(/\\/$/, '') + embed_project_path(@project) + \"' width='575' height='485'></iframe><p>This project created with <b><a href='\" + root_url + \"'>#{ENV[\"APP_NAME\"]}</a></b> and updated on \" + @project.updated_at.strftime(\"%A, %B %-d at %-I:%M %p\") +\"</p>\"\n iframe_src = iframe_src.html_safe.to_str\n village_user_ids = @project.village_user_ids\n response = access_token.post(\"/api/projects\", params: {project: {name: @project.title, project_type_id: 15, source: \"original\", description: iframe_src, thumbnail_file_id: 769508, user_ids: village_user_ids} })\n village_project_id = response.parsed[\"project\"][\"id\"]\n @project.update_attributes(:village_id => village_project_id)\n end", "def project_params\n params.require(:project).permit(:developer_id, :employer_id, :project_status, :project_name, :project_description, :project_review, :plattform_mobile, :plattform_desktop, :platform_tablet, :assets_text, :assets_images, :assets_videos, :assets_audio, :assets_database, :due_date_less_then_month, :due_date_one_month, :due_date_three_month, :due_date_plus_three_month, :pages_landing_pages, :pages_two_pages)\n end", "def project_params\n params.require(:project).permit(:title, :short_description, :status, :deadline, :tags, :nbr_people)\n end", "def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end", "def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\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 create\n @userproject = Userproject.new(userproject_params)\n\n respond_to do |format|\n if @userproject.save\n format.html { redirect_to @userproject, notice: 'Userproject was successfully created.' }\n format.json { render :show, status: :created, location: @userproject }\n else\n format.html { render :new }\n format.json { render json: @userproject.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\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 create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => {:valid => true, :designation => @project, :notice => \" project was successfully created.\"}}\n else\n format.html { render action: \"new\" }\n format.json { render :json => {:valid => false, :errors => @project.errors}}\n end\n end\n end", "def create\n @ourproject = Ourproject.new(params[:ourproject])\n\n respond_to do |format|\n if @ourproject.save\n format.html { redirect_to @ourproject, notice: 'Ourproject was successfully created.' }\n format.json { render json: @ourproject, status: :created, location: @ourproject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ourproject.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n @project.status = \"Etat zero\"\n creator = current_user\n ProjectUser.create(:project => @project, :user => creator, :admin => true)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project 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 project_params\n params.require(:project).permit(:name, :description, :completion_date, :user_id, :project_id)\n end", "def create\n @project = @user.projects.new(project_params)\n @project.collaborates = [false]\n if @project.save\n success = @project.project_users.create!({user_id: current_user.id, role: 'project_manager'})\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to project_documents_path(@project), notice: 'The project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Admin::Project.new(project_params)\ndebugger\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render action: 'show', 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 create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end", "def post_project_with_http_info(project_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.post_project ...'\n end\n # verify the required parameter 'project_body' is set\n if @api_client.config.client_side_validation && project_body.nil?\n fail ArgumentError, \"Missing the required parameter 'project_body' when calling ProjectsApi.post_project\"\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(project_body)\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Project')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#post_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def developer_params\n params.require(:developer).permit(:name, :email, :password, :project_id, :story_id)\n end", "def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\n :header_params => 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: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project 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 create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n @project.team.touch\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n render_errors(format, @project.errors, :new)\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n\n format.html { redirect_to @project, success: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_project_with_http_info(api_project, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#add_project ...\"\n end\n \n # verify the required parameter 'api_project' is set\n fail \"Missing the required parameter 'api_project' when calling add_project\" if api_project.nil?\n \n # resource path\n path = \"/Projects\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_project)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIProject')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#add_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @project.user = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def project_params\n params.require(:project).permit(:name, :start_date, :end_date, :devlink, :accountm, :editaccess, :developer, :designer, :plinks, :mockup, :activebuild, :inactive, :launched, :build_one, :build_two, :build_three, :build_four, :build_five, :build_six, :build_seven, :build_eight, :build_nine, :build_ten, :build_eleven, :build_twelve, :build_thirteen, :build_fourteen, :build_fifthteen, :build_sixteen, :build_seventeen, :build_eighteen, :build_nineteen, :build_twentee, :build_twenteeone, :build_twenteetwo, :build_twenteethree, :build_twenteefour, :build_twenteefive, :build_twenteesix, :build_twenteeseven, :build_twentyeight, :build_twentynine, :build_thrity, :build_thirtyone, :build_thirtytwo, :build_thirtythree, :build_thirtyfour, :build_thirtyfive, :build_thirtysix, :build_thirtyseven, :build_thirtyeight, :build_thirtynine, :build_fourty, :user_id)\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: :created, location: @project }\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.html { render action: \"new\" }\n end\n end\n end", "def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end", "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end", "def create\n project_params[:owner_id] = current_user.id if project_params[:owner_id].nil? or not current_user.is_admin?\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_url, notice: 'Project was successfully created.' }\n format.json { head :no_content }\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 project_params\n params.require(:project).permit(:customer, :product, :platform, :user_id)\n end", "def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project 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 project_params\n params.require(:project).permit(:task_group_id, :designation, :title, :short_title, :project_type, :status,\n :last_motion, :draft_no, :next_action, :award, :pool_formed, :mec, :par_url,\n :csd_url, :page_url, :files_url, :draft_url, :par_approval, :par_expiry,\n :standard_approval, :published)\n end", "def create\n @project = current_user.projects.new(project_params)\n if @project.save\n render :show\n else\n render json: { errors: @project.errors }\n end\n end", "def create\n @project = TaskTracker::Project.new(project_params)\n @project.fractal_interface = @user.task_tracker_interface\n\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def project_params\n params.require(:project).permit(:name, :description, :make_public, :user_key)\n end", "def create\n @project = Project.new(params[:project])\n\t\[email protected]_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project 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 create\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was successfully created.') }\n format.xml { render xml: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n find_projects(params[:api_key])\n end", "def create\n @project = Project.new(params[:project])\n @project.users << current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(projects_path) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { \n flash[:error] = @project.errors.full_messages[0] if not @project.valid?\n redirect_to(projects_path)\n }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id ? current_user.id : 0\n @project.is_enabled = Constants::DISABLED\n @project.status = Constants::NEW\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end", "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes un nuevo proyecto. A trabajar!' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project 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 create\n @project = Project.new(params[:project])\n #@project.assigned_users << current_user\n @project.updated_by = current_user.id\n respond_to do |format|\n if @project.valid1? and @project.save\n format.html { redirect_to client_projects_path(client_id: @project.client_id), notice: \"成功创建#{Project.model_name.human}\" }\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 create\n @project = Project.new(params[:project])\n @project.creator_id = current_user.id\t \n respond_to do |format|\n if @project.save\n @project.users << current_user\n format.html { redirect_to project_path(@project), notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n @main_projects = Project.roots.where(creator_id: @project.creator_id)\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def gooddata_project_params\n params.require(:gooddata_project).permit(:name, :description, :project_uid, :client_id)\n end", "def create\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html {redirect_to \"/projects\", notice: \"Project was successfully created.\"}\n format.json {render :show, status: :created, location: @project}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @project.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def project_params\n params.require(:project).permit(:title, :description, projects_users_attributes: [:id, :user_id, :_destroy])\n end", "def create\n @project = Project.new(project_params)\n\n if params[\"project\"][\"client_id\"] != \"\"\n @project.client = Client.find params[\"project\"][\"client_id\"]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Novo projeto cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(:project_title => params[:project_title], :start_date => params[:startDate], :end_date => params[:endDate],\n :status => params[:project_status])\n\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.save\n p \"pass on projects controller\"\n format.html { redirect_to @project}\n format.json { render json: \"ok\" }\n else\n p \"fail on projects controller\"\n end\n end\n\n\n end", "def project_params\n params.fetch(:project, {})\n params.require(:project).permit(:utf8, :authenticity_token, :schema_name, :id)\n end", "def create\n @project = Project.new(project_params)\n authorize! :create, @project\n @project.user_id ||= current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n @user.projects << @project\n \n respond_to do |format|\n if @user.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to user_project_path(@project) }\n else \n format.html { render :action => \"new\",:controller => \"user/projects\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id\n }))\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end", "def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/v1/project'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n # return_type\n return_type = opts[:return_type] || 'Project' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create \n\t\t@project = Project.new(project_params)\n\t\[email protected] = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75814474", "0.68438554", "0.6755185", "0.67182094", "0.67029667", "0.6671006", "0.66655385", "0.6575432", "0.65573704", "0.6542593", "0.65305126", "0.6500427", "0.64721096", "0.6469582", "0.64685637", "0.6468156", "0.64530027", "0.64296067", "0.6428455", "0.6423522", "0.6419035", "0.64119774", "0.6374074", "0.63655204", "0.63626516", "0.6362384", "0.6350912", "0.6346749", "0.63391364", "0.6338452", "0.6337963", "0.632931", "0.63103706", "0.6301729", "0.6295494", "0.6283742", "0.62821", "0.62811476", "0.6277398", "0.6275908", "0.62709427", "0.627044", "0.6267026", "0.6264663", "0.626281", "0.62596804", "0.62583405", "0.62510514", "0.6250664", "0.6250664", "0.6250151", "0.62448865", "0.6235117", "0.623064", "0.6228838", "0.6228407", "0.6224845", "0.6223364", "0.6219935", "0.6207167", "0.62007123", "0.61987257", "0.61983657", "0.619734", "0.61918527", "0.6184649", "0.6177883", "0.6174073", "0.61712277", "0.616908", "0.61648744", "0.61620384", "0.6159632", "0.6156066", "0.61558807", "0.61511135", "0.61507994", "0.61501324", "0.6149393", "0.6145393", "0.61445504", "0.61421275", "0.61419505", "0.61406624", "0.6133105", "0.61321104", "0.6131918", "0.6123315", "0.6120925", "0.6120702", "0.6120027", "0.6120027", "0.6120027", "0.6120027", "0.6120027", "0.6120027", "0.6120027", "0.6120027", "0.6120027", "0.6120027" ]
0.69291526
1
PUT /project_developers/1 PUT /project_developers/1.json
def update @project_developer = ProjectDeveloper.find(params[:id]) respond_to do |format| if @project_developer.update_attributes(params[:project_developer]) format.html { redirect_to @project_developer, notice: 'Project developer was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @project_developer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'UpdateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\n render 'projects/error', status: 422\n end\n end", "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @api_project.update(api_project_params)\n format.html { redirect_to @api_project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_project }\n else\n format.html { render :edit }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @project\n if @project.update(project_params.merge!(updated_by_id: current_user.id))\n render json: @project\n else\n render json: {errors: @project.errors.full_messages}, status: 422\n end\n end", "def update_project_with_http_info(api_project, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#update_project ...\"\n end\n \n # verify the required parameter 'api_project' is set\n fail \"Missing the required parameter 'api_project' when calling update_project\" if api_project.nil?\n \n # resource path\n path = \"/Projects\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_project)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIProject')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#update_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = params[:value]\n @project.project_name = project_name\n end\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n\n @projects = Project.all\n format.html {\n render :action => \"index\"\n }\n format.json { render json: @project }\n else\n logMessage = self.class.to_s + \"#\" + __method__.to_s + \" \" + current_user.username + \" errors:\" + @project.errors.full_messages.to_s\n logger.info logMessage\n\n format.html {\n flash[:error] = 'Project was not successfully updated.'\n redirect_to action: \"index\"\n }\n errorMsg = @project.errors.full_messages.to_s.split(\"\\\"\")\n format.json { render json: errorMsg[1], status: 500 }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render :show, status: :ok, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @project.update(project_params)\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end", "def update\n @project = Salesforce::Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Salesforce::Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_village_project\n iframe_src = \"<iframe src='\" + root_url.sub(/\\/$/, '') + embed_project_path(@project) + \"' width='575' height='485'></iframe><p>This project created with <b><a href='\" + root_url + \"'>#{ENV[\"APP_NAME\"]}</a></b> and updated on \" + @project.updated_at.strftime(\"%A, %B %-d at %-I:%M %p\") +\"</p>\"\n iframe_src = iframe_src.html_safe.to_str\n village_user_ids = @project.village_user_ids\n response = access_token.put(\"/api/projects/\" + @project.village_id.to_s, params: {project: {name: @project.title, description: iframe_src, user_ids: village_user_ids}})\n end", "def update\n if params[:developer][:project_id] != @developer.project_id\n @developer.story_id = nil\n @developer.save\n end\n respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @developer, notice: 'Developer was successfully updated.' }\n format.json { render :show, status: :ok, location: @developer }\n else\n format.html { render :edit }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = @client.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to([@client, @project], notice: 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n service_result = Organizers::BuildJoinTableObjects.call(project_params, 'project', :update)\n @project = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :ok, location: @project\n end\n end", "def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n @signspot_project = Signspot::Project.find(params[:id])\n\n respond_to do |format|\n if @signspot_project.update_attributes(params[:signspot_project])\n format.html { redirect_to @signspot_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @signspot_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_project project_gapi\n execute do\n service.update_project project_gapi.project_id, project_gapi\n end\n end", "def update\n if @project\n if @project.update(project_params)\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end", "def update\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'owner')\n if @project.update(project_params)\n render @project.to_json(include: :project_detail), status: 200\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'Only the project owner can update its details' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:id]}\" }, status: 404\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, :notice => 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n # Update project status to open\n if @project.developer and @project.project_status == 'open'\n @project.update(project_status: 'in process')\n end\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 if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\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 build_projects_user\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @project.update(project_params)\n\t\t\t\tformat.json { render :show, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @project = current_user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to session.delete(:return_to), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_project\n @project = Project.find(params[:id])\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authenticate_user!\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @edit_project = Project.find(params[:id])\n\n respond_to do |format|\n if @edit_project.update_attributes(params[:project])\n format.html { redirect_to @edit_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @edit_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n @source = params[:source]\n\n allowed_hash = {:allow_anonymous => params[:allow_anonymous], :allow_turk => params[:allow_turk], :allow_interstitial => params[:allow_interstitial]}\n params[:project][:meta] = allowed_hash.to_json\n \n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :edit, @project\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 @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to add_path(@project), notice: 'Project was successfully updated.' }\n format.json { render :add, 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 authorize Project\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, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'project was successfully updated.' }\n format.json { render :json => {:valid => true, :designation => @project, :notice => \"project was successfully updated.\"} }\n else\n format.html { render action: \"edit\" }\n format.json {render :json => {:valid => false, :errors => @project.errors}}\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Projeto atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n @project.attributes = params[:project]\n @project.updated_by = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to client_projects_path(client_id: @project.client_id), notice: \"成功修改#{Project.model_name.human}\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n if @ourproject.update_attributes(params[:ourproject])\n format.html { redirect_to @ourproject, notice: 'Ourproject was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ourproject.errors, status: :unprocessable_entity }\n end\n end\n end", "def project_updates\n @project = Project.find(params[:id])\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project.as_json(:include => [:client, :project_participants ] ) }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\t\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n \tset_site_entities @project\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to workspace_project_tasks_path(@workspace , @project), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n #@project.user_id = current_user.id\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:client_id])\n @project = Project.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@project = Project.find(params[:id])\n\n #respond_to do |format|\n # if @project.update_attributes(params[:project])\n # format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n # end\n #end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n \t\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 @project = @user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(project_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\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 { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def update\n project_params[:owner_id] = current_user[:id] if project_params[:owner_id].nil? or not current_user.is_admin?\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_url, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n @project.team.touch\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n render_errors(format, @project.errors, :edit)\n end\n end\n end", "def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@project = Project.find(params[:id])\t# Taken out because of the before action GENIUS!\n\n\t\trespond_to do |format|\n \t\t if @project.update(projects_params)\n \t\tformat.html { redirect_to @project, notice: 'Project was successfully updated.' }\n \t\tformat.json { render :show, status: :ok, location: @project }\n \t\telse\n \t\tformat.html { render :edit }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend", "def update\n @project = @client.projects.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to client_project_path(@project.client_id,@project), notice: 'Project was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to project_documents_path(@project), notice: 'The 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 respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: \"#{I18n.t 'project.project_updated'}\"}\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\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 { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n params[:project][:problem_ids] ||= []\n params[:project][:target_ids] ||= []\n params[:project][:factor_ids] ||= []\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(projects_path, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n project = Project.find(params[:id])\n\n respond_to do |format|\n if project and project.update_attributes(params[:project])\n format.html { redirect_to project }\n else\n format.html { redirect_to projects_path }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to user_projects_path(current_user), 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 repo = ProjectRepo.new current_user\n @v_project = VProject.new(params[:v_project])\n\n respond_to do |format|\n if (repo.update(params[:id], @v_project))\n format.html { redirect_to @v_project, notice: 'V project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @v_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n activity = current_user.create_activity(@project, 'updated')\n activity.user_id = current_user.id\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 respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, info: '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 @project_task = ProjectTask.find(params[:id])\n\n respond_to do |format|\n if developer?\n if @project_task.update_attributes(params[:project_task])\n flash[:notice] = 'ProjectTask was successfully updated.'\n format.html { redirect_to(@project_task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project_task.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { render :xml => XML_ERRORS[:not_authorized]}\n end\n end\n end", "def update\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.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to admin_path, notice: 'Project was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize_action_for @project\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 respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @namespace, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :show }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\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 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 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" ]
[ "0.69619554", "0.6888588", "0.6885766", "0.6881098", "0.6879897", "0.679647", "0.67608637", "0.6744371", "0.67327344", "0.6708739", "0.6705506", "0.66924673", "0.6686431", "0.66856587", "0.6658466", "0.66511136", "0.6643734", "0.6629499", "0.66246736", "0.6622314", "0.66130567", "0.6591195", "0.658378", "0.6570028", "0.6570028", "0.6567324", "0.65650254", "0.65650254", "0.6561737", "0.6551992", "0.6550779", "0.6550779", "0.6549528", "0.6543557", "0.6542597", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.654217", "0.65411186", "0.6540271", "0.6536181", "0.6536181", "0.6536181", "0.6536181", "0.6523158", "0.6513251", "0.651307", "0.65118724", "0.6509405", "0.6509405", "0.6507314", "0.6502087", "0.6500372", "0.6490559", "0.6489264", "0.6488797", "0.64881647", "0.64874315", "0.64845", "0.6482035", "0.64813685", "0.64627385", "0.6453192", "0.64511496", "0.6440441", "0.64340115", "0.64300984", "0.6429312", "0.64281285", "0.64260525", "0.6418644", "0.64044213", "0.6399819", "0.6398668", "0.6398668", "0.63984185", "0.63968134", "0.6389428", "0.6388727", "0.63866955", "0.63860404", "0.63842624", "0.6379379", "0.63782066", "0.63721347", "0.63718873", "0.6369817", "0.6369817", "0.6369817" ]
0.65930057
21
DELETE /project_developers/1 DELETE /project_developers/1.json
def destroy @project_developer = ProjectDeveloper.find(params[:id]) @project_developer.destroy respond_to do |format| format.html { redirect_to project_developers_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n @project.users.delete_all\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_project.destroy\n respond_to do |format|\n format.html { redirect_to api_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n project = Project.find(params[:id])\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @project\n @project.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end", "def destroy\n @project.destroy\n head :no_content\n end", "def destroy\n @project = @client.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to @client }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n\n head :no_content\n end", "def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end", "def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def delete\r\n\t\t\trender json: Project.delete_by_id(params[:id])\r\n\t\tend", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = @user.projects.find(params[:id])\n @project.remove!\n\n respond_to do |format|\n format.html { redirect_to(projects_url(:subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def _project_delete(acronym)\n delete \"/projects/#{acronym}\"\n _response_status(204, last_response)\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = current_user.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.json { head :ok }\n end\n end", "def destroy\n name = @project.name\n @project.destroy\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authenticate_user!\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n client_id = @project.client_id\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to client_projects_path(client_id), notice: \"成功删除#{Project.model_name.human}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Salesforce::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(salesforce_projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \t@project = Project.find(params[:id])\n \t#ap @project\n \t#abort\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end", "def delproject(project)\n post('delproject.json', project: project)\n end", "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @signspot_project = Signspot::Project.find(params[:id])\n @signspot_project.destroy\n\n respond_to do |format|\n format.html { redirect_to signspot_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n standard_destroy(Project, params[:id])\n end", "def destroy\r\n @project.destroy\r\n respond_to do |format|\r\n format.html { redirect_to projects_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @project = @user.project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @project = Project.find(params[:id])\n # @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find_by_permalink(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:valid => true} }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #@project = Project.find(params[:id])\n #@project.destroy\n\n #respond_to do |format|\n # format.html { redirect_to(goals_url) }\n # format.xml { head :ok }\n #end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t('models.project.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @featured_project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end", "def destroy\n project=Project.find(params[:project_id])\n project.destroy\n respond_to do |format|\n format.html {redirect_to projects_url, notice: \"Project was successfully destroyed.\"}\n format.json {head :no_content}\n end\n end", "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:message=>\"OK\",:id=>@project.id}, :staus=>:ok}\n end\n end", "def destroy\n @project=Project.find(params[:id])\n @project.destroy\n respond_to do |format|\n format.html { redirect_to \"/usershome\", notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = @client.projects.find(params[:id])\n\n begin\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was deleted.') }\n format.xml { head :ok }\n end\n rescue ActiveRecord::DeleteRestrictionError\n redirect_to client_project_url(@client, @project), notice: \"Delete was restricted.\"\n end\n end", "def destroy\n @file_project = FileProject.find(params[:id])\n @file_project.destroy\n\n respond_to do |format|\n format.html { redirect_to file_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_entry = ProjectEntry.find(params[:id])\n @project_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = @projectable.projects.find(params[:id])\n @project.destroy\n track_activity @project\n\n respond_to do |format|\n format.html { redirect_to [@projectable, :projects] }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = current_user.active_projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n end", "def destroy\n authorize! :delete, @project\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_url(:user_id => current_user.id), notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_path, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find( params[:user_id] )\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7498583", "0.7466114", "0.74535763", "0.74474853", "0.7407827", "0.7388403", "0.7384838", "0.7370378", "0.73628443", "0.73472995", "0.7332888", "0.7329687", "0.73255384", "0.73187464", "0.73150516", "0.7312549", "0.7287514", "0.7281139", "0.7276472", "0.72719777", "0.7266784", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7266482", "0.7263532", "0.7260014", "0.7256459", "0.7256459", "0.7256459", "0.7256459", "0.72527933", "0.7251974", "0.72497547", "0.7237441", "0.723731", "0.7237238", "0.7237238", "0.7237238", "0.7237238", "0.7237238", "0.7236041", "0.72350353", "0.72313714", "0.7227872", "0.72274494", "0.722681", "0.72230023", "0.72193855", "0.7215337", "0.72105354", "0.720973", "0.7209126", "0.71799874", "0.71787095", "0.7174381", "0.7163634", "0.7160777", "0.7160516", "0.71587944", "0.7158686", "0.7156657", "0.71562105", "0.7147616", "0.71326584", "0.7126805", "0.7119155", "0.71180874", "0.71165043", "0.7115439", "0.7114117", "0.71136916", "0.71038944", "0.7099874", "0.70933104", "0.7089654", "0.7089458", "0.7084151", "0.7084151", "0.7082272", "0.7080719", "0.70720845" ]
0.76469755
0
Returns a list of roles we have permission to assign
def roles_for_select Role.all.select {|role| can? :add_user, role }.sort.map {|r| [r.name.titleize, r.id] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roles\n # we can't use abilities as those are not defined when creating a new operator that is not yet saved\n #result = abilities.collect(&:name)\n authorizations.collect{|auth| auth.ability.try(:name)}\n end", "def roles\n # we can't use abilities as those are not defined when creating a new operator that is not yet saved\n #result = abilities.collect(&:name)\n authorizations.collect{|auth| auth.ability.try(:name)}\n end", "def roles\n roles_from_users\n end", "def the_roles\n roles.each.map{|_r| User::ROLES[_r.to_sym] }\n end", "def roles\n roles_as_editor + roles_as_reviewer + role_as_admin\n end", "def roles\r\n @roles ||= user_roles.map(&:name)\r\n end", "def assigned_roles\n to_array_if_not(self.roles)\n end", "def accessible_roles\n index = ROLES.index(self.role)\n roles = User::ROLES[0..index].map{|x| [x.humanize, x]} if index\n return roles\n end", "def role_permissions\n return @role_permissions\n end", "def roles\n Jak.role_klass.where(id: grants.pluck(:role_ids).compact.flatten)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability,:read)\n end", "def role_assignments\n return @role_assignments\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability)\n end", "def roles\n self.dig_for_array(\"roles\")\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability, :read)\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability, :read)\n end", "def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end", "def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end", "def roles\n return [] if !subject.respond_to?(roles_list_meth) || roles_of(subject).blank?\n roles_of(subject).flatten\n end", "def roles\n self.class.roles.map do |name|\n __send__(name)\n end\n end", "def pass_on_roles\n r = self.roles.to_a\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users)).to_a\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles)).to_a\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users)).to_a\n end\n return (r.is_a?(Array) ? r : [r])\n end", "def accessible_roles\n @accessible_roles = Role.accessible_by(current_ability, :read)\n end", "def roles\n @resource_roles\n end", "def assignment_roles\n AssignmentRole.all\n end", "def roles\n response[\"roles\"]\n end", "def map_available_roles\n roles.each.map &:name\n end", "def role_list \n @role_list ||= begin\n (store.display_roles | group_store.display_roles)\n end\n end", "def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end", "def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end", "def accessible_roles\n #@accessible_roles = Role.accessible_by(current_ability,:read)\n @accessible_roles = User::ROLES\n end", "def roles\n return proposed_snapshot.roles if proposed? \n return active_snapshot.roles if active?\n []\n end", "def roles\n User.valid_roles\n end", "def roles\n # rocking this in memory because eager-loading\n roles = object.paper_roles.select { |role|\n role.user_id == scoped_user.id\n }.map(&:description)\n roles << \"My Paper\" if object.user_id == scoped_user.id\n roles\n end", "def accessible_roles\n @accessible_roles = Level.accessible_by(current_ability, :read)\n end", "def get_roles_list()\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n get_request(resource_path, query_parameters, nil)\n end", "def roles\n @roles = Role.order(\"name\")\n\t@rights = Right.order(\"name\").map {|r| [r.name, r.id] }\n end", "def all\n data = []\n conn = @ec2_main.environment.iam_connection\n if conn != nil\n begin\n response = conn.list_roles()\n if response.status == 200\n data = response.body[\"Roles\"]\n end\n rescue\n puts \"ERROR: getting all roles #{$!}\"\n end\n end\n return data\n end", "def possible_roles\n ([self.role] + DEFAULT_ROLES).uniq.compact.collect { |r| [ r.titleize, r ]}\n end", "def grantable_roles\n roles = Role.available_roles\n has_cached_role?(:superuser) ? roles : roles - ['superuser']\n end", "def roles_list(role = nil)\n self.role_symbols\n end", "def roles\n users.map { |item| item['roles'] }.flatten.uniq\n end", "def roles(options = {})\n headers = extract_headers!(options)\n json = client.list(\"/v1/auth/approle/role\", options, headers)\n return Secret.decode(json).data[:keys] || []\n rescue HTTPError => e\n return [] if e.code == 404\n raise\n end", "def roles\n raise \"#{subject.inspect} should have a #{roles_list_meth} method\" if !subject.respond_to?(roles_list_meth)\n subj_roles = subject.send(roles_list_meth)\n return [] if subj_roles.blank?\n subj_roles.flatten\n end", "def resource_roles\n return @resource_roles\n end", "def facility_admin_roles\n ['facility_management', 'setter', 'head_setter', 'marketing', 'guest']\n end", "def list_review_roles\n\n @review_roles = Role.get_review_roles\n\n end", "def roles_with_permission\n shift.location.loc_group.roles\n end", "def roles\n client.user_roles(id)\n end", "def roles\n client.user_roles(id)\n end", "def my_roles\n @my_roles ||= self.roles.map {|r| r.name}.flatten.freeze\n end", "def roles\n groups.find(:all, :conditions => {:context => Group::GroupType::ROLE})\n end", "def assigned_roles(object)\n assignments.select { |pair|\n pair.first == object\n }.map(&:last)\n end", "def role_names\n roles.split(',')\n end", "def permissions\n Roles.type_map[role_type].permissions\n end", "def my_assigned_roles(user)\n roles = []\n self.my_roles(user).each do |role|\n design_review_result = self.design_review_results.detect { |drr| drr.role == role }\n roles << role if design_review_result.reviewer == user\n end\n roles\n end", "def role_select\n @@Roles.list\n end", "def roles\n Role.group_roles_from_cache(self)\n end", "def groups\n roles\n end", "def role_ids\n roles.pluck(:id)\n end", "def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end", "def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end", "def roles\n url = \"/gdc/projects/#{pid}/roles\"\n tmp = GoodData.get(url)\n tmp['projectRoles']['roles'].map do |role_url|\n json = GoodData.get role_url\n GoodData::ProjectRole.new(json)\n end\n end", "def collect_anniversary_roles\n role_names = [\"Company Admin\", \"Executive\"]\n roles = []\n role_names.each do |role_name|\n roles << Role.find_by_long_name(role_name)\n end\n return roles\n end", "def roles\n @declared_roles ||= Hash.new\n end", "def roles\n (properties[:roles] || []).map { |r| r.is_a?(Link) ? r : Link.new(r, nil, client) }\n end", "def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end", "def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end", "def roles_presented\n roles.join(\", \")\n end", "def roles_from_users\n Role.for_resource(self)\n end", "def list\n @roles = Role.all(:include => [:groups, :users])\n end", "def role_names\n roles.map { |role| role.name.capitalize }\n end", "def cr_node_roles\n @node.roles\n end", "def roles\n tmp = client.get @json['user']['links']['roles']\n tmp['associatedRoles']['roles'].pmap do |role_uri|\n role = client.get role_uri\n client.factory.create(GoodData::ProjectRole, role)\n end\n end", "def claims\n get_all_roles\n end", "def claims\n get_all_roles\n end", "def filter_roles\n if params[:user] && params[:user][:roles]\n params[:user][:roles] = params[:user][:roles].map(&:to_i) & current_user.assignable_roles\n end\n end", "def user_roles\n roles.collect(&:name).join(', ').split(', ').map(&:capitalize).join(', ')#.capitalize\n end", "def roles\n @users = User.order(\"user_name\").all\n end", "def get_role_ids()\n server = Rails.cache.read('discord_bot/servers')&.find { |s| s['id'] == self.discord_server.id }\n\n return [] if server.nil?\n\n roles_config = server['exp_roles_config']\n\n return [] if roles_config.nil?\n\n thresholds = roles_config.sort_by { |r| r[0] }\n acquired_roles = []\n\n while thresholds.count > 0 && self.exp > thresholds.first[0] do\n acquired_roles.push(thresholds.shift)\n end\n\n return acquired_roles\n end", "def all_roles\n _role_ids_ = (account_groups.map(&:role_ids) + role_ids).flatten.uniq\n Role.where(id: _role_ids_)\n end", "def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end", "def my_roles(user)\n user.roles & self.design_review_results.collect { |drr| drr.role }\n end", "def all_roles\n result = Array.new\n \n# for role in self.roles\n# result << role.ancestors_and_self\n# end\n \n for group in self.groups\n result << group.all_roles\n end\n \n result.flatten!\n result.uniq!\n \n return result\n end", "def get_available_roles \n ids = Array.new\n \n current = self.parent_id\n while current\n role = Role.find(current)\n if role\n if not ids.index(role.id)\n ids << role.id\n current = role.parent_id\n end \n end \n end\n return ids\n end", "def reviewer_roles\n\n members = []\n Role.get_open_reviewer_roles.each do |role|\n entry_user = self.board_design_entry_users.detect{ |eu| eu.role_id == role.id }\n members << { :role => role,\n :member_list => role.active_users,\n :member_id => entry_user ? entry_user.user_id : 0,\n :required => !entry_user || (entry_user && entry_user.required?) }\n end\n members\n end", "def roles\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Role)\n end", "def roles!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/roles'\n end.execute!\n\n json[:roles]\n end", "def super_and_admin_roles\n return roles_include(roles.keys[0..1])\n end", "def check_role_group\n @roles = Role.role_group.accessible_by(current_ability)\n end", "def index\n @role_permissions = RolePermission.all\n end", "def list\n\n @roles = Role.find(:all, :order => 'name')\n\n end", "def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end", "def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end", "def roles_for(section)\n roles = []\n Section.find_roles.pluck(:name).uniq.each do |role|\n roles += [role] if self.has_role?(role, section)\n end\n roles\n end", "def data_roles\n if current_user.has_role? :superadmin\n @roles = Role.only_super_admin.accessible_by(current_ability)\n else\n unless current_user.warehouse.blank?\n roles = \"customer\"\n else\n roles = \"supplier\"\n end\n @roles = Role.only_admin_group(roles)\n end\n end", "def roles_for_project(project)\n roles = []\n # No role on archived projects\n return roles unless project && project.active?\n if logged?\n # Find project membership\n membership = memberships.detect { |m| m.project_id == project.id }\n if membership\n roles = membership.roles\n else\n @role_non_member ||= Role.non_member\n roles << @role_non_member\n end\n else\n @role_anonymous ||= Role.anonymous\n roles << @role_anonymous\n end\n roles\n end" ]
[ "0.7961274", "0.7961274", "0.78211755", "0.7805926", "0.777467", "0.7765346", "0.7642368", "0.7590508", "0.75558734", "0.7555324", "0.75542194", "0.75542194", "0.75542194", "0.75542194", "0.755171", "0.7516201", "0.75057757", "0.7470726", "0.74580353", "0.74580353", "0.74501413", "0.74501413", "0.7440693", "0.74181104", "0.7408376", "0.73811525", "0.73233974", "0.7303809", "0.729944", "0.7283556", "0.728111", "0.7268903", "0.72646177", "0.72215563", "0.7219733", "0.7218045", "0.7203467", "0.7194707", "0.71916735", "0.71820897", "0.71812165", "0.71643865", "0.71242106", "0.71068704", "0.710601", "0.70925313", "0.7091828", "0.70878816", "0.70643234", "0.7046351", "0.7045393", "0.7020831", "0.7020831", "0.7020477", "0.7007371", "0.699852", "0.6986857", "0.69591206", "0.6948994", "0.6943975", "0.69433403", "0.6940848", "0.69347626", "0.6884096", "0.68526614", "0.6851731", "0.6850348", "0.68322235", "0.6829183", "0.68242604", "0.6822721", "0.68156445", "0.68076134", "0.68007416", "0.68002474", "0.6760751", "0.6757375", "0.67462355", "0.67462355", "0.67366976", "0.6720655", "0.67198086", "0.67173964", "0.67119336", "0.67088413", "0.6703372", "0.6683127", "0.66829616", "0.66721827", "0.666185", "0.6660685", "0.6657409", "0.66521716", "0.66489255", "0.6637984", "0.66369116", "0.6632728", "0.6629889", "0.6605501", "0.66004485" ]
0.7181458
40
initializes with a name, always with a balance of 1000, and always with a status of "open"
def initialize(name) @name = name @balance = 1000 @status = "open" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(name)\n @name = name\n @balance = 1000\n @status = \"open\"\n end", "def initialize(name) # takes in name for account\n @name = name # assigns instance variables\n @balance = 1000 # starting out balance\n @status = \"open\" # sets status to \"open\" when created\n end", "def initialize(name)\n @name = name\n # add balance of $1000 to initialize method\n @balance = 1000\n # initialize with a status of open (instance variable)\n @status = \"open\"\n end", "def initialize(name)\n @name = name #string\n @balance = 1000 #integer\n @status = \"open\" #string\n end", "def initialize(name)\n\t\t#when I initialize the bank account I need to do so with my name\n\t\t#always initialize with a balance of 1000\n\t\t@name = name\n\t\t@balance = 1000 \n\t\t@status = \"open\"\n\tend", "def initialize(name)\n # BankAccount BankAccount #initialize initializes with a name\n @name = name\n # BankAccount BankAccount #initialize always initializes with balance of 1000\n @balance = 1000\n # BankAccount BankAccount #initialize always initializes with a status of 'open'\n @status = 'open'\n end", "def initialize(name, balance = 100)\n\t\t@name = name\n\t\t@balance = balance\n\tend", "def initialize(name, balance=100)\n @name = name\n @balance = balance\n end", "def initialize(opening_balance, name)\n @opening_balance = opening_balance # We want to know the initial opening balance\n @balance = opening_balance # and set the current balance to the opening balance\n @name = name # We want an account name so we can identify the account and to display the name on the screen.\n @transactions = [] # We want to keep a list of our transactions\n end", "def initialize(name, balance=100)\n @name = name\n @balance = balance\n end", "def initialize(name)\n @name = name #expect(avi).to be_a(BankAccount)\n @balance = 1000\n @status = \"open\"\n @account_total = []\n end", "def initialize(name)\n\t\t@name = name\n\t\t@transactions = [ ]\n\t\taddtransaction(\"Beggining balance\", 0.00)\n\tend", "def initialize(name, amount)\n\t\t\t@name = name\n\t\t\t@amount = amount\n \n\t\tend", "def initialize(name, balance = 100)\n @name = name\n @balance = balance\n puts \"Hi #{@name}, your account has been created.\" \n end", "def open_account(name, balance)\n account = {name: name, balance: balance}\n if account[:balance] >= 200\n @accounts.push(account)\n else\n end\n end", "def initialize(name)\n @name = name\n @bank_account = 25.0\n @happiness = 8\n @hygiene = 8\n end", "def initialize(balance,account_open_date = Time.now)\n @id = Random.rand(100000..999999)\n @balance\n @account_open_date = account_open_date\n @minimum_balance = 0\n @withdraw_fee = 0\n check_opening_balance(balance)\n show_current_balance\n return @balance\n end", "def open_account(name, amount)\n accounts.push({ :name => name, :balance => amount }) if amount >= 200\n end", "def initialize(id, balance, open_date)\n\t\t# ruby dosen't like constants in intialize values, lowercase it\n\t\t\t@id = id\n\t\t\t@balance = balance\n\t\t\t@open_date = open_date\n\t\t\t# pretty_initial_balance = (@initial_balance / 100).to_f\n\t\t\tis_negative # method to determine if transaction would lead to overdraft\n\t\tend", "def initialize(initial_name)\n puts \"I was created\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end", "def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n end", "def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n end", "def initialize(balance, account_holder_name)\n @interest_rate = 1.00001\n @balance = balance\n @account_holder_name = account_holder_name\n end", "def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n\n\n end", "def initialize(balance)\n @balance = balance\n end", "def initialize(name)\n @name = name\n @balance = 25\n @hygiene_index = 8\n @happiness_index = 8\nend", "def initialize(exisiting_savings) #This gets called when a new instance of a bank account gets created\n # @balance = 0\n @balance = exisiting_savings\n end", "def initialize(initial_name=nil)\n # what's important to your object\n # upon its creation?\n puts \"I was created!\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end", "def initialize(starting_balance)\n @balance = starting_balance\n end", "def initialize(holder_name , balance , type)\n @holder_name =holder_name\n @balance = balance\n @type = type\n end", "def initialize\n @balance = 0\n end", "def initialize(name = \"\", price = 0, weight = 0)\n self.name = name\n self.price = price\n self.weight = weight\n @quantity = 0\n @description = \"\"\n @@ship_price_per_oz = 1.2\n end", "def initialize (name, cash)\n\t\tself.name = name \t\t\t\t\t\t\t\t\t\t\t\t#defining .name to to act on self method and to take name parameter\n\t\tself.cash = cash \n\t\tself.accounts = Hash.new(name)\t\t\t\t\t\t\t\t\t\t\t\t#defining .cash to to act on self method and to take cash parameter\n\t\tputs \"Hi, #{name}. You have $#{cash}!\" \t#interpolating the parameters into the puts\n\tend", "def open ( person )\r\n\t\t@bank_listing[person.id_number] = {:name => person.name, :balance => 0}\r\n\t\tputs \"#{@bank_name}:Thank you for joining, #{person.name}! Your balance is currently #{@bank_listing[person.id_number][:balance]}!\"\r\n\tend", "def initialize(balance = 0)\n if balance < 0\n raise ArgumentError.new(\"You cannot open an account with a negative amount.\")\n end\n @balance = balance\n @id = Faker::Company.swedish_organisation_number\n # Make sure there are no duplicate ID #s?\n @owner = Bank::Owner.new(account_id: @id, first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, street_address: Faker::Address.street_address, city: Faker::Address.city, state: Faker::Address.state, zip: Faker::Address.zip)\n end", "def initialize(name, wallet)\n @name = name\n @wallet = wallet\n @drinks = 0\n end", "def initialize(name = \"\")\n @name = name\n @age = 0\n @last_wash = Time.now\n @last_food = Time.now\n @alive = true\n @limit_wash = 0\n @limit_food = 0\n @kind = \"\"\n end", "def initialize(account_id, balance, opendate)\n super # or super(account_id, balance, opendate); never put super()\n @withdrawal_fee = 2\n end", "def initialize(name, cash)\n @name = name\n @cash = cash\n @hands = []\n @bet = 0 # amount of money player is betting on default hand\n @total_bet = 0 # total amount bet on all hands thus far\n\n end", "def initialize(name, amount, units)\n\t\t\t@name = name\n\t\t\t@amount = amount\n\t\t\t@units = units\n\t\tend", "def initialize(name, capacity, daily_expenses, budget)\n @name = name\n @capacity = capacity\n @daily_expenses = daily_expenses\n @budget = budget\n @state = :idle\n @days = 0\n @projects_waiting = []\n @projects_current = []\n @projects_done = []\n end", "def initialize(name, man_days, price)\n @name = name\n @man_days = man_days\n @man_days_done = 0\n @price = price\n @state = :waiting\n end", "def initialize(name)\n #making sure name can be called out of instance method\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n\n end", "def initialize(name, price_usd, price_btc, market_cap_usd, percent_change_24h, last_updated_unix)\n @name = name\n @price_usd = price_usd.to_f.round(2)\n @price_btc = price_btc.to_i\n @market_cap_usd = market_cap_usd.to_i\n @percent_change_24h = percent_change_24h.to_i\n @last_updated_unix = last_updated_unix\n end", "def initialize\n createAccountNumber\n @CheckingAccount = 500\n @SavingAccount = 50\n @interestRate = 0.05\n @@account_counter += 1\n end", "def initialize(name:, commission_rate:, balance: \"$0.00\")\n set_required_field(:name, name)\n set_percentage_field(:commission_rate, commission_rate)\n set_monetary_field(:balance, balance)\n end", "def initialize(name, price, currency, shares)\n @name = name\n @price = price\n @currency = currency.upcase\n @shares = shares\n convert_curr\n shares_totals\n end", "def initialize(initial_balance, initial_equity, initial_margin, lev, currcy)\n # Account position / status.\n @balance = initial_balance\n @equity = initial_equity\n @margin = initial_margin\n @leverage = lev\n @base_currency = currcy\n\n # Open and closed trades.\n @orders = []\n @positions = []\n @closed_positions = []\n end", "def initialize(account_ID, account_initial_balance, date_of_creation, account_owner = nil)\n\n super\n\n if account_initial_balance < MIN_BAL\n raise ArgumentError\n end\n\n @type = \"money market\"\n @transactions_remaining = MAX_TRANSACTIONS\n @frozen = false\n\n end", "def initialize(name = \" \", price = 0, units = 0, min_stock = 0, max_stock = 0)\n @name = name\n @price = price\n @units = units\n @min_stock = min_stock\n @max_stock = max_stock\n end", "def initialize\n\t\t@mult = 1.1\n @name = 'High Low'\n @min = 1\n @game_money = $player.wallet.amount #game_money\n @game_bet = 0\n\tend", "def initialize(name, level, bc, prize, levelChange = 0)\n @name = name\n @combatLevel = level\n @badCons = bc\n @prize = prize\n @levelChangeAgainstCultistPlayer = levelChange\n end", "def initialize\n @account_number = new_account_number\n @balance_total = 0\n @interest_rate = 0.0025 #per month or 3% per year.\n @balance_savings = 0\n @balance_checking = 0\n @@total_accounts += 1\n puts \"Your account has been created.\"\n end", "def initialize(name, happiness=8, hygiene=8)\n #I initialize name, happiness and hygiene = 8 because they should start with 8 points each.\n @name = name\n @bank_account = 25\n @happiness = happiness\n @hygiene = hygiene\n end", "def initialize\n @account_number = account_number # private method\n @checking_balance = 100\n @savings_balance = 100\n @rate = interest_rate # private method\n @@account_count += 1\n end", "def initialize(name, side)\n @name = name\n @quota = 50\n @experience = 0\n @side = side\n @earnings = 0\n @number_of_houses = 0\n end", "def initialize(name = nil)\n super(name)\n @at_will_available = 0\n @encounter_available = 0\n @encounter_spells = 1\n @default_encounter_spells = 1\n @encounter_abilities = 1\n @default_encounter_abilities = 1\n @level = 1\n @experience = 0\n @minimum_money = 0\n end", "def initialize(name, price)\n\t\t@name = name\n\t\t@price = price\n\tend", "def initialize(name, price)\n\t\t@name = name\n\t\t@price = price\n\tend", "def initialize(name, price)\n\t\t@name = name\n\t\t@price = price\n\tend", "def initialize(name)\n @name = name\n @age = 0\n @in_coffin = true\n @@drank_blood_today = false\n end", "def initialize(name)\n\t\t@name = name\n\t\t@transactions = []\n\tend", "def initialize(balance:)\n @balance = balance\n @change = nil\n @product = nil\n end", "def initialize\n @funds = 1000\n end", "def initialize(name, ordered, retail_price, cost_of_sale)\r\n @name = name # String. The name of the drink type, e.g. \"Beers\".\r\n @ordered = ordered # Integer. The number of orders pending for this drink.\r\n @retail_price = retail_price # Numeric. What the customer pays for the drink.\r\n @cost_of_sale = cost_of_sale # Numeric. What it costs the business to sell this drink.\r\n end", "def initialize(bankname)\n\t\t@bankname = bankname\n\t\t@accounts = {}\n\t\t@cc_limits = {}\n\t\t@cc_balances = {}\n\t\t@cc_holds = {}\n\t\t@cc_rates = {}\n\t\tputs \"#{@bankname} bank was just created.\"\n\tend", "def initialize(name)\n @name = name\n @transactions = []\n end", "def initialize (bank_name)\t\t\t\n\t\tself.bank_name = bank_name \t\t\t\t\t\t\t\t#self.bank_name defined as a particular instance of parameter bank_name\n\t\tself.accounts = {}\t\t\t\t\t\t\t\t\t\t\t\t#creates empty hash accounts to store future account info in\n\t\tself.name_counter = {}\n\t\tprint_initialize\n\tend", "def initialize(name)\n @name, @wins, @losses = name, 0, 0;\n end", "def initialize(name, till_value, drinkstock)\n @name = name\n @till = till_value\n @drinkstock = drinkstock\n end", "def initialize(account_id, start_balance, open_date, owner = Owner.new({last_name: \"The_Bank\"}))\n # Check that start_balance argument is a Fixnum & meets minimum balance\n if start_balance.to_i >= self.class::MINIMUM_BALANCE && start_balance.class == Fixnum\n @balance = start_balance\n else\n raise ArgumentError, \"Start balance must be greater than minimum balance: #{ self.class::MINIMUM_BALANCE } cents\"\n end\n\n # Check that owner argument is an Owner object\n if owner.class != Owner\n # If owner argument is a hash, attempt to initialize an Owner from it\n if owner.class == Hash\n owner = Owner.new(owner)\n else\n raise ArgumentError, \"Invalid owner info provided\"\n end\n end\n\n @account_id = account_id\n @open_date = open_date\n @owner = owner\n end", "def initialize(id, balance, open_date = nil )\n\n raise ArgumentError.new \"Your balance must be greater than 0.\" if balance < 0\n @balance = balance\n @id = id\n @open_date = open_date\n end", "def initialize(name, price) #description, calories, fat, carbs, protein)\n\t\t@name = name\n\t\t@price = price\n\tend", "def initialize(account_ID, account_initial_balance, date_of_creation, account_owner = nil)\n\n super # This is kind of sloppy to call here because it will still do the < 0 check and assign the balance\n # before throwing the error below if the balance is between $0 and $10\n\n @type = \"savings\"\n\n if account_initial_balance < MIN_BAL\n raise ArgumentError\n end\n\n end", "def initialize(id, balance)\n raise ArgumentError.new \"Money Market Accounts must\n have at least $10,000\" if balance < 10000\n super(id, balance)\n @transactions = 6\n end", "def initialize(name, price)\n @name = name\n @price = price\n end", "def initialize(name, commodities)\n @name = name\n @inventory = Inventory.new(commodities)\n @conditions = {}\n @production_rules = []\n @trade_prefs = Hash.new { |hash, key| hash[key] = 0 }\n end", "def initialize(n)\n\n @balance = n\n @ledger = []\n\n end", "def initialize(input_name, input_balance, input_type) # .new in the spec needs an initialize.\n @holder_name = input_name # @symbol is global.\n @balance = input_balance\n @type = input_type\n end", "def initialize(account_id, open_date, amount)\n # The initial balance cannot be less than $10. If it is, this will raise an ArgumentError\n super(account_id, open_date, amount) #passing into Account, the arguments it needs to initialize.\n end", "def initialize()\n\t\t# @name = name\n\t\t# @price = price \n\tend", "def initialize(name)\n @name = name\n @first_seen = @last_activity = Time.now\n @total_connections = 0\n @total_time = 0\n @money = 0\n @rank = 0\n @colour = :ansi\n @muffled = false\n end", "def initialize (name)\n @name = name\n @player_decisions = []\n @grand_total = 0\n end", "def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n # Your end here should go to the left to be flush with your def. \n # Also, check the setting in your text editor to make sure you tab using 2 spaces, instead of 4. Ruby style only uses 2\n end", "def initialize(balance = 0)\n @balance = balance\n @max = 90\n @min = 1\n @entry_station = nil\n @history = []\n @current_journey\n end", "def initialize(holder_name, balance, genre)\n @holder_name = holder_name\n @balance= balance\n @genre = genre\n # @sortcode = sortcode\n end", "def initialize (card_name, bank_name)\n\t\tself.bank_name = bank_name\n\t\tself.card_name = card_name\n\t\tself.accounts = {}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#creates accounts hash to store credit card balance in\n\t\tself.credit_lim = 1000\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#creates a credit limit of 1000\n\t\tself.record_to_statem = {}\n\t\tself.trans_count = 0\n\t\tself.post = \"\"\n\tend", "def initialize(name, cost)\n @name = name\n @cost = cost\n end", "def initialize(id, balance, date = '')\n unless balance >= 0\n raise ArgumentError.new \"Balance must be greater or equal to 0\"\n end\n @id = id\n @balance = balance\n @opening_date = date\n end", "def initialize nama\n @nama = nama\n\t@blood = 100\n\t@manna = 40\n\t@status =\"\"\n end", "def initialize(notes = DEFAULT_BALANCE)\n @balance = {}\n deposit(notes)\n end", "def initialize(name, gold, min, max, kind)\n @name = name\n @goldCoins = gold\n @minBonus = min\n @maxBonus = max\n @kind = kind\n end", "def initialize(name, price, units = 0)\n @name = name\n @price = price\n @units = units\n end", "def initialize(name, credits = 0, dex = 1, str = 1, int = 1, lck = 1)\n @name = name\n @credits = credits\n @daily = false\n @dex = dex\n @str = str\n @int = int\n @lck = lck\n @pvp = false\n @mission = false\n @crew = '%NONE'\n @crew_array = []\n @crew_open = false\n @fact = '%NONE'\n end", "def initialize(name, price) #function to initialize variables.\n @name = name\n @price = price\n end", "def initialize(name) #constructor\n self.name = name\n self.hp = 50 # default values\n self.mp = 10\n self.atk = 10\n self.speed = 5\n self.ct = 0\n self.maxhp = 5\n self.maxmp = 10\n self.status = 'alive'\n ALL_UNITS << self\n end", "def initialize id, balance, open_date, owner = nil\n # error handling for initial negative balance\n if balance >= 0\n @balance = balance\n else\n raise ArgumentError.new \"Inital balance cannot be a negetive value\"\n end\n\n @id = id\n @open_date = DateTime.parse(open_date)\n\n # Assumes that required csv file is accesible\n CSV.read(\"support/account_owners.csv\").each do |line|\n if line[0].to_i == @id\n @owner = Bank::Owner.find(line[1].to_i)\n end\n end\n\n if owner.class == Bank::Owner\n @owner = owner\n else\n # Default instance of the Owner class initialized with empty hash\n @owner = Bank::Owner.new({})\n end\n end", "def initialize\n puts \"Tell me your name\".colorize(:magenta)\n @name = gets.strip\n @wallet = 100.0\n end", "def initialize(name)\n @name = name\n @confines = []\n @value = nil\n @timeout = 0\n @weight = nil\n end" ]
[ "0.8795592", "0.8673122", "0.8481442", "0.84619963", "0.8369874", "0.7936659", "0.7903903", "0.7824567", "0.7817918", "0.7790271", "0.7772847", "0.7526974", "0.7119722", "0.7080683", "0.69818026", "0.68975455", "0.68658704", "0.68627304", "0.68241763", "0.681126", "0.67644423", "0.6713289", "0.67112887", "0.67108047", "0.66867304", "0.6682268", "0.66709375", "0.6641612", "0.66082335", "0.66069084", "0.66015327", "0.6575509", "0.6509354", "0.6502379", "0.64899933", "0.6486534", "0.6479726", "0.6475475", "0.64546007", "0.64521325", "0.6422321", "0.6417998", "0.6416271", "0.6412918", "0.63889366", "0.6388239", "0.63816077", "0.6344199", "0.63349736", "0.6331451", "0.63083446", "0.62833506", "0.6268465", "0.62498796", "0.6231946", "0.6231497", "0.62181914", "0.6208885", "0.6208885", "0.6208885", "0.6204946", "0.62045914", "0.61985373", "0.6196813", "0.61936706", "0.6163375", "0.6162797", "0.6158544", "0.6145538", "0.6143358", "0.61379045", "0.6125016", "0.6110759", "0.6079746", "0.6079003", "0.60761184", "0.6074032", "0.60678905", "0.6062703", "0.6045491", "0.6044421", "0.6040756", "0.6025235", "0.6011691", "0.6008738", "0.5999502", "0.5999016", "0.5997255", "0.59943926", "0.59939045", "0.59804296", "0.59768707", "0.5972833", "0.59665847", "0.59476835", "0.59246606", "0.59062785", "0.5904287", "0.58979017" ]
0.8772102
1
can deposit money into its account
def deposit(money) self.balance = (self.balance + money) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit (amount, account)\n if account == \"checking\"\n @checking_account_balance += amount\n elsif account == \"saving\"\n @saving_account_balance += amount\n else\n puts \"No account was selected\"\n end\n end", "def deposit\n end", "def deposit\n end", "def deposit(amount)\n deposit_account = Account.find_by(account_type: :deposit)\n raise 'No deposit account, has the db been seeded?' if\n deposit_account.nil?\n\n create_transfer('deposit', amount, deposit_account, self)\n end", "def deposit(money_to_deposit)\n @balance += money_to_deposit\n end", "def deposit(amount)\n if (balance < 10000) && (balance + amount >= 10000)\n @balance += amount\n else\n @balance += amount\n @transactions -= 1\n end\n end", "def deposit(cash)\n @balance += cash\n end", "def deposit ( person, amount )\r\n\t\tif person.worth >= amount\r\n\t\t@bank_listing[person.id_number][:balance]+=amount\r\n\t\tputs \"#{@bank_name}: Thanks #{person.name}, you deposited #{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry, you don't have enough on hand.\"\r\n\t\tend\r\n\tend", "def deposit(amount_of_money)\n return @balance + amount_of_money\n end", "def deposit!(amount)\n raise NegativeDepositError if amount < 0\n add_transaction(amount)\n\n balance\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance = @balance + amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n @balance\n end", "def deposit(amount, *args)\n do_transaction :deposit, amount, *args\n end", "def will_deposit(amount, *args)\n do_scheduled_transaction :deposit, amount, *args\n end", "def deposit(amount)\n \n #return if amount_is_not_valid(amount)\n ActiveRecord::Base.transaction do\n #note: need to use self or Account as a prefix when using balance, since it is not a variable or anythign defined in tis class\n self.update!(balance: self.balance + amount)\n end \n end", "def withdraw(amount, atm, pin, acc_no)\n if @balance >= amount && atm.balance >= amount && @pin == pin && acc_no == @account_no\n atm.dispense(amount)\n @balance = @balance - amount\n puts \"your new balance is #{@balance}\"\n else\n puts \"you are too pov\"\n end\n end", "def deposit(amt)\n @bank_acct += amt\n puts \"Your balance is #{@bank_acct}.\"\n end", "def allowance(amt.to_f)\r\n save.deposit(amt.to_f * 0.6)\r\n puts \"Save balance = $#{@balance}.\"\r\n spend.deposit(amt.to_f * 0.3)\r\n puts \"Spend balance = $#{@balance}.\"\r\n spare.deposit(amt.to_f * 0.1)\r\n puts \"Spare balance = $#{@balance}.\"\r\nend", "def deposit(money_amount)\n # Negative deposit amount, invalid\n if money_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be a negetive value\"\n elsif @num_transaction < 6\n if @balance >= 1000000\n @num_transaction += 1\n end\n @balance += money_amount\n end\n return @balance\n end", "def deposit(amount)\n self.balance = (self.balance + amount).round(2)\n self.save!\n end", "def deposit(name, amount)\n find_account(name)[:balance] += amount\n end", "def deposit acct, amount\n\t\t\treturn \"Invalid account: '#{acct}'\" unless valid_acct acct\n\n\t\t\tamount = to_money amount.abs\n\n\t\t\tadjust acct, amount\n\t\tend", "def deposit(money)\n @balance += money\nend", "def deposit(amount)\n @balance += amount\n puts \"Deposit #{amount}. New Balance: $#{@balance}\"\n returned\n end", "def deposit(deposit_amount)\n if deposit_amount <= 0\n puts \"dummy.\"\n else\n @balance += deposit_amount\n end\n show_current_balance\n end", "def deposit_cash(deposit_amount)\n @balance += deposit_amount\n end", "def has_paid (driver, person, amount)\n # debt - amount\n end", "def deposit(balance, amount)\n\tnew_balance = balance + amount\n\treturn new_balance\nend", "def deposit(deposit_amount)\n self.balance += deposit_amount\n end", "def deposit(amount)\n amount = amount.abs\n @balance = @balance + amount\n one_transaction\n return @balance\n end", "def deposit(amount)\n @balance += amount\n return @balance\n end", "def deposit(deposit_amount)\n self.balance += deposit_amount\n end", "def deposit(deposit_amount)\n if deposit_amount < 0\n puts \"Invalid deposit amount entered.\"\n else\n @balance += deposit_amount\n puts \"You deposited $#{deposit_amount}. \"\n end\n return balance\n end", "def deposit(amount_to_deposit)\n @balance += amount_to_deposit\n return @balance\n end", "def deposit(amount_to_deposit)\n @balance += amount_to_deposit\n return @balance\n end", "def deposit(amount_to_deposit)\n\n if @frozen\n\n @balance += amount_to_deposit\n\n if @balance > MIN_BAL\n @frozen = false\n puts \"Thank you - you have exceeded the minimum balance of $%.2f\" % MIN_BAL + \", and your account is unfrozen.\"\n end\n\n else\n\n if @transactions_remaining == 0\n puts \"Sorry, you cannot perform transactions right now. You have already used your #{MAX_TRANSACTIONS} transactions for the month.\"\n else\n @balance += amount_to_deposit\n @transactions_remaining -= 1\n end\n\n end\n\n return @balance\n\n end", "def deposit\n if admin_use\n 0\n elsif estimated_numbers < 20\n 150\n elsif estimated_numbers < 40\n 300\n else\n 600\n end\n end", "def direct_debit()\n @amount -= 50 if @type == \"personal\"\n @amount -= 100 if @type == \"business\"\n end", "def deposit(amount, options={})\n adjust_and_save(amount.abs, :deposit, options)\n end", "def deposit(account_id, accounts,action)\n account = accounts[account_id]\n show_message \"Enter amount to deposit in your account\"\n money_to_deposit = gets.chomp.to_i\n balance=account[:balance]\n #accounts[:account_id].store :balance ,balance+money_to_deposit\n account[:balance] = balance + money_to_deposit\n show_message \"wooow !!! transaction sucessful..your current balance is #{account[:balance]}\"\n create_history(account_id,accounts,action,money_to_deposit,account[:balance])\nend", "def withdraw (amount, account)\n if account == \"checking\"\n @checking_account_balance -= amount\n elsif account == \"saving\"\n @saving_account_balance -= amount\n else\n puts \"No account was selected\"\n end\n end", "def deposit(amount)\n @balance += amount\n puts \"#{money_convert(balance)}\"\n return @balance\n end", "def withdraw!(amount)\n amount = -amount if amount > 0\n add_transaction(amount)\n\n balance\n end", "def transfer ( bank, person, amount)\r\n\t\tif @bank_listing[person.id_number][:balance] >= amount\r\n\t\t\t@bank_listing[person.id_number][:balance]-=amount\r\n\t\t\tputs \"#{@bank_name}: #{person.name}, your transfer of #{amount} to #{bank.bank_name} is complete.\"\r\n\t\t\tbank.deposit(person, amount)\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry #{person.name}, insufficient funds.\"\r\n\t\tend\r\n\t\t\t\r\n\tend", "def deposit(deposit_amt = 0)\n @balance = @balance + deposit_amt\n return @balance\n end", "def deposit(money_amount)\n # Negative deposit amount, invalid\n if money_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be a negetive value\"\n else\n @balance += money_amount\n return @balance\n end\n end", "def deposit(pin_number, amount)\n if verify_pin(pin_number)\n add_amount(amount)\n puts \"Deposited #{amount}. New balance: $#{@balance}\"\n end\n end", "def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend", "def deshacer\n entidad.deposit monto, operadora\n end", "def despositing_adds_transaction_to_bank_statement\n account = BankAccount.new\n account.deposit('10-01-2012', 1000)\n p account\n p account.bank_statement\nend", "def deposit(deposit_amount)\n\n raise ArgumentError.new \"Your deposit amount must be greater than 0.\" if deposit_amount <= 0\n\n @balance += deposit_amount\n end", "def deposit(money) #Creating a method called deposit for the 1st user story\n @balance = @balance + money #The instance of 'balance' get recreated everytime the deposit method is called\n end", "def deposit (amount, options={})\n options[:memo] ||= 'Regular deposit.'\n @transactions.push({:amount => amount, :memo => options[:memo]})\n end", "def can_cash?\n if self.tier && self.tier.piggy_bank\n if rate = find_bonus_rate\n # transfer cents\n if rate.cents.to_i > 0 && rate.funding_source.piggy_bank &&\n cashed_events_limit_not_reached?(rate.max_events_per_month)\n result = rate.funding_source.piggy_bank.transfer(self.receiver.piggy_bank, \n Money.new(rate.cents, rate.default_currency))\n if result.success?\n self.description = result.message \n return true\n end\n end\n end\n end\n false\n end", "def coin_exists_on_withdrawal\n \t\treturn if deposited\n \t\tdeposits = Transaction.where(user_id: user_id, coin_id: coin_id, deposited: true)\n \t\twithdrawals = Transaction.where(user_id: user_id, coin_id: coin_id, deposited: false)\n \t\tbalance = deposits.count - withdrawals.count\n \t\terrors.add(:deposited, \"invalid coins\") if balance <= 0 \n \tend", "def deposit(amount)\n result = BigDecimal.new(balance) + BigDecimal.new(amount)\n update_attributes(balance: result)\n end", "def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end", "def debit_customer_account\n end", "def withdraw ( person, amount )\r\n\t\tif @bank_listing[person.id_number][:balance] >= amount\r\n\t\t\t@bank_listing[person.id_number][:balance]-=amount\r\n\t\t\tputs \"#{@bank_name}: Thanks #{person.name}, here's your $#{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry #{person.name}, insufficient funds.\"\r\n\t\tend\r\n\tend", "def can_pay_deposit?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end", "def withdraw(name, amount)\n a = find_account(name)\n a[:balance] < amount ? a[:balance] -= 30 : a[:balance] -= amount\n end", "def withd amount\n unless amount > @savings_account_balance\n @savings_account_balance -= amount\n \n else\n end\n end", "def charge_paypal_account(amount)\n true\n end", "def charge_paypal_account(amount)\n true\n end", "def saldo\n balance\n end", "def deposit(deposit_amount)\n if deposit_amount < 0\n puts \"Invalid deposit amount entered. Please enter a new deposit amount. \"\n deposit_amount = gets.chomp.to_f\n else\n @balance += deposit_amount\n puts \"You deposited #{deposit_amount}. Your new balance is #{@balance}.\"\n end\n end", "def create\n account = Account.where(\"account_number = ?\", params[:account_number]).first \n deposit_amount = params[:deposit_amount].to_f \n\n if (account && account.balance >= deposit_amount)\n deposit = Deposit.new\n deposit.account_id = account.id\n deposit.user_id = account.user_id\n\n tenure_in_years = params[:tenure_in_years].first\n tenure_in_months = params[:tenure_in_months].first\n tenure_in_days = params[:tenure_in_days].first\n\n deposit.tenure_in_years = tenure_in_years\n deposit.tenure_in_months = tenure_in_months\n deposit.tenure_in_days = tenure_in_days\n deposit.maturity_proceeds = params[:maturity_proceeds].present? ? params[:maturity_proceeds] : 0\n\n deposit.save\n\n user_age = account.user.age rescue 0\n\n # This is to calculate the rate of interest.\n #interest = deposit.calculate_interest(tenure_in_years, tenure_in_months, tenure_in_days, user_age)\n #deposit.update(:interest => interest)\n\n balance = (account.balance - deposit_amount)\n account.update(:balance => balance)\n else\n flash[:error] = \"Account doesn't exsits / balance is less. Please try again.\"\n redirect_to new_account_path\n end\n flash[:message]= \"Amount is deposited successfully.\"\n redirect_to new_account_path\n end", "def payment_allowed?(acct_no, amount)\n if DB[:Account].where(AcctNo: acct_no).first[:Balance].to_i <\n amount.to_i.fdiv(100)\n return false\n end\n true\n end", "def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend", "def deposit_cash()\n puts \"Deposit amount?\"\n deposit_amount = gets.to_f\n @balance += deposit_amount\n end", "def deposit_cash()\n puts \"Deposit amount?\"\n deposit_amount = gets.to_f\n @balance += deposit_amount\n end", "def deposit(deposit_amount)\n @amount+=deposit_amount\n puts @amount\n end", "def deposit(user, amount)\n user.with_lock do\n user.my_wallet.balance += amount.to_f\n user.my_wallet.save!\n end\n end", "def close_account\n self.void_pending_authorizations\n if probono = Organization.probono\n if probono.piggy_bank && probono.piggy_bank.reload && probono.piggy_bank != self\n result = self.transfer(probono.piggy_bank, self.available_balance, :limits => false) if probono.piggy_bank\n raise BankError, \"remaining funds could not be transferred\" if !result || !result.success?\n end\n end\n end", "def deposit_checking funds\n @balance_checking += funds\n @balance_total += funds\n rebalance\n puts \"#{funds} has been deposited. Your new balance is #{@balance_checking}\"\n self\n end", "def set_deposit\n @deposit_amount = set_deposit_amount(@project.id)\n end", "def deposit(t)\n\n @balance += t.amount\n t.currBalance = @balance\n @ledger << t\n\n end", "def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end", "def withdraw(debit, fee = FEE)\n super(debit, fee)\n if @balance - debit < INITIAL_MIN_BALANCE # @balance 10, 000 - 100 <\n puts \"WARNING!\"\n @balance -= debit - fee\n return @balance\n # need to keep closed until brought back up\n elsif @balance < INITIAL_MIN_BALANCE\n puts \"Pay FEE plus balance\"\n return @balance\n else @balance - debit > INITIAL_MIN_BALANCE\n return @balance\n end\n end", "def pay_amount(user, amount)\r\n if(self.credits>= amount)\r\n self.credits= self.credits-amount\r\n user.receive_credits(amount)\r\n else\r\n return 'suddenly you dont have enough money'\r\n end\r\n end", "def withdraw(amount)\n @balance -= amount\n end", "def withdraw(amount)\n @balance = @balance - amount\n end", "def transferir(conta, valor)\n \n if self.saldo > valor\n if valor > 1000 #Se a transferencia for maior que 1000 \n retirar_valor(valor+self.taxa)\n depositar_valor(conta,valor) \n else\n depositar_valor(conta,valor) \n retirar_valor(valor)\n end\n else\n p \"Nao e possivel transferir R$#{valor} para #{conta.proprietario}\" \n end\n \n end", "def withdraw(amount)\n withdrawal_account = Account.find_by(account_type: 'withdrawal')\n raise 'No withdrawal account, has the db been seeded?' if\n withdrawal_account.nil?\n\n create_transfer('withdrawal', amount, self, withdrawal_account)\n end", "def debit(amount)\n self.balance -= amount\n end", "def debit_player(p)\n p.money -= p.bet\n end", "def debit(amount)\n amount = amount.to_f\n return false if self.available_amount < amount\n\n self.available_amount -= amount\n self.withdrawable_amount -= amount\n save!\n end", "def currency_required? \n deposit_type?\n end", "def deposit\n request_params = params.permit(:source_account_id, :destination_account_id, :amount)\n\n bank ||= Actions.new.deposit(\n request_params['source_account_id'], \n request_params['destination_account_id'], \n request_params['amount']\n )\n\n return render status: bank[0], json: bank[1]\n end", "def withdraw(name_of_account, amount)\n\t\taccount = find_account(name_of_account)\n\t\tbalance_check = account[:balance] \n\t\tif balance_check < amount\n\t\t\taccount[:balance] -= 30\n\t\telse\n\t\t\taccount[:balance] -= amount\n\t\tend\n\tend", "def withdraw(amount)\n raise ArgumentError.new if amount < 0\n\n #check that balance after will exceed 10 + $2 fee\n if @balance - amount - 200 < 1000\n puts \"Sorry, minimum $10 balance.\"\n else\n @balance = @balance - amount - 200\n end\n @balance\n end", "def debit!(amount)\n self.balance -= parse_monetary_value(amount)\n self.store\n end", "def transfer_funds()\n vendor = Portfolio.find(self.seller_id)\n customer = Portfolio.find(self.buyer_id)\n amount = self.transaction_cost\n customer.balance -= amount\n vendor.balance += amount\n \n Transactor.transaction do \n raise \"Transaction of funds failed!\" unless customer.save && vendor.save\n end\n end" ]
[ "0.7813424", "0.7774127", "0.7774127", "0.75479126", "0.75432813", "0.7491637", "0.74026537", "0.7385984", "0.7365258", "0.7334569", "0.7331713", "0.7331658", "0.7331658", "0.7325905", "0.73096097", "0.73096097", "0.73096097", "0.73078656", "0.7297343", "0.729532", "0.72350985", "0.723245", "0.72322494", "0.7196563", "0.7127829", "0.70958155", "0.7092811", "0.70808476", "0.7065313", "0.70576376", "0.7053021", "0.7043021", "0.70415306", "0.70266", "0.69889414", "0.6974067", "0.6940258", "0.6935673", "0.6935552", "0.69055796", "0.68777597", "0.68777597", "0.68524766", "0.6844846", "0.6842485", "0.6841175", "0.68395215", "0.6839199", "0.6834821", "0.6823756", "0.6820943", "0.6815878", "0.6774066", "0.67615986", "0.6755029", "0.6742691", "0.6741981", "0.6720313", "0.6703195", "0.6699012", "0.6691715", "0.6691243", "0.66858995", "0.66834974", "0.6675584", "0.66685814", "0.6666584", "0.6659632", "0.66563416", "0.665184", "0.665184", "0.66072226", "0.6606816", "0.6606583", "0.66035855", "0.6600394", "0.6591225", "0.6591225", "0.6587065", "0.6586295", "0.656976", "0.6569513", "0.65644705", "0.6562895", "0.6548213", "0.65339684", "0.6533745", "0.6533185", "0.6528539", "0.6527904", "0.6521753", "0.65164876", "0.65157264", "0.6515165", "0.6511329", "0.65090925", "0.65090775", "0.650296", "0.64937586", "0.64844203" ]
0.72865784
20
can display its balance
def display_balance "Your balance is $#{self.balance}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_balance()\n puts \"Balance:$#{@balance}.\"\n returned\n end", "def show_balance\n\t\t\treturn @balance\n\t\tend", "def balance_display(balance)\n puts \"Your current balance is $#{@balance}.\"\n end", "def current_balance_display\n number_to_currency(current_balance)\n end", "def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end", "def balance\n @balance\n end", "def pending_balance_display\n number_to_currency(pending_balance)\n end", "def display_balance\n \"Your balance is $#{@balance}.\"\n end", "def display_balance\n \"Your balance is $#{balance}.\" \n end", "def balance\n super\n end", "def balance\n super\n end", "def show_current_balance\n return \"Balance: $#{sprintf \"%.2f\", @balance}\"\n end", "def total_balance\n\t\tputs \"Total Balance: #{@@accounts.total}\"\n\tend", "def non_pending_balance_display\n number_to_currency(non_pending_balance)\n end", "def balance client\n puts \"Estimado Sr./Sra #{client.name} #{client.last_name}\"\n puts \"Su saldo es:\"\n puts \"Cuentas de ahorros: Bs. #{client.saving_amount}\".colorize(:blue)\n puts \"Cuentas de corriente: Bs. #{client.check_amount}\".colorize(:blue)\n end", "def display_balance\n \"Your balance is $#{@balance}.\"\n end", "def balance\n return @balance\n end", "def get_balance\n puts \"Current Balance: #{@balance}\"\n puts \"Current Interest: #{@interest}\"\n puts \"Current Payoff: #{@balance + @interest}\"\n puts\n end", "def get_balance\n return balance\n end", "def balance #same as attr_reader :balance\n @balance\n end", "def current_balance\n puts \"Your running total is $#{@current_balance}.\"\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def display_balance\nputs = \"Your balance is $#{self.balance}.\"\nend", "def balance\n rest.get(:getbalance)['data']\n end", "def printbalance\n puts \"Your balance = #{@balance}\"\nend", "def balance\n @client.balance(name)\n end", "def print_balance\n # $50.00\n # \"$\" + balance.to_s + \".00\"\n \"$#{balance}.00\"\n end", "def displayOutstandingBalance\n puts \"\\n\"\n if @outstanding_balance > 0\n puts \"Outstanding Balance : \\x1B[31m#{toCurrency(@outstanding_balance).to_s.rjust(11)}\\x1B[0m\"\n else\n puts \"Outstanding Balance : #{toCurrency(@outstanding_balance).to_s.rjust(11)}\"\n end\n\n if @minimum_payment > 0\n puts \"Minimum Payment : \\x1B[31m#{toCurrency(@minimum_payment).to_s.rjust(11)}\\x1B[0m\"\n else\n puts \"Minimum Payment : #{toCurrency(@minimum_payment).to_s.rjust(11)}\"\n end\n puts \"Due Date : \\x1B[0m#{@due_date.strftime('%d-%m-%y').to_s.rjust(11)} \\x1B[90m[in #{diffBetweenDatesInDays(@due_date.strftime('%y-%m-%d'))} days]\\x1B[0m\"\n puts \"\\n\"\n end", "def print_wallet\n\t\tputs \"\\n\\n\\n\"\n\t\tputs \"Your balance: #{@balance.round(2)}\"\n\tend", "def balance\n self.all_benefits - self.all_pays\n end", "def balance_inquiry\n \"$#{'%.2f' % @balance}\"\n end", "def pretty_balance\n puts \"You have $#{balance} in the bank\"\n end", "def get_balance\n\t\treturn @balance.balance\n\tend", "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def show_bankaccount()\n p \"The owner is #{@owner}, and The balance is #{@balance}\"\n end", "def balance\n @balance ||= total - amount_paid\n end", "def account_balance\n @account_balance\n end", "def balance\n request_params = params.permit(:account_id)\n\n balance ||= Actions.new.balance(request_params['account_id'])\n\n return render status: balance[0], json: balance[1]\n end", "def check_balance_display\n\t\tputs \"#######################\"\n\t\tputs \"# #\"\n\t\tputs \"# Hi #{@username}, \"\n\t\tputs \"# #\"\n\t\tputs \"# Your current #\"\n\t\tputs \"# #\"\n\t\tputs \"# balance is: #\"\n\t\tputs \"# #\"\n\t\tputs \"# $#{@balance} \"\n\t\tputs \"# #\"\n\t\tputs \"# #\"\n\t\tputs \"#######################\"\n sleep(5) \n\tend", "def say_balance\n puts \"This is account with id: #{user_id} and the balance is #{balance}.\"\n end", "def balance() @address.balance; end", "def balance\n b = read_attribute(:balance)\n if User.current and User.current.currency\n b.to_d * User.current.currency.exchange_rate.to_d\n else\n b.to_d\n end\n end", "def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end", "def to_s\n\t\t puts \"Bank Account:\\t#{name}\\n\"\n\t\t puts \"Your current balance is:\\t#{sprintf(\"%0.2f\", balance)} USD\" \n\tend", "def balance\n JSON.parse(response.body).fetch('balance')\n end", "def showTotal\n #checking\n #saving\n @total = @chk_balance + @sav_balance\n #print ' Bank Account Totals: $',total,\"\\n\"\n return self\n end", "def balance\n self.ledger_entries.sum(:value)\n end", "def to_s\n\t\t puts \"\\nEnding balance:\\nBank Account Name:\\t#{name}\\nBalance:\\t#{balance}\"\n\tend", "def get_account_balance\n submit GetAccountBalance.new\n end", "def balance_btc_ui\n balance_btc.to_f * 10 ** -8\n end", "def saldo\n balance\n end", "def starting_balance\n @balance\n end", "def balances?(tk); end", "def balance\n @accounts.values.first\n end", "def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end", "def balance\r\n BalanceController.instance\r\n end", "def show_man_balance\n Dialog::space\n @acct_list = bank.account_list(@man_name, @man_pin)\n @account_id_array = Display::account_info(@acct_list) \n end", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def available_balance(cur)\n 1000\n end", "def available_balance\n self.limit - self.sum_of_charges\n end", "def balances\n accounts.with_balance\n end", "def show\n puts \"\n ID: #{id}\n Balance: #{balance}\n Date: #{open_date}\"\n end", "def balance\n credit = FineBalance.sum('AMOUNT', :conditions=>{:INCURRED_ID=>self.CHARGE_INCURRED_ID})\n return self.AMOUNT-credit\n end", "def getcardbalance\r\n @cardbalance\r\n end", "def balance=(value)\n @balance = value\n end", "def balance\n body = { action: \"balance\", key: @@access_key }\n post_request(body).to_i\n end", "def balance\n # accounts.reduce(0) {|sum, account| sum + account.balance}\n accounts.sum {|account| account.balance}\n\n # total = 0\n # accounts.each {|account| total += account.balance}\n # total\n end", "def current_balance\n \"EUR. #{sprintf('%.2f', bankaccount.reload.balance)}\"\n end", "def account_name_balance\n name + ' (' + current_balance_display + ')'\n end", "def balance(account)\n net_deposits(account) - net_withdraws(account)\n end", "def allowance(amt.to_f)\r\n save.deposit(amt.to_f * 0.6)\r\n puts \"Save balance = $#{@balance}.\"\r\n spend.deposit(amt.to_f * 0.3)\r\n puts \"Spend balance = $#{@balance}.\"\r\n spare.deposit(amt.to_f * 0.1)\r\n puts \"Spare balance = $#{@balance}.\"\r\nend", "def withdraw(amount)\n @balance = @balance - amount\n end", "def balance\n exception = Exception.new(\"Invalid call\")\n\n Rollbar.error(exception, user: self)\n raise exception\n end", "def show_balance(header = \"NODE BALANCE\")\n\n puts \"\\n#{header}\"\n puts \"=\" * header.length\n\n @weights.each do |node,providers|\n puts \"#{node}\"\n providers.each do |label,detail|\n printf \" %-12s weight = %2d | serve_mode = %-8s | status = %-4s | address = %s\\n\",\n label, detail['weight'], detail['serve_mode'], detail['status'], detail['address']\n end\n end\n\n puts \"\"\n end", "def check_balance\n return @balance\n end", "def owes_amount\n loans=@loans\n net_worth=@net_worth\n @balance = net_worth-loans\n print \"the balance is : \",balance,\"\\n\"\n is_developer_solvent?\n end", "def print_register\n puts \"#{name}'s' Bank Account\"\n puts \"/\" * 40\n\n puts \"Description\".ljust(30) + \"Amount\".rjust(10)\n puts \"/\" * 40\n @transactions.each do |transaction|\n puts transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n end\n\n puts \"-\" * 40\n\n puts \"Ending Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n puts \"-\" * 40\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def displayPaymentAccountBalances\n count = 0\n @payment_accounts.each do |payment_account|\n count = count + 1\n @payment_map[count] = {}\n @payment_map[count]['account_id'] = payment_account['account_id']\n @payment_map[count]['account_name'] = payment_account['account_name']\n if payment_account['balance'] > 0\n puts \"#{count}) #{payment_account['account_name'].ljust(24)}: \\x1B[32m#{toCurrency(payment_account['balance']).to_s.rjust(11)} \\x1B[90m(#{toCurrency(payment_account['available'])} Available)\\x1B[0m\"\n else\n puts \"#{count}) #{payment_account['account_name'].ljust(24)}: \\x1B[31m#{toCurrency(payment_account['balance']).to_s.rjust(11)} \\x1B[90m(#{toCurrency(payment_account['available'])} Available)\\x1B[0m\"\n end\n end\n puts \"\\n\"\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def display_balance(pin_number)\n # put varialble if pin_number is equal to pin\n # if not, go to method pin_error\n puts pin_number == pin ? \"Balance: $#{@balance}.\" : pin_error\n end", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def index\n @bank_registers = BankRegister.all\n @total = BankRegister.balance.to_f\n if @total <= 0\n @chastise = \"WARNING: Your balance is negative!\"\n end\n # total_balance = @transaction_name.reduce(0) {|sum, i| sum + i.transaction_amount}\n end", "def show_total_cash\n \"Total: #{total_cash}\"\n end", "def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end", "def balance\n @balance ||= starting_balance + flights.inject(0) do |result, element|\n result + element.profit\n end\n end", "def prt_balance\n b = self.balance\n return \"#{'-' if b.cents<0}#{b.currency.symbol}#{b.abs.to_s}\"\n end", "def actual_balance\n if previous.present?\n previous.balance_amount_with_sign\n else\n 0\n end\n end", "def balance_hash\n @money\n end", "def print_result\n @balance.sort.each do |key, value|\n puts \"#{key}: #{value} billcoins\" if value != 0\n end\n end", "def current_balance\n starting_balance + transactions.sum(:amount)\n end", "def outstanding_balance\n loan.funded_amount - loan.payments.amount\n end", "def display_balance(pin_number)\n if pin_number == @pin #=>condition to see if pin match\n put \"Balance: $#{@balance}\"\n else\n puts pin_error\n end\n end", "def balance\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n sum = 0\n entries.each do |entry|\n value = entry['value'].gsub(\"$\",\"\")\n\n if entry['value'][0] == '('\n value = value[1..-2]\n sum = sum - value.to_i\n else\n sum = sum + value.to_i\n end\n end\n\n @t.say(\"The balance is $#{sum}\")\nend", "def format_balance\n format(\"%.2f\", balance.to_f)\n end", "def display_coins\n end", "def withdraw(amount, atm, pin, acc_no)\n if @balance >= amount && atm.balance >= amount && @pin == pin && acc_no == @account_no\n atm.dispense(amount)\n @balance = @balance - amount\n puts \"your new balance is #{@balance}\"\n else\n puts \"you are too pov\"\n end\n end", "def show\n @balance = @user.balance\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def check_balance\n\t\tsystem('clear')\n\t\tcheck_balance_display\n menu\n\tend" ]
[ "0.8508467", "0.83462274", "0.81983024", "0.80116713", "0.79525816", "0.78881663", "0.7806524", "0.77841616", "0.767867", "0.7646203", "0.7646203", "0.7644793", "0.76190525", "0.7573928", "0.75675935", "0.755066", "0.7517488", "0.7513542", "0.7494483", "0.7490018", "0.7489263", "0.74872774", "0.74586576", "0.74342537", "0.74230283", "0.74021006", "0.7400825", "0.73943067", "0.7383297", "0.7365492", "0.7345919", "0.73341644", "0.7316143", "0.7245008", "0.72447824", "0.72341734", "0.7212427", "0.721006", "0.7208967", "0.72028583", "0.71955717", "0.7185655", "0.71795386", "0.71752167", "0.71631247", "0.7147025", "0.7137616", "0.71265364", "0.7089252", "0.70869994", "0.7084353", "0.7061558", "0.7044295", "0.70425653", "0.7038964", "0.70223856", "0.7007407", "0.70065224", "0.6995737", "0.69950956", "0.69891995", "0.69871104", "0.69731164", "0.6969371", "0.69644505", "0.69615954", "0.69575715", "0.6950107", "0.69406176", "0.6935233", "0.69099486", "0.69060284", "0.69056875", "0.68983614", "0.68909675", "0.6888236", "0.68859977", "0.68842554", "0.68827635", "0.6881117", "0.6875232", "0.6855329", "0.68429756", "0.6833569", "0.6799877", "0.6798813", "0.67955333", "0.67934614", "0.67863435", "0.67841935", "0.67838943", "0.67801493", "0.67772704", "0.6763404", "0.6760097", "0.67450255", "0.67441076", "0.6742288", "0.67396486", "0.672941" ]
0.7590332
13
is valid with open status and a balance greater than 0
def valid? if status != "open" || balance == 0 false else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?\n balance > 0 && status == \"open\"\n end", "def valid?\n @status == 'open' && @balance > 0\n end", "def valid? \n balance > 0 && status == 'open'\n end", "def valid?\n @balance > 0 && @status == \"open\"\n end", "def valid?\n @status == \"open\" && @balance > 0 \n end", "def valid?\n if @status == \"open\" && @balance > 0\n return true\n else\n return false\n end\n end", "def valid?\n if @status = \"open\" && @balance > 0 \n true\n \n else\n false\n end\nend", "def amount_is_valid_for_outstanding_balance_or_credit\n end", "def balance?\n to_model.balance > 0\n end", "def can_afford_to_bet?(amount)\n (self.balance >= amount)\n end", "def valid_loan_amount?(amount)\n amount > 0\nend", "def ok_to_sum?\n status.try(:downcase) == \"closed\" && closed_reason.try(:downcase) != \"invalid\"\n end", "def validate_bet_status\n return true if bet.pending?\n errors.add(:base, I18n.t(:cashout_not_eligible))\n end", "def valid?\n # binding.pry\n # if (self.status == \"pending\") && (self.amount > 0)\n # true\n # elsif (self.status != \"pending\") || (self.amount = 0)\n # false\n # end\n if (receiver.valid? == true) && (sender.valid? == true)\n true\n end\n end", "def payment_outstanding?\n balance > BigDecimal(0)\n end", "def low_balance?\n balance < low_balance_threshold\n end", "def payment_allowed?(acct_no, amount)\n if DB[:Account].where(AcctNo: acct_no).first[:Balance].to_i <\n amount.to_i.fdiv(100)\n return false\n end\n true\n end", "def can_bet(amount)\n amount > 0 && amount <= @total_money\n end", "def had_funds?\n balance_at = self.get_address.balance(self.currency_id, before_time: self.tx_date)\n balance_at >= amount\n end", "def source_account_has_enough_balance?\n return true if @source_account.blank?\n\n transfer_amount = transaction_params[:amount]\n final_balance = @source_account.current_balance - transfer_amount\n final_balance >= 0\n end", "def valid?\n afterTransaction = self.sender.balance - self.amount > 0\n accountAreValid = self.sender.valid? && self.receiver.valid?\n isPending = self.status == 'pending'\n return afterTransaction && accountAreValid && isPending\n end", "def can_deliver?(cur, amount)\n amount > 0.01 && amount <= available_balance(cur)\n end", "def input_valid?\n could_refund = @order.total_price - @order.refund_price\n @params[:refund_price].to_f.positive? && @params[:refund_price].to_f <= could_refund\n end", "def funds_available?\n if self.num_shares * Stock.find(self.stock_id).quote > Account.find_by(investor_id: self.investor_id).balance\n self.status = \"canceled\"\n self.bought_sold = \"Funds to execute trade were unavailable.\"\n puts \"Your account does not have the funds available to execute this trade.\"\n return false\n else\n true\n end\n end", "def check_balances(num)\n @balance.each do |key, value|\n if value.negative?\n puts \"Line #{@blocks[num].block_number}: Invalid block, address #{key} has #{value} billcoins!\"\n return false\n end\n end\n true\n end", "def coin_exists_on_withdrawal\n \t\treturn if deposited\n \t\tdeposits = Transaction.where(user_id: user_id, coin_id: coin_id, deposited: true)\n \t\twithdrawals = Transaction.where(user_id: user_id, coin_id: coin_id, deposited: false)\n \t\tbalance = deposits.count - withdrawals.count\n \t\terrors.add(:deposited, \"invalid coins\") if balance <= 0 \n \tend", "def balance_negative?\n current_balance.negative?\n end", "def balance_adequate_for_transaction?(amount)\n if self.satisfaction_rating > amount\n return true\n else\n return false\n end\n end", "def test_check_balances_empty\n assert_equal(false, @bv.check_balances?(1))\n end", "def has_valid_status?\n #STATUSES = ['Borrador', 'Aprobado','Asign. a Comprador','Faltan Esp.','Solicitado a Prov.','Entregado en Almacén','Recibido Parcial','Recibido total','Rechazada','Devuelto a Prov.','Facturado','Cancelado']# el ultimo es el 11 empieza en 0\n # 0 1 2 3 4 5 6 7 8 9 10 12 \n if(self.supp_quantity > 0.0 && self.status < 6 )\n errors.add(:estatus, \" debe ser superior a 'Recibido Parcial' \")\n end\n\n if( !self.pseudo_delivery_date && self.status == STATUSES.index('Solicitado a Prov.') && self.created_at.to_date >= Date.parse(\"14-05-14\") )\n errors.add(:solicitud_de_compra, \" debe tener F.E. Compras\")\n end\n\n end", "def is_valid_balance?(balance, silent=0)\n # Balances and currency amounts are specified as a number\n # indicating a whole amount and a fractional input separated\n # by a period. The fractional input is in decimal and is always\n # two digits and thus can include a leading 0 (should match /[0-9]{2}/).\n # The interpretation of the fractional amount v is that of having\n # value equal to v/100 of a whole amount (akin to cents and dollars in\n # US currency). Balances are bounded from 0.00 to 4294967295.99.\n if balance =~ /^(\\d{1,10}).(\\d{2})$/\n left_part = balance.split(\".\")[0]\n if left_part == \"0\" || left_part[0] != \"0\"\n balance = balance.to_f\n if balance >= 0.0 && balance <= 4294967295.99\n return true\n end\n end\n end\n\n debug \"Invalid balance: #{balance}\" unless silent\n false\nend", "def refund_created_or_approved_only_if_balance_is_negative\n\t\tif refund\n\t\t\t## in case the admin wants to mark a refund as failed.\n\t\t\tif payment_status == 0 && payment_status_changed?\n\t\t\t\n\t\t\telse\n\t\t\t\tself.errors.add(\"payment_status\",\"you cannot authorize a refund since the pending balance is positive.\") if self.cart.cart_pending_balance >= 0\n\t\t\tend\n\t\tend\n\tend", "def valid?\n return false if @plan.nil?\n return false if [email protected]? && @amount < 0\n return false if [email protected]? && @quantity < 1\n return false if !@plan_version.nil? && @plan_version < 1\n return false if !@grace_duration.nil? && @grace_duration < 0\n return false if @signup_method.nil?\n return true\n end", "def check_items_balances\n details.select(&:marked_for_destruction?)\n .all?(&:valid_for_destruction?)\n end", "def ready_to_exchange?\n self.balance >= self.promotion.points_to_exchange\n end", "def success?\r\n\treturn true if @fund >= @target_fund\r\n\treturn false if @fund < @target_fund\r\nend", "def balances?(tk); end", "def is_valid?\n # Expiration date is nil, or equal to or greater than today?\n (self.expiration.nil? || self.expiration >= Date.current) &&\n # Limit is set to 0 (for unlimited) or limit is greater than the current used count.\n (self.limit == 0 || self.limit > self.used)\n\tend", "def can_transfer?\n return if sender.balance >= amount\n errors.add(:amount, INSUFFICIENT_FUNDS_MESSAGE)\n end", "def check_balance\n return @balance\n end", "def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end", "def fully_paid?\n amount_owed <= 0\n end", "def withdraw_using_check(amount)\n @minimum_balance = -10\n if (@balance - amount - @withdraw_fee) >= @minimum_balance\n @checks_used += 1\n\n # user is allowed 3 free checks in a month; any subsequent use adds $2 fee\n if @checks_used < 4\n @withdraw_fee = 0\n else\n @withdraw_fee = 1\n end\n\n withdraw(amount)\n @minimum_balance = 0 #reset the minimum_balance\n else\n puts \"Sorry, that's beyond the overdraft allowance.\"\n @minimum_balance = 0\n end\n show_current_balance\n end", "def is_benefit_out_of_bal\n @cur_pkg = self.get_latest_effective_package\n #@cur_pkg = self.current_package\n if @cur_pkg != nil\n #if false && @cur_pkg\n @bene_bal = ( self.monthly_benefit.to_f -\n ( self.current_package.calc_hourly_benefit.to_f * self.calc_tot_hours.to_f )\n )\n\n else\n @bene_bal = 0.0000\n end\n if @bene_bal > 0.0005 || @bene_bal < -0.0005\n true\n else\n false\n end\n end", "def applicable?\n mandatory || amount != 0\n end", "def can_pay_deposit?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end", "def execute_transaction\n if self.valid? == true && @sender.balance > amount && @status == 'pending'\n @sender.balance -= amount\n @receiver.balance += amount\n @status = 'complete'\n else\n @status = 'rejected'\n \"Transaction rejected. Please check your account balance.\"\n end\n end", "def startup_has_balance?\n AccountTransaction.sufficient_funds?(self.startup.account, self.total_price)\n end", "def confirmed?\n self.status >= 0\n end", "def fulfilled?\n amount_remaining.zero?\n end", "def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : false\n end", "def valid?\n return false if @currency_code.nil?\n return false if @transaction_type.nil?\n transaction_type_validator = EnumAttributeValidator.new('String', ['atm_withdrawal', 'purchase', 'other'])\n return false unless transaction_type_validator.valid?(@transaction_type)\n return false if @card_id.nil?\n return false if @amount.nil?\n return false if @date.nil?\n true\n end", "def execute_transaction\n if valid? && sender.balance > amount && self.status == \"pending\"\n sender.balance -= amount\n receiver.balance += amount\n self.status = \"complete\"\n else \n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\" \n end\n end", "def allow_negative_balance\n @allow_negative_balance == false ? false : true\n end", "def execute_transaction\n if valid? && @sender.balance > amount && @status == \"pending\"\n @sender.balance -= amount\n @receiver.balance += amount\n @status = \"complete\"\n else\n reject\n end\n end", "def money_enough?\n remaining_sum > 0\n end", "def withdraw(amount, atm, pin, acc_no)\n if @balance >= amount && atm.balance >= amount && @pin == pin && acc_no == @account_no\n atm.dispense(amount)\n @balance = @balance - amount\n puts \"your new balance is #{@balance}\"\n else\n puts \"you are too pov\"\n end\n end", "def upper_balance?\n now = Time.now\n sql = \"SELECT l.quantity, i.price, i.barcode \n FROM line_items l \n INNER JOIN orders o ON o.id = l.order_id \n INNER JOIN items i ON i.id = l.item_id \n WHERE o.family_id = #{family.id} AND status = 'TRADE_SUCCESS' \n AND o.created_at BETWEEN '#{now.beginning_of_month}' AND '#{now.end_of_month}'\"\n\n case line_items.first.item.barcode\n when 'A' # recharge has no restriction\n when 'B'\n restrictions = family.prisoner.jail.configuration.settings[\"restrictions\"][\"remittance\"]\n sql << \" AND i.barcode = 'B'\"\n is_restrict?(sql, restrictions)\n else\n restrictions = family.prisoner.jail.configuration.settings[\"restrictions\"][\"consumption\"]\n sql << \" AND i.barcode NOT IN ('A', 'B')\"\n is_restrict?(sql, restrictions)\n end\n end", "def balance_status(balance, user)\n lended_value = user.lended_value(balance)\n borrowed_value = user.borrowed_value(balance)\n if lended_value > borrowed_value\n balance_status = { \n status: \"lending\",\n value: lended_value - borrowed_value, \n message: \"You lended: \" \n }\n elsif lended_value < borrowed_value\n balance_status = { \n status: \"owing\", \n value: borrowed_value - lended_value,\n message: \"You owe: \" \n }\n else\n balance_status = { \n status: \"even\", \n value: nil, \n message: \"You are even!\" \n }\n end\n end", "def withdraw(amount)\n raise ArgumentError.new if amount < 0\n\n #check that balance after will exceed 10 + $2 fee\n if @balance - amount - 200 < 1000\n puts \"Sorry, minimum $10 balance.\"\n else\n @balance = @balance - amount - 200\n end\n @balance\n end", "def valid_account(sports_centre) # pass in current_sports_centre\n if sports_centre != nil\n return true if Date.current <= sports_centre.nextPaymentDue\n else\n return false\n end\n end", "def is_negative\n\t\t\tunless @balance > 0 \n\t\t\t\traise ArgumentError.new(\"You must enter a positive balance!\")\n\t\t\tend\n\t\tend", "def payment_cadence_allowed?\n begin\n config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i\n _date_from_str = \"#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime(\"%:z\")}\"\n _date_from = DateTime.strptime(_date_from_str,'%Y-%m-%dT%H:%M:%S%:z')\n diff_in_hours = ((_date_from.to_time - self.creation_date.to_time).to_f * 24).to_i\n allowed = diff_in_hours > 0 && (diff_in_hours >= config_payment_cadence)\n allowed || force_allow_payment\n rescue => error\n p \"Error #{id} #{date_from} #{time_from} #{date_to} #{time_to} #{driver_date_of_birth} #{driver_driving_license_date}\"\n return false\n end\n end", "def test_check_balances_false\n @bv.balances[\"Joe\"] = 90\n @bv.balances[\"John\"] = -25\n assert_equal(false, @bv.check_balances?(1))\n end", "def value_check(amount)\n # if \n if amount < 0\n error\n else\n return false\n end\n end", "def valid?\n status == 'Valid'\n end", "def amount_ok?( order_amount )\n BigDecimal.new( amount ) == order_amount \n end", "def block_valid?(block, difficulty = 4)\n block.valid?(difficulty) &&\n block.parent_digest == head_digest &&\n balances([block]).none? { |user, balance| balance < 0 }\n end", "def valid_bid?\n unless Auction.find(Item.find(self.item_id).auction_id).end_date > (DateTime.now.to_time - 7.hours).to_datetime\n errors[:base] = \"It is now past the auction time and no more bids are allowed online.\"\n return false\n end\n # Check if there are any bids for this item yet.\n if !Bid.where(:item_id => self.item_id).empty?\n # Checks if there was an unsuccessful bid that is waiting but it's the first one\n if Bid.where(:item_id => self.item_id).count == 1 && Bid.where(:item_id => self.item_id).first.user_id.nil?\n if self.bid_amount >= Item.find(self.item_id).min_bid\n return true\n else \n errors[:base] = \"Invalid bid amount! Please make sure that your bid is at \n least as high as the starting bid.\"\n return false\n end\n end\n # Check that this bidder is not the one who made the highest bid, first\n if Bid.where(:item_id => self.item_id, :bid_amount => Item.find(self.item_id).min_bid).first.user_id==self.user_id\n \terrors[:base] = \"You are already the highest bidder!\"\n return false\n else\n # Now check that this bid amount is higher than the highest bid amount\n if self.bid_amount < Item.find(self.item_id).min_bid + Item.find(self.item_id).min_increase\n errors[:base] = \"Invalid bid amount! Please make sure that your bid is at \n least as high as the highest bid plus the minimum increase.\"\n return false\n else\n # If the bidder isn't already the highest bidder, the bid amount is not empty,\n # and the bid is more than the highest bid, return true because it's valid\n return true\n end\n end\n # there are no bids for the item, check that the bid is at least as much as the min bid\n else\n if self.bid_amount >= Item.find(self.item_id).min_bid\n return true\n else \n errors[:base] = \"Invalid bid amount! Please make sure that your bid is at \n least as high as the starting bid.\"\n return false\n end\n end\n end", "def technically_paid?\n unconfirmed_value_paid >= value_needed\n end", "def open?\n (AVAILABLE == status) and in_redemption_period?\n end", "def withdraw_using_check(amount)\n amount += CHECK_WITHDRAWL_FEE if @checks_remaining <= 0\n if amount <= @balance + MAX_OVERDRAFT\n @balance -= amount\n @checks_remaining -= 1\n else\n puts \"Your account does not contain enough to withdraw the amount requested. You may not overdraft more than $#{ '%.2f' % (MAX_OVERDRAFT / 100.0)}.\"\n end\n return @balance\n end", "def can_be_unconfirmed?\n reverse_adjustment_quantity = -1*diff \n \n wh_item = self.warehouse_item\n item = self.item \n \n final_item_ready = item.ready + reverse_adjustment_quantity\n final_wh_item_ready = wh_item.ready + reverse_adjustment_quantity\n \n if final_item_ready < 0 or final_wh_item_ready < 0 \n msg = \"Akan menyebabkan jumlah item ready menjadi : #{final_item_ready}.\"\n self.errors.add(:generic_errors, msg )\n return false\n end\n \n return true \n end", "def test_num_transactions_correct_0_true\n assert_equal(false, @bv.num_transactions_correct?(0, [0,1]))\n end", "def execute_transaction\n if valid? && sender.balance > amount && self.status == \"pending\"\n sender.balance -= amount\n receiver.balance += amount\n self.status = \"complete\"\n else\n reject_transfer\n end\n\n end", "def status_valid? valid = true\n\t\tif valid\n\t\t\tTicket::STATUSES[0..1].include? status\n\t\telse\n\t\t\tTicket::STATUSES[2..-1].include? status\n\t\tend\n\tend", "def hasEnoughFunds?\n \t puts \"Checking for available MTurk balance...\"\n \t available = @mturk.availableFunds\n \t puts \"Got account balance: %.2f\" % available\n \t return available > 0.055\n \tend", "def active?(active_because_dd)\n active_as_credit_card = (payment_method == 'Credit Card' && !gpo_processed)\n active_as_check_or_cash = !payment_received\n active = (active_as_credit_card || active_as_check_or_cash)\n should_display = (active_because_dd || slot.semester == Semester.current_semester)\n return active && should_display\n end", "def billed_or_paid?\n status == PAID || status == BILLED\n end", "def active_bank_accounts?\n # (client_bank_accounts_count > 0) && (!client_bank_accounts.where(ending_at: nil).blank?)\n (client_bank_accounts_count > 0) && (!active_bank_accounts.empty?)\n end", "def out_of_money()\n @total_money <= 0\n end", "def amount_isvalid?(amount)\n amount = amount.to_i\n gold = 10000\n ruby = 30000\n diamond = 50000\n if amount === gold || amount === ruby || amount === diamond\n return true\n else\n return false\n end\n end", "def trade_is_open\n unless trade && trade.status == Trade::STATUSES['open']\n errors.add(:trade_id, \"Offers cannot be made unless the trade is open.\")\n end\n end", "def withdraw(withdraw_amount)\n transaction = withdraw_amount + @withdraw_fee\n if withdraw_amount <= 0\n puts \"dummy.\"\n elsif @minimum_balance == (@balance - transaction)\n # withdraw method does not allow account to be < minimum balance - Will output a warning message and return the original un-modified balance\n puts \"Warning: balance will be the minimum balance. I won't do that out of principle.\"\n elsif @minimum_balance > (@balance - transaction)\n # same thing here as above- balance cannot be less than minimum\n puts \"You trying to steal from me?? This is your warning!\"\n else\n @balance -= (transaction)\n end\n show_current_balance\n end", "def credit_check(proposed_hours)\n credits >= proposed_hours\n end", "def enough_money?(maxAmount)\r\n self.price<=maxAmount\r\n end", "def valid?\n return false if [email protected]? && @comments.to_s.length > 1024\n return false if !@invoice_number.nil? && @invoice_number.to_s.length > 48\n return false if !@purchase_order_number.nil? && @purchase_order_number.to_s.length > 128\n disbursement_trans_type_validator = EnumAttributeValidator.new('String', [\"FUNDING\", \"DISBURSEMENT\"])\n return false unless disbursement_trans_type_validator.valid?(@disbursement_trans_type)\n wallet_provider_validator = EnumAttributeValidator.new('String', [\"GOOGLE_PAY\", \"APPLE_PAY\", \"SAMSUNG_PAY\", \"MASTERPASS\"])\n return false unless wallet_provider_validator.valid?(@wallet_provider)\n true\n end", "def cannot_withdraw?\n cannot_withdraw = false\n case status\n when InventoryItem::OUT_OF_STOCK\n cannot_withdraw = true\n when InventoryItem::PENDING_ENTRY\n cannot_withdraw = true\n when InventoryItem::EXPIRED\n cannot_withdraw = true\n end\n\n cannot_withdraw\n end", "def valid_status?(hQuery, hValue)\n return false if hValue.key?(:status) && hValue[:status] != :active &&\n !hQuery.key?(:status)\n true\n end", "def withdraw_using_check(amount_to_withdraw)\n\n transaction_fee = 0.0\n\n if @free_checks_available <= 0\n transaction_fee = CHECK_WITHDRAWAL_FEE\n end\n\n if amount_to_withdraw <= @balance - transaction_fee + MAX_ALLOWABLE_OVERDRAFT\n\n @balance -= amount_to_withdraw + transaction_fee\n\n if @free_checks_available > 0\n @free_checks_available -= 1\n end\n\n else\n\n print \"Sorry, your account balance is only $%.2f\" % @balance + \", which is not enough for you to withdraw $%.2f\" % amount_to_withdraw + \". Remember that you can only have a maximum overdraft of $-%.2f\" % MAX_ALLOWABLE_OVERDRAFT + \".\"\n\n if transaction_fee == CHECK_WITHDRAWAL_FEE\n print \" Also, a $%.2f\" % CHECK_WITHDRAWAL_FEE + \" fee would be charged, because you've already used up your #{FREE_CHECKS_PER_MONTH} free check withdrawals for this month.\"\n end\n\n print \" No withdrawal was made.\\n\"\n\n end\n\n return @balance\n\n end", "def is_full_payment? \n (only_savings == false ) && (no_payment == false ) && \n (not transaction_activity_id.nil? ) && \n (week_number != nil) # independent payment: can be full payment.\n end", "def amount_ok?( order_amount, order_discount = BigDecimal.new( '0.0' ) )\n BigDecimal.new( gross ) == order_amount && BigDecimal.new( discount.to_s ) == order_discount\n end", "def amount_is_valid\n errors.add(:amount, 'ticket amount is not right. Please double check') if amount < 40 || amount > 200\n end", "def check_value?(amount)\n if amount > 0 # If amount is greater than 0 (or it is positive)\n return true\n end\n end", "def need_to_be_paid?(gateway, payment_status, amount)\n !paid? && (payment_status == SUCCESS_STATES[gateway.to_s]) && (self.amount.to_f == amount.to_f)\n end", "def valid?\n valid = expiration_date && expiration_date_valid? && card_type && check_card_type && card_number_valid?\n update_errors unless valid\n valid\n end", "def withdraw(debit, fee = FEE)\n super(debit, fee)\n if @balance - debit < INITIAL_MIN_BALANCE # @balance 10, 000 - 100 <\n puts \"WARNING!\"\n @balance -= debit - fee\n return @balance\n # need to keep closed until brought back up\n elsif @balance < INITIAL_MIN_BALANCE\n puts \"Pay FEE plus balance\"\n return @balance\n else @balance - debit > INITIAL_MIN_BALANCE\n return @balance\n end\n end", "def validate_contract_data?\n initial_call_off_period.present? ? initial_call_off_period.positive? : false\n end", "def validate_contract_data?\n initial_call_off_period.present? ? initial_call_off_period.positive? : false\n end", "def valid?\n return false if @id.nil?\n return false if @exec_date.nil?\n return false if @register_date.nil?\n return false if @amount.nil?\n return false if @state.nil?\n return false if @beneficiary_type.nil?\n true\n end" ]
[ "0.8760936", "0.8736063", "0.87166816", "0.862196", "0.85786635", "0.83929384", "0.8107673", "0.725797", "0.66484445", "0.6616169", "0.66124284", "0.65710354", "0.6539395", "0.6496315", "0.64564383", "0.64217", "0.64134145", "0.6409339", "0.63671815", "0.6355064", "0.6349653", "0.6345412", "0.6289923", "0.628867", "0.6242269", "0.62046856", "0.6185795", "0.6173416", "0.6155515", "0.61497974", "0.6136367", "0.60959506", "0.6086758", "0.6079828", "0.6069361", "0.60691345", "0.6058017", "0.6029045", "0.6017527", "0.6015867", "0.60012317", "0.599885", "0.59896135", "0.59864855", "0.5972794", "0.5951781", "0.5950382", "0.5947663", "0.592887", "0.5908682", "0.59028494", "0.5902563", "0.58958143", "0.5876704", "0.5876653", "0.5876611", "0.58747065", "0.5874602", "0.58662546", "0.5852612", "0.5845868", "0.58431923", "0.58390146", "0.583629", "0.58298105", "0.58252406", "0.58199275", "0.58195126", "0.58171177", "0.5810342", "0.58066666", "0.5802543", "0.579568", "0.5794202", "0.5792817", "0.57813776", "0.57806474", "0.57763004", "0.57680994", "0.57652724", "0.5763974", "0.5762593", "0.5750581", "0.5749298", "0.57472634", "0.57353306", "0.5732726", "0.5728054", "0.5727504", "0.5719601", "0.57131886", "0.5697261", "0.5697168", "0.5695682", "0.5690098", "0.5687956", "0.5687635", "0.5684799", "0.5684799", "0.5683184" ]
0.84753686
5
can close its account
def close_account self.status = "closed" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_account\n self.status = \"closed\"\n end", "def close_account\n @status = 'closed'\n end", "def close_account\n @status = \"closed\"\n end", "def close_account \n @status = \"closed\" \n end", "def close_account\n self.void_pending_authorizations\n if probono = Organization.probono\n if probono.piggy_bank && probono.piggy_bank.reload && probono.piggy_bank != self\n result = self.transfer(probono.piggy_bank, self.available_balance, :limits => false) if probono.piggy_bank\n raise BankError, \"remaining funds could not be transferred\" if !result || !result.success?\n end\n end\n end", "def close_account\n self.status = \"closed\"\nend", "def close_account(account_descr, authorizer)\n if account_descr.is_a?(OMF::SFA::Model::Account)\n account = account_descr\n else\n account = find_account(account_descr, authorizer)\n end\n raise InsufficientPrivilegesException unless authorizer.can_close_account?(account)\n\n #release_all_components_for_account(account, authorizer)\n release_all_leases_for_account(account, authorizer)\n\n account.close\n\n @liaison.close_account(account)\n account\n end", "def can_close?; end", "def close_account(account_descr, authorizer)\n debug \"central close_account: #{account_descr}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def cancel_account\n @account.active = 0\n @account.endtime = Time.now\n @account.save\n \n redirect_to :controller => 'subs' and return false\n end", "def close\n raise Error.new(5) ## ERROR_ACCESS_DENIED\n end", "def close_account\n stocks_qty = self.stocks.group(:stock_symbol).sum(:stock_qty)\n total_amount = 0 # sets variable total_amount to 0\n # iterates through each stock owned by the user, pulls the current price from the stock table\n ## and muplies it by the quantity of stocks owned by user\n stocks_qty.each do |key, value| \n total_amount += (find_stock(key).current_price * value)\n end\n self.update(balance: self.balance += total_amount) # adds the total amount to the users balance\n self.trades.destroy_all # removes all associated trades for that user from the trades table\n puts \"Your account has been closed and funds have been transferred to your account, your current balance is $#{self.balance.round(2)}\" # displays users net worth\n end", "def can_close_signup?\n @signup_closecross.visible?\n end", "def destroy?\n @current_user.permission('Currency', :clerk)\n end", "def confirm_account\n confirm\n end", "def close_corporation_registration_number; end", "def destroy?\n @current_user.permission('Commodity', :clerk)\n end", "def close\n Account.where(:id => params[:id]).update_all(status: 'CLOSED')\n @account = Account.find(params[:id])\n flash[:success] = \"Closed Account #\" + @account.acct_number.to_s\n redirect_to @account\n end", "def destroy?\n @current_user.permission('Bid', :clerk)\n end", "def closable_by? (by_user)\n !by_user.nil? && by_user.username==self.username && self.opened?\n end", "def close_enabled?()\n #This is a stub, used for indexing\n end", "def closed?\n # the conference has been created the virtual hearing was deleted\n conference_id.present? && conference_deleted?\n end", "def can_create_patient_close_contacts?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "def close; true; end", "def close; true; end", "def destroy?\n @current_user.permission('FdpContact', :clerk)\n end", "def account_closed(hacker)\n @hacker = hacker\n\n mail to: @hacker.email, subject: 'Sorry to see you go.'\n end", "def should_allow_close\n return @peer.should_all_close\n end", "def debit_customer_account\n end", "def close!(reason)\n @session.chanserv.close(self.name, :on, reason)\n end", "def have_account?\n false\n end", "def cancelled?\n # the establishment has been cancelled by the user\n request_cancelled?\n end", "def can_view_patient_close_contacts?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "def cancelled?; end", "def can_edit_patient_close_contacts?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "def destroy?\n @current_user.permission('Donor', :clerk)\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 deactivate_account!\n time_since_sign_in = Time.now - self.last_sign_in_at\n inactive_days = Time.now - 60.days\n if last_signed_in_at.where(inactive_days > time_since_sign_in)\n update_attribute :is_active, false\n end\n end", "def close\n return true\n end", "def owner_retain_canceled?\n self.abnormal_close_type.present? && self.abnormal_close_type.owner_retain_canceled?\n end", "def deactivate\n @credit_card.is_active = false\n\n if @credit_card.save\n current_user.upcoming_sessions.each do |counseling_session|\n counseling_session.cancelled_on_dts = Time.now\n if counseling_session.save\n CounselorMailer.client_cancellation(counseling_session.id).deliver\n UserMailer.counseling_session_cancellation(counseling_session.id).deliver\n end\n end\n # If the account has been deactivated from MoodyCall,\n # uncomment below if we decide we need to remove from Stripe\n # customer = Stripe::Customer.retrieve(current_user.stripe_customer_id)\n # card = customer.cards.retrieve(@credit_card.stripe_card_id).delete()\n redirect_to credit_cards_url, notice: 'Credit card was successfully destroyed and all upcoming session were cancelled.'\n else\n redirect_to credit_cards_url, notice: 'Credit card was not successfully.'\n end\n\n end", "def confirmation_period_expired?; end", "def someone_did_lose_privilege(stem, channel, nick, privilege, bestower)\n end", "def close()\n if isConnected()\n if @sentConnect\n @sentConnect = false # set in connect()\n @signedOn=false # set in signOn() inside connect()\n bye = VistaRPC.new(\"#BYE#\", RPCResponse::SINGLE_VALUE, true)\n retval = execute(bye)\n @socket.close()\n @socket = nil\n @duz = \"0\"\n @lastvistaerror = nil\n @currentContext = nil\n return retval\n end\n end\n end", "def cancelled?\n false\n end", "def unlock_access!; end", "def check_user_account!\n if(current_user.present? && (current_user.service_type == 'pending' || !current_user.is_active?))\n service_type = current_user.service_type\n sign_out(current_user)\n redirect_to root_path, :flash => {:notice => \"Your account is in waiting list for approval by Aa Express Staff.You will be notified when your account is ready.\"} and return if service_type == 'pending'\n redirect_to root_path, :flash => {:notice => \"Your account is de-activated by Aa Express Staff, please contact to Aa Express Staff for account activation.\"}\n end\n end", "def account_expired?\n if current_user.expired? && current_user.owns_cookbook(current_cookbook)\n redirect_to upgrade_account_path(current_user)\n end\n end", "def Close\n end", "def close_options\n request('close/options').auth_required!\n end", "def destroy\n authorize @account\n if @account.update({active: false})\n render json: { status: :ok }\n else\n render json: { status: :unprocessable_entity}\n end\n end", "def cancel?(id); end", "def banned?\r\n if current_user.present? && !current_user.activated?\r\n sign_out current_user\r\n flash[:error] = \"This account has been suspended....\"\r\n redirect_to new_user_session_path\r\n end\r\n end", "def donor_can_cancel?\n !received?\n end", "def close!\n\n\t @connected = false\n\t return nil\n\n\tend", "def destroy\n @account = @user.account.find(params[:id])\n @account.start_cancellation!\n @user.suspend!\n \n flash[:notice] = \"Your account has been scheduled for cancellation\"\n \n respond_to do |format|\n format.html { redirect_to(root_url, :subdomain => false) }\n format.xml { head :ok }\n end\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end", "def close() end", "def close\n @connection.close # Close the active mailbox\n @connection.logout # Send the logout command\n @connection.disconnect # Close the actual connection\n end", "def close_locked\n close_clients\n unregister_pubcontrol_locked\n end", "def closed?; end", "def closed?; end", "def closed?; end", "def closed?; end", "def disconnect\n if @current_user.fitbit_user\n @current_user.fitbit_user.unsubscribe_from_notifications rescue nil\n #@current_user.fitbit_user.destroy (MySQL error when deleting from view... have to do it manually)\n ActiveRecord::Base.connection.execute \"delete from fbskeleton.fitbit_users where id = #{@current_user.fitbit_user.id}\"\n end\n\n # set it to nil if it is FITBIT\n @current_user.update_column(:active_device,nil) if @current_user.active_device == 'FITBIT'\n \n head :ok \n end", "def disconnect\n @crazyflie.close_link\n\n super\n end", "def cancel!\n if AccountTransaction.transfer(self.num * self.price, self.startup.account, self.startup.account, :escrow, :balance).new_record?\n self.errors.add(:num, 'could not be refunded to your startup\\'s balance') \n return false\n end\n if self.responses.count > 0\n self.num = 0\n self.save\n else\n self.destroy\n end\n end", "def destroy\n authorize @account\n @account.destroy\n redirect_to accounts_url, notice: \"Account was successfully destroyed.\" \n end", "def confirmed?; end", "def closed?() end", "def closed?() end", "def closed?() end", "def close_button_can(buid, nuid, add_params = nil)\n params = {\n uid: uid,\n buid: buid,\n nuid: nuid,\n }\n api_call('/stores/:uid/buttons/:buid/cans/:nuid/close(.:format)',:post,params,add_params)\n end", "def abandon!\n authentication.abandon!\n end", "def destroy?\n @current_user.permission('Ration', :clerk)\n end", "def deactivate\n @client.delete(\"card_accounts/#{id}\")\n @attributes['active'] = false\n true\n end", "def close\n inactive!\n close_connections\n end", "def cancelar_hipoteca\n @hipotecada = false\n end", "def deactivate\n @client.delete(\"paypal_accounts/#{id}\")\n @attributes['active'] = false\n true\n end", "def disconnect!; true; end", "def destroy\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym][:secret_key]\n acct = Stripe::Account.retrieve(@connected_account.sid)\n acct.deauthorize(Rails.application.credentials.stripe[Rails.env.to_sym][:client_id])\n @connected_account.destroy\n redirect_to connected_accounts_url, notice: 'Connected account was successfully removed.'\n end", "def destroy\n if delete_cim_profile and super\n return true\n end\n\n return false\n end", "def closed\n if @user && @room\n @user.remove_session\n @room = nil\n end\n end", "def destroy?\n @current_user.permission('Fdp', :admin)\n end", "def do_close; end", "def closed?\n end", "def closed?\n end", "def destroy\n if params[:cancel]\n flash[:notice] = t('account.cuenta_no_eliminada', :email => Settings.email_addresses[:contact])\n redirect_to account_path\n else\n @user = User.find(current_user.id)\n if @user.deactivate_account\n self.current_user.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = t('account.cuenta_eliminada')\n redirect_to root_path\n else\n flash[:error] = t('account.cuenta_no_eliminada_razon')\n redirect_to account_path\n end\n end\n end", "def destroy\n return unless modifying_self?\n @hacker = current_user\n \n if @hacker.authenticate(params[:cancel_password])\n @hacker.cancel_account\n \n cookies.delete :auth_token\n session.delete :filter\n session.delete :current_tags\n\n @hacker.destroy\n \n redirect_to home_url\n else\n redirect_to(edit_hacker_path(@hacker), alert: 'Incorrect password supplied')\n end\n end", "def closed?\n minutes_open = (Time.zone.now - self.created_at)/60.0\n time_limit = workout_offering.time_limit_for(user)\n\n !time_limit.nil? && minutes_open >= time_limit\n end", "def closed?\n minutes_open = (Time.zone.now - self.created_at)/60.0\n time_limit = workout_offering.time_limit_for(user)\n\n !time_limit.nil? && minutes_open >= time_limit\n end", "def close\n check_cookie\n Native::magic_close(@cookie);\n @cookie = nil\n end", "def deletable_by?(user)\n false\n end", "def logging_out?\n current_account.present? && controller_name == 'sessions' && action_name == 'destroy'\n end", "def closing?; end" ]
[ "0.7792949", "0.7652441", "0.7563503", "0.722757", "0.7101658", "0.6441255", "0.6397707", "0.63665074", "0.63282776", "0.6236617", "0.621774", "0.6130505", "0.59812987", "0.59445584", "0.58914953", "0.5889675", "0.58874696", "0.58824694", "0.586955", "0.58655894", "0.5863964", "0.5811983", "0.5730014", "0.5727553", "0.5727553", "0.56990755", "0.5695137", "0.5690899", "0.5685122", "0.5673564", "0.56611776", "0.56456006", "0.56306773", "0.56242776", "0.5618551", "0.5604355", "0.5603224", "0.55956876", "0.5586666", "0.55850774", "0.55577767", "0.55452216", "0.55218667", "0.55215436", "0.55076694", "0.5502996", "0.5498243", "0.54965967", "0.54835767", "0.5475597", "0.5475423", "0.54716116", "0.54607713", "0.54583883", "0.54565346", "0.54527116", "0.5441431", "0.5441431", "0.5441431", "0.5441431", "0.5440175", "0.5439567", "0.5434886", "0.54317576", "0.54291356", "0.54291356", "0.54291356", "0.54291356", "0.5422663", "0.5421487", "0.54211146", "0.54120857", "0.5408201", "0.54042953", "0.54042953", "0.54042953", "0.540427", "0.5403066", "0.54014975", "0.539893", "0.5393793", "0.5383914", "0.5383829", "0.53812706", "0.5374189", "0.5365498", "0.5360792", "0.53588396", "0.53579116", "0.53576905", "0.53576905", "0.5353484", "0.534927", "0.5347653", "0.5347653", "0.533841", "0.5337033", "0.5331203", "0.53227013" ]
0.7382381
3
GET /traded_contacts/1 GET /traded_contacts/1.json
def show @traded_contact = TradedContact.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @traded_contact } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def new\n @traded_contact = TradedContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traded_contact }\n end\n end", "def index\n @contacts = @client.contacts\n end", "def get_contacts(params={})\n @obj.get('get-contacts', @auth.merge(params))\n end", "def query_contacts(options={}) path = \"/api/v2/contacts\"\n get(path, options, AvaTax::VERSION) end", "def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end", "def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end", "def index\n @referral_contacts = @user.referralContact.page(params[:page]).per(params[:per])\n\n render json: @referral_contacts\n end", "def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end", "def index\n @contacts = current_user.contacts\n end", "def contacts\r\n\r\n end", "def list params={}\n params[:fields] = params[:fields].join(',') if params[:fields]\n params[:record_type] ||= 'person'\n @nimble.get \"contacts\", params\n end", "def getContacts\n @contact_list.each_with_index do |c, i|\n #puts \"#{i +1}) #{c}\"\n puts \"#{i +1}) #{c[:first_name]} #{c[:last_name]} #{c[:email]}\"\n end\n end", "def get_contacts(options = {})\n request_params = {}\n request_params[:type] = options[:type] if options[:type]\n request_params[:sortBy] = options[:sort] if options[:sort] \n request_params[:direction] = options[:direction] if options[:direction] \n \n response_xml = http_get(\"#{@xero_url}/contacts\", request_params)\n \n parse_response(response_xml, :request_params => request_params)\n end", "def list\n contacts_index(Contact.all)\n end", "def show\n @breadcrumb = 'read'\n @corp_contact = CorpContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_contact }\n end\n end", "def index\n @contacts = current_user.contacts.all\n\n\n end", "def get_contacts\n\n #@company = Benefits.find.params[:company_id]\n #@contacts = @company.contacts\n\n Rails.logger.warn \"#{:areabenefit_id} jajaxxx\"\n @contacts = Benefit.where(areabenefit_id: params[:areabenefit_id], asistencia: '1')\n end", "def index\n @contacts = @scenario.contacts\n end", "def my_contacts(opts = {})\n client.get_my_contacts(opts)\n end", "def index\n @contacts = Contact.all\n render json: @contacts\n end", "def index\n @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end", "def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['contacts_full'], params)\n parse_contacts response_body(response)\n end", "def index\n @contacts = current_user\n .contacts\n .where(active: true)\n .order(id: :desc)\n render json: @contacts\n end", "def index\n @contacts = current_company.contacts\n respond_to do |format|\n format.xml { render :xml => @contacts }\n format.json { render :json => @contacts }\n end\n end", "def index\n @contacts = current_user.get_address_book_contacts\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def index\n\t\t@contacts = current_user.contacts.get_active_contacts\n\tend", "def index\n @contacts = current_user.contacts.paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "def index\n @subcontractor_contacts = SubcontractorContact.all\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def contacts\n contact_client.contacts\n end", "def get_contacts(options = {})\n request_params = {}\n\n if !options[:updated_after].nil?\n warn '[warning] :updated_after is depracated in XeroGateway#get_contacts. Use :modified_since'\n options[:modified_since] = options.delete(:updated_after)\n end\n\n request_params[:ContactID] = options[:contact_id] if options[:contact_id]\n request_params[:ContactNumber] = options[:contact_number] if options[:contact_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:where] = options[:where] if options[:where]\n request_params[:page] = options[:page] if options[:page]\n\n response_xml = http_get(@client, \"#{@xero_url}/Contacts\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/contacts'})\n end", "def scrape_contacts; end", "def index\n # @contacts = Contact.all\n end", "def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(params)\n parse_contacts response_body(response)\n end", "def access_live_contacts_api\n Net::HTTP.version_1_1\n http = http = Net::HTTP.new('livecontacts.services.live.com', 443)\n http.use_ssl = true\n\n response = nil\n http.start do |http|\n request = Net::HTTP::Get.new(\"/users/@L@#{@consent_token.locationid}/rest/invitationsbyemail\", {\"Authorization\" => \"DelegatedToken dt=\\\"#{@consent_token.delegationtoken}\\\"\"})\n response = http.request(request)\n end\n\n return response.body\n end", "def lookup\n respond_to do |format|\n format.json { render json: Crm::ContactLookup.new(view_context) }\n end\n end", "def show_related\n approved_friends = current_user.allFriends.map!{|user| user.id}\n pending_friends = current_user.allPendingFriends.map!{|user| user.id}\n contacts = []\n filtered_contacts = current_user.contacts.where(\"contacts.name ilike '%#{current_user.lastname}%'\").joins('inner join users on users.email = contacts.email')\n filtered_contacts.each do |contact|\n user = User.find_by_email(contact.email)\n\n # Verify current user isn't that contact!\n next if user.id == current_user.id\n\n # Rehash contact\n currentContact = {\n :uid => Digest::MD5.hexdigest(contact.id.to_s),\n :name => contact.name,\n :email => contact.email,\n :source => contact.source,\n :user_id => user.id,\n :is_confirmed_friend => approved_friends.include?(user.id),\n :is_pending_friend => pending_friends.include?(user.id),\n :profile_photo => user.profile_photo\n }\n\n # Add to contacts list\n contacts << currentContact\n end\n render :status => 200, :json => {:contacts => contacts, :total_contacts => contacts.size}\n end", "def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end", "def index\n contacts = Contact.order('created_at DESC')\n\n respond_to do |format|\n format.html \n format.json { render json: contacts.as_json }\n end\n end", "def destroy\n @traded_contact = TradedContact.find(params[:id])\n @traded_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to traded_contacts_url }\n format.json { head :no_content }\n end\n end", "def index\n @user_contacts = UserContact.all\n render :json => user_contact_data(@user_contacts)\n end", "def index\n respond_with Contact.all\n end", "def get_all_contacts\r\n info = load_contacts\r\n info.each do |arr|\r\n puts \"#{arr[0]}: #{arr[1]} (#{arr[2]})\"\r\n end\r\n puts \"---\"\r\n puts \"#{generate_id} records total\"\r\n end", "def index\n ignore = contact_emails_rejected\n @contacts = resource_owner.contacts.reject do |c|\n ignore.include?(c.emailaddress.downcase)\n end.each{ |c| authorize c }\n session[:ret_url] = contacts_path\n end", "def index\n @contacts = []\n Facebase::Contact.on_each_shard{|p|\n @contacts.concat(p.limit(20).all())\n }\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "def get_agent_contacts(params)\n message = {\n serviceGroupID: params[:service_group_id],\n serviceID: params[:service_id],\n teamID: params[:team_name],\n agentID: params[:agent_id],\n startDate: params[:start_date],\n endDate: params[:end_date],\n contactTypes: params[:contact_type],\n useServiceTime: false\n }\n\n reply = @client.call(:get_contacts, message: message)\n data = reply.body.dig(:get_contacts_response,\n :get_contacts_result,\n :array_of_string)\n\n data = check_if_data_exists(data)\n data = map_contacts_data(data)\n delete_contact_headers(data)\n data\n end", "def contacts\n contacts_raw.present? ? JSON.parse(contacts_raw) : {}\n end", "def get_contacts\n @notification_server.get_contacts\n end", "def index\n @contacts = Contact.where(:client_id => @firm.id).order(order_string).paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "def show_contact(id)\n get(\"contacts/#{id}\")\n end", "def contacts(reload = false)\n self.cache(CostAgent::Contact, :all, reload) do\n (self.api(\"contacts\")/\"contact\").collect do |contact|\n projects = self.projects(:all, reload).select { |p| p.contact_id == (contact/\"id\").first.inner_text.to_i }\n Contact.new(\n :id => (contact/\"id\").first.inner_text.to_i,\n :organisation_name => (contact/\"organisation-name\").first.inner_text,\n :first_name => (contact/\"first-name\").first.inner_text,\n :last_name => (contact/\"last-name\").first.inner_text,\n :address1 => (contact/\"address1\").first.inner_text,\n :address2 => (contact/\"address2\").first.inner_text,\n :address3 => (contact/\"address3\").first.inner_text,\n :town => (contact/\"town\").first.inner_text,\n :region => (contact/\"region\").first.inner_text,\n :country => (contact/\"country\").first.inner_text,\n :postcode => (contact/\"postcode\").first.inner_text,\n :phone_number => (contact/\"phone-number\").first.inner_text,\n :email => (contact/\"email\").first.inner_text,\n :billing_email => (contact/\"billing-email\").first.inner_text,\n :contact_name_on_invoices => (contact/\"contact-name-on-invoices\").first.inner_text == \"true\",\n :sales_tax_registration_number => (contact/\"sales-tax-registration-number\").first.inner_text,\n :uses_contact_invoice_sequence => (contact/\"uses-contact-invoice-sequence\").first.inner_text == \"true\",\n :account_balance => (contact/\"account-balance\").first.inner_text.to_f,\n :projects => projects)\n end\n end\n end", "def index\n @other_contactinfos = OtherContactinfo.all\n end", "def index\n params[:page] ||= 1 \n @contacts = Contact.all\n filtering_params(params).each do |key, value|\n @contacts = @contacts.public_send(key, value) if value.present?\n end\n # Order by\n #order=name:asc / order=name:desc / order=name (defaults to ascending)\n @contacts = @contacts.order(params[:order].gsub(':', ' ')) if params[:order]\n\n # if params[:relationship]\n # render json: Contact.relationship(params[:relationship])\n # else\n # render json: Contact.all\n # end\n\n # if (params[:offset] && params[:limit])\n # @contacts = @contacts.page(1).per(params[:limit]).padding(params[:offset])\n # else\n # @contacts = @contacts.page(1).per(25)\n # end\n\n # @contacts = @contacts.relationship(params[:relationship]) if params[:relationship]\n\n render json: @contacts\n\n\n end", "def show\n @contact = contacts.find(params[:id])\n end", "def index\n # only show contacts for current login user\n @user = User.find_by_id(current_user.id)\n if ([email protected]?)\n @contacts = @user.contacts\n end\n end", "def lactic_contacts(id,lactic_contacts)\n # PostgresUser.lactic_contacts(uid,lactic_contacts)\n lactic_pg_contacts(id,lactic_contacts)\n end", "def index\n @contacts = Contact.all\n\n [:first_name, :last_name, :email].each do |param|\n if params[param].present?\n regexp = /\\A#{Regexp.escape(params[param].strip)}\\Z/i # ignore case\n @contacts = @contacts.where(param => regexp)\n end\n end\n\n if params[:phone].present?\n standard_phone = Contact.standardize_phone_format(params[:phone]) # standardize phone number\n @contacts = @contacts.where(phone: standard_phone)\n end\n\n if @contacts.blank?\n payload = {\n success: { full_messages: ['no record found'] }\n }\n render json: payload, status: :ok\n else\n render json: @contacts if stale? last_modified: @contacts.max(:updated_at)\n end\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def index\n @contacts = Contact.all\n end", "def show\n render json: @referral_contact\n end", "def get_contact\r\n @contact = @customer.contact_people.find_by_name params[:id]\r\n end", "def contacts(id, limit:, offset: 0, account: nil)\n path = \"filter/#{id}/contacts\"\n get account, path, limit: limit, offset: offset\n end", "def contacts(uid, params={})\n response = @client.get \"#{@path}/#{uid}/contacts\", params\n PaginateResource.new \"#{@path}\", @client, response, Textmagic::REST::Contact\n end", "def index\n @contacts = Contact.all\n\n end", "def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end", "def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end", "def index\n # todo implement search and sort and paginate\n @contacts = Legacy::LegacyContact.order(\"first_name\").paginate(:page => params[:page])\n end", "def get_contacts(user_or_identifier)\n identifier = identifier_param(user_or_identifier)\n json = parse_response(get(\"/api/#{API_VERSION}/get_contacts\",\n :apiKey => @api_key,\n :identifier => identifier))\n ContactList.new(json)\n end", "def show\n @contact = current_user.contacts.find(params[:id])\n\n end", "def fetch id=nil\n id ||= self.id\n resp = @nimble.get \"contact/#{id}\"\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end", "def create\n @traded_contact = TradedContact.new(params[:traded_contact])\n\n respond_to do |format|\n if @traded_contact.save\n format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully created.' }\n format.json { render json: @traded_contact, status: :created, location: @traded_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @traded_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def get_contact(id)\n contacts = read_contacts\n contacts.select { |contact| contact[:id] == id }.first\nend", "def user_contacts(user_id, options={})\n response = connection.get do |req|\n req.url \"/user/#{user_id}/contacts\", simple_params(options)\n end\n response.body\n end", "def fetch (contact_id)\n RubyRedtail::Query.run(\"contacts/#{contact_id}/addresses\", @api_hash, \"GET\")\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def contacts\n\t\t@contact = Contact.first();\n\tend", "def index\n @recipients = Recipient.all\n # render json: @recipients\n end", "def contacts\n Easybill::Api::Contacts\n end", "def index\n @contacts = Contact.all\n\n #Fazendo chamadas para um metodo de traducao do modelo\n # render json: @contacts, methods: :birthdate_br\n render json: @contacts\n end", "def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end", "def index\n @accounts = current_user.person.phone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def get_contact(id)\n\t\[email protected]_contact(id)\n\tend", "def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end", "def index\n @contacts = @person.contacts.paginate(:page => params[:page],\n :per_page => RASTER_PER_PAGE)\n end", "def index\n @contacts = @current_affiliate_group.contacts.all_open.paginate :page => params[:page], :order => 'created_at desc', :include => [:contact_issue, :issue_status]\n logger.info @contacts.inspect\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @contacts }\n end\n end", "def contacts\n @contacts = @seller.get_contacts\n end", "def show\n render json: Group.find(params[:id]).contacts\n end", "def new\n @contact = current_user.contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end" ]
[ "0.6873559", "0.68089205", "0.68003875", "0.6777273", "0.67317975", "0.6606174", "0.660239", "0.6568577", "0.64534885", "0.64042234", "0.63922286", "0.63890934", "0.63555866", "0.63540447", "0.63411003", "0.6333284", "0.6324839", "0.6310962", "0.6310599", "0.63015854", "0.62981784", "0.6282059", "0.627704", "0.62731", "0.62699395", "0.6266833", "0.6258056", "0.62454855", "0.62328726", "0.62269855", "0.62061906", "0.6181239", "0.61636657", "0.6161114", "0.61597645", "0.61566824", "0.61556333", "0.61439997", "0.6127828", "0.6122541", "0.6114214", "0.6113309", "0.6110196", "0.6108466", "0.61006224", "0.6094886", "0.609146", "0.6087482", "0.608405", "0.60795325", "0.607435", "0.60706216", "0.60678935", "0.6066745", "0.60649747", "0.6063354", "0.6062566", "0.60470897", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.6039607", "0.60394245", "0.6038906", "0.6026541", "0.6023663", "0.6003056", "0.6000724", "0.5981686", "0.5974335", "0.5970168", "0.59517413", "0.59504217", "0.5949919", "0.5923251", "0.5916737", "0.5915255", "0.59075505", "0.59075165", "0.59040606", "0.5903425", "0.5900592", "0.58875144", "0.5887279", "0.58859223", "0.58814615", "0.5877502", "0.58733994", "0.5868697", "0.5867864", "0.5865264", "0.5856319" ]
0.73813266
0
GET /traded_contacts/new GET /traded_contacts/new.json
def new @traded_contact = TradedContact.new respond_to do |format| format.html # new.html.erb format.json { render json: @traded_contact } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend", "def new\n @contact = current_user.contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n @contact = contacts.new\n end", "def new\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def create\n @traded_contact = TradedContact.new(params[:traded_contact])\n\n respond_to do |format|\n if @traded_contact.save\n format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully created.' }\n format.json { render json: @traded_contact, status: :created, location: @traded_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @traded_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\r\n\t\t@contact = current_user.contacts.new\r\n\tend", "def new\n @crm_contact = CrmContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact }\n end\n end", "def new\n @contact_request = ContactRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_request }\n end\n end", "def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n params[:ur_contact].delete(:id)\n newContact = current_user.ur_contacts.new(contact_params)\n\n if newContact.save then\n render json: newContact\n else\n Rails.logger.info \"Error when creating contacts #{newContact.errors.messages}\"\n head :internal_server_error\n return\n end\n end", "def new_contact\n @contact=Contact.new()\n end", "def new\n @contacts = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def new\n @contact_partner = ContactPartner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_partner }\n end\n end", "def new\n @crm_contact_info = CrmContactInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact_info }\n end\n end", "def new\n @contact = current_user.contacts.new\n\n end", "def new\n \n @transaction = Transaction.new(:contact_id => params[:contact_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @contact = Contact.new\n end", "def new\n @contact = Contact.new\n end", "def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end", "def new\n @contact = Contact.new(:client => @firm, :current_date => Time.now, :next_date => 7.days.from_now.to_date)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n @breadcrumb = 'create'\n @corp_contact = CorpContact.new\n $attachment = Attachment.new\n destroy_attachment\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corp_contact }\n end\n end", "def new\n @contactinfo = Contactinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contactinfo }\n end\n end", "def new\n @contact = Contact.new(:state_id => 5, :country_id => 226)\n @contact.numbers.build\n @contact.occasions.build\n @contact.presences.build\n @contact.build_support_state\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n @library_contact = @library_location.library_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library_contact }\n end\n end", "def new\n @projectcontact = Projectcontact.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectcontact }\n end\n end", "def new\n\t\t@contact = Contact.new\n\t\[email protected]_phone_numbers.build\n\t\[email protected]_addresses.build\n\tend", "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end", "def new\n @contact_number = ContactNumber.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact_number }\n end\n end", "def create_contact()\n Contact.new(id: rand(2000)).tap do |c|\n contacts << c\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n fresh_when(@contact)\n render json: @contact, status: :created, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @contact = Contact.new\n @contact.user = current_user\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n \n \n end\n end", "def new\n @contactaction = Contactaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contactaction }\n end\n end", "def new\n @site_contact = SiteContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_contact }\n end\n end", "def new\n @ad_contact = AdContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ad_contact }\n end\n end", "def create\n @contact = Contact.new(contact_params)\n @contact.sender = current_user.pseudo\n @contact.state = \"new\"\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to session[:previous_request_url], notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n render_contact_partials\n\n @location = Location.new\n @location.contacts = [{:phone => [{}]}]\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @location }\n end\n end", "def new\n @contact_action = ContactAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_action }\n end\n end", "def create\n @contact = @resource.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(@resource, :notice => 'Contact was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @contact = contacts.new(params[:contact])\n\n if @contact.save\n redirect_to contacts_path, notice: '联系人创建成功'\n else\n render action: \"new\"\n end\n end", "def new\n @assessment = Assessment.new\n authorize! :create, @assessment\n\n @assessment.contacts.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assessment }\n end\n end", "def new\n @person_contact = PersonContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person_contact }\n end\n end", "def create\n @contact = @business.contacts.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: business_contact_path(@business,@contact) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contact = Contact.new\n if not params[:client].nil?\n @client = Client.new JSON.parse(params[:client])\n @contact.clientId = @client._id\n @contact.name = @client.nome\n @contact.email = @client.email\n @contact.phone = @client.telefone\n @contact.address = @client.endereco\n @contact.client_type = @client.client_type\n @contact.institution = @client.instituicao\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def new\n #@contact = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n format.js\n end\n end", "def new\n @contact = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end", "def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end", "def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end", "def create_list\n # First delete all current contacts for this user (no overlapping contacts)\n Contact.delete_all(\"user_id = #{current_user.id}\")\n \n # Parse the list (json encoded) and create individual contact entries\n if params[:contacts].nil? || params[:contacts].empty?\n return render :status => 170, :json => {:message => 'Contacts are missing.'}\n end\n contacts = ActiveSupport::JSON.decode(CGI::unescape(params[:contacts]))\n \n total_saved = 0\n contacts.each do |contact|\n # Verify this contact has all required params\n next if (!contact.key?('name') || !contact.key?('email') || !contact.key?('source'))\n\n # Create new contact entry\n Contact.create({\n :user_id => current_user.id,\n :name => contact['name'],\n :email => contact['email'],\n :source => contact['source']\n })\n\n total_saved += 1\n end\n\n render :status => 200, :json => {:message => \"Contacts saved successfully (#{total_saved} of #{contacts.size}).\"}\n end", "def new\n @contact = Contact.new\n if params[:registration].present?\n @registration = true\n @reason = params[:reason]\n else\n @tag, @seo = Seo.contact(params[:tag_id], I18n.locale.to_s)\n end\n @contact.agreements << Agreement.where(:display => true).locale(I18n.locale.to_s)\n \n respond_to do |format|\n if @registration\n format.html { render 'registration' }\n format.json { render :json => @contact }\n else\n format.html # new.html.erb\n format.json { render :json => @contact }\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n render json: @contact, status: :created, location: @contact\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def new\n @ucontact = Ucontact.new\n \n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @ucontact }\n format.json { render :json => @ucontact }\n end\n end", "def create\n @crm_contact = CrmContact.new(params[:crm_contact])\n\n respond_to do |format|\n if @crm_contact.save\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully created.' }\n format.json { render json: @crm_contact, status: :created, location: @crm_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @contact_rule = ContactRule.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end", "def new\n @client = Client.new\n\t\tcontact_type = ContactType.find_by_default_selection(true)\n\t\[email protected]( :contact_type => contact_type )\n\t\[email protected]\n\t\[email protected]\n\t\[email protected]_agencies.build\n\t\[email protected]_sentences.build\n\t\[email protected]_classes.build\n\t\[email protected]_substances.build\n\n respond_to do |format|\n format.html { render :layout=>'client_new' }\n format.xml { render :xml => @client }\n end\n end", "def new\n if params[:member].present? && params[:member].respond_to?(:to_i) # prefill new form with member's data\n if @member = Member.find(params[:member])\n @contact = Contact.new( company: @member.company,\n country: @member.country,\n address: @member.address,\n city: @member.city,\n postal_code: @member.postal_code,\n is_ceres_member: true,\n )\n tag_list = @member.activity_list + @member.brand_list\n tag_list << \"member\"\n @contact.tag_list = tag_list.join(',')\n end\n end\n @contact ||= Contact.new\n @contact.emails.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n format.js { render template: 'contacts/new' }\n end\n # { render partial: \"new\" }\n end", "def new\n @repairer = Repairer.new\n \n 3.times do\n @repairer.contact_repairers.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repairer }\n end\n end", "def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to new_contact_path, notice: 'We got your info! We\\'ve sent you a copy and we\\'ll get back to you soon.' }\n format.json { render :new, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @func_contact = FuncContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @func_contact }\n end\n end", "def new\n @addressbook_contact = AddressbookContact.new(params[:addressbook_contact])\n @addressbook_contact.public = params[:public] unless params[:public].nil?\n @addressbook_contact.public ||= false\n \n # Check if item ready and granted to be created\n if @addressbook_contact.nil? || !granted_to(:create, @addressbook_contact) then\n if request.xhr?\n render :update do |page| page.redirect_to :action => 'index' end\n else\n redirect_to :action => 'index'\n end\n return\n end\n\n # setup automatic default value\n @addressbook_contact.user = self.current_user\n \n build_lookup_belongs\n \n if params[:addressbook_contact] then\n if @addressbook_contact.save then\n #@addressbook_contact.update_groups( params[:addressbook_group_ids] )\n \n flash[:notice] = print_words('addressbook contact').capitalize_words + \" \\\"#{@addressbook_contact.display_name}\\\" \" + print_words('has been created')\n \n redirect_to :action => 'list_' + (@addressbook_contact.public ? 'public' : 'private'), :page => params[:page]\n else\n render :action => 'new' #, :layout => 'application'\n end \n else\n redirect_to :action => 'index' and return unless request.xhr?\n render :update do |page| \n page.hide 'add_new_button'\n page['message'].hide\n page.replace_html \"message\", ''\n page.insert_html :after,\"title\", :partial => 'new'\n end\n end \n end", "def create\n klass = Contact.create_model_class(params[:contact][:klaas], params[:contact])\n \n @contact = klass.new(contact_params)\n debugger\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contact_url @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: (contact_url @contact) }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_a_new_contact_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsAndContactListsApi.create_a_new_contact ...'\n end\n # resource path\n local_var_path = '/v3/contacts'\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[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n return_type = opts[:return_type] \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsAndContactListsApi#create_a_new_contact\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_phone_to_nouveau_ticket }\n end\n end", "def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = @user.contacts.build(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to root_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contact_message = ContactMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_message }\n end\n end", "def new\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.build\n @request.deadline = Date.today\n\n respond_with @request\n end", "def new\n @lead = Lead.find(params[:lead_id])\n if @lead.lead_contacts.count > 0\n emails = ''\n first = true\n @lead.lead_contacts.each do |contact|\n if first\n emails = contact.email\n first = false\n else\n emails = emails+', '+contact.email\n end\n end\n @contract = Contract.new(:invoice_mailing => emails)\n else\n @contract = Contract.new\n end\n \n @months = []\n for i in 0..18\n @months << [i,i]\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contract }\n end\n end", "def new\n @contact = CompanyContact.new\n respond_with @contact\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @person = Person.find(params[:person_id])\n @contact = Contact.start(@person,\n :psu_code => NcsNavigatorCore.psu_code,\n :contact_date_date => Date.today,\n :contact_start_time => Time.now.strftime(\"%H:%M\"))\n @event = event_for_person\n\n if @event\n @requires_consent = (@person.participant &&\n (@person.participant.consented? == false) &&\n [email protected]_event?)\n end\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @contact }\n end\n end", "def new\n @location = Location.new\n @location.contacts = [{:phone => [{}]}]\n @types = Type.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def create_contact(name, telephone, email)\n\tcontact_list = {\n\t\tname: name,\n\t\ttelephone: telephone,\n\t\temail: email\n\t}\n\tcontacts = []\n\tcontacts << contact_list\nend", "def action_new( contacts )\n\n #calls the create new method to create a new contact\n contact = create_new\n\n #puts the newly created contact in the contacts array\n contacts << contact\n\n write_contacts( contacts )\n\n puts\n puts \"New contact created:\"\n puts\n\n #Shows the newly created user\n show( contact )\n puts\nend", "def new\n @lwidth = '20%'\n @rwidth = '0' \n @contact = flash[:form_data] || Contact.new\n session[:method] = 'new'\n @contact.public = true\n @campaign_name = Campaign.map(:name)\n Action.add_record(@contact.id, session[:email], 'created', 'contact', @contact.last_name)\n @items = Action.recent_items\n end", "def new\n\t\t@contact=Contact.new\n\t\t$flag_edit=false\n\tend", "def new\n # .find(:all, :conditions => \"customer_type_id = 1\") Customer.find(:all, :conditions => \"customer_type_id = 1\")\n last_cargo_manifest = CargoManifest.find(:last)\n if last_cargo_manifest.nil?\n c_m=0\n else\n c_m=last_cargo_manifest.manifest_num\n end\n @cargo_manifest = CargoManifest.new\n @cargo_manifest.manifest_num =c_m.to_i + 1\n @transport_guides= TransportGuide.where(id: 0)\n @cargo_manifest_detail=CargoManifestDetail.new\n # @transport_guide_details= TransportGuideDetail.all\n @cities= City.find(:all)\n @btt_guardar='Guardar'\n @option_print=false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_manifest}\n end\n end", "def create\n @contact = current_user.contacts.new(name:params[:name], email:params[:email])\n @contact = current_user.contacts.new(params[:contact])\n @server_id = params[:server_id].to_i\n @contact.save\n end", "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contato foi criado com sucesso.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @campaign = Campaign.new\n @contacts_list = current_user.contacts.active\n @contents_list = current_user.contents.active\n\n logger.warn \"debug: ====================>>>>> contacts_list = [\" + @contacts_list.to_s + \"]\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @campaign }\n end\n end", "def new\n @owner = Owner.new\n @owner.build_owner_address\n @owner.owner_contacts.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to edit_contact_path(@contact), notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\t\t@contact = current_user.contacts.new(contact_params)\r\n\t\t\r\n\t\tif @contact.save\r\n\t\t\tflash[:success] = \"New Contact Added\"\r\n\t\t\tredirect_to @contact\r\n\t\telse\r\n\t\t\trender 'new'\r\n\t\tend\r\n\tend", "def new\n @contactos = Contactos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contactos }\n end\n end", "def new\n @user_contact = UserContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_contact }\n end\n end", "def new\n @addresstype = Addresstype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addresstype }\n end\n end", "def new\n load_data\n @company = Company.new\n @contactinfo = Contactinfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def create\n \n @contact = Contact.new(params[:contact])\n \n if @contact.save\n render :json => { :success => true, :message => \"Created new contact #{@contact.id}\", :contact => @contact }\n else\n render :json => { :success => false, :message => \"Failed to create contact\"}\n end\n \n # @contact = Contact.new(params[:contact])\n # \n # respond_to do |format|\n # if @contact.save\n # format.html { redirect_to(@contact, :notice => 'Contact was successfully created.') }\n # format.xml { render :xml => @contact, :status => :created, :location => @contact }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def create\n contact = Contact.create(contact_params)\n\n if contact.new_record?\n render json: { errors: contact.errors.messages }, status: 422\n else\n render json: contact, status: 201\n end\n end" ]
[ "0.76800346", "0.7492992", "0.74658173", "0.74141914", "0.7252208", "0.7105118", "0.70777303", "0.70777303", "0.70777303", "0.70354754", "0.70173347", "0.7013792", "0.69985336", "0.6941247", "0.6923718", "0.69222015", "0.6877605", "0.6845283", "0.6845169", "0.6836063", "0.6836063", "0.68153083", "0.68127155", "0.67991763", "0.67665714", "0.67635757", "0.67593193", "0.67039365", "0.670224", "0.66854745", "0.6667301", "0.66494286", "0.6645741", "0.66200304", "0.66059923", "0.66000146", "0.6598234", "0.6590889", "0.65824735", "0.65792596", "0.6578726", "0.6557703", "0.65354127", "0.65307194", "0.652058", "0.64904076", "0.64892846", "0.6482059", "0.64812624", "0.64798427", "0.64798427", "0.64798427", "0.64781815", "0.64696294", "0.64696294", "0.6449868", "0.6440256", "0.64363235", "0.64256936", "0.64149755", "0.6406072", "0.63978297", "0.6378456", "0.637236", "0.6366607", "0.6365918", "0.6360224", "0.6358902", "0.6338476", "0.6334836", "0.633383", "0.6331412", "0.6323584", "0.6323382", "0.6317039", "0.6312935", "0.63124555", "0.63039845", "0.62970006", "0.62961394", "0.62926763", "0.6290081", "0.6287374", "0.628475", "0.62709755", "0.62655723", "0.62647617", "0.62638533", "0.62628293", "0.62611586", "0.62581307", "0.62564445", "0.6236066", "0.6232673", "0.6232459", "0.6231117", "0.6228992", "0.621095", "0.6209853", "0.6209402" ]
0.80314195
0
POST /traded_contacts POST /traded_contacts.json
def create @traded_contact = TradedContact.new(params[:traded_contact]) respond_to do |format| if @traded_contact.save format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully created.' } format.json { render json: @traded_contact, status: :created, location: @traded_contact } else format.html { render action: "new" } format.json { render json: @traded_contact.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @traded_contact = TradedContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traded_contact }\n end\n end", "def create_list\n # First delete all current contacts for this user (no overlapping contacts)\n Contact.delete_all(\"user_id = #{current_user.id}\")\n \n # Parse the list (json encoded) and create individual contact entries\n if params[:contacts].nil? || params[:contacts].empty?\n return render :status => 170, :json => {:message => 'Contacts are missing.'}\n end\n contacts = ActiveSupport::JSON.decode(CGI::unescape(params[:contacts]))\n \n total_saved = 0\n contacts.each do |contact|\n # Verify this contact has all required params\n next if (!contact.key?('name') || !contact.key?('email') || !contact.key?('source'))\n\n # Create new contact entry\n Contact.create({\n :user_id => current_user.id,\n :name => contact['name'],\n :email => contact['email'],\n :source => contact['source']\n })\n\n total_saved += 1\n end\n\n render :status => 200, :json => {:message => \"Contacts saved successfully (#{total_saved} of #{contacts.size}).\"}\n end", "def destroy\n @traded_contact = TradedContact.find(params[:id])\n @traded_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to traded_contacts_url }\n format.json { head :no_content }\n end\n end", "def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end", "def add_contacts\n \tap \"adding contacts\"\n # asking whether we are already authorized\n AddressBook.request_authorization unless AddressBook.authorized?\n\n \n if AddressBook.authorized?\n 25.times do\n person = AddressBook::Person.create(\n :first_name => Forgery::Name.first_name, \n :last_name => Forgery::Name.last_name, \n :email => [{ :value => Forgery(:internet).email_address , :label => 'Home'}], :phones => [{ :value => rand(10 ** 10).to_s, :label => 'Mobile'}])\n end\n else\n #ap \"This app is not authorized to access the address book.\"\n end\n #enVd\n end", "def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n params[:ur_contact].delete(:id)\n newContact = current_user.ur_contacts.new(contact_params)\n\n if newContact.save then\n render json: newContact\n else\n Rails.logger.info \"Error when creating contacts #{newContact.errors.messages}\"\n head :internal_server_error\n return\n end\n end", "def post_contacts_with_http_info(contacts, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.post_contacts ...'\n end\n # verify the required parameter 'contacts' is set\n if @api_client.config.client_side_validation && contacts.nil?\n fail ArgumentError, \"Missing the required parameter 'contacts' when calling ContactsApi.post_contacts\"\n end\n # resource path\n local_var_path = '/contacts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(contacts) \n\n # return_type\n return_type = opts[:return_type] || 'Contact' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#post_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end", "def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end", "def show\n @traded_contact = TradedContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traded_contact }\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def contacts\r\n @contact = @customer.contact_people.find_by_id params[:id]\r\n \r\n # Delete contact\r\n if @contact && params[:method] == \"delete\"\r\n @store_user.my_account_log(@contact,\"Delete Contact #{@contact.name}\")\r\n @contact.destroy\r\n @customer.update_ax( :contacts => [@contact] )\r\n redirect_to :id => nil\r\n end\r\n \r\n # Add or update contact\r\n if request.post? && params[:contact]\r\n @contact ||= @customer.contact_people.build\r\n @contact.attributes = params[:contact]\r\n if @contact.save\r\n redirect_to :id => nil\r\n else\r\n @customer.contact_people.delete @contact\r\n render\r\n end\r\n \r\n # Synchronize customer\r\n @customer.update_ax( :contacts => [@contact] ) if @contact.errors.empty?\r\n @store_user.my_account_log(@contact,\"Add or Update Contact #{@contact.name}\")\r\n end\r\n end", "def create_contact\n @contact = Spree::Address.new(contact_params)\n # Currently for demo, I will leave the country id to be 1, later update will be noticed!\n hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.save\n @seller.spree_addresses << @contact\n format.html { redirect_to contacts_admin_seller_path, notice: \"Contacts #{@contact.firstname} #{@contact.lastname} is successfully created!\" }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :new_contact }\n format.json { render :new_contact, status: :unprocessable_entity }\n end\n end\n end", "def create_contact(name, telephone, email)\n\tcontact_list = {\n\t\tname: name,\n\t\ttelephone: telephone,\n\t\temail: email\n\t}\n\tcontacts = []\n\tcontacts << contact_list\nend", "def contacts\r\n\r\n end", "def create\n @contact = Contact.new\n @contact.first_name=params[:first_name]\n @contact.last_name=params[:last_name]\n @contact.email=params[:email]\n @contact.org=params[:org]\n @contact.events=params[:events]\n @contact.interests=params[:interests]\n @contact.save\n\n contacts_list\n end", "def add_list_contacts(list_ids, params = {})\n contact_params = params[:contacts].each_with_object({}).with_index do |(value, hash), index|\n hash[index.to_s.to_sym] = value\n end\n request = @request.post(self_path, {\n list_ids: list_ids.join(','),\n contact: contact_params,\n **params.except(:contacts)\n })\n response = Response.new(request).parse\n if response[:status] == 'error'\n raise Errors::UnprocessableEntityError.new, response[:message]\n end\n end", "def post_contact\n\t\tcontact = Contact.new\n\t\tcontact.first_name = params[:first_name]\n\t\tcontact.last_name = params[:last_name]\n\t\tcontact.phone_number = params[:phone_number]\n\t\tcontact.email = params[:email]\n\t\tcontact.save\n\t\tcurrent_agendify_user.contacts.push(contact)\n\t\tcurrent_agendify_user.save\n\t\tredirect_to root_path\n\tend", "def create\n @contact = @business.contacts.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: business_contact_path(@business,@contact) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend", "def update_contacts(contacts)\n b = Builder::XmlMarkup.new\n request_xml = b.Contacts {\n contacts.each do | contact |\n contact.to_xml(b)\n end\n }\n\n response_xml = http_post(@client, \"#{@xero_url}/Contacts\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'POST/contacts'})\n response.contacts.each_with_index do | response_contact, index |\n contacts[index].contact_id = response_contact.contact_id if response_contact && response_contact.contact_id\n end\n response\n end", "def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end", "def create_contact(params={})\n @obj.post('create-contact', @auth.merge(params))\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def contact_added(freshdesk_data)\n\t response = HTTParty.post(\n\t \"#{@api_domain}contacts\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def update\n @traded_contact = TradedContact.find(params[:id])\n\n respond_to do |format|\n if @traded_contact.update_attributes(params[:traded_contact])\n format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @traded_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = @user.contacts.build(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to root_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_contacts \n params[:contact_ids] = params[:contact_ids][0].split(', ')\n contacts = current_user.contacts.find(params[:contact_ids]) \n @notification = current_user.notifications.find(params[:id])\n \n contacts = contacts.collect{|el| @notification.contacts.include?(el) ? nil : el}.compact\n contacts.each do |el|\n @notification.receipients.create( :contact_id => el.id, :status => 'active' )\n end\n \n render :update do |page| \n page.redirect_to(@notification)\n end \n end", "def create\n @subcontractor_contact = SubcontractorContact.new(subcontractor_contact_params)\n\n respond_to do |format|\n if @subcontractor_contact.save\n format.html { redirect_to @subcontractor_contact, notice: 'Subcontractor contact was successfully created.' }\n format.json { render :show, status: :created, location: @subcontractor_contact }\n else\n format.html { render :new }\n format.json { render json: @subcontractor_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_contacts(contacts, opts = {})\n data, _status_code, _headers = post_contacts_with_http_info(contacts, opts)\n data\n end", "def create_a_new_contact_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsAndContactListsApi.create_a_new_contact ...'\n end\n # resource path\n local_var_path = '/v3/contacts'\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[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n return_type = opts[:return_type] \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsAndContactListsApi#create_a_new_contact\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_for_current\n\n # 1) create new recipient\n first_name = params[:first_name]\n last_name = params[:last_name]\n recipient = current_user.recipients.create(\n first_name: first_name,\n last_name: last_name\n )\n\n # 2) save recipient addresses\n addresses = params[:addresses]\n if addresses\n primary_set = false\n addresses.each do |address|\n address = recipient.addresses.new(\n first_name: first_name,\n last_name: last_name,\n street: address[:street],\n city: address[:city],\n suite: address[:suite],\n state: address[:state],\n zipcode: address[:zipcode],\n )\n if address.save\n unless primary_set\n address.set_primary\n primary_set = true\n end\n end\n end\n end\n \n\n # 3) save recipient occasions\n occasions = params[:occasions]\n\n if occasions\n occasions.each do |occasion|\n\n occasion_id = occasion[:recipient_occasion][:occasion_id]\n day = occasion[:recipient_occasion][:day]\n month = occasion[:recipient_occasion][:month]\n notes = occasion[:recipient_occasion][:notes]\n recipient.recipient_occasions.create(\n occasion_id: occasion_id,\n day: day,\n month: month,\n notes: notes\n )\n end\n end\n\n respond_to do |format|\n format.json { render json: recipient }\n end\n\n end", "def createContact(k = 0)\n puts $testCaseID = \"VT229-0003\"\n contacts = []\n for i in 0..k\n createRandContacts\n contacts << {\"first_name\" =>$conFirstName, \"last_name\" =>$conLastName, \"mobile_number\" =>$conMobNum, \"business_number\" =>$conBusNum, \"email_address\" =>$conEmail, \"company_name\" =>$conComp}\n end\n puts \"Value of local variable is #{contacts}\" \n \n contacts.each do |contact|\n Rho::RhoContact.create! contact\n end\n redirect :action => :index \n end", "def upload_contacts(params={})\n @obj.post('upload-contacts', @auth.merge(params)) # file: UploadIO.new(filepath, 'text/csv')\n end", "def create\n \n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = _('Contact was successfully created.')\n format.html { redirect_to(customer_contact_url(:customer_id => @customer.id, :id => @contact.id)) }\n format.js { render :text => \"contact added\", :layout => false }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\", :layout => request.xhr? }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n render json: @contact, status: :created, location: @contact\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new({\n first_name: contact_info[:first_name],\n last_name: contact_info[:last_name],\n phone: contact_info[:phone]\n })\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'contact.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new, {\n contact: contact,\n user: self\n })\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/contacts/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n @response.status == 201\n end", "def create\n #@contact = Contact.new(params[:contact])\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(contacts_url, :notice => t('contacts.was_created.')) }\n format.json { render json: @contact, status: :created, location: @contact }\n format.js {\n @contacts = Contact.accessible_by current_ability\n @contacts = @contacts.order(@sort) if @sort and Contact.attribute_names.include? @sort\n }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n format.js { render 'failure' }\n end\n end\n end", "def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end", "def create\n @contact = contacts.new(params[:contact])\n\n if @contact.save\n redirect_to contacts_path, notice: '联系人创建成功'\n else\n render action: \"new\"\n end\n end", "def create\n @contact = current_user.contacts.new(name:params[:name], email:params[:email])\n @contact = current_user.contacts.new(params[:contact])\n @server_id = params[:server_id].to_i\n @contact.save\n end", "def add_contact(params={})\n @obj.put('add-contact', @auth.merge(params))\n end", "def import_contacts(email, password, with_names = false)\n data = { :email => email, :password => password }\n data[:names] = 1 if with_names\n self.api_post(:contacts, data)\n end", "def create\n @contact = @resource.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(@resource, :notice => 'Contact was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end", "def create\n @contact = Contact.new(contact_params)\n @contact.sender = current_user.pseudo\n @contact.state = \"new\"\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to session[:previous_request_url], notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def contacts\n\t #begin\n\t autopilot_contact = params[\"contact\"]\n\t autopilot_event = params[\"event\"]\n\t if autopilot_contact.has_key?(\"Company\") && autopilot_contact[\"Company\"] != \"\"\n company_id = get_freshdesk_company_id(autopilot_contact[\"Company\"])\n #Rails.logger.debug \"comp id==>#{company_id}\"\n autopilot_contact[\"Company\"] = company_id \n end\n @freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n @freshdesk_data[\"company_id\"] = autopilot_contact[\"Company\"] unless autopilot_contact[\"Company\"] == \"\"\n\n\t #@freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n\t get_custom_fields(autopilot_contact)\n\t if autopilot_event == \"contact_added\"\n\t \t response = contact_added(@freshdesk_data)\n\t elsif autopilot_event == \"contact_updated\"\n\t\t #Rails.logger.info \"Update response from autopilotttttttttttttttttt\"\n\t response = contact_updated(@freshdesk_data, @freshdesk_contact_id)\n\t\t #Rails.logger.debug \"#{response}\"\t\t\n\t end \n\t response.parsed_response.has_key?(\"errors\") ? failure_response(response) : success_response\n\t #rescue Exception => e\n\t #\tputs e.message\n\t #end\n\tend", "def create\n @contact = Contact.new(contact_params)\n @contact.created_by = @current_user.id\n\n @contact = encrypt_contacts(@contact)\n\n respond_to do |format|\n if @contact.save\n format.html {\n flash[:notice] = \"Contact was successfully created.\"\n flash[:color] = \"valid\"\n redirect_to action: \"index\"\n }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if get_case\n @contact = @case.contacts.create(contact_params)\n path_contacts = case_contacts_path\n else\n @contact = Contact.new(contact_params)\n path_contacts = contacts_path\n end\n\n # TODO: render partials per each type\n\n @contact.user = @user\n @contact.firm = @firm\n\n if @contact.type != 'Attorney'\n @contact.attorney_type = ''\n end\n\n #@case.contacts << @contact\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to path_contacts, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, contact: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @point_of_contact.save\n render json: @point_of_contact, status: :created, location: @point_of_contact\n else\n render json: @point_of_contact.errors, status: :unprocessable_entity\n end\n end", "def new\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end", "def create\n @contact = Contact.new(contact_params)\n @contact.locale_id = current_user.locale_id\n @contact.contact_type_id = 12\n @contact.is_team = true\n respond_to do |format|\n if @contact.save\n format.html { redirect_to team_path(@contact), notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n flash[:error] = @contact.errors.full_messages\n @contact = Contact.new(contact_params)\n load_lists\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_contact(list_id, email, attributes={})\n endpoint = \"/api/v1/list/#{list_id}/add-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email,\n 'attributes' => attributes\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def create\n @reminder = Reminder.new(params[:reminder])\n\n respond_to do |format|\n if @reminder.save\n # add contacts to schedule_contact table\n\t@loop_over_count = params[:contact_number_name_list].length\n\t\n \tfor @i in 0..(@loop_over_count-1)\n\t\[email protected]_contacts.create(:name => params[:contact_number_name_list][@i], :contact_no => params[:contact_number_list][@i], :status => \"Pending\")\n \tend\n format.html { redirect_to reminders_path, notice: 'Reminder was successfully created.' }\n format.json { render json: @reminder, status: :created, location: @reminder }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reminder.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @contacts = @client.contacts\n end", "def create\n @crm_contact = CrmContact.new(params[:crm_contact])\n\n respond_to do |format|\n if @crm_contact.save\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully created.' }\n format.json { render json: @crm_contact, status: :created, location: @crm_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n @contact.phone_number.entity=@contact\n @contact.user=current_user\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n format.js { render action: \"new\", status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contacts::Person.new(contacts_person_params.merge(user: current_user))\n company = Contacts::Company.new(contacts_company_params.merge(user: current_user)) if params[:contacts_company]\n @contact.company = company if @contact.company.nil? && !company.nil? && company.valid?\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: t('controllers.contacts.people.create.success') }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def contacts\n contacts_raw.present? ? JSON.parse(contacts_raw) : {}\n end", "def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end", "def add_contacts_to_selection\n logger.debug \"**** ADD CONTACTS to SELN ****\"\n show_params(params) #debug params and put them in logs\n @role_contactinfos_ids = params[:role_contactinfos][:ids]\n \n previous_contacts = session[SELECTED_CONTACTS]\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n existent_contacts = previous_contacts\n \n # add saved list contacts or mailout contacts if any\n # so they are not added again to the list\n if saved_list_contacts != nil\n existent_contacts = existent_contacts + saved_list_contacts\n end\n \n if mailout_list_contacts != nil\n existent_contacts = existent_contacts + mailout_list_contacts\n end\n \n new_contacts = []\n for new_contact_id in @role_contactinfos_ids\n #new_contact = get_person_or_organisation(new_contact_id)\n # get the contact to add\n new_contact_id = new_contact_id.gsub('role_contactinfo_', '')\n new_contact = RoleContactinfo.find( new_contact_id )\n new_contacts = new_contacts + [new_contact] unless existent_contacts.include?new_contact\n end\n \n \n session[SELECTED_CONTACTS] = previous_contacts + new_contacts\n \n @contacts = session[SELECTED_CONTACTS] \n \n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n \n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end\n \n render :layout => false\n end", "def create\n @contact = Contact.new(contact_params)\n @contacts = Contact.where(active_status: true, del_status: false).order('first_name ASC')\n @regions = Region.where(active_status: true, del_status: false)\n respond_to do |format|\n if @contact.save\n flash.now[:notice] = \"#{@contact.get_full_name} added successfully\"\n format.js\n else\n # flash.now[:alert] = \"Error adding contact\"\n logger.info \"Error Messages :: #{@contact.errors.messages.inspect}\"\n format.js { render :new }\n end\n end\n end", "def add_contact(contact)\n\t\tcontact.id = @@ids\n\t\t@contacts << contact \n\t\t@@ids += 1\n\t\tcontact\n\tend", "def create\n @projectcontact = Projectcontact.new(params[:projectcontact])\n #@project = params[:project]\n #@contacts = params[:contact_ids]\n\n #@contacts.each do |c| \n # Projectcontact.create!(:contact_id=>5, :project_id=>params[:project])\n #end\n #redirect_to edit_project_path(@project)\n\n\n respond_to do |format|\n if @projectcontact.save\n format.html { redirect_to project_path(@projectcontact.project_id), notice: 'Contacttype was successfully created.' }\n format.json { render json: @projectcontact, status: :created, location: @projectcontact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projectcontact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n fresh_when(@contact)\n render json: @contact, status: :created, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end", "def contact_params\n params.require(:contact).permit(:firstname, :lastname, :email, :address1,:address2, :city, :country_id, :pincode, :phone_number, :vendor, :buisinessname, :notes, :brand_id, :contact_id, :reference_contact_id, :tag_list, referred_contacts_attributes: [])\n end", "def queue_contacts\n @contacts.where(contact_type: 'PBX', direction: 'I', forwarded_to_agent: nil, call_ended: nil).where.not(service_id: 120)\n end", "def create_find\n puts $testCaseID = \"VT229-0004\"\n con_remove\n createContact 10\n @contact = Rho::RhoContact.find(:all)\n puts \"Contacts Are\" + @contact.inspect\n redirect :action => :index\n end", "def create(contact, organization_id)\n path = get_path(organization_id)\n result = handle_response(@client.push(path, contact.attributes))\n return if result.blank?\n\n set_contact_data(contact.attributes, result['name'])\n end", "def create\n @relinquishment_contact = current_user.organization.relinquishment_contacts.new(params[:relinquishment_contact])\n if @relinquishment_contact.save\n flash[:notice] = 'Relinquishment contact was successfully created.'\n else\n flash[:error] = 'Relinquishment contact was not successfully created.'\n end\n \n respond_with(@relinquishment_contact, :location => admin_relinquishment_contact_path(@relinquishment_contact))\n end", "def create\n @test_contact_detail = TestContactDetail.new(test_contact_detail_params)\n\n respond_to do |format|\n if @test_contact_detail.save\n format.html { redirect_to @test_contact_detail, notice: 'Test contact detail was successfully created.' }\n format.json { render :show, status: :created, location: @test_contact_detail }\n else\n format.html { render :new }\n format.json { render json: @test_contact_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def contacts_params\n params.permit(:name, :email, :phone)\n end", "def create\n @contacts_file = current_user.contacts_files.new(contacts_file_params)\n @contacts_file.contacts = contacts_file_params.fetch(:contacts)\n\n respond_to do |format|\n if @contacts_file.save\n format.html { redirect_to action: :edit, id: @contacts_file.id, notice: 'Contacts file was successfully created.' }\n format.json { render :show, status: :created, location: @contacts_file }\n else\n format.html { render :new }\n format.json { render json: @contacts_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contact = current_user.contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end", "def create_contact()\n Contact.new(id: rand(2000)).tap do |c|\n contacts << c\n end\n end", "def create\n klass = Contact.create_model_class(params[:contact][:klaas], params[:contact])\n \n @contact = klass.new(contact_params)\n debugger\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contact_url @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: (contact_url @contact) }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_agent_contacts(params)\n message = {\n serviceGroupID: params[:service_group_id],\n serviceID: params[:service_id],\n teamID: params[:team_name],\n agentID: params[:agent_id],\n startDate: params[:start_date],\n endDate: params[:end_date],\n contactTypes: params[:contact_type],\n useServiceTime: false\n }\n\n reply = @client.call(:get_contacts, message: message)\n data = reply.body.dig(:get_contacts_response,\n :get_contacts_result,\n :array_of_string)\n\n data = check_if_data_exists(data)\n data = map_contacts_data(data)\n delete_contact_headers(data)\n data\n end", "def create\n @customer_contact = CustomerContact.new(customer_contact_params)\n\n respond_to do |format|\n if @customer_contact.save\n format.html { redirect_to @customer_contact, notice: 'Customer contact was successfully created.' }\n format.json { render :show, status: :created, location: @customer_contact }\n else\n format.html { render :new }\n format.json { render json: @customer_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n contact = Contact.create(contact_params)\n\n if contact.new_record?\n render json: { errors: contact.errors.messages }, status: 422\n else\n render json: contact, status: 201\n end\n end", "def add_contact(ownnick, person)\n return ret_fail('can not add yourself') if person == ownnick #you cant add yourself !\n\n usr = User.first(:nickname=>person)\n return ret_fail('no such user') if usr == nil #user does not exist !\n\n ownusr = User.first(:nickname => ownnick) #get own record to get the contact list\n return ret_fail('already in list') if ownusr.contacts.first(:userid => usr.id) != nil\n\n c = ownusr.contacts.new\n c.userid = usr.id\n puts usr.id\n puts c.userid\n c.authgiven = 'f'\n c.save\n\n return ret_success\nend", "def create\n \n @contact = Contact.new(params[:contact])\n \n if @contact.save\n render :json => { :success => true, :message => \"Created new contact #{@contact.id}\", :contact => @contact }\n else\n render :json => { :success => false, :message => \"Failed to create contact\"}\n end\n \n # @contact = Contact.new(params[:contact])\n # \n # respond_to do |format|\n # if @contact.save\n # format.html { redirect_to(@contact, :notice => 'Contact was successfully created.') }\n # format.xml { render :xml => @contact, :status => :created, :location => @contact }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def scrape_contacts; end", "def contact_params\n params.require(:contact).permit(:first_name, :last_name, \n phone_numbers_attributes: [:id, :number, :phone_type, :_destroy],\n addresses_attributes: [:id, :street, :city, :region, :country, :postal_code, :_destroy]\n )\n end", "def create\n @ad_contact = AdContact.new(params[:ad_contact])\n\n respond_to do |format|\n if @ad_contact.save\n format.html { redirect_to @ad_contact, notice: 'Ad contact was successfully created.' }\n format.json { render json: @ad_contact, status: :created, location: @ad_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ad_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to thank_you_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact_partner = ContactPartner.new(params[:contact_partner])\n\n respond_to do |format|\n if @contact_partner.save\n format.html { redirect_to @contact_partner, notice: 'Ansprechpartner wurde erfolgreich erzeugt' }\n format.json { render json: @contact_partner, status: :created, location: @contact_partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact_partner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@contact = Contact.new(contact_params)\n\t\tif @contact.save\n\t\t\tflash[:notice] = \"Contact sucessfully saved!\"\n\t\t\tredirect_to contacts_path\n\t \telse\n\t \t\tflash[:error] = \"Contact could not save!\"\n\t \t\[email protected]_phone_numbers.build unless @contact.contact_phone_numbers.present?\n\t \t\[email protected]_addresses.build unless @contact.contact_addresses.present?\n\t \trender 'new'\n\t \tend\n\tend", "def add_pasted_contacts_with_http_info(contact_emails, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.add_pasted_contacts ...\"\n end\n # verify the required parameter 'contact_emails' is set\n if @api_client.config.client_side_validation && contact_emails.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_emails' when calling ContactsApi.add_pasted_contacts\"\n end\n # resource path\n local_var_path = \"/contacts/paste\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"contactEmails\"] = contact_emails\n form_params[\"listInfo\"] = opts[:'list_info'] if !opts[:'list_info'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#add_pasted_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @searcheds = Searched.all\n @searched = Searched.new(searched_params)\n contact_id = ''\n if !params['contact_ids'].nil? && params['contact_ids'].first.to_i > 0\n id_array = []\n contact_id_array = params['contact_ids'].to_a\n\n contact_id_array.each do |id |\n if id.to_i > 0\n id_array << id\n contact_id = id.to_s\n end\n end\n\n if contact_id_array[0].to_i > 0\n @searched.contact_ids = id_array\n end\n @searched.update_attributes(:name => @searched.contacts.first.name, :contact_id => contact_id, :number => @searched.contacts.first.phone, :email => @searched.contacts.first.email, :cell => @searched.contacts.first.cell, :fulladdress => @searched.contacts.first.Fulladdress)\n\n end\n\n\n respond_to do |format|\n if @searched.save\n format.html { redirect_to @searched, notice: 'Searched was successfully created.' }\n format.json { render :show, status: :created, location: @searched }\n else\n format.html { render :new }\n format.json { render json: @searched.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @person = Person.find(params[:person_id])\n @contact = Contact.start(@person, params[:contact])\n\n @event = event_for_person\n\n respond_to do |format|\n if @contact.save\n link = find_or_create_contact_link\n if @event\n format.html { redirect_to(select_instrument_contact_link_path(link.id), :notice => 'Contact was successfully created.') }\n else\n format.html { redirect_to(@person, :notice => 'Contact was successfully created.') }\n end\n\n format.json { render :json => @contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors }\n end\n end\n end", "def create\n Rails.logger.info \"Completed in #{contact_params}\"\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def contact_params\n params.require(:contact).permit(:first_name, :last_name, :contact_number, :active_status, :del_status, :region, :city, :town_id)\n end", "def save\n redirect(Contacts.r(:index)) if request.params['cancel'] == \"Cancel\"\n \n # Fetch the request data to use for a new or updated object\n data = request.subset(:first_name, :last_name, :email, :phone,\n :rating, :source, :public)\n extra = request.subset(:campaign_to, :assigned_to, :account_to)\n # p extra\n data['campaign_id'] = Campaign[:name=>extra['campaign_to']].id\n data['assigned_id'] = User[:email=>extra['assigned_to']].id if extra['assigned_to']\n data['account_id'] = Account[:name=>extra['account_to']].id if extra['account_to']\n if data['public'].nil?\n data['public'] = 0\n else\n data['public'] = 1\n end\n data['full_name'] = data['last_name'] + \", \" + data['first_name']\n id = request.params['id']\n data['user_id'] = user.id\n p data\n # If an ID is given it's assumed the user wants to edit an existing Contact,\n # otherwise a new one will be created.\n if !id.nil? and !id.empty?\n @contact = Contact[id]\n\n # Let's make sure the Contact is valid\n if @contact.nil?\n flash[:error] = 'The specified Contact is invalid...'\n redirect_referrer\n end\n success = 'The Contact has been updated'\n error = 'The Contact could not be updated'\n # Create a new object\n else\n @contact = Contact.new\n success = 'The Contact has been successfully created'\n error = 'The Contact could not be created'\n end\n\n # Time to actually insert/update the data\n begin\n # If the object doesn't exist, it will be automatically created\n @contact.update(data)\n\n flash[:success] = success\n\n # Redirect the user back to the correct page.\n redirect(Contacts.r(:index)) \n rescue => e\n Ramaze::Log.error(e)\n\n # Store the submitted data and the errors. The errors are used by BlueForm\n flash[:form_data] = @contact\n flash[:form_errors] = @contact.errors\n flash[:error] = error\n\n redirect_referrer\n end\n end", "def add_list_contact(list_id, params = {})\n contact_params = Resources::Contacts.build(params)\n request = @request.get(self_path, params.merge(list_id: list_id, **contact_params))\n response = Response.new(request).parse\n if response[:status] == 'error'\n raise Errors::UnprocessableEntityError.new, response[:message]\n end\n end", "def create\n\n\t\tlocations = params[:contact][:locations] ? params[:contact][:locations].join(\", \"): \"\"\n\t\tnew_contact = contact_params\n\t\tnew_contact[:locations] = locations\n\t\t@contact = Contact.new(new_contact)\t\t\n\t\t\n\n ContactMailer.contact_email(@contact).deliver\n redirect_to contact_path, notice: 'Sent successfully'\n end" ]
[ "0.6605225", "0.63128066", "0.6236456", "0.62179726", "0.6161837", "0.6120184", "0.6045358", "0.604509", "0.5956315", "0.59332", "0.5925741", "0.5923131", "0.58933395", "0.589315", "0.5890042", "0.5871507", "0.58490944", "0.5805748", "0.57989794", "0.5794468", "0.579427", "0.5758791", "0.57496667", "0.57415724", "0.5736823", "0.57320255", "0.57217073", "0.57076514", "0.5652182", "0.563531", "0.5613399", "0.55943435", "0.55909383", "0.5588308", "0.5587016", "0.55867565", "0.55839515", "0.55683243", "0.5563267", "0.5560505", "0.5529669", "0.5518851", "0.5490436", "0.54878277", "0.54867357", "0.54721516", "0.5463298", "0.54626733", "0.54582596", "0.5457769", "0.5452824", "0.54438", "0.54408854", "0.5438333", "0.54375696", "0.53974164", "0.53940797", "0.53918433", "0.53737706", "0.53633696", "0.5360173", "0.5360086", "0.53594255", "0.5353836", "0.53516185", "0.53459984", "0.5344386", "0.53443146", "0.5328545", "0.5327102", "0.53146106", "0.5314209", "0.52954507", "0.5289666", "0.5284918", "0.5280778", "0.5278733", "0.5270293", "0.5264741", "0.5263517", "0.52598107", "0.5256172", "0.52557915", "0.5246244", "0.52443284", "0.5241428", "0.52386403", "0.52352256", "0.52345264", "0.5231316", "0.5231252", "0.5230897", "0.5227353", "0.5226212", "0.52253366", "0.5225198", "0.5225105", "0.52247196", "0.5221076", "0.5220795" ]
0.7248378
0
PUT /traded_contacts/1 PUT /traded_contacts/1.json
def update @traded_contact = TradedContact.find(params[:id]) respond_to do |format| if @traded_contact.update_attributes(params[:traded_contact]) format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @traded_contact.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_contacts(contacts)\n b = Builder::XmlMarkup.new\n request_xml = b.Contacts {\n contacts.each do | contact |\n contact.to_xml(b)\n end\n }\n\n response_xml = http_post(@client, \"#{@xero_url}/Contacts\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'POST/contacts'})\n response.contacts.each_with_index do | response_contact, index |\n contacts[index].contact_id = response_contact.contact_id if response_contact && response_contact.contact_id\n end\n response\n end", "def create\n @traded_contact = TradedContact.new(params[:traded_contact])\n\n respond_to do |format|\n if @traded_contact.save\n format.html { redirect_to @traded_contact, notice: 'Traded contact was successfully created.' }\n format.json { render json: @traded_contact, status: :created, location: @traded_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @traded_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @traded_contact = TradedContact.find(params[:id])\n @traded_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to traded_contacts_url }\n format.json { head :no_content }\n end\n end", "def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end", "def update_contact(companyId, id, model) path = \"/api/v2/companies/#{companyId}/contacts/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n @contact = current_user.contacts.find(params[:id])\n @contact.update_attributes(params[:contact])\n end", "def update_contacts(params)\n params[:types] = index_array(params[:types])\n\n params[:contact_set] = params.delete :contacts\n params[:key] = 'attributes'\n\n run_command :update_contacts, :domain, params\n end", "def new\n @traded_contact = TradedContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traded_contact }\n end\n end", "def show\n @traded_contact = TradedContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traded_contact }\n end\n end", "def update_contact\n @contact = Contact.find(params[:id])\n @contact.update(params[:contact])\n redirect \"/contacts/#{@contact.id}\"\nend", "def upsert(list_id, contact)\n post @endpoint, params = {:list_id => list_id, :contacts => [contact]}\n end", "def contacts\r\n @contact = @customer.contact_people.find_by_id params[:id]\r\n \r\n # Delete contact\r\n if @contact && params[:method] == \"delete\"\r\n @store_user.my_account_log(@contact,\"Delete Contact #{@contact.name}\")\r\n @contact.destroy\r\n @customer.update_ax( :contacts => [@contact] )\r\n redirect_to :id => nil\r\n end\r\n \r\n # Add or update contact\r\n if request.post? && params[:contact]\r\n @contact ||= @customer.contact_people.build\r\n @contact.attributes = params[:contact]\r\n if @contact.save\r\n redirect_to :id => nil\r\n else\r\n @customer.contact_people.delete @contact\r\n render\r\n end\r\n \r\n # Synchronize customer\r\n @customer.update_ax( :contacts => [@contact] ) if @contact.errors.empty?\r\n @store_user.my_account_log(@contact,\"Add or Update Contact #{@contact.name}\")\r\n end\r\n end", "def update\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n return\n end\n\n #really update the contacts\n contact = UrContact.find(params[:id])\n\n #can't dlete contact you don't own\n if contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to update contact you don't own\"\n head :internal_server_error\n return\n end\n\n if contact.update_attributes(contact_params) then\n render json: contact\n else\n head :internal_server_error\n end\n end", "def update_contact_in_salesforce\n \tsf = Salesforce::API.connect_to_salesforce\n \tcontact_id = self.sf_contact_id\n \tsf.update(\n \"Contact\",\n Id: \"#{contact_id}\",\n Name: \"#{self.first_name}\",\n Email: \"#{self.email}\",\n )\n end", "def put_contacts_id_with_http_info(id, contacts, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.put_contacts_id ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ContactsApi.put_contacts_id\"\n end\n # verify the required parameter 'contacts' is set\n if @api_client.config.client_side_validation && contacts.nil?\n fail ArgumentError, \"Missing the required parameter 'contacts' when calling ContactsApi.put_contacts_id\"\n end\n # resource path\n local_var_path = '/contacts/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(contacts) \n\n # return_type\n return_type = opts[:return_type] || 'Contact' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#put_contacts_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def modify_contact\n\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end", "def contacts\r\n\r\n end", "def update\n @contact = Contact.find(params[:id])\n\n # respond_to do |format|\n if @contact.update_attributes(params[:contact])\n # format.html { redirect_to(@contact, :notice => 'Contact was successfully updated.') }\n # format.xml { head :ok }\n render :json => { :success => true, :message => \"Created new client #{@contact.id}\", :contact => @contact }\n else\n render :json => { :success => false, :message => \"Failed to create contact\"}\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n # end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update fields\n self.contact = @nimble.put \"contact/#{self.id}\", { fields: fields }\n return nil unless self.contact\n self\n end", "def change_primary_contact\n Account.transaction do\n @account||=Account.find(params[:id])\n if request.get?\n @primary_contact = Contact.find(@account.primary_contact_id) if @account.primary_contact_id \n render :action=>:change_primary_contact, :layout =>false\n end\n if request.put?\n begin \n @account.update_attribute(:primary_contact_id, params[:new_account_contact][:id])\n rescue\n end \n flash[:notice] =\"Primary #{t(:text_contact)} #{t(:text_updated)} For #{@account.name}\"\n redirect_to :back\n end\n end\n end", "def update_for_current\n\n # 1) find recipient\n recipient = Recipient.find(params[:id])\n\n # 2) update first / last name\n first_name = params[:first_name]\n last_name = params[:last_name]\n recipient.update_columns(\n first_name: params[:first_name],\n last_name: params[:last_name]\n )\n\n puts params.inspect\n\n # 3) update recipient addresses\n \n # delete all addresses then insert\n recipient.addresses.delete_all\n addresses = params[:addresses]\n if addresses\n\n primary_set = false\n addresses.each do |address|\n address = recipient.addresses.new(\n first_name: first_name,\n last_name: last_name,\n street: address[:street],\n city: address[:city],\n suite: address[:suite],\n state: address[:state],\n zipcode: address[:zipcode],\n )\n if address.save\n unless primary_set\n address.set_primary\n primary_set = true\n end\n end\n end\n end\n\n # 4) save recipient occasions\n # our update will be to delete all occasions then create new ones\n \n recipient.occasions.delete_all # delete all then re-insert\n occasions = params[:occasions]\n if occasions\n occasions.each do |occasion|\n\n occasion_id = occasion[:recipient_occasion][:occasion_id]\n day = occasion[:recipient_occasion][:day]\n month = occasion[:recipient_occasion][:month]\n notes = occasion[:recipient_occasion][:notes]\n\n recipient.recipient_occasions.create(\n occasion_id: occasion_id,\n day: day,\n month: month,\n notes: notes\n )\n end\n end\n\n respond_to do |format|\n format.json { render json: recipient }\n end\n end", "def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def update\n if @contact.update(contact_params)\n fresh_when(@contact)\n render json: @contact, status: :ok, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end", "def post_contacts_with_http_info(contacts, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.post_contacts ...'\n end\n # verify the required parameter 'contacts' is set\n if @api_client.config.client_side_validation && contacts.nil?\n fail ArgumentError, \"Missing the required parameter 'contacts' when calling ContactsApi.post_contacts\"\n end\n # resource path\n local_var_path = '/contacts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(contacts) \n\n # return_type\n return_type = opts[:return_type] || 'Contact' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#post_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @reminder = Reminder.find(params[:id])\n\n $current_contact_list = params[:contact_number_list]\n $previous_contact_list = @reminder.schedule_contacts.map {|contact| contact.contact_no.to_s}\n \n @common_contacts = ($current_contact_list & $previous_contact_list)\n \n # delete contacts\n @delete_contacts = $previous_contact_list - @common_contacts\n if !@delete_contacts.blank?\n\t@delete_contacts.each do |contact|\n\t\[email protected]_contacts.delete(ScheduleContact.where(\"contact_no = ? AND reminder_id = ?\", contact, @reminder.id))\n\tend\n end\n \n # insert contacts\n @insert_contacts = $current_contact_list - @common_contacts\n if !@insert_contacts.blank?\n\t@insert_contacts.each do |contact|\n\t\t@i = params[:contact_number_list].index(contact)\n\t\[email protected]_contacts.create(:name => params[:contact_number_name_list][@i], :contact_no => contact, :status => \"Pending\")\n\tend\n end\n\n\n respond_to do |format|\n if @reminder.update_attributes(params[:reminder])\n format.html { redirect_to reminders_path, notice: 'Reminder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reminder.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_contacts\n \tap \"adding contacts\"\n # asking whether we are already authorized\n AddressBook.request_authorization unless AddressBook.authorized?\n\n \n if AddressBook.authorized?\n 25.times do\n person = AddressBook::Person.create(\n :first_name => Forgery::Name.first_name, \n :last_name => Forgery::Name.last_name, \n :email => [{ :value => Forgery(:internet).email_address , :label => 'Home'}], :phones => [{ :value => rand(10 ** 10).to_s, :label => 'Mobile'}])\n end\n else\n #ap \"This app is not authorized to access the address book.\"\n end\n #enVd\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @contact = Contact.find(params[:id])\n @contact.person_id = nil if params[:contact][:person_name].present?\n respond_to do |format|\n if @contact.update_attributes(params[:contact].merge(:updated_by => current_user.id))\n format.html { redirect_to client_contacts_path(@firm), :notice => \"#{ Contact.model_name.human } успешно изменен.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_contact\n @category = \"Contact\"\n @contact = resource_owner.contacts.find(params[:id])\n end", "def update\n contact = Contact.find(params[:id])\n\n if contact.user_id == current_user.id\n contact.update_attributes(params[:contact])\n render json: contact\n else\n render text: \"That's not your contact!\"\n end\n end", "def update_contact(id, params)\n put(\"contacts/#{id}\", contact: params)\n end", "def update\n @contact = @business.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(contact_params || {})\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_contact\n @contact = current_user.contacts.find(params[:id])\n end", "def save\n redirect(Contacts.r(:index)) if request.params['cancel'] == \"Cancel\"\n \n # Fetch the request data to use for a new or updated object\n data = request.subset(:first_name, :last_name, :email, :phone,\n :rating, :source, :public)\n extra = request.subset(:campaign_to, :assigned_to, :account_to)\n # p extra\n data['campaign_id'] = Campaign[:name=>extra['campaign_to']].id\n data['assigned_id'] = User[:email=>extra['assigned_to']].id if extra['assigned_to']\n data['account_id'] = Account[:name=>extra['account_to']].id if extra['account_to']\n if data['public'].nil?\n data['public'] = 0\n else\n data['public'] = 1\n end\n data['full_name'] = data['last_name'] + \", \" + data['first_name']\n id = request.params['id']\n data['user_id'] = user.id\n p data\n # If an ID is given it's assumed the user wants to edit an existing Contact,\n # otherwise a new one will be created.\n if !id.nil? and !id.empty?\n @contact = Contact[id]\n\n # Let's make sure the Contact is valid\n if @contact.nil?\n flash[:error] = 'The specified Contact is invalid...'\n redirect_referrer\n end\n success = 'The Contact has been updated'\n error = 'The Contact could not be updated'\n # Create a new object\n else\n @contact = Contact.new\n success = 'The Contact has been successfully created'\n error = 'The Contact could not be created'\n end\n\n # Time to actually insert/update the data\n begin\n # If the object doesn't exist, it will be automatically created\n @contact.update(data)\n\n flash[:success] = success\n\n # Redirect the user back to the correct page.\n redirect(Contacts.r(:index)) \n rescue => e\n Ramaze::Log.error(e)\n\n # Store the submitted data and the errors. The errors are used by BlueForm\n flash[:form_data] = @contact\n flash[:form_errors] = @contact.errors\n flash[:error] = error\n\n redirect_referrer\n end\n end", "def update\n respond_to do |format|\n if @subcontractor_contact.update(subcontractor_contact_params)\n format.html { redirect_to @subcontractor_contact, notice: 'Subcontractor contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @subcontractor_contact }\n else\n format.html { render :edit }\n format.json { render json: @subcontractor_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_contact(contact)\n raise \"contact_id or contact_number is required for updating contacts\" if contact.contact_id.nil? and contact.contact_number.nil?\n \n request_xml = contact.to_xml\n response_xml = http_post(\"#{@xero_url}/contact\", request_xml, {})\n\n parse_response(response_xml, :request_xml => request_xml)\n end", "def sync_contact(params)\n post('contact/sync', contact: params)\n end", "def update\n @crm_contact = CrmContact.find(params[:id])\n\n respond_to do |format|\n if @crm_contact.update_attributes(params[:crm_contact])\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params[:client][:contact_ids] ||= []\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_contact(token, payload, id, user = nil)\n request_url = user_context(user) << \"/Contacts/\" << id\n\n update_contact_response = make_api_call \"PATCH\", request_url, token, nil, payload\n\n parse_response(update_contact_response)\n end", "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end", "def update_source_contact(id, data)\n update(\"sourceContacts\", id, data).first\n end", "def update!(**args)\n @contact = args[:contact] if args.key?(:contact)\n end", "def create\n @contact = current_user.contacts.new(name:params[:name], email:params[:email])\n @contact = current_user.contacts.new(params[:contact])\n @server_id = params[:server_id].to_i\n @contact.save\n end", "def add_contacts \n params[:contact_ids] = params[:contact_ids][0].split(', ')\n contacts = current_user.contacts.find(params[:contact_ids]) \n @notification = current_user.notifications.find(params[:id])\n \n contacts = contacts.collect{|el| @notification.contacts.include?(el) ? nil : el}.compact\n contacts.each do |el|\n @notification.receipients.create( :contact_id => el.id, :status => 'active' )\n end\n \n render :update do |page| \n page.redirect_to(@notification)\n end \n end", "def add_contact(params={})\n @obj.put('add-contact', @auth.merge(params))\n end", "def update\n params[:collection_point][:contact_ids] = params[:collection_point][:contact_ids].first.split(\",\") if params[:collection_point][:contact_ids].present?\n\n @collection_point = CollectionPoint.find(params[:id])\n\n respond_to do |format|\n if @collection_point.update_attributes(params[:collection_point])\n @collection_point.delay.create_collection_point_tag_on_contacts\n format.html { redirect_to @collection_point, notice: 'Collection point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_list_contacts(list_ids, params = {})\n contact_params = params[:contacts].each_with_object({}).with_index do |(value, hash), index|\n hash[index.to_s.to_sym] = value\n end\n request = @request.post(self_path, {\n list_ids: list_ids.join(','),\n contact: contact_params,\n **params.except(:contacts)\n })\n response = Response.new(request).parse\n if response[:status] == 'error'\n raise Errors::UnprocessableEntityError.new, response[:message]\n end\n end", "def set_team_contacts\n @team = Team.find(params[:id])\n end", "def update\n @contact = Contact.find(params[:id])\n\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def modify_contact\n # prompt user for id\n puts \"What id to modify?\"\n id = gets.chomp.to_i\n # get contact from rolodex\n contact = @rolodex.get_contact_by_id(id)\n # call modify\n modify(contact)\n end", "def update\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize @contact\n\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to success_path(contact_path(@contact), contact_path(@contact, @shared_user)), flash: { success: 'Contact was successfully updated.' } }\n format.json { render :show, status: :ok, location: @contact }\n else\n error_path(:edit)\n format.html { render controller: @path[:controller], action: @path[:action], layout: @path[:layout] }\n format.json { render json: @contact.errors , status: :unprocessable_entity }\n end\n end\n end", "def add_contact(contact)\n\t\tcontact.id = @@ids\n\t\t@contacts << contact \n\t\t@@ids += 1\n\t\tcontact\n\tend", "def set_tfp_contact\n user_company = UserCompany.find(params[:user_company_id]) if params[:user_company_id].present?\n @log_msg = \"Contact \" + params[:user_company][:clientcontact].to_s + \" marked/unmarked as TFP Contact by user \" + current_user.id.to_s if user_company.present? && params[:user_company].present? && user_company.update_attributes(params[:user_company])\n \n company = UserCompany.find(params[:user_company_id]).company\n return render :partial => \"contacts\", :locals => {:company_contacts => company.contacts, :company => company}\n end", "def update_shared_contact(_contact, _entity, _supplier)\n _contact.attributes = { first_name: first_name, last_name: last_name, company: _entity.company,\n fiscal_id: fiscal_id, street_type_id: _supplier.street_type_id, street_name: _supplier.street_name,\n street_number: _supplier.street_number, building: _supplier.building, floor: _supplier.floor,\n floor_office: _supplier.floor_office, zipcode_id: _supplier.zipcode_id, town_id: _supplier.town_id,\n province_id: _supplier.province_id, country_id: _supplier.country_id, phone: phone,\n extension: extension, fax: _supplier.fax, cellular: cellular,\n email: email, shared_contact_type_id: 2, region_id: _supplier.region_id,\n organization_id: organization_id, created_by: created_by, updated_by: updated_by,\n position: position }\n _contact.save\n return _contact \n end", "def ur_contact_update\n #skip if all three field are empty\n if params[:ur_contact][:name].blank? && params[:ur_contact][:email].blank? && params[:ur_contact][:telephone].blank? then\n Rails.logger.info \"Zero info on contact for reservation #{params[:user_reservation_id]}. Skipping...\"\n head :ok\n return\n end\n\n #skip if there's no name\n if params[:ur_contact][:name].blank? then\n Rails.logger.info \"Name field is blank. Skipping...\"\n end\n\n #load the user reservation\n ur = UserReservation.find(params[:user_reservation_id])\n\n #skip if the reservation method is online\n if ur.online? then\n Rails.logger.info \"Reservation #{params[:user_reservation_id]} is created online. Skipping...\"\n head :ok\n return\n end\n\n #scenario #1a: ur_contact id is detected\n if !params[:ur_contact][:id].empty? then\n Rails.logger.info \"Linking contact #{params[:ur_contact][:id]} to reservation #{params[:user_reservation_id]}...\"\n\n ur.update_attributes({contact_id:params[:ur_contact][:id], contact_type:params[:ur_contact][:type]})\n\n head :accepted\n return\n end\n\n #screnario #2: current ur has a contact_id, check if it's big change or not\n # if the name is the same, just update the email/telephone, otherwise go to\n if !ur.contact_id.blank? && params[:ur_contact][:id].empty? then\n if ur.contact.name == params[:ur_contact][:name] then\n #sanity checks, the contact type is UrContact and you own it\n if ur.contact_type == \"UrContact\" then\n UrContact.transaction do\n ur.contact.update_attributes({email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n end\n head :accepted\n return\n else\n head :ok\n return\n end\n end\n end\n\n #screnario #3: no current contact, or the chages are too big\n # default screnario is to create a new contact and link it\n Rails.logger.info \"Creating new contact for reservation #{params[:user_reservation_id]}...\"\n UrContact.transaction do\n #create the ur contact\n urContact = current_user.ur_contacts.new({name:params[:ur_contact][:name],\n email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n if urContact.save then\n ur.update_attributes({contact_id:urContact.id, contact_type:\"UrContact\"})\n head :created\n return\n else\n render json: {errors:urContact.errors.messages}, status: :internal_server_error\n end\n end\n\n end", "def update_contact\n # @sample_2 = sample_2.find(params[:id])\n # @sample_2.update(params[:sample_2])\n # redirect \"/sample_2/#{@sample_2.id}\"\nend", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def delete_contacts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.delete_contacts ...\"\n end\n # resource path\n local_var_path = \"/contacts/delete\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"listId\"] = opts[:'list_id'] if !opts[:'list_id'].nil?\n form_params[\"contactIds\"] = opts[:'contact_ids'] if !opts[:'contact_ids'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#delete_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_contact(ownnick, person)\n return ret_fail('can not add yourself') if person == ownnick #you cant add yourself !\n\n usr = User.first(:nickname=>person)\n return ret_fail('no such user') if usr == nil #user does not exist !\n\n ownusr = User.first(:nickname => ownnick) #get own record to get the contact list\n return ret_fail('already in list') if ownusr.contacts.first(:userid => usr.id) != nil\n\n c = ownusr.contacts.new\n c.userid = usr.id\n puts usr.id\n puts c.userid\n c.authgiven = 'f'\n c.save\n\n return ret_success\nend", "def update\n @contact = Contact.find(params[:id])\n\n if @contact.update_attributes(params[:contact])\n redirect_to contacts_path, notice: '联系人更新成功'\n else\n render action: \"edit\"\n end\n end", "def index\n @contacts = @client.contacts\n end", "def update\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(contacts_url, :notice => t('contacts.was_updated.')) }\n format.json { head :ok }\n format.js { render 'success' }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n format.js { render 'failure' }\n end\n end\n end", "def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n params[:ur_contact].delete(:id)\n newContact = current_user.ur_contacts.new(contact_params)\n\n if newContact.save then\n render json: newContact\n else\n Rails.logger.info \"Error when creating contacts #{newContact.errors.messages}\"\n head :internal_server_error\n return\n end\n end", "def create_list\n # First delete all current contacts for this user (no overlapping contacts)\n Contact.delete_all(\"user_id = #{current_user.id}\")\n \n # Parse the list (json encoded) and create individual contact entries\n if params[:contacts].nil? || params[:contacts].empty?\n return render :status => 170, :json => {:message => 'Contacts are missing.'}\n end\n contacts = ActiveSupport::JSON.decode(CGI::unescape(params[:contacts]))\n \n total_saved = 0\n contacts.each do |contact|\n # Verify this contact has all required params\n next if (!contact.key?('name') || !contact.key?('email') || !contact.key?('source'))\n\n # Create new contact entry\n Contact.create({\n :user_id => current_user.id,\n :name => contact['name'],\n :email => contact['email'],\n :source => contact['source']\n })\n\n total_saved += 1\n end\n\n render :status => 200, :json => {:message => \"Contacts saved successfully (#{total_saved} of #{contacts.size}).\"}\n end", "def update_contact(list_id, email, attributes={})\n endpoint = \"/api/v1/list/#{list_id}/update-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email,\n 'attributes' => attributes\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def update\n @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = @current_affiliate_group.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n flash[:notice] = 'Contact was successfully updated.'\n format.html { redirect_to(@contact) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contact_partner = ContactPartner.find(params[:id])\n\n respond_to do |format|\n if @contact_partner.update_attributes(params[:contact_partner])\n format.html { redirect_to @contact_partner, notice: 'Ansprechpartner wurde erfolgreich bearbeitet.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact_partner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_contact\n @contact = Contact.find(params[:contact_id])\n\nend", "def update\n @person_contact = PersonContact.find(params[:id])\n\n respond_to do |format|\n if @person_contact.update_attributes(params[:person_contact])\n format.html { redirect_to(@person_contact, :notice => 'Person contact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_contact\n load_user\n @contact = @user.contacts.find(params[:id])\n end", "def save_enriched_contact(list_id, contact_id)\n post(\"contactLists/#{list_id}/#{contact_id}/enriched\")\n end", "def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_contact_params=contact_params\n new_contact_params[:name]=params[:name]\n new_contact_params[:phone]=params[:phone]\n new_contact_params[:reason]=params[:reason]\n new_contact_params[:email]=params[:email]\n\n contact_params=new_contact_params\n end\n\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_contact\n # hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.update_attributes(contact_params)\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact has successfully been updated!' }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { redirect_to contacts_admin_seller_path(@seller), notice: 'Contact failed to be saved!' }\n format.json { render :contacts, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend", "def action_activate_contacts_with_http_info(list_id, activate_contacts_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_activate_contacts ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_activate_contacts\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_activate_contacts, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'activate_contacts_request' is set\n if @api_client.config.client_side_validation && activate_contacts_request.nil?\n fail ArgumentError, \"Missing the required parameter 'activate_contacts_request' when calling ContactsApi.action_activate_contacts\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/activate'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(activate_contacts_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_activate_contacts\",\n :header_params => 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: ContactsApi#action_activate_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n if @crm_contact_info.update_attributes(params[:crm_contact_info])\n format.html { redirect_to @crm_contact_info, notice: 'Crm contact info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crm_contact_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end", "def action_update_contacts_with_http_info(list_id, update_contacts_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_update_contacts ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_update_contacts\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_update_contacts, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'update_contacts_request' is set\n if @api_client.config.client_side_validation && update_contacts_request.nil?\n fail ArgumentError, \"Missing the required parameter 'update_contacts_request' when calling ContactsApi.action_update_contacts\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/update'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(update_contacts_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_update_contacts\",\n :header_params => 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: ContactsApi#action_update_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_contact\n @contact = Contact.find(params[:id])\n\n end", "def update\n @contact_detail.update(contact_detail_params)\n @contact_details = ContactDetail.all\n @contact_detail = ContactDetail.new \n end", "def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end", "def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end", "def update_subscriptions_from_account \n contacts = params[:contacts]\n contacts_subscribing = params[:subscribers].is_a?(Hash) ? params[:subscribers].keys : []\n contacts_unsubscribing = params[:contacts] - contacts_subscribing\n \n # subscribe these contacts\n contacts_subscribing.each do |c_id|\n begin\n Case_Watcher.create_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't create subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n\n # unsubscribe these contacts\n contacts_unsubscribing.each do |c_id|\n begin\n Case_Watcher.remove_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't remove subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n \n redirect_to :action => 'account', :id => @account, :notice => \"Account subscriptions updated.\"\n end", "def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html{redirect_to([@scenario, @contact], notice: 'Contact was successfully updated.')}\n format.json{render :show, status: :ok, location: @contact}\n else\n format.html{redirect_to :back, flash: {error: \"Error saving contact\"}}\n format.json{render json: @contact.errors, status: :unprocessable_entity}\n end\n end\n end", "def contact_added(freshdesk_data)\n\t response = HTTParty.post(\n\t \"#{@api_domain}contacts\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def update\n @contact = Contact.find(params[:id])\n \n if @contact.update_attributes(params[:contact])\n redirect_to contacts_url, notice: 'Contact was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def update_shared_contact(_contact, _entity)\n _contact.attributes = { first_name: first_name, last_name: last_name, company: company,\n fiscal_id: fiscal_id, street_type_id: street_type_id, street_name: street_name,\n street_number: street_number, building: building, floor: floor,\n floor_office: floor_office, zipcode_id: zipcode_id, town_id: town_id,\n province_id: province_id, country_id: country_id, phone: phone,\n extension: _entity.extension, fax: fax, cellular: cellular,\n email: email, shared_contact_type_id: 3, region_id: region_id,\n organization_id: organization_id, updated_by: updated_by }\n _contact.save\n return _contact\n end", "def update\n @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end", "def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.64655876", "0.63682073", "0.62679166", "0.6263075", "0.615947", "0.60822165", "0.606527", "0.60127795", "0.5910292", "0.59077436", "0.58503604", "0.584946", "0.58452976", "0.5835972", "0.5797832", "0.5797656", "0.5741505", "0.57066053", "0.57032037", "0.5684102", "0.5653388", "0.564973", "0.56487626", "0.56431663", "0.5625667", "0.5610239", "0.5608532", "0.5602177", "0.5573337", "0.5566432", "0.5560812", "0.55520236", "0.55473113", "0.55468404", "0.5533087", "0.55183125", "0.5482542", "0.54796124", "0.5476083", "0.5474278", "0.54629785", "0.5455244", "0.54525965", "0.5450507", "0.544694", "0.5436704", "0.54326683", "0.543117", "0.5430191", "0.5429932", "0.5424032", "0.5410668", "0.54032433", "0.5387532", "0.5365212", "0.5361316", "0.5356491", "0.53506863", "0.5344308", "0.5341351", "0.5340206", "0.533768", "0.53376424", "0.5335518", "0.5333969", "0.5332518", "0.53175163", "0.531151", "0.5306884", "0.53050447", "0.53003985", "0.52979195", "0.52864", "0.528422", "0.5278468", "0.5276922", "0.5276731", "0.52755696", "0.52599317", "0.5256371", "0.5249104", "0.5245184", "0.52421737", "0.5238396", "0.5235728", "0.5232959", "0.5228568", "0.52283216", "0.52273446", "0.52243996", "0.52243996", "0.52243996", "0.5222983", "0.5222224", "0.5220337", "0.5214556", "0.5213938", "0.5209935", "0.52074355", "0.52045757" ]
0.7031796
0
DELETE /traded_contacts/1 DELETE /traded_contacts/1.json
def destroy @traded_contact = TradedContact.find(params[:id]) @traded_contact.destroy respond_to do |format| format.html { redirect_to traded_contacts_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(contactname)\n\n end", "def destroy\n Conshejointable.where(:contact_id =>@contact.id).delete_all\n Description.where(:contact_id =>@contact.id).delete_all\n puts @contact.id.to_s + \": \" + @contact.name\n @contact.delete\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(contacts)\n @@contacts.delete(contact)\n end", "def destroy\n @contact.destroy\n render json: {status: 204}\n end", "def delete(options={})\n options.merge!({:basic_auth => Client.credentials})\n self.class.delete(\"#{Client.base_uri}/contacts/#{id}.json\", options)\n end", "def destroy\n @contact.destroy\n #Contact.delete(@contact.id)\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = @business.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to business_contacts_url(@business) }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n render json:Contact.all\n end", "def delete_contact(params={})\n @obj.delete('delete-contact', @auth.merge(params))\n end", "def destroy\n remove_contacts_dependencies\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crm_contact = CrmContact.find(params[:id])\n @crm_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to crm_contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n\n @contact.destroy\n #@contact.version\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def delete\n @@contacts.delete(self)\n end", "def delete\n @@contacts.delete(self)\n end", "def delete id=nil\n id ||= self.id\n @nimble.delete \"contact/#{id}\"\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n DNSimple::Client.delete(\"/v1/contacts/#{id}\", options)\n end", "def delete(id)\n results = connection.exec_params('DELETE FROM contacts WHERE id=$1;', [id]) \n end", "def delete\n\t\t#@@contacts -= [delete_id.to_i]\n\t\t@@contacts.delete(self)\n\tend", "def destroy\n @entity_contact = EntityContact.find(params[:id])\n @entity_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_contact }\n end\n end", "def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to client_contacts_path(@firm), :notice => \"'#{ Contact.model_name.human } удален.'\" }\n format.json { head :ok }\n end\n end", "def delete_contact(contact_to_delete)\n @contacts.delete(contact_to_delete)\n end", "def destroy\n @corp_contact = CorpContact.find(params[:id])\n @corp_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to corp_contacts_url,\n notice: (crud_notice('destroyed', @corp_contact) + \"#{undo_link(@corp_contact)}\").html_safe }\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 @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subcontractor_contact.destroy\n respond_to do |format|\n format.html { redirect_to subcontractor_contacts_url, notice: 'Subcontractor contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n ur_contact = UrContact.find(params[:id])\n\n #you can delete contacts you don't own\n if ur_contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to delete contact you don't own\"\n head :internal_server_error\n return\n end\n\n if ur_contact.destroy then\n render json: {message:'Content Deleted'}\n else\n head :internal_server_error\n end\n end", "def destroy\n @contact = @detail.contact\n @detail.destroy\n respond_to do |format|\n format.html { redirect_to @contact, notice: 'Detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def contact_delete(handle)\n query 'contact-delete', { handle: handle }\n end", "def destroy\n @contact = @current_affiliate_group.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact.destroy\n\n head :no_content\n end", "def destroy\n @contact.destroy\n Cashier.expire \"contacts-filter-#{current_user.id}\"\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_contact\n contact = retrieve_contact_by_email\n if contact\n if @rolodex.delete(contact)\n puts \"Contact successfully deleted.\"\n end\n end\n end", "def delete_contact(id)\n delete(\"contacts/#{id}\")\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: t('controllers.contacts.people.destroy.success') }\n format.json { head :no_content }\n end\n end", "def bulk_delete\n contact_ids = []\n contact_params[:contact_ids].each do |cid|\n contact_ids << BSON::ObjectId.from_string(cid)\n end\n\n deleted = Contact.where(uid: current_user.id).in(:_id => contact_ids).delete_all\n\n Cashier.expire \"contacts-filter-#{current_user.id}\"\n notice = \"#{deleted} #{(t :contacts_deleted)}\"\n\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: notice }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad_contact = AdContact.find(params[:id])\n @ad_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contactable = find_contactable\n @contactable.contactos.find(params[:id]).destroy\n respond_to do |format|\n format.html { head :ok}\n # format.html { redirect_to @contactable }\n #format.json { head :ok }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to scenario_contacts_url(@scenario), notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(contact)\n @@contacts.delete(contact)\n end", "def destroy\n @member_contact.destroy\n respond_to do |format|\n format.html { redirect_to member_contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact_request = ContactRequest.find(params[:id])\n @contact_request.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @func_contact = FuncContact.find(params[:id])\n @func_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(func_contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person_contact = PersonContact.find(params[:id])\n @person_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @unclean_contact_history.destroy\n respond_to do |format|\n format.html { redirect_to contact_histories_url, notice: 'Contact history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n head :no_content\n end", "def destroy\n @point_of_contact.destroy\n\n head :no_content\n end", "def destroy\n @test_contact_detail.destroy\n respond_to do |format|\n format.html { redirect_to test_contact_details_url, notice: 'Test contact detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @contact.destroy\n payload = {\n success: { full_messages: [\"deleted id[#{params[:id]}]\"] }\n }\n render json: payload, status: :ok\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end", "def delete\n Contact.all.delete(self)\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n \n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @referral_contact.destroy\n end", "def destroy\n @crm_contact_info = CrmContactInfo.find(params[:id])\n @crm_contact_info.destroy\n @crm_contact=@crm_contact_info.crm_contact\n\n # respond_to do |format|\n # format.html { redirect_to crm_contact_infos_url }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to @contact, notice: \"contact has been deleted\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_contacts_url(customer) }\n format.json { head :ok }\n end\n end", "def delete_contact(id, options = {})\n delete \"contacts/#{id}\"\n end", "def destroy\n @contactinfo = Contactinfo.find(params[:id])\n @people_id = @contactinfo.people_id\n @contactinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to person_path(@people_id) }\n format.json { head :ok }\n end\n end", "def destroy\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n @request.destroy\n @requests = @contact.requests.last_requests\n\n respond_with @request do |format|\n format.html { redirect_to(contact_requests_path) }\n end\n end", "def destroy\n #@enc_contacto.contactos.each do |contacto|\n # contacto.destroy\n\n #end\n @enc_contacto.destroy\n\n respond_to do |format|\n format.html { redirect_to enc_contactos_url, notice: 'Enc contacto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to contacts_url }\n format.json { head :no_content }\n end\n end", "def delete_contacts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.delete_contacts ...\"\n end\n # resource path\n local_var_path = \"/contacts/delete\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"listId\"] = opts[:'list_id'] if !opts[:'list_id'].nil?\n form_params[\"contactIds\"] = opts[:'contact_ids'] if !opts[:'contact_ids'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#delete_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.73942363", "0.7232646", "0.70827925", "0.70704037", "0.70154643", "0.7007486", "0.6965657", "0.6905969", "0.68942845", "0.68882906", "0.68840176", "0.68840176", "0.68840176", "0.6853569", "0.68421364", "0.68375385", "0.68375385", "0.68368655", "0.6833954", "0.6826107", "0.6820867", "0.68206006", "0.68185115", "0.6814137", "0.6801568", "0.6800474", "0.67991644", "0.6794447", "0.67910314", "0.6790474", "0.6790474", "0.6790474", "0.6790474", "0.6789877", "0.67797977", "0.6777492", "0.67758363", "0.6772586", "0.67708826", "0.67533135", "0.6740627", "0.6739849", "0.6732567", "0.67252094", "0.6723274", "0.6715839", "0.67012036", "0.66979194", "0.66851836", "0.6675827", "0.6651234", "0.66382843", "0.66376454", "0.66350734", "0.6630612", "0.6605342", "0.6604397", "0.6601785", "0.66001505", "0.65981954", "0.65944153", "0.65927315", "0.6589737", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.6580978", "0.65792567", "0.65792567", "0.65792567", "0.65792567", "0.6570556", "0.6563456", "0.6551336", "0.6546845", "0.6539678", "0.6536894", "0.65226275" ]
0.7745995
0
Channels brakes Borsa Italiana
def filter_overResistanceBorsaItaliana @overResistanceStocksBorsaItaliana = @@SJA.select("stocks.isin, name, last_price, borsa_italiana_resistance").where("borsa_italiana_resistance > 0 AND last_price > borsa_italiana_resistance").order(:name) render json: @overResistanceStocksBorsaItaliana end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channels; end", "def cable; end", "def witcher; end", "def channels\n []\n end", "def circuit_breaker; end", "def each_channel(&block); end", "def pitch_bend( channel, value )\n message( PB | channel, value )\n end", "def part_all()\n @channels.clear()\n end", "def bury\n @channel_control.bury\n end", "def subscribe_to_channel; end", "def channelDown\n\t\t@previousChannel = @currentChannel\n\t\tif @currentChannel == @config.lowestChannel \n\t\t\t@currentChannel = @config.highestChannel\n\t\t\tlogStatus @previousChannel, @currentChannel\n\t\t\treturn\n\t\tend\n\t\tloop do\n\t\t\tbreak if [email protected]?(@currentChannel-=1)\n\t\tend\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def channels\r\n return @chanlist\r\n end", "def free_booth\n @booth = User.where(:id => params[:user_id]).first\n @invoice = @booth.cs_invoices.first\n if @invoice\n begin\n # terminated calls if any\n server_id, channel = params.values_at(:server, :channel)\n\n unless server_id.blank? or channel.blank?\n server = Server.where(:id => server_id.to_i).first\n\n if server\n server.ami_cmd(\"soft hangup #{channel}\")\n end\n\n MorLog.my_debug \"Hangup channel: #{channel} on server: #{server_id}\"\n end\n rescue Exception => e\n @status = _('Unable_to_terminate_calls_check_connectivity')\n end\n end\n render :layout=>false\n end", "def close\n @channels.each{|channel,omegle|\n omegle.send(\"You have been connected to a message bridge, which is now shutting down. Goodbye.\")\n omegle.disconnect\n }\n end", "def channels(*params)\n puts \"Channels:\"\n @channels.each do |channel|\n muted = @muted_channels.include?(channel)\n puts \"#{channel}#{muted ? \" (muted)\" : \"\"}\"\n end\n end", "def channels(*params)\n puts \"Channels:\"\n\n @channels.each do |channel|\n muted = @muted_channels.include?(channel)\n puts \"#{channel}#{muted ? ' (muted)' : ''}\"\n end\n end", "def channel_flow(active)\n subject.channel_flow(active)\n end", "def to_channel\n self\n end", "def broadcasting; end", "def unsubscribe_from_channel; end", "def initialize \n\t\t@config = nil\n\t\t@defaultChannel = 0\n\t\t@previousChannel = 0\n\t\t@currentChannel = 0\n\tend", "def broadcast(content)\n if content.include? \"\u001b[3;J\u001b[H\u001b[2J\"\n content = content.sub(\"\u001b[3;J\u001b[H\u001b[2J\", \"\")\n clearConsole\n sleep(0.2)\n end\n ActionCable.server.broadcast 'blackjack_channel', content: content\n end", "def decay_conversation\n # we half-life the conversation every minute\n units = (Time.now - @last_faded_weights)/60\n if units > 1 \n @last_faded_weights = Time.now \n if incoming_weight > 0 or outgoing_weight > 0\n @outgoing_weight /= (2**units) if outgoing_weight > 0\n @incoming_weight /= (2**units) if incoming_weight > 0\n end\n end\n end", "def broadcast_example_b1\n end", "def send_unban(channel, *masks)\n send_multiple_mode(channel, '-', 'b', masks)\n end", "def talk\n \n #\n # The Listening Proc\n # \n # This proc loopingly accepts a piping hot TiscapTransmission,\n # interprets it, and acts upon it. It almost never exits by itself,\n # but will sometimes call #graceful to cause itself to be\n # indirectly terminated.\n # \n Concurrent.ly do\n \n loop do\n begin # like ‘try’\n \n # If we're no longer accepting, stop reading now.\n break unless @accepting\n \n # Pull a Transmission off the wire.\n # Execution usually waits here.\n received = TiscapTransmission.from @iost\n \n # Now that we have a transmission, interpret it\n # based on the verb at hand:\n \n case received.verb\n \n when :'/private' # Deliver a private message.\n \n raise BadSyntaxError.new unless username_arg_ok? received.argument\n raise BadSyntaxError.new if received.data.nil?\n \n # all messages go over the MessageDispatch Hub.\n MessageDispatch.hub.send_private received.argument, received.data, self.name\n \n \n when :'/public' # Broadcast a public message.\n \n raise BadSyntaxError.new unless received.argument.nil?\n raise BadSyntaxError.new if received.data.nil?\n \n # even public messages go over the MessageDispatch Hub.\n MessageDispatch.hub.send_public received.data, self.name\n \n \n when :'/users' # Prepare and send back the active user list.\n \n response = TiscapTransmission.new( :']activeusers',\n MessageDispatch.hub.users.join(','),\n nil )\n self.receive response\n \n \n when :'/close' # Close the connection.\n \n self.graceful\n \n \n else # probably a server verb. not cool.\n raise BadSyntaxError.new\n \n \n end\n \n \n # Mitigate overrunning the whole machinery, and don't\n # accept more data for a little bit:\n sleep 0.25\n \n \n \n rescue TiscapError => you_fucked_up\n # Syntax errors raised above land here.\n # These can be written to the client, and then ignored.\n self.error you_fucked_up\n \n rescue EOFError, IOError, SystemCallError => goodbye\n # I/O problems land here, as in when the input stream\n # gets terminated. We could kill the connection,\n # but it might not be so dire; and the #graceful procedure\n # is robust enough to bail out of an already-dead stream.\n self.graceful\n break\n \n rescue NoMethodError, JavaLang::NullPointerException => to_err\n # An error I haven't yet caught will hopefully land here,\n # barf its backtrace, and cause the handler to stop reading\n # from the client.\n puts to_err.inspect\n puts to_err.backtrace\n break\n \n end # try\n end # loop\n \n end # thread\n \n \n \n \n #\n # The Writing Proc\n # \n # This proc loopingly waits for things to say (in the @outbox)\n # and---gasp!---writes them out to the client. It's this proc\n # which is responsible for executing a graceful shutdown of the\n # connection. When it receives a HaltTransmission in the @outbox,\n # it breaks its run loop, closes the I/O stream, and instructs\n # the MessageDispatch Hub to disown the handler, thereby re-\n # moving itself from the chat circle.\n # \n Concurrent.ly do\n \n loop do\n begin\n \n # We don't break if inactive,\n # because we might have a few more messages to shove down the pipe.\n \n toGo = @outbox.take\n break if toGo.is_last? # Graceful shutdown\n \n @iost.write toGo.representation\n \n rescue EOFError, IOError, SystemCallError => goodbye\n # When the I/O stream breaks, we land here.\n # Just hop out of the loop for cleanup.\n break\n \n rescue NoMethodError, JavaLang::NullPointerException => to_err\n # Uh-oh. I missed something. Better fix it...\n # but first, break the connection.\n puts to_err.inspect\n puts to_err.backtrace\n break\n \n end # try\n end # loop\n \n \n #\n # As soon as the write-loop ends, break the pipe altogether:\n @iost.close rescue nil\n \n #\n # And then tell MessageDispatch to disown us:\n MessageDispatch.hub.disown self\n \n \n end # thread\n \n \n \n end", "def subscribe(*channels, &block); end", "def public_channel\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n @_public_channels\n end", "def agent(channel); end", "def channels\n self.class::CHANNELS\n end", "def channels_from names\n names.map{|x| Wires::Channel[x]}\n end", "def set_bandwidth(hertz)\n puts \"Setting filter bandwidth to #{hertz}\" if $verbose\n b='BW'+(('0000'+(hertz/10).to_i.to_s)[-4..-1])+';'\n puts b if $verbose\n ret=send_cmd(b,'BW;',b,0.25,0.75,3)\n if(ret)\n return(ret.gsub(/^BW/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def transmissions; end", "def transmissions; end", "def send_ban(channel, *masks)\n send_multiple_mode(channel, '+', 'b', masks)\n end", "def omni\n @channel = nil\n true\n end", "def system_channel\n # [\"sys\", \"rumor\", \"chat\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n @_system_channels\n end", "def band; end", "def band; end", "def test1 #fails\n\n EventMachine::WebSocket.start(:host => \"0.0.0.0\", :port => 8567) do |ws|\n ws.onopen do\n puts \"WebSocket opened\"\n conn = Bunny.new\n conn.start\n#ch = conn.default_channel\n q = $ch.queue(\"tweets\")\n q.subscribe(:block => true) do |delivery_info, properties, body|\n puts \"Received tweet\\n\"\n ws.send \"test\"\n end\n end\n ws.onclose do\n ws.close(code = nil, body = nil)\n puts \"WebSocket closed\"\n# exit\n end\n end\nend", "def channels\n @channel_map.values\n end", "def channelBack\n\t\tswap(@currentChannel, @previousChannel)\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def track_uses_channel(chan)\n\t@chan_mask = @chan_mask | (1 << chan)\n end", "def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend", "def broadcast_messages\n @info = ['Gol', 'Zmiana','Żółta Kartka','Druga Żółta Kartka','Czerwona Kartka',]\n end", "def reset_all_channels\n @channels = {}\n end", "def free_channels\n @channels.each_with_index do |channel, index|\n if channel\n unless SDL2::Mixer::Channels.play?(index)\n @channels[index] = false\n end\n end\n end\n end", "def dispense_b_mercap(buff_Y1_b_me, buff_rlt_b_me)\n buff = 'Beta-Mercaptoethanol'\n \n # Prepares fumehood for working with organics\n prepare_fumehood(buff)\n \n # while in fumehood also aliquot ethanol required\n get_etoh()\n \n # add b-me to both\n b_me_tab = [\n [\"Buffer(s)\", \"#{buff} (uL)\"]\n ]\n (buff_Y1_b_me != 0) ? b_me_tab.push([\"Buffer Y1\"].concat([buff_Y1_b_me].map{ |v| { content: v, check: false }})) : nil\n (buff_rlt_b_me != 0) ? b_me_tab.push( [\"RLT Buffer\"].concat( [(buff_rlt_b_me * 10)].map{ |v| { content: v, check: false }} )) : nil # 10ulB-E : 1mL RLT\n \n show do \n title \"Dispense Beta-Mercaptoethanol in Fume Hood\"\n separator\n # check \"Bring the test tube containing <b>Buffer Y1</b> and the test tube containing <b>Buffer RLT<b/> to the fume hood\"\n warning \"The next step should be done in the fumehood\"\n note \"Follow table below to and take the listed tubes to the fume hood\"\n table b_me_tab\n check \"After dispensing B-ME, clean pipettes and gloves with EtOH to prevent B-ME from leaving fume hood.\"\n check \"<b>Place both tubes on ice until later use.</b>\"\n end\n end", "def update\n Channel.channels_to_update\n end", "def safetynet_channel\n @safetynet_channel\n end", "def send_moola!\n # @todo\n end", "def initialize(bpm = 120)\n self.bpm = bpm\n @interval = 60.0/bpm\n @timer = Timer.get(@interval/10)\n @channel_manager = ChannelManager.new(16)\n open\n end", "def boring(message, quit)\n channel = make_chan()\n go do \n 1.upto(Float::INFINITY) do |i|\n sleep rand(1..1000)/1000.0\n Concurrent::Channel.select do |s|\n s.take(quit) do |msg|\n cleanup()\n quit << \"See ya!\"\n end \n s.default { channel << \"#{message} #{i}\" }\n end\n end\n end\n channel\nend", "def boring(message, quit)\n channel = make_chan()\n go do \n 1.upto(Float::INFINITY) do |i|\n sleep rand(1..1000)/1000.0\n Concurrent::Channel.select do |s|\n s.take(quit) { puts \"quit\"; exit }\n s.default { channel << \"#{message} #{i}\" }\n end\n end\n end\n channel\nend", "def pbSendOutBattlers(sendOuts, startBattle = false)\n return if sendOuts.length == 0\n @briefMessage = false\n # decide which sendout animation to play\n if @battle.opposes?(sendOuts[0][0])\n trainerBattlerSendOut(sendOuts, startBattle)\n else\n playerBattlerSendOut(sendOuts, startBattle)\n end\n @vector.reset\n self.wait(20, true)\n # try set low HP BGM music\n self.setBGMLowHP(true)\n @sendingOut = false\n end", "def waiver\n end", "def stop_public_channel(channel_name) stop_channel(:public, channel_name) end", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def initialize\r\n @owner = msg.sender\r\n @counter = 0\r\n @bets = Mapping.of( Integer => Bet ) ## type mapping( uint => Bet )\r\n end", "def wake_up(bot)\r\n bot.servers.each do |key, server|\r\n server.channels.each do |channel|\r\n if channel.name == @botChannelName and @awakenStrings.size > 0\r\n bot.send_message(channel, @awakenStrings.sample)\r\n end\r\n end\r\n end\r\n end", "def is_channel_blacklisted?(channel_name)\n !ENV[\"CHANNEL_BLACKLIST\"].nil? && ENV[\"CHANNEL_BLACKLIST\"].split(\",\").find{ |a| a.gsub(\"#\", \"\").strip == channel_name }\nend", "def unsubscribe(*channels); end", "def data_channel_closed\n puts \"Data channel closed!\"\nend", "def chondromyxoma(buckshee, uncongenially_chiquitan)\n end", "def cable=(_arg0); end", "def clear\n channels = @channels.dup\n @channels.clear\n channels\n end", "def initialize\n\n # Objects noted with the 'the_' prefix are used to be passed without risking\n # execution context name collisions\n\n # Put itself to be referenced by the internal irc bot #THE\n #the_faye_sender = self\n\n # Load IRC config part from APP_CONFIG #THE\n load_irc_config\n the_irc_config = @config\n\n #Load device_channels #THE\n the_device_channels = get_device_channels(true)\n\n # Initialize the message processor instance # THE\n the_message_processor = initialize_message_processor\n the_irc_gateway = self\n\n\n # Create the ZBOT, instance of GBot...lol\n @zbot = GBot.new do\n\n configure do |c|\n c.server = the_irc_config[:server][:ip]#'127.0.0.1'#\n c.nick = \"#{the_irc_config[:client][:nick_prefix]}#{the_irc_config[:client][:nick]}\"\n c.channels = the_irc_config[:client][:default_channels] + the_device_channels\n end\n\n #if the_irc_config[:client][:logger].eql? 'null'\n #\n #end\n\n #self.logger = Cinch::Logger::NullLogger.new($stderr)\n\n #Listen and do...\n on :message do |m|\n # self === Callback.new\n\n # Retrieve important params\n rcvd_message = m.message # \"the message\" the actual message\n rcvd_channel = m.channel.name # \"#lobby\" the channel it was sent on\n rcvd_user = m.user.nick # \"charles\" who sent it\n\n # Process it and get the required data to send\n\n # ELIMINATE\n the_message_processor=DeviceCommandProcessor.new(the_irc_gateway)\n\n the_message_processor.process_irc_message rcvd_channel, rcvd_user, rcvd_message\n\n end\n end\n\n # Finally...start da bot\n start\n end", "def channel i, param\r\n param.clone.tap{ |hash| \r\n hash[:channel] = i.to_s\r\n self.channel_dispatch hash\r\n self.vertical hash\r\n }\r\n end", "def beeit(pos)\r\n\tpos = 0 if pos > @bees.count - 1\r\n\t@bee = @bees[pos][:bee]\r\n\t@msg = @bees[pos][:mh]\r\n\t# This is just to provide testing ... we already did the work we needed with queen...\r\n\tp = @msg.protocols.first\r\n\t@queen = p.connect('127.0.0.1',3333)\r\n\tputs \"Sending echo test ... \"\r\n\[email protected]_echo(@queen,\"Echo test...\")\r\n\[email protected]\r\nend", "def channel\n params['channel'].gsub('/','')\n end", "def channels\n @format.channels\n end", "def retry\n @channel_control.release\n end", "def applicable_channels\n if @channel_group == :_none_\n # it's a single channel\n [@channel]\n else\n @config.channels_by_group(@channel_group)\n end\n end", "def changerEnBleu\n\t\t@couleur=0\n\tend", "def channelUp\n\t\t@previousChannel = @currentChannel\n\t\tif @currentChannel == @config.highestChannel\n\t\t\t@currentChannel = @config.lowestChannel\n\t\t\t# while rotating back ensure current channel is not in blocked list\n\t\t\tlogStatus @previousChannel, @currentChannel\n\t\t\treturn\n\t\tend\n\t\t#loop until current channel rests for the non blocked channel\n\t\tloop do\n\t\t\tbreak if [email protected]?(@currentChannel+=1)\n\t\tend\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def swift_bic; end", "def each_controlchannel\n Array[*shared[:controlchannel]].each {|channel| \n chan, key = channel.split(' ')\n c = Channel(chan)\n c.join(key) if [email protected]?(chan)\n yield c\n }\n end", "def broadcast\n end", "def channels\n build :channels, :using => data_for(:channels)\n end", "def subscribed_channels\n @channels\n end", "def subscribe_to_default_channels\n #User.find_by_username(\"brevidy\").channels.where(:recommended => true).each { |c| c.subscribe!(self) } unless Rails.env.test?\n end", "def set_bunny_volume vol\n @exch.publish(vol.to_i) \n end", "def channel_fee\n 1\n end", "def bass_intro\n play :f2, sustain: 3\n sleep 3.66\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :D3, sustain: 0.66\n sleep 0.66\n play :e3, sustain: 0.66\n sleep 0.93\n play :d3, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :bb2, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :f2, sustain: 3.5\n sleep 4.4\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :d3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :a2, sustain: 4\n sleep 5.4\n play :a2, sustain: 0.66\n sleep 0.66\n play :bb2, sustain: 3.5\n sleep 4.4\n play :E3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 1.66\nend", "def backlog; end", "def backlog; end", "def stop_broadcast_subscribe\n # The only object for this is clean the clients buffer\n # anything that we send for the channel will send the sign\n Helpers.redis.subscribe('stop-broadcast') do |on|\n on.message do\n begin\n Helpers.log 'Stopping Broadcast'\n\n # send_signal_to_stop_brodcast!\n force_stop_broadcast!\n rescue => e\n Helpers.error 'Stopping Broadcast', e\n end\n end\n end\n end", "def initialize\n \n @connection_options = Baton.configuration.connection_opts\n\n logger.info \"Connecting to AMQP host: #{@connection_options[:host]}:#{@connection_options[:port]}\"\n\n tries = 10\n seconds_between_tries = 10\n added_seconds_between_tries = 15\n begin\n @session = Bunny.new(@connection_options)\n @session.start\n rescue Exception => e\n tries -= 1\n logger.error(\"#{e.class}: #{e.message}. #{tries} #{tries == 1 ? 'try' : 'tries'} remaining\")\n if tries > 0\n logger.info(\"Trying to connect again in #{seconds_between_tries} seconds\")\n sleep seconds_between_tries\n seconds_between_tries += added_seconds_between_tries\n retry\n else\n exit 1\n end\n end\n \n @channel = @session.channel\n\n # Not everything needs an input exchange; default to the \"\" exchange if there isn't\n # one defined in the config (monitors, for example)\n Baton.configuration.exchange = '' if Baton.configuration.exchange.nil?\n\n # Create the exchanges\n # Input exchange is how baton receives messages\n # Output exchange is how baton returns output\n @exchange_in = channel.direct(Baton.configuration.exchange)\n if Baton.configuration.exchange_out.nil? || Baton.configuration.exchange_out.empty?\n logger.error 'An output exchange must be configured. Exiting.'\n exit 1\n else\n @exchange_out = channel.direct(Baton.configuration.exchange_out)\n end\n\n logger.info 'Connection to AMQP host established'\n end", "def connectbackhauls\n \n locID = params[:id]\n loc = Location.find(locID)\n @location = loc\n \n list_free_ports_withloc(locID)\n \n #binding.pry\n #return\n \n \n #counters...\n #darkFibersA = 0\n #darkFibersB = 0\n @newlyConnectedFibers=0\n @fiberIDList=[]\n #@freeCapacityBetweenPoints=0\n \n \n #this brings @ports_A and @ports_B\n #for every port in @ports_A, check the connID, and search for that in \n # @ports_B, if matched...connect both ports with a new fiber, using the same\n # connID\n \n indx=0\n @ports_B.each do |prtB|\n \n #Loop only for those valid, live/reserved connections\n fbrIB = Fiberstrand.find(prtB.fiber_out_id) #fiber_in on prtB should be zero\n connBID = fbrIB.connection_id\n next if connBID==0\n \n connB = Connection.find(connBID)\n \n if connB.status.casecmp(\"Dark\")==0\n \n #darkFibersB += 1\n next \n end\n \n @ports_A.each do |prtA|\n \n next if (prtB ==0 || prtB.nil?)\n \n #get connection at fiber_out at A\n fbrOA = Fiberstrand.find(prtA.fiber_in_id) #fiber_out on prtA should be zero\n connAID = fbrOA.connection_id\n next if connAID==0\n \n connA = Connection.find(connAID)\n \n if connA.status.casecmp(\"Dark\")==0\n #darkFibersA += 1\n next\n end\n \n #binding.pry\n \n if connA.name.casecmp(connB.name)==0\n #found a matching connection on both sides...\n #connect both ports \n interconnectConnections(connA, prtA, connB, prtB, loc)\n\n @newlyConnectedFibers +=1\n\n break #end the portA loop as we have already connected the B port to that A port! Nov26,2016\n\n end\n \n \n end #@port_A loop\n\n indx += 1\n\n end #@port_B loop\n\n #return the correct counters...\n #@freeCapacityBetweenPoints = darkFibersA\n #@freeCapacityBetweenPoints = darkFibersB if darkFibersB < darkFibersA\n\n \n end", "def punsubscribe(*channels); end", "def send_channel_msg( msg)\n @descriptors.each do |sock|\n if sock != @serverSocket\n user = @user_info[@descriptors.index(sock)-1] \n if user[:role] == \"client\" and user[:mode] == \"push\"\n str = \"Advice from channel #{msg[:channel]} : #{msg[:ad]}\\n\"\n sock.write(str) if user[:channels].include? msg[:channel]\n @@connection.register_sent_ad(user[:nickname],msg[:id],msg[:time])\n end\n end\n end\n end", "def whaXen(bottom, range, vol, channel)\n playXen(Pitches[bottom], vol.volume, @t.w, channel)\n hesitate\n (3..@its+3).each do |i|\n hesitated?\n r = rand(range)\n if r == 0 or r > Pitches.size\n if brnd\n sleep @t.q\n elsif brnd\n playXen(Pitches[bottom + rand(range)], vol.walk!, @t.q, channel)\n else\n playXen(Pitches[bottom], vol.walk!, @t.q, channel)\n end\n else\n playXen(Pitches[bottom+r], vol.walk!, @t.q, channel)\n end\n end\n playXen(Pitches[bottom], vol.volume, @t.w, channel)\n hesitate\n end", "def bellini; end", "def channel\n params.detect { |param| param.start_with?(\"#\") }&.delete(\"#\")\n end", "def channel_keys\n %w[ channel room ]\n end", "def write_to_channel()\n store_button()\n sleep(0.5)\n store_button()\n sleep(0.5)\nend", "def run(aggregate_file, channel_file)\n File.delete(aggregate_file) if File.exists?(aggregate_file)\n ag_f = File.open(aggregate_file, File::CREAT | File::WRONLY)\n\n File.delete(channel_file) if File.exists?(channel_file)\n ch_f = File.open(channel_file, File::CREAT | File::WRONLY)\n\n $patterns_file.rewind\n\n # print aggregate legend\n str = \"t\\tdesired\\tactual\\tlimit\\tb-cast\\tf-avg\\tf-sdev\\t\"\n $groups.each { |g| str << \"f-g#{g}\\t\" } # fairness to each group\n $groups.each { |g| str << \"d-g#{g}\\t\" << \"g#{g}\\t\" } # group desired and group traffic\n ag_f.write(str+\"\\n\")\n\n # print per channel legend\n str = \"t\\tu_avg\\tu_sdev\\t\"\n $groups.each{|g| $members[g].each{|n| str << \"d-g#{g}n#{n}\\t\" << \"g#{g}n#{n}\\t\"}}\n ch_f.write(str+\"\\n\")\n\n\n 0.upto($ticks) do |t|\n # get this sending pattern in this tick\n tick_pattern = []\n $patterns_file.readline.scan(/(.+?),+/) { tick_pattern << $1.split(' ') }\n tick_pattern.each {|tp| $wanted_in_tick[[tp[0].to_i, tp[1].to_i]] = tp[2].to_i }\n\n prep_epoch(t)\n send_msgs(t)\n recv_msgs(t)\n broadcast_info(t)\n\n ag_f.write(t.to_s + \"\\t\")\n ch_f.write(t.to_s + \"\\t\")\n\n # show me the traffic in each big tick\n if fmod(t, $big_tick)\n # calculate what the traffic would have been without AJIL\n desired_traffic = 0\n group_wanted = []\n channels = []\n str = \"\"\n $groups.each do |g|\n group_wanted[g] = 0\n $members[g].each do |n|\n ch_wanted = $wanted_in_tick[[g,n]]\n desired_traffic += ch_wanted\n group_wanted[g] += ch_wanted\n if ch_wanted == 0\n channels << 1.0\n else\n channels << ($sent_in_tick[[g,n]].to_f / ch_wanted)\n end\n str << (ch_wanted.to_s + \"\\t\" + $sent_in_tick[[g,n]].to_s + \"\\t\")\n end\n end\n ch_avg, ch_sdev = avg_and_sdev(channels)\n ch_f.write(\"%.2f\\t\" % ch_avg)\n ch_f.write(\"%.2f\\t\" % ch_sdev)\n ch_f.write(str << \"\\n\")\n\n # calculate what the traffic is with AJIL\n str = \"\"\n fairness_str = \"\"\n total_traffic = 0\n groups_fairness = []\n $groups.each do |g|\n total_traffic += $group_sent_in_btick[g]\n str << group_wanted[g].to_s + \"\\t\"\n str << $group_sent_in_btick[g].to_s + \"\\t\"\n\n gfair = 0.0\n if group_wanted[g] == 0\n gfair = 1.0\n else\n gfair = ($group_sent_in_btick[g].to_f / group_wanted[g])\n end\n\n groups_fairness << gfair\n fairness_str << \"\\t%.2f\" % gfair\n end\n\n # aggregate fairness\n agf_avg, agf_sdev = avg_and_sdev(groups_fairness)\n fairness_str = (\"%.2f\\t\" % agf_avg) + (\"%.2f\" % agf_sdev) + fairness_str + \"\\t\"\n\n # print out traffic reports\n ag_f.write(desired_traffic.to_s + \"\\t\" + total_traffic.to_s + \"\\t \" + $rate_limit.to_s + \"\\t\" + $sent_in_broadcast.to_s + \"\\t\" + fairness_str + str + \"\" + \"\\n\")\n $sent_in_broadcast = 0\n end\n\n $nodes.each { |n| reval_strategy(t, n) }\n tick(t)\n end\n ag_f.close\nend", "def channel(name, schema=nil, loopback=false)\n define_collection(name)\n @tables[name] = Bud::BudChannel.new(name, self, schema, loopback)\n @channels[name] = @tables[name]\n end", "def wake_bixsby\n # Initiate new ProgramB instance\n # Load in properties and add new AIML node to ProgramB\n bixsby_print \"Loading ProgramB version #{Programb::VERSION}\"\n @bixsby = Programb::Kernel.new(\"./config/properties.yml\")\n @bixsby.parser[\"bixsby\"] = @bixsby.method(:process_bixsby)\n\n # Load modules and AIML\n # Loads the guts for Bixsby\n load_modules\n load_aiml\n\n # Start loop for server commands\n @console = Console.new\n\n bixsby_print \"Good day sir, I am up and running.\\nType '\\\\h' to see a list of my commands.\"\n\n # Main loop\n # Listens for connections and initates a new thread for the client.\n loop {\n Thread.start(@server.accept) do |client|\n session_id = set_session\n \n bixsby_print \"Established new connection: #{Time.now.to_s}, session_id: #{session_id}, client: #{client.peeraddr.last}\"\n \n @connections[:clients][session_id] = client\n \n greeting_msg = @bixsby.respond(\"Hello\")\n formatted_response = package_response(session_id, greeting_msg)\n\n client.puts(formatted_response)\n bixsby_listen(client)\n end\n }\n end", "def stop_stream_from(broadcasting); end", "def out_of_band(&block); end" ]
[ "0.7051922", "0.59848416", "0.5977472", "0.59599334", "0.5805278", "0.57999384", "0.57564306", "0.5719745", "0.56589764", "0.5593077", "0.55754435", "0.5569902", "0.55639875", "0.5554487", "0.5501904", "0.54837495", "0.5480029", "0.54775393", "0.5442823", "0.54199713", "0.5399713", "0.53820825", "0.53802407", "0.53606766", "0.5352294", "0.5303696", "0.5287391", "0.52843755", "0.5282074", "0.52801573", "0.52730846", "0.5270208", "0.526287", "0.526287", "0.5261665", "0.5245611", "0.5241281", "0.5234935", "0.5234935", "0.5234561", "0.5230515", "0.52257293", "0.52115494", "0.5211485", "0.52092546", "0.5203499", "0.5197663", "0.5195697", "0.5188669", "0.5186862", "0.51843727", "0.51810837", "0.5170039", "0.5166371", "0.516091", "0.51489997", "0.51392144", "0.5132337", "0.5122621", "0.5120347", "0.51174736", "0.51124406", "0.5104324", "0.509941", "0.5098352", "0.5094688", "0.5080964", "0.5079731", "0.5078223", "0.5075251", "0.507461", "0.50721616", "0.5067582", "0.50661254", "0.50654995", "0.5058868", "0.5046957", "0.50337905", "0.50276726", "0.5027295", "0.502298", "0.50225824", "0.50209075", "0.50054324", "0.5003093", "0.5003093", "0.49970615", "0.49961525", "0.49952728", "0.49921578", "0.49890414", "0.49819747", "0.49795544", "0.49781796", "0.4974301", "0.49727866", "0.4972672", "0.49702477", "0.49691337", "0.49652237", "0.49651155" ]
0.0
-1
Channels brakes Sole 24 Ore
def filter_overResistanceSoleXXIVOre @overResistanceStocksSolexxivore = @@SJA.select("stocks.isin, name, last_price, xxivore_resistance").where("xxivore_resistance > 0 AND last_price > xxivore_resistance").order(:name) render json: @overResistanceStocksSolexxivore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channels; end", "def channels\n []\n end", "def part_all()\n @channels.clear()\n end", "def channelDown\n\t\t@previousChannel = @currentChannel\n\t\tif @currentChannel == @config.lowestChannel \n\t\t\t@currentChannel = @config.highestChannel\n\t\t\tlogStatus @previousChannel, @currentChannel\n\t\t\treturn\n\t\tend\n\t\tloop do\n\t\t\tbreak if [email protected]?(@currentChannel-=1)\n\t\tend\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def free_channels\n @channels.each_with_index do |channel, index|\n if channel\n unless SDL2::Mixer::Channels.play?(index)\n @channels[index] = false\n end\n end\n end\n end", "def unsubscribe_from_channel; end", "def subscribe_to_channel; end", "def cable; end", "def update\n Channel.channels_to_update\n end", "def channel_fee\n 1\n end", "def channels\n self.class::CHANNELS\n end", "def channels(*params)\n puts \"Channels:\"\n\n @channels.each do |channel|\n muted = @muted_channels.include?(channel)\n puts \"#{channel}#{muted ? ' (muted)' : ''}\"\n end\n end", "def channels(*params)\n puts \"Channels:\"\n @channels.each do |channel|\n muted = @muted_channels.include?(channel)\n puts \"#{channel}#{muted ? \" (muted)\" : \"\"}\"\n end\n end", "def free_booth\n @booth = User.where(:id => params[:user_id]).first\n @invoice = @booth.cs_invoices.first\n if @invoice\n begin\n # terminated calls if any\n server_id, channel = params.values_at(:server, :channel)\n\n unless server_id.blank? or channel.blank?\n server = Server.where(:id => server_id.to_i).first\n\n if server\n server.ami_cmd(\"soft hangup #{channel}\")\n end\n\n MorLog.my_debug \"Hangup channel: #{channel} on server: #{server_id}\"\n end\n rescue Exception => e\n @status = _('Unable_to_terminate_calls_check_connectivity')\n end\n end\n render :layout=>false\n end", "def data_channel_closed\n puts \"Data channel closed!\"\nend", "def system_channel\n # [\"sys\", \"rumor\", \"chat\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n @_system_channels\n end", "def expire_all_backlogs!\n sync do\n @channels = {}\n end\n end", "def is_channel_blacklisted?(channel_name)\n !ENV[\"CHANNEL_BLACKLIST\"].nil? && ENV[\"CHANNEL_BLACKLIST\"].split(\",\").find{ |a| a.gsub(\"#\", \"\").strip == channel_name }\nend", "def public_channel\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n @_public_channels\n end", "def each_channel(&block); end", "def close\n @channels.each{|channel,omegle|\n omegle.send(\"You have been connected to a message bridge, which is now shutting down. Goodbye.\")\n omegle.disconnect\n }\n end", "def channels\n @format.channels\n end", "def witcher; end", "def subscribe_to_default_channels\n #User.find_by_username(\"brevidy\").channels.where(:recommended => true).each { |c| c.subscribe!(self) } unless Rails.env.test?\n end", "def channels\r\n return @chanlist\r\n end", "def reset_all_channels\n @channels = {}\n end", "def channels_list\n get \"channels\"\n end", "def safetynet_channel\n @safetynet_channel\n end", "def unsubscribe(*channels); end", "def decay_conversation\n # we half-life the conversation every minute\n units = (Time.now - @last_faded_weights)/60\n if units > 1 \n @last_faded_weights = Time.now \n if incoming_weight > 0 or outgoing_weight > 0\n @outgoing_weight /= (2**units) if outgoing_weight > 0\n @incoming_weight /= (2**units) if incoming_weight > 0\n end\n end\n end", "def channels_from names\n names.map{|x| Wires::Channel[x]}\n end", "def subscribed_channels\n @channels\n end", "def get_subscribed_channels\n @channels\n end", "def channel_keys\n %w[ channel room ]\n end", "def initialize(bpm = 120)\n self.bpm = bpm\n @interval = 60.0/bpm\n @timer = Timer.get(@interval/10)\n @channel_manager = ChannelManager.new(16)\n open\n end", "def applicable_channels\n if @channel_group == :_none_\n # it's a single channel\n [@channel]\n else\n @config.channels_by_group(@channel_group)\n end\n end", "def retry\n @channel_control.release\n end", "def track_uses_channel(chan)\n\t@chan_mask = @chan_mask | (1 << chan)\n end", "def subscribe(*channels, &block); end", "def channelUp\n\t\t@previousChannel = @currentChannel\n\t\tif @currentChannel == @config.highestChannel\n\t\t\t@currentChannel = @config.lowestChannel\n\t\t\t# while rotating back ensure current channel is not in blocked list\n\t\t\tlogStatus @previousChannel, @currentChannel\n\t\t\treturn\n\t\tend\n\t\t#loop until current channel rests for the non blocked channel\n\t\tloop do\n\t\t\tbreak if [email protected]?(@currentChannel+=1)\n\t\tend\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def clear\n channels = @channels.dup\n @channels.clear\n channels\n end", "def stop_public_channel(channel_name) stop_channel(:public, channel_name) end", "def pitch_bend( channel, value )\n message( PB | channel, value )\n end", "def channel\n params['channel'].gsub('/','')\n end", "def getChannelsList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/channels\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n channels_data = temp2[\"resource_response\"][\"resources\"]\n return channels_data\n \n end", "def circuit_breaker; end", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def bury\n @channel_control.bury\n end", "def channelBack\n\t\tswap(@currentChannel, @previousChannel)\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def channels\n @channel_map.values\n end", "def get_channel()\n return(get_cmd('MC;',0.1,0.5,3).gsub(/^MC/,'').gsub(/;$/,'').to_i)\nend", "def exchange\n @exchange ||= channel.fanout(QUEUE_NAME)\n end", "def initialize \n\t\t@config = nil\n\t\t@defaultChannel = 0\n\t\t@previousChannel = 0\n\t\t@currentChannel = 0\n\tend", "def channels\n build :channels, :using => data_for(:channels)\n end", "def drop_rate_comm\n @drop_rate_comm ||= (uint16_t(18..19) / 100)\n end", "def to_channel\n self\n end", "def punsubscribe(*channels); end", "def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user should have at last one channel\n @channels\n end", "def wake_up(bot)\r\n bot.servers.each do |key, server|\r\n server.channels.each do |channel|\r\n if channel.name == @botChannelName and @awakenStrings.size > 0\r\n bot.send_message(channel, @awakenStrings.sample)\r\n end\r\n end\r\n end\r\n end", "def delete(channels)\n\treturn if not channels.is_a? Array #meh\n\tcurChannels = readCurrentChannels()\n\tcurChannels.reject! { |e| channels.include? e.downcase }\n\twriteChannels(curChannels)\nend", "def channel\n @channels[BASE_PATH]\n end", "def find_channels\n @channels = Channel.all.order('created_at desc')\n end", "def load_channels\n APICache.logger = Somadic::Logger\n APICache.get('di_fm_channel_list', cache: ONE_DAY, timeout: API_TIMEOUT) do\n Somadic::Logger.debug('DI#load_channels')\n channels = []\n page = open('http://www.di.fm').read\n app_start = page.scan(/di\\.app\\.start\\((.*?)\\);/).flatten[0]\n json = JSON.parse(app_start)\n json['channels'].each do |c|\n channels << {id: c['id'], name: c['key'], display_name: c['name']}\n end\n\n channels\n end\n end", "def waiver\n end", "def getOnlineChannels(channelData)\n\tresult = []\n\tchannelData['streams'].each do |stream|\n\t\tresult << makeChannelString(outputFormat(), stream)\n\tend\n\tresult\nend", "def channels_count\n channels.count\n end", "def omni\n @channel = nil\n true\n end", "def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end", "def data_channel_open\n puts \"Data channel open!\"\n data_channel = $$.data_channel\n # send_message(\"ALIVE\")\nend", "def changerEnBleu\n\t\t@couleur=0\n\tend", "def channel_aftertouch( channel, pressure )\n message( CA | channel, pressure )\n end", "def channel_open_handlers; end", "def set_channel_info(client)\n @@channel_list = nil\n s = Rufus::Scheduler.new(:max_work_threads => 200)\n #Wait 5s so that the client is setup before trying to run.\n s.in '5s' do\n @@channel_list = client.web_client.channels_list.channels\n end\n s = Rufus::Scheduler.new(:max_work_threads => 200)\n s.every '15m' do\n @@channel_list = client.web_client.channels_list.channels || @@channel_list\n end\n end", "def subscriptions\n @channels\n end", "def open_channel\n @@game_channels.delete(@event.channel)\n nil\n end", "def send_when_clear cmd_msg\n snooze = 0.05 + rand / 100 # 50-60ms\n unless @carrier_sense == 0 and @last_message < Time.now - snooze\n loop do\n @carrier_sense = 0\n sleep snooze\n break if @carrier_sense == 0\n end\n end\n @io.write cmd_msg\n end", "def channel\n return @channel\n end", "def channel\n \"market-coin-#{market_coin.id}\"\n end", "def channel\n params.detect { |param| param.start_with?(\"#\") }&.delete(\"#\")\n end", "def data_channel_message(data)\n # puts \"Message received! #{data}\"\n if !$$.host\n receiveSync(data)\n end\nend", "def buz; Sound.play_buzzer; end", "def channel_flow(active)\n subject.channel_flow(active)\n end", "def write_to_channel()\n store_button()\n sleep(0.5)\n store_button()\n sleep(0.5)\nend", "def tv_last_channel \n send_cmd(\"tv_last_channel\")\n end", "def get_upstream_channels\r\n logger.debug \"Upstream1 Channels\"\r\n upstream_channels=UpstreamChannel.find(:all)\r\n logger.debug \"Upstream Channels2\"\r\n chlist=upstream_channels.collect {|ch| {:freq=>ch.freq, :bandwidth => ch.bandwidth, :name => ch.name}}\r\n logger.debug \"Upstream Channels3\"\r\n logger.debug upstream_channels.inspect()\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => chlist.to_x }\r\n format.amf { \r\n logger.debug \"Returning upstream_channels\"\r\n logger.debug \"Returning #{upstream_channels}\"\r\n render :amf => chlist\r\n }\r\n end\r\n end", "def wait_action_cable_subscription\n sleep 1\n end", "def broadcast(content)\n if content.include? \"\u001b[3;J\u001b[H\u001b[2J\"\n content = content.sub(\"\u001b[3;J\u001b[H\u001b[2J\", \"\")\n clearConsole\n sleep(0.2)\n end\n ActionCable.server.broadcast 'blackjack_channel', content: content\n end", "def channel(name, schema=nil, loopback=false)\n define_collection(name)\n @tables[name] = Bud::BudChannel.new(name, self, schema, loopback)\n @channels[name] = @tables[name]\n end", "def channels\r\n return for_context(nil, false) { |c| c.channels }\r\n end", "def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end", "def brake(seconds)\n fail 'Engine Off Error' unless engine_on\n\n seconds.times do\n break if speed <= 1\n @speed -= 1\n end\n end", "def readCurrentChannels()\n\tFile.readlines('channels.txt').map{ |e| e.chomp.downcase }.uniq\nend", "def send_channel_msg( msg)\n @descriptors.each do |sock|\n if sock != @serverSocket\n user = @user_info[@descriptors.index(sock)-1] \n if user[:role] == \"client\" and user[:mode] == \"push\"\n str = \"Advice from channel #{msg[:channel]} : #{msg[:ad]}\\n\"\n sock.write(str) if user[:channels].include? msg[:channel]\n @@connection.register_sent_ad(user[:nickname],msg[:id],msg[:time])\n end\n end\n end\n end", "def exchanges\n @channel.exchanges\n end", "def diff(oldChannels, currentChannels)\n currentChannels\n .select do |nc|\n oc = oldChannels.find do |x|\n x[:channel] == nc[:channel]\n end\n oc == nil || (oc[:power] - nc[:power]).abs >= $POWER_CHANGE_THRESHOLD\n end\nend", "def subscribe(channel, *channels, &block); end", "def public_channel(ns)\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n get_client(ns).public_channel\n end", "def msg_BMASK(source, args)\n # :42X BMASK 1234567890 #x b :*!*@derp *!Mibbit@* ...\n c = Channel.find_by_name(args[1])\n if not c\n raise(NoSuchChannelException, \"Couldn't find #{args[1]}\")\n end\n\n ts = args[0].to_i()\n\n if c.ts < ts\n return nil\n end\n\n if args[2] != 'b' && args[2] != 'e'\n # We've \"added\" the entry, i.e., discarded what we didn't care about\n return nil\n end\n\n args[3].split(' ').each do |ban|\n c.add_ban(ban, args[2])\n end\n\n return nil\n end", "def work(msg)\n parsed_msg = Oj.load(msg)\n channel = Channel.find(parsed_msg.fetch('channel_id'))\n ack! && return if channel.inactive?\n\n API::Products::Puller.new(channel).call\n ack!\n rescue StandardError => exception\n Rails.logger.error(\"[ImportProductError]: #{exception.message}\")\n reject!\n end", "def listSoftwareChannels\n channels = @connection.call('channel.listSoftwareChannels', @sid)\n channels.each do |c|\n print ' Channel: ' + \"\\n\"\n c.keys.each do |key|\n print ' ' + key + ': ' + c[key] + \"\\n\"\n end\n end\n end", "def update_channel(data)\n channel = Channel.new(data, self)\n old_channel = @channels[channel.id]\n return unless old_channel\n old_channel.update_from(channel)\n end" ]
[ "0.6845944", "0.59654546", "0.5938828", "0.5851249", "0.57966876", "0.5750821", "0.5725818", "0.57128656", "0.567642", "0.5645508", "0.5607094", "0.5595669", "0.5593223", "0.55656266", "0.55279404", "0.5503553", "0.5502866", "0.54866606", "0.54770243", "0.5452569", "0.5437113", "0.54340166", "0.5424803", "0.54103845", "0.5406573", "0.5406093", "0.5404912", "0.5400467", "0.53942764", "0.53907", "0.5354751", "0.5349359", "0.5337278", "0.53333867", "0.5318569", "0.5311785", "0.5304141", "0.5282843", "0.528056", "0.52406865", "0.5232677", "0.522977", "0.5229678", "0.52270633", "0.5223684", "0.52185094", "0.52082723", "0.5197192", "0.5190552", "0.5183317", "0.517789", "0.5171141", "0.51705855", "0.51657456", "0.51640123", "0.5159163", "0.5143929", "0.51387256", "0.5136931", "0.51368016", "0.511284", "0.5100042", "0.50966954", "0.50941277", "0.5092175", "0.5087206", "0.50763637", "0.5074817", "0.5068941", "0.5061718", "0.50560796", "0.50530636", "0.5052229", "0.50504565", "0.5049833", "0.5039427", "0.5015988", "0.50158036", "0.50153863", "0.5006679", "0.5004902", "0.4987548", "0.49848288", "0.49820367", "0.49788362", "0.49783805", "0.4975051", "0.49681547", "0.4967825", "0.49655005", "0.49652794", "0.49585968", "0.49580854", "0.49521253", "0.49456468", "0.4943507", "0.4935713", "0.49300468", "0.49100053", "0.49088818", "0.49037817" ]
0.0
-1
Suggestions Sole 24 Ore
def filter_suggestionsSoleXXIVOre @suggestionsFromSole24Ore = @@SJA.select("stocks.isin, name, last_price, xxivore_shorttrend, xxivore_ftaindex, xxivore_rsi").where("xxivore_shorttrend = ? AND xxivore_ftaindex > ? AND xxivore_rsi > ?", "molto rialzista", 50, 75).order(:name) render json: @suggestionsFromSole24Ore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findorsuggest()\n \n end", "def sanitize text\n SANITIZE_THIS.each { |s| text = text.gsub(/#{s}/,'') }\n\n #római számok kiegészítés\n text = text.gsub(/\\W*(#{ROMAISZAMOK.keys.join('|')})\\.\\W*(\\w+)/) do \n ROMAISZAMOK[$1] ? ( ROMAISZAMOK[$1] + ' ' + $2 ) : $&\n end\n \n #századok\n text = text.gsub(/(\\W*)(#{(1..21).to_a.join('|')})\\.\\W+század/) do\n $1 + ROMAISZAMOK.values[($2.to_i - 1)]+' század'\n end\n\n #törtek ( itt mind , mind . után jön egy számsorozat\n text = text.gsub(/(\\d+)[,.](\\d+)/) { $1 + ' egész,' + $2 + ' ' }\n\n #külön írt számok, ha az első nem csatlakozik karakterhez, mint bolygónevek pl M4079 448 km/sec\n # és a második 3 karakter, hogy táblázatban lévő évszámokat pl ne vonjon össze\n text = text.gsub(/(\\W\\d+)\\s(\\d{3})/) { $1 + $2 }\n\n #idegesített az isbn\n text = text.gsub(/(ISBN)\\s*([0-9\\-]+)$/i) { 'iesbéen ' + $2.split('').join(' ') }\n\n # ie isz kr e kr u\n text = text.gsub(/(i\\.{0,1}\\s{0,1}sz\\.{0,1})\\s{0,1}(\\d)/i){ ' időszámításunk szerint ' + $2 }\n text = text.gsub(/([kK]r\\.{0,1}\\s{0,1}sz\\.{0,1})\\s{0,1}(\\d)/){ ' Krisztus szerint ' + $2 }\n text = text.gsub(/([kK]r\\.{0,1}\\s{0,1}u\\.{0,1})\\s{0,1}(\\d)/){ ' Krisztus után ' + $2 }\n text = text.gsub(/(i\\.{0,1}\\s{0,1}e\\.{0,1})\\s{0,1}(\\d)/){ ' időszámításunk előtt ' + $2 }\n text = text.gsub(/([kK]r\\.{0,1}\\s{0,1}e\\.{0,1})\\s{0,1}(\\d)/){ ' Krisztus előtt ' + $2 }\n\n # kis mértékegység hekk\n text = text.gsub(/\\Wkm\\/h\\W/,' km per óra ')\n text = text.gsub(/\\WkW\\W/,' kilo watt ')\n text = text.gsub(/\\Wkg\\W/i,' kilo gramm ')\n text = text.gsub(/(\\d+)\\W+m\\W/) { $1 + ' méter '}\n text = text.gsub(/°/,' fok')\n text = text.gsub(/[&]i/,' és ')\n # négyzet - sokszor előfordul földrajzban\n text = text.gsub(/km\\W{0,1}²/i){ ' négyzet km ' }\n # négyzet - matekban változó után jön. :/, mértékegységeknél előtte, mértékegységeket ki kéne szedni tömbbe\n text = text.gsub(/²/){ ' négyzet ' }\n text = text.gsub(/\\+\\/\\-/,' plussz minusz ')\n text = text.gsub(/×/,' szor ')\n\n # deokosvagyok rövidítésekbű\n text = text.gsub(/\\sstb\\.\\s/i, ' satöbbi ')\n text = text.gsub(/\\sun\\.\\s/i, ' úgy nevezett ')\n text\nend", "def ou_to_short(name)\n name = name.upcase\n\n case name\n when \"DSS IT SERVICE CENTER\", \"DSS IT SHARED SERVICE CENTER\"\n return \"IT\"\n when \"DSS HR/PAYROLL SERVICE CENTER\"\n return \"HR\"\n when \"CALIFORNIA HISTORY SS PROJECT\"\n return \"CHP\"\n when \"UC CENTER SACRAMENTO\"\n return \"UCCS\"\n when \"HEMISPHERIC INSTITUTE-AMERICAS\"\n return \"PHE\"\n when \"HISTORY PROJECT\", \"HISTORY PROJECT UCD\"\n return \"HP\"\n when \"SOCIAL SCIENCES PROGRAM\"\n return \"SSP\"\n when \"PHYSICAL EDUCATION PROGRAM\"\n return \"PHE\"\n when \"DSS RESEARCH SERVICE CENTER\"\n return \"RSC\"\n when \"GEOGRAPHY\"\n return \"GEO\"\n when \"ANTHROPOLOGY\"\n return \"ANT\"\n when \"COMMUNICATION\"\n return \"CMN\"\n when \"ECONOMICS\"\n return \"ECN\"\n when \"HISTORY\"\n return \"HIS\"\n when \"LINGUISTICS\"\n return \"LIN\"\n when \"MILITARY SCIENCE\"\n return \"MSC\"\n when \"PHILOSOPHY\"\n return \"PHI\"\n when \"POLITICAL SCIENCE\"\n return \"POL\"\n when \"PSYCHOLOGY\"\n return \"PSC\"\n when \"EASTERN ASIAN STUDIES\"\n return \"EAS\"\n when \"INTERNATIONAL RELATIONS\"\n return \"IRE\"\n when \"MIDDLE EAST/SOUTH ASIA STUDIES\", \"MIDDLE EAST/SOUTH ASIA PROGRAM\"\n return \"MSA\"\n when \"SCIENCE & TECHNOLOGY STUDIES\"\n return \"STS\"\n when \"CENTER FOR MIND AND BRAIN\", \"CENTER FOR MIND & BRAIN\"\n return \"CMB\"\n when \"SOCIOLOGY\"\n return \"SOC\"\n when \"COM, PHIL & LIN RED CLUSTER\"\n return \"RED\"\n when \"POLI SCI, IR ORANGE CLUSTER\", \"SOCIAL SCIENCE ORANGE CLUSTER\"\n return \"ORANGE\"\n when \"ECON, HIS, MS BLUE CLUSTER\", \"SOCIAL SCIENCES BLUE CLUSTER\"\n return \"BLUE\"\n when \"ANT, SOC GREEN CLUSTER\", \"SOCIAL SCIENCES GREEN CLUSTER\"\n return \"GREEN\"\n when \"L&S DEANS - SOCIAL SCIENCES\"\n return \"DEANS\"\n when \"PSYCH, CMB YELLOW CLUSTER\", \"SOCIAL SCIENCE YELLOW CLUSTER\"\n return \"YELLOW\"\n when \"EDUCATION - PH.D.\"\n return \"EDU\"\n when \"COMMUNITY DEVELOPMENT\"\n return \"ComDev\"\n when \"NEUROSCIENCE\", \"CENTER FOR NEUROSCIENCE\"\n return \"NueroSci\"\n when \"CENTER FOR INNOVATION STUDIES\"\n return \"CSIS\"\n when \"ASUCD\", \"UC DAVIS\", \"ASIAN AMERICAN\", \"UNIVERSITY EXTENSION\", \"CHEDDAR\", \"STUDENT EMPLOYMENT CENTER\",\n \"TEMPORARY EMPLOYMENT SERVICE\", \"CAMPUS RECREATION AND UNIONS\", \"CRESS DEPARTMENT\", \"LIBRARY\", \"POLICE\",\n \"COMPARATIVE LITERATURE\", \"PRIMATE CENTER\", \"L&S DEANS - U/G ED & ADVISING\", \"STATISTICS\",\n \"AGR & ENV SCI DEANS OFFICE\", \"OFFICE OF THE CHANCELLOR\", \"UNDERGRADUATE ADMISSIONS\",\n \"UNIVERSITY WRITING PROGRAM\", \"TEXTILES & CLOTHING\", \"STUDENT HOUSING\", \"ENGLISH\", \"ANIMAL SCIENCE\",\n \"IRB ADMINISTRATION\", \"SCHOOL OF LAW-DEANS OFFICE\", \"STUDENT ACADEMIC SUCCESS CTR\", \"GERMAN & RUSSIAN\",\n \"INTERCOLLEGIATE ATHLETICS\", \"HUMAN ECOLOGY\", \"GRADUATE DIVISION\", \"MED: NEUROLOGY\",\n \"ENVIRONMENTAL TOXICOLOGY\", \"SCHOOL OF MED - STAFF\", \"L&S DEANS - DEVELOPMENT\",\n \"TEMPORARY EMPLOYMENT POOL ADMN\", \"SCHOOL OF MED - APS\", \"MED: GENERAL PEDIATRICS\",\n \"MED:PSYCHIATRY & BEHAV SCI\", \"NATIVE AMERICAN STUDIES\", \"ART\", \"VP UNDERGRADUATE EDUCATION\", \"GEOLOGY\",\n \"VM: CTR COMPARATIVE MEDICINE\", \"ENGR COMPUTER SCIENCE\", \"MED: DIV OF INTERNAL MED\",\n \"FM: CUSTODIAL SERVICES\", \"VOORHIES ADMINISTRATIVE UNIT\", \"MED: OPHTHALMOLOGY\", \"MED: PUBLIC HEALTH SCIENCES\",\n \"NEURO PHYSIO & BEHAVIOR\", \"INST OF TRANSPORTATION STUDIES\", \"ENVIRONMENTAL HEALTH & SAFETY\",\n \"MEDIEVAL STUDIES\", \"EDUCATION\", \"ACADEMIC AFFAIRS\", \"ANR SUSTAINABLE AG PROG\"\n return nil\n else\n Rails.logger.warn \"AD Sync: Missing OU for translation to container name: #{name}\"\n ActivityLog.err!(\"Could not translate unknown organization to AD group equivalent: #{name}\", ['active_directory'])\n end\n\n return false\nend", "def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend", "def suggest\n end", "def auto_suggest(input,sports_reg_exp)\n similarity = 0\n sport_suggestion = \"\"\n # iterates through each regular expression option\n\n return \"\" if input == \" \" || input == \"\"\n sports_reg_exp.each do |sport, reg_exp|\n #hashmap to numerize the similarity\n count = Hash.new 0\n # hits on matches and adds to hash the size of the match\n input.scan(reg_exp).each {|elm| count[elm.length] += 1}\n temp_similarity = 0;\n count.each do |k,v|\n # longer matches are given more weight in the sum\n count[k] = k ** v\n temp_similarity += count[k]\n end\n # identifies the most similar spot\n if temp_similarity > similarity\n sport_suggestion = sport\n similarity = temp_similarity\n elsif temp_similarity == similarity\n # returns different sports for mistyped input\n sport_suggestion = sport if rand(0..1) == 1\n end\n end\n # returns empty string if not similar enough\n sport_suggestion = \"\" if (similarity == 1 || (similarity <= 3 && sport_suggestion.length > 15))\n sport_suggestion\nend", "def romeo_and_juliet_quote; end", "def add_suggestions(name, items)\n # unless alternatives = compute_alternatives(name, items)\n # return\n # end\n # append_message(sprintf(' Did you mean \"%s\"?', implode('\", \"', alternatives)))\n end", "def spy_alias1 full_name\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n vowels=['a','e','i','o','u']\n alias_name.map! do |letter|\n next_vowel=letter\n vowels.each_index do |index|\n if vowels[index]=='u'&&letter==vowels[index]\n next_vowel='a'\n elsif letter==vowels[index]\n next_vowel=vowels[index+1]\n end\n end\n next_vowel\n end\n \n consonants=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n alias_name.map! do |letter|\n next_consonant=letter\n consonants.each_index do |index|\n if consonants[index]=='z'&&letter==consonants[index]\n next_consonant='b'\n elsif letter==consonants[index]\n next_consonant=consonants[index+1]\n end\n end\n next_consonant\n end\n \n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "def index\n @kai2_ji7s = Kai2Ji7.where('\"無齊記號\" LIKE ?','%*%*%*%*%*%').order('LENGTH(REPLACE(\"無齊記號\",\\'\\n\\',\\'\\')) ASC').limit(100)\n end", "def sittinae_hooey(scrawny_appulsion, termly)\n end", "def rating; \"Д/379 (stub)\"; end", "def suggest_other_query(items, query)\n query = query.gsub(/_/,\" \").downcase\n\n distance_levenshtein = 100\n longest_subseq = 0\n word = \"\"\n\n matcher1 = Amatch::Levenshtein.new(query)\n matcher2 = Amatch::LongestSubsequence.new(query)\n\n items.each{ |item|\n name_array = item.name.downcase.split\n name_array.push(item.name.downcase)\n\n new_distance_array_levenshtein = matcher1.match(name_array).sort\n new_longest_subseq_array = matcher2.match(name_array).sort.reverse\n\n if new_distance_array_levenshtein[0] < distance_levenshtein and new_longest_subseq_array[0] >= longest_subseq\n word = item.name\n distance_levenshtein = new_distance_array_levenshtein[0]\n longest_subseq = new_longest_subseq_array[0]\n end\n\n }\n\n if distance_levenshtein <= 3 and longest_subseq >=2\n self.closest_string = word\n end\n\n end", "def usage()\n puts \"you can use it wih the following options\"\n puts \"-w <a word> search sentences containing this word\"\n puts \"-i <id> search sentences with this id\"\n puts \"-l <lang> search sentences from this lang (lang is its iso 639 alpha 3 code\"\nend", "def catch_phrase\n [\n [\"Фирма1\", \"Суперфирма\", \"Фирма3\", \"ПанСамСклепав\"].rand,\n [\"24 часа\", \"24/7\", \"круглосуточно\", \"3 года на рынке\"].rand,\n [\"доступно\", \"быстро\", \"надежно\"].rand\n ].join(' ')\n end", "def badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend", "def autocomplete_book_author\n# re = Regexp.new(\"^#{params[:user][:favorite_language]}\" , \"i\" )\n # @books= Book.find_all do |book|\n # book.title.match re\n # end\n # render :layout=>false\n end", "def description\n \"Whois lookup\"\nend", "def test_passing_options_abbreviation\n\t\ta = @a.request(\"한국전쟁\", {:rt => \"rfile\", :pys => \"2005\"})\n\t\tputs a.title\n\t\tputs a.total\n\tend", "def get_short_name\n sname = description.split(/trofeo|meeting/i)\n if sname.length > 1\n # Remove spaces, split in tokens, delete empty tokens and take just the first 3, joined together:\n (sname[1].strip.split(/\\s|\\,/).delete_if { |item| item == '' })[0..2].join(' ')\n else\n # Just use the name if it wasn't \"splittable\":\n sname[0]\n end\n end", "def suggestions(endpoint_id)\n Utils::Fuzzy.match(endpoint_id, keys)\n end", "def fast_suggestions query\n return []\n end", "def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend", "def startstop minsize=30\n stopstop(minsize).find_all { | orf | \n codon1= orf.nt.seq[0..2].upcase\n ['ATG','TTG','CTG','AUG','UUG','CUG'].index(codon1) != nil\n }\n end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n word_substituter(tweet)\n #\"...\"\n else\n tweet\n end\nend", "def searchdescription\n end", "def alternatives(prefix)\n if @project\n word_list = Redcar::AutoCompleter::WordList.new\n tags = CompletionSource.project_tags(@project)\n tags.keys.sort_by{|tag| tag.downcase}.each do |tag|\n if tag[0..(prefix.length-1)] == prefix\n word_list.add_word(tag, 100000)\n end\n end\n word_list\n end\n end", "def lookup_new_swimmer\n \n end", "def minimal_age\n search_by_text('возраст').strip\n end", "def shorten\n\t\trange = [*'0'..'9',*'A'..'Z',*'a'..'z']\n self.short_url = Array.new(7){range.sample}.join\n self.save\n\tend", "def selective_tweet_shortener(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)\n end\nend", "def index\n @kai2_tuan7s = Kai2Tuan7.where('漢羅逝!=全羅逝').order(漢羅逝: :desc)\n end", "def best_euros p\n euros(p)\n end", "def selective_tweet_shortener(tweet)\n # tweets.each do |tweet|\n new_tweet = \"\"\n if tweet.length > 140\n new_tweet = word_substituter(tweet)\n else\n new_tweet= tweet\n end\n # end\n new_tweet\nend", "def career\n search_by_text('карьера').split(', ')\n end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def autocomplete; end", "def short_place_name\n # Drop the last word, it is always the legal description.\n words = place_name.split\n words.slice!(-1) if words.size > 1\n words.join(' ')\n end", "def selective_tweet_shortener(tweet)\n\tif tweet.size > 140\n\t\tword_substituter(tweet)\n\telse\n\t\ttweet\n\tend\nend", "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "def fit_name_by_pairing\r\n # Changed for Pairing Logic\r\n if pairing > 4\r\n return \"Best\"\r\n elsif pairing > 3 and pairing <= 4\r\n return \"Better\"\r\n elsif pairing > 2 and pairing <= 3\r\n return \"Good\"\r\n else\r\n return \"Wildcard\"\r\n end\r\n #End\r\n end", "def romeo_and_juliet; end", "def amount_of_suggestions\n system('clear')\n puts '》 RECOMMENDATIONS 《'\n amount = @prompt.ask('How many recommendations would you like to generate?'.colorize(:light_green)) do |q|\n q.in '1-10'\n q.messages[:range?] = 'Number must be between 1 and 10'\n end\n recommend(amount.to_i)\n end", "def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "def alias_creator(nickname)\nvowels=\"aeiou\"\nconsonants=\"bcdfghjklmnpqrstvwxyz\"\n#consonants exclude all vowels\n\nnickname_split=nickname.split(\"\")\nnew_nickname=[]\n#The translated nickname will be saved in the new_nickname arrawy\n\nnickname_split.map! do |x|\n\tif vowels.include?(x)\n\t\tnew_nickname << vowels[vowels.index(x)+1]\n\telsif consonants.include?(x)\n\t\tnew_nickname << consonants[consonants.index(x)+1]\n\telsif x == \" \"\n\t\tnew_nickname << \" \"\n\tend\nend\nnew_nickname.join(\"\").split.map {|x| x.capitalize}.join(\" \")\n#We are doing this so that we capitalize the first letter of both words\nend", "def find_complemental_infix\n verb, complement = @word.chars\n\n if complement == \"得\"\n query = \"#{verb} 不得\"\n else\n query = \"#{verb} 不|得 #{complement}\"\n end\n @complemental_infix = query_leeds_corpus(query) do |context|\n context.match.map(&:text).join\n end\n\n report_words_with_frequency(\"Complemental Infixes\", @complemental_infix)\n end", "def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend", "def throw_fierce_lqqks\n 'Here I am, giving you Soviet-Satellite realness'\n end", "def short_select_text_method\n ['du', beginning_of_week, 'au', end_of_week]\n .map(&:to_s)\n .map(&:strip)\n .join(' ')\n end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def make_syllable\n structure = self.structure.chars\n\n while true\n syll = ''\n structure.each do |ptype|\n # If the char is '?', skip with 50% chance to remove last character\n # (think RegEx usage of '?')\n if ptype == '?'\n if rand < 0.5\n syll = syll[0...syll.length - 1]\n end\n next\n end\n\n syll << choose(self.phonemes[ptype], self.exponent)\n end\n\n # Make sure this syllable doesn't violate a restriction\n bad = false\n self.restricts.each do |regex|\n if /#{regex}/ =~ syll\n bad = true\n break\n end\n end\n next if bad\n\n return spell(syll)\n end\n end", "def autocomplete(input, dictionary)\n mod_input = input.gsub(/[^a-zA-Z]/,\"\") \n dictionary.select { |word| word if word.start_with?(mod_input.downcase) || word.start_with?(mod_input.capitalize)}\n .first(5)\nend", "def modeler_description\n return 'To start with measure will hard code a string to narrow the search. Then a shorter list than all weather files on BCL will be shown. In the future woudl be nice to select region based on climate zone set in building object.'\n end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n tweet = word_substituter(tweet)\n end\n tweet\nend", "def scan_austal_src(pollutants)\n File.readlines(@austal_txt).collect{|l|l.scan /^\\S+/}.flatten & pollutants\n end", "def half_wind_abbreviation; end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n return tweet\n end\nend", "def slogan\n search_by_text 'слоган'\n end", "def improve(text)\n return Typogruby.improve(text.to_s)\n end", "def unoconv_pname\n 'LibreOffi'\n end", "def word_picker\n dictionary = File.readlines('lib/5desk.txt')\n word = dictionary.sample(1)[0].chomp.downcase\n word = dictionary.sample(1)[0].chomp.downcase until word.length.between?(5, 12)\n word\n end", "def new_query\n @min_date, @max_date = PlateTube.find_min_and_max_dates\n @oligo_usages = PlatePosition::OLIGO_USAGE.invert.to_a.sort.insert(0,'(All)') \n end", "def known_edits2 (word)\n # get every possible distance - 2 edit of the input word. Return those that are in the dictionary.\n end", "def suggest_prereqs; suggest_with_score(prereqs).last; end", "def selective_tweet_shortener(string)\n if string.length < 140 \n string\n else \n word_substituter(string)\n end\nend", "def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end", "def corrections; end", "def create_researcher_quotation\n nome_citacoes = Array.new\n initials = []\n cleaned_name = self.clean_name self.nome\n nome_list = cleaned_name.split ' '\n nome_list.each{|n| initials << n[0]}\n\n initials_first_index = 0\n initials_last_index = initials.length - 1\n nome_list_last_index = nome_list.length - 1\n\n # 1. MICHAEL DA COSTA MORA\n citacao = self.nome.upcase\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 2. MICHAEL C. M.\n citacao = nome_list.first + ' ' + initials.list_without_element(initials_first_index).join('. ') + '.'\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 3. MICHAEL C. MORA\n citacao = nome_list.first + ' ' + initials.list_without_list_of_elements([initials_first_index, initials_last_index]).join('. ') + '. ' + nome_list.last\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 4. M. C, MORA\n citacao = initials.list_without_element(initials_last_index).join('. ') + ', ' + nome_list.last\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 5. MORA, MICHAEL COSTA\n rest_of_name = nome_list.list_without_element(nome_list_last_index)\n last_name_formatted = nome_list.list_without_list_of_elements((0..(rest_of_name.length - 1))).join('') + ', '\n citacao = last_name_formatted + rest_of_name.join(' ')\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 6. MORA, MICHAEL DA COSTA\n full_name_list = I18n.transliterate(self.nome).upcase.split(' ')\n full_name_list_last_index = full_name_list.length - 1\n rest_of_name = full_name_list.list_without_element(full_name_list_last_index)\n citacao = last_name_formatted + rest_of_name.join(' ')\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 7. MORA, MICHAEL C.\n citacao = last_name_formatted + rest_of_name.list_without_element(rest_of_name.length - 1).join('') + initials.list_without_list_of_elements([initials_first_index, initials_last_index]).join('. ') + '.'\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 8. MORA, M. C.\n citacao = last_name_formatted + initials.list_without_element(initials_last_index).join('. ') + '.'\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 9. DA COSTA MORA, MICHAEL\n full_name_list = I18n.transliterate(self.nome).upcase.split(' ')\n rest_of_name = full_name_list.list_without_element(0)\n citacao = rest_of_name.join(' ') + ',' + full_name_list.first\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n return nome_citacoes\n end", "def modeler_description\n return \"Loop through all thermal zones, and append a user-specified suffix to thermal zone names that either include or don't include the user-provided search string\"\n end", "def char_description(character)\n\thtml = open(\"https://awoiaf.westeros.org/index.php/#{character}\")\n\tdoc = Nokogiri::HTML(html)\n\tif doc.css(\"div.hatnote:first-child\").empty? #|| doc.css(\".mw-parser-output .hatnote:nth-child(2)\").empty?\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(2)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\telse \n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(3)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\n\tif character == \"Walder_Frey\"\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(3)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\n\tif character == \"Viserys_Targaryen\"\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(3)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\n\tif character == \"Tywin_Lannister\"\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(2)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\tdescription\nend", "def marketplace_names\n %w(graphicriver themeforest activeden codecanyon videohive audiojungle photodune 3docean)\n end", "def pessoavaidois(lugar)\n \"indo para \" + lugar\nend", "def map_description_part(description, query)\n start_of_find = description.gsub(/_/, \" \").downcase.index(query)\n substring_start = if start_of_find - 17 < 0 then 0 else start_of_find - 17 end\n substring_end = if start_of_find + 20 > description.size then description.size else start_of_find + 20 end\n\n matching_description = description[substring_start..substring_end].gsub(\"/~/\", \",\")\n\n if substring_end != description.size\n matching_description << \"...\"\n end\n\n if substring_start != 0\n matching_description = \"...\" + matching_description\n end\n\n matching_description\n end", "def long_appearance\n # How Med does it:\n # description\n # glance\n # eq\n # inventory\n \"{!{FG#{description}\\n\\n{FY{#{short_name} is in excellent condition.\"\n end", "def suggest(search)\n suggestions = []\n\n haystack.scan /#{search}(?<suggestion>\\b[^.?!]+\\b{1,5})/i do |match|\n suggestions << match.first\n end\n\n suggestions\n end", "def api_other_options(variable)\n url_auto = \"https://wagon-dictionary.herokuapp.com/autocomplete/#{variable}\"\n auto_dictionary_serialized = open(url_auto).read\n auto_words = JSON.parse(auto_dictionary_serialized)\n\n sorted_words = auto_words['words'].max_by(auto_words['words'].length) { |word| word.length }\n return sorted_words\nend", "def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend", "def get_licence_step1_per_item\n a = @dc[:description] + @dc[:rights]\n a.each{|desc|\n # It is important to test for abbreviations in the correct order\n # (as per the LICENCE_KEYS array).\n LICENCE_KEYS.each{|k| return k.to_s.upcase.gsub(\"_\", \"-\") if\n desc.match(LICENCE_ABBR_REGEX_LIST[k]) || desc.match(LICENCE_URL_REGEX_LIST[k])}\n }\n nil\n end", "def optimum_epl max = 1700, tolerance = 0.1\n last_epl = false\n epl = nil\n 10.times do |i|\n epl = generate_epl(tolerance)\n \n # Exit loop \n # 28 == basic string length from generate_epl\n if epl.length > max || (epl.length == last_epl.length if last_epl && epl.length != 29)\n return last_epl \n else \n last_epl = epl\n tolerance = tolerance / 10.0 #DECREASE SIMPLIFICATION BY FACTOR OF TEN\n end \n end\n epl\n end", "def optimum_epl max = 1700, tolerance = 0.1\n last_epl = false\n epl = nil\n 10.times do |i|\n epl = generate_epl(tolerance)\n \n # Exit loop \n # 28 == basic string length from generate_epl\n if epl.length > max || (epl.length == last_epl.length if last_epl && epl.length != 29)\n return last_epl \n else \n last_epl = epl\n tolerance = tolerance / 10.0 #DECREASE SIMPLIFICATION BY FACTOR OF TEN\n end \n end\n epl\n end", "def hard_to_pronounce?\n word = last_epithet.downcase\n word.gsub!(/(ou|ii|ae|au|ei|eu|oe)/, '_')\n word.gsub!(/(sch|[cptzsg]h|[ct]r|t[sz])/, '@')\n word.gsub!(/([^aeiouy_])\\1/, '@')\n return true if word =~ /[aeiou_]{4}/ || word =~ /[aeiou_]{3}y($|[^aeiou_])/\n return true if word =~ /[^aeiouy_]{4}/\n false\n end", "def build_sru_query(input)\n if input[0..4] == 'lccn:'\n \"bath.lccn=#{input[5..-1]}\"\n else\n \"bath.isbn=#{input}\"\n end\nend", "def anstatauKodo(teksto)\n\n trovoj = teksto.scan(/&(.*?);/)\n if trovoj == nil or trovoj.size <= 0 then return teksto end\n\n for i in 0..trovoj.size do\n \n\ttrov = trovoj[i].to_s[2..-3]\n if @literoj[trov] != nil\n\t teksto.sub!(\"&#{trov};\", @literoj[trov])\n\telse\n\t #puts \"Eraro! Ne trovis [#{trov}]\"\n\tend\n end\n\n teksto = CGI::unescapeHTML(teksto)\n return teksto\nend", "def suggestions\n words = params[:query].split(/\\s+/).reject(&:blank?)\n\n suggestions = case words.size\n when 1\n if words.first.starts_with?('@')\n users = find_users(words.first[1..-1]).limit(MAX_SUGGESTIONS)\n users.map do |user|\n {\n user: user.as_json,\n url: user_url(user),\n type: 'user'\n }\n end\n else\n projects = find_projects(words[0]).limit(MAX_SUGGESTIONS).map(&:sluggable).compact\n projects.map do |project|\n {\n project: project.as_json,\n url: project_url(project),\n type: 'project',\n }\n end\n end\n when 2\n project = find_projects(words[0]).only.try!(:sluggable)\n envs = find_environments(project, words[1]).limit(10) if project\n envs.map do |env|\n {\n project: project.as_json,\n environment: env.as_json,\n type: 'environment',\n url: project_environment_bugs_url(project, env)\n\n\n }\n end if project\n when 3\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n [{\n type: 'bug',\n url: project_environment_bug_url(project, env, bug),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json\n }] if bug\n when 4\n project = find_projects(words[0]).only.try!(:sluggable)\n env = find_environments(project, words[1]).only if project\n bug = env.bugs.find_by_number(words[2].to_i) if env\n occurrence = bug.occurrences.find_by_number(words[3].to_i) if bug\n [{\n type: 'occurrence',\n url: project_environment_bug_occurrence_url(project, env, bug, occurrence),\n project: project.as_json,\n environment: env.as_json,\n bug: bug.as_json,\n occurrence: occurrence.as_json\n }] if occurrence\n end\n\n respond_to do |format|\n format.json { render json: (suggestions || []).to_json }\n end\n end", "def borra_fuzzy_match\n return if Rails.env.development_mac?\n # Borra el nombre cientifico\n FUZZY_NOM_CIEN.delete(id)\n\n # Borra los nombre comunes\n 50.times do |i|\n id_referencia = nombre_comun_a_id_referencia(i+1)\n FUZZY_NOM_COM.delete(id_referencia)\n end\n end", "def unit_lead_by_academician\n main_tasks=Login.current_login.staff.position.tasks_main\n if main_tasks.include?(\"Ketua Unit\") \n mgmt_unit=main_tasks.scan(/Ketua Unit(.*),/)[0][0].strip\n else\n mgmt_unit=\"\"\n end\n mgmt_unit\n end", "def short\n # this are short words\n assert PorterStemmer::Porter2.short?(\"bed\")\n assert PorterStemmer::Porter2.short?(\"shed\")\n assert PorterStemmer::Porter2.short?(\"shred\")\n\n # this are not short words\n assert !PorterStemmer::Porter2.short?(\"bead\")\n assert !PorterStemmer::Porter2.short?(\"embed\")\n assert !PorterStemmer::Porter2.short?(\"beds\")\n end", "def fix_suggestion\n backup_error_obj.fix_hint rescue 'Please help us debug this error by forwarding this email to [email protected]'\n end", "def shorten_difficulty(diff)\n diff = diff.to_s\n diff = diff.gsub(/heroic_(10|25)/, '\\1H')\n diff = diff.gsub(/normal_(10|25)/, '\\1')\n\n \" (#{diff})\"\n end", "def handle_dn_mn_sd_h_m_s_abbr_sy\n handle_dn_mn_sd\n next_tag\n handle_h_m_s\n next_tag\n handle_abbr\n next_tag\n handle_sy\n end", "def support_autocorrect?; end", "def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend", "def show # shows the selected word of the day (redundant)\n end", "def construct_supply_item_description(data)\n @description = @description.strip\n @description = @description.gsub(\"ß\",\"ss\")\n return @description\n end", "def description\n \"This task looks for usernames via google searchs.\"\nend", "def update_if_phoneme(word)\n\n\tsingle_phoneme = [\"qu\"]\n\n\tstart_with_phoneme = \"\"\n\n\tsingle_phoneme.each do |phoneme|\n\t\t\n\t\tstart_with_phoneme = phoneme if word.start_with?(phoneme)\n\t\tif(start_with_phoneme == \"\" && !is_vowel(word[0]))\n\t\t\tstart_with_phoneme = word[0] + phoneme if word[1..word.size].start_with?(phoneme)\n\t\tend\n\n\tend\n\n\treturn start_with_phoneme\n\nend", "def find_meaning(lexical_item)\n \n end" ]
[ "0.60147995", "0.56466407", "0.56322396", "0.549939", "0.5470212", "0.54232776", "0.5340587", "0.5327706", "0.53213376", "0.531095", "0.5303589", "0.52974606", "0.52776086", "0.52680314", "0.5264563", "0.5239856", "0.5234957", "0.5220638", "0.52076626", "0.51983064", "0.5184889", "0.5179709", "0.51736885", "0.516263", "0.5156843", "0.51465946", "0.513847", "0.51348025", "0.5133946", "0.5130514", "0.51298463", "0.51294124", "0.51174843", "0.51152724", "0.51039916", "0.50914115", "0.5087307", "0.5070493", "0.5066789", "0.50651383", "0.5058295", "0.5051605", "0.5049154", "0.50482506", "0.5046835", "0.50458324", "0.5043496", "0.50413513", "0.50373006", "0.5035992", "0.5035992", "0.5035992", "0.5035992", "0.5034151", "0.5028145", "0.5026128", "0.5022034", "0.50102305", "0.5005435", "0.50052774", "0.50011164", "0.5000777", "0.5000733", "0.4995289", "0.4986334", "0.49813327", "0.49806008", "0.4979851", "0.49744654", "0.49729842", "0.49654785", "0.49647725", "0.49637145", "0.4961056", "0.4945108", "0.49393296", "0.49336624", "0.49281773", "0.4927417", "0.49196345", "0.4918643", "0.49104908", "0.49104878", "0.49070773", "0.49037734", "0.49027833", "0.49020848", "0.4899664", "0.48950046", "0.48943865", "0.48901445", "0.4886492", "0.48837265", "0.48755136", "0.4874947", "0.48733312", "0.48720595", "0.4868577", "0.48664895", "0.48652816" ]
0.5261307
15
Suggestions Investing Dot Com
def filter_suggestionsInvestingDotCom @suggestionsFromInvestingDotCom = @@SJA.select("stocks.isin, name, last_price, investing_dotcomrating").where("investing_dotcomrating = ?", true).order(:name) render json: @suggestionsFromInvestingDotCom end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_for_dots(token); end", "def lex_en_leading_dot; end", "def lex_en_leading_dot; end", "def lex_en_leading_dot; end", "def dottify\n self.gsub(/[^[:print:]]/, \".\")\n end", "def handle_agent_corporate_punctuation(name_fields)\n name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}\n\n # The value of subfield g must be enclosed in parentheses.\n g_index = name_fields.find_index {|a| a[0] == \"g\"}\n unless !g_index\n name_fields[g_index][1] = \"(#{name_fields[g_index][1]})\"\n end\n\n # The value of subfield n must be enclosed in parentheses.\n n_index = name_fields.find_index {|a| a[0] == \"n\"}\n unless !n_index\n name_fields[n_index][1] = \"(#{name_fields[n_index][1]})\"\n end\n\n #If subfield $e is present, the value of the preceding subfield must end in a comma.\n #If subfield $n is present, the value of the preceding subfield must end in a comma.\n #If subfield $g is present, the value of the preceding subfield must end in a comma.\n ['e', 'n', 'g'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index || s_index == 0\n preceding_index = s_index - 1\n\n # find preceding field and append a comma if there isn't one there already\n unless name_fields[preceding_index][1][-1] == \",\"\n name_fields[preceding_index][1] << \",\"\n end\n end\n end\n\n # Each part of the name (the a and the b’s) ends in a period, until the name itself is complete, unless there's a subfield after it that takes a different mark of punctuation before it, like an e or it's got term subdivisons like $b LYRASIS $y 21th century.\n\n ['a', 'b'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index\n\n # find field and append a period if there isn't one there already\n unless name_fields[s_index][1][-1] == \".\" || name_fields[s_index][1][-1] == \",\"\n name_fields[s_index][1] << \".\"\n end\n end\n end\n\n apply_terminal_punctuation(name_fields)\n\n return name_fields\n end", "def cln(str, dot = true)\n str.gsub!('/', '_')\n str.gsub!(':', '_')\n str.gsub!('?', '_')\n str.gsub!(/\\.$/, '_') if dot\n str \nend", "def lex_en_leading_dot=(_arg0); end", "def lex_en_leading_dot=(_arg0); end", "def lex_en_leading_dot=(_arg0); end", "def test_mike_with_dots_become_mike\n assert_equal 'MIKE', sanitize('M.I.K.E.')\n assert_equal 'MIKE', sanitize('m.i.k.e.')\n end", "def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end", "def fix_dots\n fields = %w(100$a 100$d 240$a 300$a $650a 710$a 700$a 700$d)\n fields.each do |field|\n tag, code = field.split(\"$\")\n links = node.xpath(\"//marc:datafield[@tag='#{tag}']/marc:subfield[@code='#{code}']\", NAMESPACE)\n links.each {|link| link.content = link.content.gsub(/[\\.,:]$/, \"\")}\n end\n end", "def clean_up_word(word)\n\t\tword.strip!\n\t\tword.chomp!(\".\")\n\t\tword.chomp!(\",\")\n\t\tword.chomp!(\"\\\"\")\t\n\t\tword.downcase!\n\tend", "def addDots(beforeDot)\n\t\tafterDot = \"\"\n\t\tapproachLast = false\n\n\t\tbeforeDot.each_char { |ch|\n\t\t\tif approachLast\n\t\t\t\tcase ch\n\t\t\t\twhen '|', ';'\n\t\t\t\t\tapproachLast = false\n\t\t\t\twhen '*', '+', ')' \n\t\t\t\twhen '(' \n\t\t\t\t\tafterDot << '#'\n\t\t\t\t\tapproachLast = false\n\t\t\t\telse \n\t\t\t\t\tafterDot << '#'\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tcase ch\n\t\t\t\twhen '(', '+', '*', '|', ';'\n\t\t\t\telse\n\t\t\t\t\tapproachLast = true\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tafterDot << ch\n\t\t}\n\t\t# print afterDot\n\t\tafterDot\n\tend", "def fix_dots\n fields = %w(100$a 100$d 240$a 300$a 710$a 700$a 700$d)\n fields.each do |field|\n tag, code = field.split(\"$\")\n links = node.xpath(\"//marc:datafield[@tag='#{tag}']/marc:subfield[@code='#{code}']\", NAMESPACE)\n links.each {|link| link.content = link.content.gsub(/[\\.,:]$/, \"\")}\n end\n end", "def eat\n \"Nom. Nom. Nom.\"\n end", "def scan_for_commas(token); end", "def nice_name\n name.gsub(/\\..+/, '').wikify\n end", "def test_contain_period\n %w( example.com del.icio.us ).each do |word|\n assert_equal word, word.titlecase\n end\n end", "def stuff(input)\n\twords = input.split(\" \")\n\n\twords.each do |x| \n\t\tif x == 'the' || x == 'of' || x == 'and' || x == 'is' || x == 'a'\n\t\t\telse\n\t\t\t\t@acronym << x.to_s.chars.first.upcase + \".\"\n\t\tend\n\tend\nend", "def chars_to_dots(chardot_str)\n dotmod_def = \"\"\n chardot_str.each_char do |char|\n if @brlchars.include? char then\n dotmod_def += @brlchars[char] + \"-\"\n else\n dotmod_def += char\n end\n end\n dotmod_def.gsub!(/--/, \"-\")\n dotmod_def.gsub!(/-\\|/, \"|\")\n dotmod_def.gsub!(/-$/, \"\")\n\n return dotmod_def\nend", "def word\n @word ||= Word.current_word('a-zA-Z0-9_.', :left).split('.').last\nend", "def strike text\n if text =~ /\\A[a-z\\d.\\/-]+\\z/i then\n \"~#{text}~\"\n else\n \"<s>#{text}</s>\"\n end\n end", "def clean_pgn\n /\\[[\\w\\\"\\s\\d\\.\\-\\:]*\\]/\n end", "def transform_control_title (title)\n title.gsub(/^\\(L1\\) /, '').gsub(/[()',.&:]/, '').gsub(/.scr/, '').gsub(/\\s+/, '_').gsub(/[\\\\%-]/, '_').gsub(/_+/,'_').downcase\nend", "def clean_name(name)\n if name.present?\n name.gsub(/(\\s|-|\\.|,)/,'')\n end\n end", "def get_incguard_from_incfname incfname\n incfname.gsub(/[^\\w]+/, \"_\").upcase\nend", "def scan_for_quote(token); end", "def scan_for_dash(token); end", "def expand_genus_abbreviation(str)\n str.sub(/^([A-Z])\\.? +(?=[\"a-z])/) do |x|\n (n = @@name_lookup[$1]) ? n + ' ' : x\n end\n end", "def excite\n @name.upcase + '!!'\n end", "def label\n @example.description.scan(/Campo\\s(.*?)\\s\\(\\w+\\)/).flatten.first\n rescue\n @example.description\n end", "def dechapterize(name)\n \"#{name.sub(/^\\d+\\.(\\d+)?\\s+/, '')}\"\n end", "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end", "def captionize\n res = titleize\n Settings::CaptionAcronyms.each do |acronym|\n res = res.gsub(/(?<![\\w\\d])(#{acronym})(?![\\w\\d])/i, acronym)\n end\n res\n end", "def sentence_maker_refactored(words)\n words.first.capitalize!\n words.join(\" \") + \".\"\nend", "def two_word_name; end", "def dot_key_code_wrapped dot_key_code\n if dot_key_code.nil? || dot_key_code.length < 20 then\n return dot_key_code\n else\n arr= dot_key_code.split('.')\n chars=0\n sep = '.'\n str = nil\n #puts 'a:' + arr.to_s\n arr.each do |part|\n #debugger\n #puts 'p:' + part\n chars += part.length\n if chars > 20 then\n sep='.<br>'\n chars =0\n end\n #puts 'c:' + chars.to_s\n if str.nil? then\n str = part\n else\n str += (sep + part)\n end\n #puts 's:' + str\n end\n #puts 'se:' + str\n return str.html_safe\n #line = dot_key_code[20..(dot_key_code.length - 1)]\n #index = line.replace( line.index('.')\n end\n end", "def hipsterfy(word)\n\nend", "def fix_team_name(team)\n team.split.map {|w| w.capitalize}.join(' ').\n gsub('.', '').\n match(/[A-z &']+/)[0].\n gsub(/((Af|F)c|Rmi)/) {|w| w.upcase}.\n strip\nend", "def name_significance #adding an instance method\n parts = self.split( '-' )\n syllables = @@syllables.dup\n signif = parts.collect do |p|\n syllables.shift[p]\n end\n signif.join( ' ' )\n end", "def sanitize_refpt1 refpt1\n refpt1.strip.gsub(\".\", \"\")\n end", "def substitute_with_dot(s) # Expression reguliére Numéro de téléphone\r\n puts s.sub(/(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/, '\\1.\\2.\\3.\\4.\\5')\r\nend", "def de_dot(list)\n list.delete('.')\n list.delete('..')\n list\n end", "def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end", "def dot\n end", "def display_word(word, triedchars)\n res = \"\"\n word.split(\"\").each do |char|\n if triedchars.include?(char.upcase) or not char.match(/^[[:alpha:]]$/)\n res += char\n elsif\n res += \"_\"\n end\n end\n res\nend", "def lex_en_expr_dot; end", "def lex_en_expr_dot; end", "def lex_en_expr_dot; end", "def cat_mouse(x)\n if x.count('.') <= 3\n return 'Caught!'\n else\n return 'Escaped!'\n end\nend", "def hard_to_pronounce?\n word = last_epithet.downcase\n word.gsub!(/(ou|ii|ae|au|ei|eu|oe)/, '_')\n word.gsub!(/(sch|[cptzsg]h|[ct]r|t[sz])/, '@')\n word.gsub!(/([^aeiouy_])\\1/, '@')\n return true if word =~ /[aeiou_]{4}/ || word =~ /[aeiou_]{3}y($|[^aeiou_])/\n return true if word =~ /[^aeiouy_]{4}/\n false\n end", "def annotate_quote\n Caption.new(\n gsub('\\\\', '\\\\\\\\\\\\').\n gsub('%', '%%').\n gsub(/^@/, '\\@'))\n end", "def short_place_name\n # Drop the last word, it is always the legal description.\n words = place_name.split\n words.slice!(-1) if words.size > 1\n words.join(' ')\n end", "def clean_tag(name)\n name.gsub( /[^-.,_[:alnum:]]/, '_' )\n end", "def abbrev_name(name)\r\n # name.split.map { |s| s[0]}.join('.').upcase\r\n # name.upcase.split.map(&:chr).join\".\"\r\n \r\n newname = name.split(' ')\r\n newname[0][0].capitalize + '.' + newname[1][0].capitalize\r\nend", "def wookiee_sentence; end", "def add_period(sentence)\n arr = [\".\",\",\",\"!\",\"?\"]\n if arr.include?(sentence[sentence.length - 1])\n return sentence\n else\n return sentence + \".\"\n end\nend", "def get_word_from_context(context)\r\n words = []\r\n\r\n context.split(\" \").each do |word|\r\n if word[-1] == \".\" or word[-1] == \",\" or\r\n word[-1] == \"?\" or word[-1] == \"!\" or\r\n word[-1] == \":\" \r\n\r\n word = word[0..-2]\r\n end\r\n\r\n words << word unless word.size < 3\r\n end\r\n\r\n words\r\nend", "def remplace_persos_in str\n str.gsub!(/\\[PERSO#([a-zA-Z_]+)\\]/){\n tag_perso = $1.freeze\n if @args_tm[:personnages].key?(tag_perso)\n perso = @args_tm[:personnages][tag_perso][:patronyme]\n \"personnage:|#{perso}|\"\n else\n \"[PERSONNAGE INTROUVABLE : #{tag_perso}]\"\n end\n }\n return str\n end", "def format_sentence(sentence)\n pattern = /([\\.\\?\\!] [A-z])/\n scan = sentence.scan(pattern).flatten\n scan.each do |occurence|\n replacement = occurence.upcase\n sentence.sub!(occurence, replacement)\n end\n sentence[0] = sentence[0].upcase\n sentence\nend", "def get_text\n text = ''\n sep = ''\n @lexemes.each { |lexeme|\n if lexeme == '.'\n text << lexeme\n sep = ''\n else\n text << sep\n text << lexeme\n sep = ' '\n end\n }\n\t@lexemes = []\n text\n end", "def safe_name\n name.to_s.gsub(/[^a-zA-Z0-9 _\\-:\\.]/, '').gsub(/:/, ' - ').gsub(/ +/, ' ')\n end", "def spell_out (foo)\n foo.downcase.split(\"\").join(\"-\")\n end", "def abbreviation; end", "def abbreviation; end", "def abbreviation; end", "def abbreviation; end", "def name_components\n @_name_components ||= name.scan(/[[:alnum:]]+/)\n end", "def phrase(str)\n puts \"#{str}..Only in America!\"\nend", "def do_process(ps )\n word = nil\n buf = \"\"\n tokens = ps.sentence.split(/[ \\t]/)\n \n for word in tokens do\n #문자열의 길이가 최대 허용치보다 길다면...\n if word.length() > REPEAT_CHAR_ALLOWED then\n repaedCnt = 0\n checkChar = word[0]\n \n buf << checkChar\n \n for i in 1..(word.length-1) do\n if checkChar == word[i] then\n if repaetCnt == (REPEAT_CHAR_ALLOWED-1) then\n buf << \" \"\n buf << word[i]\n repeatCnt = 0\n else\n buf << word[i]\n repeadCnt +=1\n end\n else\n if checkChar == \".\" then\n buf << \" \"\n end\n \n buf << word[i]\n checkChar = word[i]\n repeadCnt = 0\n end\n end\n else\n buf << word\n end\n buf << \" \"\n end\n ps.sentence=buf\n return ps\n end", "def name_filter\n self.gsub(/[^a-zA-Z\\s\\-\\(\\)]/, '')\n end", "def acronym_regex\n /#{%w(I2C UART GPIO).join(\"|\")}/\n end", "def handle\n @name.to_str.strip.downcase.split(/[_ ]+/).join(\"_\")\n end", "def sanitize(name)\n name.gsub(\".\", \"_\")\nend", "def test_suggest_word_with_one_word_inserted_and_three_letter_string\n @completion.insert(\"pizza\")\n assert_equal [\"pizza\"], @completion.suggest(\"pi\")\n end", "def sanitize(name)\n #name.gsub(\".\", \"_\").gsub(/<.+>/, \"\")\n name.gsub(\".\", \"_\").gsub(\"$\", \"_\")\nend", "def abbreviate(rawChoice, choice, token)\n choice\n end", "def implausible_common_name\n parse('creature.bird.implausible_common_names').capitalize\n end", "def deabbreviate\n str = clone\n ABBREVIATIONS.each do |abbreviations, replacement|\n abbreviations.each do |abbreviation|\n str = str.gsub(/\\b#{abbreviation}[\\.\\b\\s-]+/i, \"#{replacement} \")\n end\n end\n str\n end", "def parse_excom\n subs!(%r{<p>%excom#{PARAGRAPH_CONTENTS}</p>}, @next_excom)\n end", "def as_you_like_it_quote; end", "def name\n @token\n #match(/^Information\\son\\s([&#+][^:]+):$/)\n end", "def cardinal_abbreviation; end", "def normal_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tfirstname = firstpart.gsub(/[[:upper:]]\\./, '').strip\n\t\t\tfirstname + ' ' + lastname\n\t\tend", "def word_replace word, first_word\n if word =~ /^[A-Z]*$/ then\n \"_PROPER_\"#proper names\n elsif word =~ /^[A-Z|\\.]*$/ then\n if first_word then\n \"_FIRST_\"\n else\n \"_FNOCO_\" #first name or companies\n end\n elsif word =~ /^[A-Z].+$/ then\n if first_word then\n \"_FIRST_NAME_\"\n else\n \"_NAME_\"\n end\n elsif word =~ /^[0-9|\\-]*$/ then\n \"_NUM_\" #number\n else\n \"_RARE_\"\n end\nend", "def auto_complete(word)\n completion_list.grep(/^#{ Regexp.escape(word) }/)\n end", "def emphasis text\n if text =~ /\\A[a-z\\d.\\/]+\\z/i then\n \"_#{text}_\"\n else\n \"<em>#{text}</em>\"\n end\n end", "def more_say(more_words=\"butts\")\n puts more_words + \".\"\nend", "def lex_en_interp_backslash_delimited_words; end", "def lex_en_interp_backslash_delimited_words; end", "def lex_en_interp_backslash_delimited_words; end", "def alias_processing\n self.alias = Russian.translit(self.alias.strip.gsub(' ', '_').gsub(/[\\W\\d]/, '')).downcase\n end", "def extract_name_from_text(text); end", "def underscore\n\t\tcamel_cased_word = self\n\t\tword = camel_cased_word.to_s.dup\n\t\tword.gsub!(/::/, '/')\n#\t\tword.gsub!(/(?:([A-Za-z\\d])|^)(#{inflections.acronym_regex})(?=\\b|[^a-z])/) { \"#{$1}#{$1 && '_'}#{$2.downcase}\" }\n\t\tword.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n\t\tword.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n\t\tword.tr!(\"-\", \"_\")\n\t\tword.downcase!\n\t\tword\n\tend", "def sanitised(title)\n title.delete(',') # ignore, commas\n .sub(/[?!']$/, '') # ignore ? and ! and ' at the end of the title!\n .gsub(\"' \", ' ') # ignore ' at the endin' of a word\n .sub('Feat. ', 'Feat ')\n end", "def describe_paragraph(being)\n desc = ''\n continued = false\n describe(being) do |quality, key, amount|\n possessive = possessive_name_or_pronoun(being)\n possessive.capitalize! unless continued\n desc += [conjunction(continued),\n possessive,\n key,\n key.pluralize == key ? 'are' : 'is',\n strength(amount),\n quality].join(' ')\n continued = rand < 0.333 && !continued\n desc += \".\" unless continued\n end\n desc.strip\n end", "def abbrev_name(name)\n \"#{name[0]}.#{name.split[1][0]}\".upcase\nend", "def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end", "def fix_subfield_demarcators(value)\n value.gsub(/\\|\\w{1}/,\"--\")\n end" ]
[ "0.6595069", "0.60781986", "0.60781986", "0.60781986", "0.5987779", "0.5914746", "0.58901894", "0.5822822", "0.5822822", "0.5822822", "0.58210534", "0.58011115", "0.5774837", "0.57570976", "0.5734523", "0.568982", "0.5641017", "0.5578494", "0.5577055", "0.553349", "0.5516518", "0.55122656", "0.5494887", "0.5437484", "0.54299057", "0.53974307", "0.53913605", "0.53580177", "0.5356666", "0.5351636", "0.53415614", "0.533741", "0.53373975", "0.53349584", "0.5322037", "0.5315749", "0.53068924", "0.52663875", "0.5256724", "0.5253565", "0.5251145", "0.5244724", "0.5233084", "0.52123004", "0.52106816", "0.5193135", "0.5175118", "0.51670897", "0.51557505", "0.51557505", "0.51557505", "0.51540375", "0.5151267", "0.5150801", "0.5148127", "0.5139056", "0.5137419", "0.5123478", "0.512291", "0.5119057", "0.5100599", "0.51005477", "0.50935763", "0.5092988", "0.5088449", "0.5086171", "0.5086171", "0.5086171", "0.5086171", "0.5085532", "0.5085133", "0.50831306", "0.50777376", "0.507389", "0.5073208", "0.5069685", "0.50666195", "0.50635993", "0.50621074", "0.50599205", "0.5058201", "0.50571597", "0.5056853", "0.5056488", "0.50497115", "0.5048451", "0.5043845", "0.5042828", "0.50409776", "0.5040044", "0.5037232", "0.5037232", "0.5037232", "0.50361097", "0.5024652", "0.5023091", "0.50209594", "0.5020817", "0.5019729", "0.5019654", "0.50184864" ]
0.0
-1
Filter based on Studies
def filter_overResistanceStocksOnStudy @overResistanceStocksOnStudy = @@SJS.select("isin, name, last_price, resistance").where("last_price > resistance").order(:updated_at).reverse render json: @overResistanceStocksOnStudy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def related_studies\n _studies = []\n under_supervision_studies.each do |study|\n unless _studies.include?(study)\n _studies.append(study)\n end\n end\n studies.each do |study|\n unless _studies.include?(study)\n _studies.append(study)\n end\n end\n return _studies\n end", "def students\n filters = []\n filters.push(\"{SCHOOL_TFPID} = '#{goddamn_school}'\") if goddamn_school\n Student.some(\n shard: self.goddamn_city,\n sort: [\"Name\", :asc],\n filterByFormula: \"AND(#{filters.join(',')})\"\n )\n end", "def filters; end", "def filters; end", "def filter\n end", "def filters\n end", "def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end", "def index\n\tStudy.adjustThreshold\n @studies = Study.all\n end", "def search_studies\n @studies = Study.search(search_query, query_args)\n return {\n :recordsTotal => @studies.total_entries,\n :data => @studies.map{|s| study_result_to_json(s)},\n :aggs => @studies.aggs\n }\n end", "def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end", "def filter; end", "def filter; end", "def filter; end", "def study_subjects_conditions\n\t\tunless q.blank?\n\t\t\tstudy_subjects = StudySubject.search(:q => q, :paginate => false)\n\t\t\tstudy_subject_ids = study_subjects.collect(&:id)\n\t\t\t['abstracts.study_subject_id IN (:study_subject_ids)', \n\t\t\t\t{ :study_subject_ids => study_subject_ids } ]\n\t\tend\n\tend", "def list_studies\n act = StudyListAction.new(self)\n act.get\n end", "def filter_by_params(clinics, gestational_age, naf_only, medicaid_only)\n filtered_clinics = clinics.keep_if do |clinic|\n gestational_age < (clinic.gestational_limit || 1000) &&\n (naf_only ? clinic.accepts_naf : true) &&\n (medicaid_only ? clinic.accepts_medicaid : true)\n end\n filtered_clinics\n end", "def filtered_dataset\n filter_args_from_query.inject(@dataset) do |filter, cond|\n filter.filter(cond)\n end\n end", "def apply_filter\n end", "def filter_findings\n findings\n end", "def filters\n # Call model column on self (metadata since element in array is a string, not a variable hence we use send) <=> self.send(profile) == true\n %w[sight_seeing_adventurer art_lover serial_shopper nature_lover food_addict sport_lover history_passionate tech_fan relaxed city_wanderer].select! {|profile| send(profile) == true }\n end", "def search\n begin\n if params[:email] != \"\" && params[:study_name] != \"\"\n @header = \"Studies: #{params[:study_name]} by #{params[:email]}\"\n @studies = Study.where(originator: params[:email], name: params[:study_name], active: true, public: true)\n elsif params[:email] != \"\"\n @header = \"Studies: #{params[:email]}\"\n @studies = Study.where(originator: params[:email], active: true, public: true)\n elsif params[:study_name] != \"\"\n @header = \"Studies: #{params[:study_name]}\"\n @studies = Study.where(name: params[:study_name], active: true, public: true)\n else\n redirect_to(studies_path)\n return\n end\n @studies = @studies.reverse_each\n rescue\n redirect_to(studies_path)\n end\n end", "def filtered_dataset\n dataset\n end", "def render_search_to_s_filters(params)\n connector = t('blacklight.and', default: 'AND')\n connector = content_tag(:span, \" #{connector} \", class: 'filterSeparator')\n facets = params[:f] || {}\n facets.map { |field, values|\n label = facet_field_label(field)\n value =\n values.map { |value|\n render_filter_value(value, field)\n }.join(connector).html_safe\n render_search_to_s_element(label, value)\n }.join(\"\\n\").html_safe\n end", "def filter(values); end", "def filter(values); end", "def filter(values); end", "def filter_search\n @subjects = PipelinePositionsSubject.find(:all,:order=>\"name\")\n @grades = PipelinePositionsGradeLevel.all\n @formats = PipelinePositionsTutoringType.find(:all,:order=>\"name\")\n \n @schools = School.find(:all,:order => \"organizations.name\")\n\n @neighborhoods = @schools.collect{|school| school.locations[0].neighborhood rescue nil}.compact.uniq.sort\n \n @pipeline_positions = generate_pipeline_search(true)\n end", "def filter_by_visibility(solr_parameters)\n # add a new solr facet query ('fq') parameter that limits results to those with a 'public_b' field of 1\n solr_parameters[:fq] ||= []\n fq = viewable_metadata_visibilities.map { |visibility| \"(visibility_ssi:\\\"#{visibility}\\\")\" }.join(\" OR \")\n solr_parameters[:fq] << \"(#{fq})\"\n end", "def archival_units_filter_by_states(states) \n return Collection.archival_units_filter_by_states(collections, states); \n end", "def filtered_students\n group_id ? students_from_group(group_id) : course.course_users.student\n end", "def filter(sparql)\n raise \"Must be overridden\"\n end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def permitted_studies_only?\n self.facet_filters.empty? && self.search_terms.empty?\n end", "def index\n @studies = Study.where(active: true, public: true)\n @studies = @studies.reverse_each\n end", "def filter_publications(collection=Publication)\n query = publication_query(collection)\n query.apply_where\n end", "def filter_proquest_status(theses)\n term_filtered = filter_theses_by_term theses\n dept_filtered = filter_theses_by_department term_filtered\n degree_filtered = filter_theses_by_degree_type dept_filtered\n multi_author_filtered = filter_theses_by_multiple_authors degree_filtered\n filter_theses_by_published multi_author_filtered\n end", "def show\n @casestudies = Casestudy.all\n\n @q = Casestudy.ransack(params[:q])\n @casestudies = @q.result(distinct: true)\n end", "def apply_instance_filters(ds)\n instance_filters.inject(ds){|ds1, i| ds1.where(*i[0], &i[1])}\n end", "def filter(live_list)\n # re-bloat\n self.load_starters\n # slim to desired subset\n @starters = @starters.select {|starter| live_list.include?(starter.category)}\n end", "def filter\n conditions = [\"isEstimate = ?\"]\n values = [ 0 ]\n if(params[:filter])\n session[:filter] = params[:filter]\n end\n if(session[:filter])\n if(session[:filter][:date_max])\n conditions << \"moment <= ?\"\n values << session[:filter][:date_max]\n end\n if(session[:filter][:date_min])\n conditions << \"moment >= ?\"\n values << session[:filter][:date_min]\n end\n if(session[:filter][:name] && session[:filter][:name] != \"\") \n conditions << \"name LIKE ?\"\n values << \"%\" + session[:filter][:name] + \"%\"\n end\n end\n conditions = values.insert(0, conditions.join(\" AND \"))\n\n \n session[:event_results] = getResults(conditions, params[:event_page])\n conditions[1] = 1\n session[:estimate_results] = getResults(conditions, params[:estimate_page])\n \n session[:event_time] = Time.now.to_f\n #raise session[:event_time].to_s + \" \" + Event.last_update.to_s\n end", "def filterHotDogStandsByDrinkPreferences(httpRequestParameters)\n # Only apply the filters if the user has selected what drinks they prefer.\n if httpRequestParameters[\"selectedDrinks\"][\"length\"].to_i > 0\n httpRequestParameters[\"selectedDrinks\"][\"values\"].each do |drinkIndex|\n # Upon every preferred drink selected, if the user has specified a price range, apply a filter that not only\n # checks to see if the drink exists in the set of drink prices, but also to see if the drink price is within\n # the price range the user has specified. Otherwise, only apply the filter to see if the drink exists in\n # the set of drink prices.\n if httpRequestParameters[\"isAPriceRangeSpecified\"] === \"true\"\n @searchQuery = @searchQuery.where(\"exists (select * from drink_prices where drink_id = ? and \" +\n \"drink_prices.hot_dog_stands_id = hot_dog_stands.id and drink_prices.price >= ? and drink_prices.price <= ?)\", \\\n drinkIndex, httpRequestParameters[\"minimumItemPrice\"].to_f, httpRequestParameters[\"maximumItemPrice\"].to_f)\n else\n @searchQuery = @searchQuery.where(\"exists (select * from drink_prices where drink_id = ? and \" +\n \"drink_prices.hot_dog_stands_id = hot_dog_stands.id)\", drinkIndex)\n end\n end\n end\n end", "def index\n @studies = Study.all\n end", "def index\n @studies = Study.all\n end", "def index\n @studies = current_user.available_studies\n end", "def filter(collection)\n collection\n end", "def filter(collection)\n collection\n end", "def cohortfilter\n puts \"Please find students by cohort below:\"\n cohort_months = @students.map { |month| month[:cohort]}\n cohort_months.uniq!\n cohort_months.each do |month|\n puts \"Here are the #{month} students\"\n selected_students = @students.select { |student| student[:cohort] == month}\n list(selected_students)\n end\nend", "def apply_filters(query, options)\n if @model_ids && options[:mview]\n query = query.where(model_id: @model_ids)\n elsif @model_ids\n query = query.where('scenarios.model_id' => @model_ids)\n end\n query = query.where(scenario_id: @scenario_ids) if @scenario_ids\n query = query.where(indicator_id: @indicator_ids) if @indicator_ids\n query = query.where(location_id: @location_ids) if @location_ids\n query = query.joins(:indicator).where(indicators: {subcategory_id: apply_category_filter}) if @category_ids\n puts query.to_sql.inspect\n query\n end", "def filter!; end", "def filter_models(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"{!terms f=has_model_ssim}#{models_to_solr_clause}\"\n end", "def render_search_to_s_filters(params)\n return \"\".html_safe unless params[:f]\n\n params[:f].collect do |facet_field, value_list|\n render_search_to_s_element(facet_configuration_for_field(facet_field).label,\n value_list.collect do |value|\n render_filter_value(value)\n end.join(content_tag(:span, \" #{t('flare.and')} \", :class =>'filterSeparator')).html_safe\n )\n end.join(\" \\n \").html_safe\n end", "def read_lesson_standard_filters(set_id, subject)\n response = @mech.post(URLS[:lesson_standard_filters], {setId: set_id, subject: subject})\n\n return JSON.parse(response.content)\n end", "def filter(objects) objects end", "def filter(params)\n\n\t self.log << \"Started filtering cases\"\n\n\t\[email protected] do |adrc_case|\n\n\t\t self.log << {:message => \"packing #{adrc_case[:subject_id]}\"}\n\t\t vgroup = Vgroup.joins(\"LEFT JOIN enrollment_vgroup_memberships ON vgroups.id = enrollment_vgroup_memberships.vgroup_id\")\n\t\t \t\t\t\t.joins(\"LEFT JOIN scan_procedures_vgroups ON scan_procedures_vgroups.vgroup_id = vgroups.id\")\n\t\t \t\t\t\t.where(\"enrollment_vgroup_memberships.enrollment_id = ?\",Enrollment.where(:enumber => adrc_case[:enumber]).first.id)\n\t\t \t\t\t\t.where(\"scan_procedures_vgroups.scan_procedure_id = ?\",adrc_case[:scan_procedure].id)\n\t\t \t\t\t\t.first\n\n\n\t\t #does this vgroup have the right image datasets?\n\t\t visits = Visit.where(:appointment_id => vgroup.appointments.select{|item| item.appointment_type == 'mri'}.map(&:id))\n\t\t images = Jobs::NaccUpload::ImageDataset.where(:visit_id => visits.map(&:id)).select{|item| (@sdm_filter.map{|x| x.series_description.downcase}.include? item.series_description.downcase) and (item.series_description != 'DTI whole brain 2mm FATSAT ASSET')}\n\t\t ppt = vgroup.enrollments.first.participant\n\n\t # if we only have 2 different scan types, or the status flag for this case is 'R', fail the case\n\t series_description_counts = images.each_with_object(Hash.new(0)){|item,hash| hash[@sdm_filter.select{|sdm| sdm.series_description.downcase == item.series_description.downcase}.first.series_description_type_id] += 1}\n\t if series_description_counts.keys.count < 2\n\t \tself.exclusions << {:protocol => adrc_case[:scan_procedure].codename, :subject => adrc_case[:enumber], :message => \"too few scan types\"}\n\t \tnext\n\t end\n\n\t if adrc_case[:status_flag] == 'R'\n\t \tself.exclusions << {:protocol => adrc_case[:scan_procedure].codename, :subject => adrc_case[:enumber], :message => \"status is 'R' for this case\"}\n\t \tnext\n\t end\n\n\t #this case passes, so let's set it up for prep\n\n\t\t adrc_case[:case_dir] = \"#{adrc_case[:subject_id]}_#{vgroup.vgroup_date.strftime(\"%Y%m%d\")}_wisc\"\n\t\t adrc_case[:subject_dir] = \"#{params[:target_dir]}/#{adrc_case[:case_dir]}\"\n\t\t adrc_case[:participant] = ppt\n\n\t\t if !File.directory?(adrc_case[:subject_dir])\n\t\t Dir.mkdir(adrc_case[:subject_dir])\n\t\t end\n\n\t\t subject_subdirs = []\n\t adrc_case[:images] = []\n\n\t\t images.each do |image|\n\n\t\t \t#check that there's nothing rated \"severe\" or \"incomplete\" on the IQC checks for this image\n\t\t \tif image.passed_iqc?\n\n\t\t\t \tpath_parts = image.path.split(\"/\")\n\t\t\t \timage_target_dir = \"#{adrc_case[:subject_dir]}/#{path_parts.last}\"\n\n\t\t\t \tif subject_subdirs.include? image_target_dir\n\t\t\t \t\t#tack something on the end so that we don't overwrite\n\t\t\t \t\timage_target_dir = \"#{image_target_dir}_#{subject_subdirs.count}}\"\n\t\t\t \tend\n\n\t\t\t \tsubject_subdirs << image_target_dir\n\t\t \t\tadrc_case[:images] << {:path => File.realpath(image.path), :target_dir => image_target_dir}\n\t\t \tend\n\t\t end\n\n\t\t @driver << adrc_case\n\n\t\tend\n\n\t\tself.log << \"Filtering cases complete (#{@driver.count} new cases, #{self.exclusions.count} exclusions from processing)\"\n\tend", "def apply_filter(scope, value)\n scope = Student.find_by(rut: value[:rut])\n scope.student_friends\n end", "def filtered_stories_list state, estimated\n options = { with_state: state.to_s }\n stories = [* story_accessor.get(params: options).payload]\n if estimated\n stories.select do |s|\n s.story_type == 'bug' || s.story_type == 'chore' ||\n (s.story_type == 'feature' && s.estimate && s.estimate >= 0)\n end\n else\n stories\n end\n end", "def filter(initial_set, task_index)\n\t # WARNING: the value returned by filter is a SUPERSET of the\n\t # possible values for the query. Therefore, the result of\n\t # NegateTaskMatcher#filter is NOT\n\t #\n\t # initial_set - @op.filter(...)\n\t initial_set\n\tend", "def extract_from(students, cohort_sym)\n\tif !cohort_sym == :Nofilter\n\t\tresults = students.select do |student|\n\t\t\tstudent[:cohort] == cohort_sym\n\t\t\tend\n\telse \n\t\tresults = students\n\tend\n\tresults\nend", "def filter_by_group(group)\n self.get_venues_for_search\n @venues_for_search.each do |venue|\n venue['attributes']['groups'].each do |groups|\n if groups[\"name\"].downcase == group.downcase\n groups[\"items\"].each do |item|\n if item[\"displayValue\"].split(\" \").first != \"No\"\n @venues_by_group << venue[\"name\"]\n end\n end\n end\n end \n end\n @venues_by_group\n end", "def target_filters\n scan_ses_notes if @target_filters.nil?\n @target_filters\n end", "def filtered_entries; end", "def filters_for(model)\n filters = session['search'][model.to_s] if session['search'] && session['search'][model.to_s].presence\n filters.delete_if { |k, v| v.nil? } if filters\n end", "def index\n #sample_ids.each {|x| @studies << Study.find_by_nct_id(x)}\n #@studies\n @studies=Study.completed_since(Date.today-100.days)\n #@studies=Study.sponsored_by('Duke')\n @definitions=Aact::DataDefinition.all\n #@studies=[Aact::Study.find_by_nct_id('NCT01132846')]\n #@studies=Study.all\n end", "def filter(name, function)\n design_doc.create_filter(name, function)\n end", "def search_adding_filter(condition,value)\n conditions = params.dup[:conditions] || {}\n\n if PLURAL_FILTERS.include?(condition)\n conditions[condition] ||= []\n conditions[condition] << value\n else\n conditions[condition] = value\n end\n params.except(:quiet, :all, :facet).recursive_merge(:page => nil, :action => :show, :conditions => conditions)\n end", "def filter_systems(collection)\n control_search = {}\n unless session[:slugfilter].blank?\n control_search[:slug.like] = \"#{session[:slugfilter]}%\"\n end\n\n if session[:program_id]\n @program = Program.find(session[:program_id])\n control_search[:program_id] = @program\n end\n\n return collection if control_search.empty?\n return collection.\n joins(:system_controls => :control).\n where(:system_controls => {:controls => control_search})\n end", "def filter_systems(collection)\n control_search = {}\n unless session[:slugfilter].blank?\n control_search[:slug.like] = \"#{session[:slugfilter]}%\"\n end\n\n if session[:program_id]\n @program = Program.find(session[:program_id])\n control_search[:program_id] = @program\n end\n\n return collection if control_search.empty?\n return collection.\n joins(:system_controls => :control).\n where(:system_controls => {:controls => control_search})\n end", "def filter_systems(collection)\n control_search = {}\n unless session[:slugfilter].blank?\n control_search[:slug.like] = \"#{session[:slugfilter]}%\"\n end\n\n if session[:program_id]\n @program = Program.find(session[:program_id])\n control_search[:program_id] = @program\n end\n\n return collection if control_search.empty?\n return collection.\n joins(:system_controls => :control).\n where(:system_controls => {:controls => control_search})\n end", "def filter_on(values)\n @filters << values\n end", "def filterHotDogStandsByCondimentPreferences(httpRequestParameters)\n # Only apply the filters if the user has selected what drinks they prefer.\n if httpRequestParameters[\"selectedCondiments\"][\"length\"].to_i > 0\n httpRequestParameters[\"selectedCondiments\"][\"values\"].each do |condimentIndex|\n # On every preferred condiment selected, append the query with the exists call that checks if that condiment\n # is in the available condiments set.\n @searchQuery = @searchQuery.where(\"exists (select * from available_condiments where \" + \\\n \" condiment_id = ? and available_condiments.hot_dog_stands_id = hot_dog_stands.id)\", condimentIndex)\n end\n end\n end", "def filters\n unless (@filters)\n @filters = {}\n return @filters unless @params[:f_inclusive]\n @params[:f_inclusive].each_pair do |field, value_hash|\n value_hash.each_pair do |value, type|\n @filters[field] ||= []\n @filters[field] << value\n end\n end \n end\n return @filters\n end", "def index\n @filterrific = initialize_filterrific(\n Student,\n params[:filterrific],\n :select_options => {\n sorted_by: Student.options_for_sorted_by,\n with_religion: Student.options_for_religion,\n with_employment: Student.options_for_employment\n }\n ) or return\n # @students = @filterrific.find.page(params[:page])\n @students = Student.filterrific_find(@filterrific).paginate(page: params[:page], per_page: 10)\n\n @active_students = StudentsRecord.joins(:student).where(student: @students, status: \"active\").inject({}) do |m,o|\n # all of taken pkgs have schedules?\n has_schedules = StudentsPkg.where(student: o.student).all? {|sp|\n sp.instructors_schedules.size > 0\n }\n m[o.student_id] = has_schedules\n m\n end\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def apply_filters(query)\n query\n end", "def filter_by_group(group)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_group = []\n @venues_to_filter.each do |venue|\n venue['attributes']['groups'].each do |groups|\n if groups[\"name\"].downcase == group.downcase\n groups[\"items\"].each do |item|\n if item[\"displayValue\"].split(\" \").first != \"No\"\n @venues_by_group << venue[\"name\"]\n end\n end\n end\n end\n end\n @venues_by_group\n end", "def filter_gigs\n gigs = Gig.all\n\n if params[:industry] == \"All Industries\"\n render :json => gigs\n else\n filtered_gigs = gigs.where(industry: params[:industry])\n render :json => filtered_gigs\n end\n end", "def Filter=(arg0)", "def apply_narrowing_filters\n @filters[:narrowing].each do |filter|\n @query = @query.where(filter => @options[filter])\n end\n @query\n end", "def subject_place_filter(solr_parameters, user_parameters)\n # Find index of the facet geographical_coverage_sim\n geographical_idx = nil\n solr_parameters[:fq].each.with_index do |f_elem, idx|\n geographical_idx = idx if f_elem.include?('geographical_coverage')\n end\n\n unless geographical_idx.nil?\n geo_string = solr_parameters[:fq][geographical_idx]\n coordinates = DRI::Metadata::Transformations.get_spatial_coordinates(geo_string)\n\n if coordinates.present?\n solr_parameters[:fq][geographical_idx] = \"geospatial:\\\"Intersects(#{coordinates})\\\"\"\n end\n end\n end", "def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end", "def sub_filter(iter)\n filter = default_filter(iter)\n if iter.parent[0] == SELECT_RECORDS\n filter += \"AND records.rrecord=#{iter[3].split(\"@@@\")[1]}\" # Extract rrecord from the sort column\n end\n return filter\n end", "def filter_parameters; end", "def filter_parameters; end", "def filters= options = {}\n prominent = [ :eid, :url ]\n narrowing = options.keys & Ydl::Videos.columns - prominent\n @filters = { prominent: prominent, narrowing: narrowing }\n end", "def filters\n unless @filters\n @filters = {}\n return @filters unless @params[:f_inclusive] && @params[:f_inclusive].respond_to?(:each_pair)\n @params[:f_inclusive].each_pair do |field, value_array|\n @filters[field] ||= value_array.dup\n end\n end\n @filters\n end", "def filterHotDogStandsByFoodPreferences(httpRequestParameters)\n # Only apply the filters if the user has selected what foods they prefer.\n if httpRequestParameters[\"selectedFoods\"][\"length\"].to_i > 0\n httpRequestParameters[\"selectedFoods\"][\"values\"].each do |foodIndex|\n # Upon every preferred food selected, if the user has specified a price range, apply a filter that not only\n # checks to see if the food exists in the set of food prices, but also to see if the food price is within\n # the price range the user has specified. Otherwise, only apply the filter to see if the food exists in\n # the set of food prices.\n if httpRequestParameters[\"isAPriceRangeSpecified\"] === \"true\"\n @searchQuery = @searchQuery.where(\"exists (select * from food_prices where food_id = ? and \" + \\\n \"food_prices.hot_dog_stands_id = hot_dog_stands.id and food_prices.price >= ? and food_prices.price <= ?)\", \\\n foodIndex, httpRequestParameters[\"minimumItemPrice\"].to_f, httpRequestParameters[\"maximumItemPrice\"].to_f)\n else\n @searchQuery = @searchQuery.where(\"exists (select * from food_prices where food_id = ? and \" + \\\n \"food_prices.hot_dog_stands_id = hot_dog_stands.id)\", foodIndex)\n end\n end\n end\n end", "def query_sources(study)\n study_raw = {:errors => []}\n study_raw[:study] = query_study_source(study.irb_number)\n study_raw[:roles] = query_roles_source(study.irb_number)\n study_raw[:involvements] = {}\n if study.is_managed?\n study_raw[:involvements] = query_involvements_source(study.irb_number, study.managing_system)\n end\n\n # collecting our errors\n study_raw[:errors].concat(study_raw[:study][:errors])\n study_raw[:errors].concat(study_raw[:roles][:errors])\n study_raw[:errors].concat(study_raw[:involvements][:errors]) if study.is_managed?\n return study_raw\n end", "def filter_by(filter, current_user = nil)\n return self unless filter.present?\n\n records = self\n\n records = records.where(id: filter[:tag_ids]) if filter[:tag_ids]\n\n if filter[:user_id]\n records = records.from_user_id(filter[:user_id], current_user&.id)\n elsif filter[:user_slug]\n records = records.from_user(filter[:user_slug], current_user&.id)\n end\n\n if filter[:topic_id]\n records = records.for_topic_id(filter[:topic_id]) if filter[:topic_id]\n elsif filter[:topic_slug]\n records = records.for_topic(filter[:topic_slug])\n end\n\n records = records.bookmarked_by_user(current_user.id) if filter[:bookmarked] && current_user\n\n records = records.where(accepted: filter[:accepted]) if filter[:accepted]\n records = records.with_visibility(filter[:visibility]) if filter[:visibility]\n\n return records\n end", "def filtering_params\n params.slice(:country, :data_source, :vaccine,\n :date_updated_start_date, :date_updated_end_date,\n :first_vaccine_date_start, :first_vaccine_date_end)\n end", "def study_params\n params[:study]\n end", "def study_params\n params[:study]\n end", "def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end", "def find_by_interest(interests)\n # Fetch all readable\n records = all\n filtered_records = []\n\n interests.each do |interest|\n find_tag = ActsAsTaggableOn::Tag.find_by_name(interest)\n if find_tag\n records.each do |record|\n taggings = ActsAsTaggableOn::Tagging.find_all_by_taggable_id(record.id)\n filtered = (tagging.tag_id == find_tag.id)\n filtered = filtered && (tagging.context == 'interest')\n if filtered\n filtered_records << record\n end\n end\n end\n end\n filtered_records\n end", "def filtro_particular(conscaso, params_filtro)\n return conscaso\n end", "def filter\n @filter = params[:q]\n end", "def filter\n\t\tchain(\n\t\t\tsuper, # Use automatic filter switching, i.e. use params[:filter] and #filter_options\n\t\t\t{:published => true}, # Only find published tags\n\t\t\tlambda { |tag| !tag.active_businesses_in_city(@city).empty? } # Only find tags with at least one active business\n\t\t)\n\tend", "def whitelisted_filters_for(name, klass)\n requested_parameters = as_array(@params[name])\n if requested_parameters.empty?\n []\n else\n klass.where(slug: requested_parameters)\n end\n end", "def filter_events(collection=Conference)\n query = event_query(collection)\n query.apply_where\n end", "def show_only_active_records(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << '-suppressed_bsi:true'\n end", "def filter_trending_days(topic, trending_days)\n trending_days.select do |day|\n dbday_id = Day.find_by(date: day).id\n !Popularity.exists?(topic_id: topic.id, day_id:dbday_id)\n end\nend" ]
[ "0.65235084", "0.64073277", "0.61655235", "0.61655235", "0.61435187", "0.6138783", "0.6130579", "0.60794574", "0.60365516", "0.5985732", "0.5949009", "0.5949009", "0.5949009", "0.5881404", "0.5849883", "0.5837846", "0.5763468", "0.5758133", "0.5749137", "0.57466376", "0.5737084", "0.57164943", "0.5697949", "0.5696007", "0.5696007", "0.5696007", "0.56917113", "0.568552", "0.5676635", "0.56628203", "0.5641015", "0.56405944", "0.56405944", "0.5638074", "0.5619592", "0.5598534", "0.55920863", "0.55861133", "0.5579303", "0.5562867", "0.5520337", "0.55173904", "0.54994726", "0.54994726", "0.5487334", "0.547533", "0.547533", "0.54619944", "0.5442931", "0.54410034", "0.5437877", "0.54264873", "0.5425562", "0.542416", "0.5423356", "0.542117", "0.5407293", "0.53871274", "0.5379912", "0.5365865", "0.53629345", "0.5360224", "0.53479546", "0.53472114", "0.53391445", "0.5336902", "0.53221005", "0.53221005", "0.53221005", "0.5321199", "0.53120625", "0.5308081", "0.53062284", "0.5304392", "0.5287905", "0.52765113", "0.52760327", "0.52728176", "0.5271983", "0.52707756", "0.52701926", "0.52646273", "0.52646273", "0.5252554", "0.5252471", "0.52425385", "0.5242536", "0.52348024", "0.52276665", "0.5226826", "0.5226826", "0.52182835", "0.5217544", "0.52161425", "0.521595", "0.5208954", "0.5203082", "0.5202586", "0.5196352", "0.518863" ]
0.54922175
44