query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Show a single movie page
|
def show
id = params[:id]
@movie = Movie.find(id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n # will render app/views/movies/show.<extension> by default\n end",
"def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n # will render app/views/movies/show.<extension> by default\n end",
"def show\n @movie = Movie.find(params[:id])\n respond_to do |format|\n format.html #show.html.erb\n\tend\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n\t\tid = params[:id];\t\t\t\t#get the movie id\n\t\t@movie = Movie.find_by_id(id) \t#get the movie from the database\n\tend",
"def show\n @imdb_movie = Movie.find(params[:id])\n end",
"def show\n\t\tmr = MovieRetriever.new\n\t\t@movie = mr.get_movie(params[:id])\n\t\t@movie[\"ratings\"] = Rating.by_movie(params[:id])\n\t\t@movie[\"reviews\"] = Review.by_movie(params[:id])\n\n\t\tif params[\"page\"].to_i >= 2\n\t\t\t@movie[\"reviews\"] = Review.by_movie(params[:id], params[\"page\"].to_i)\n\t\tend\n\n\t\tif params[\"page\"]\n\t\t\t@next_page = params[\"page\"].to_i + 1\n\t\telse\n\t\t\t@next_page = 2\n\t\tend\n\n\t\tif Review.by_movie(@movie[\"id\"], @next_page).size >= 1\n\t\t\t@movie[\"more_reviews\"] = true\n\t\telse \n\t\t\t@movie[\"more_reviews\"] = false\n\t\tend\n\n\t\t@poster = mr.poster_config(3)\n\t\tif @movie[\"title\"] == nil\n\t\t\trender plain: \"Uhhh your movie doesn't seem to exist in the database. Maybe we took a wrong turn at Albuquerque...\"\n\t\tend\n\tend",
"def show\n\n @movie = Movie.find_by(id: params[:id])\n if @movie == nil\n redirect_to root_path\n end\n\n end",
"def show\n\t\t@movie = Movie.find params[:id]\n\t\trespond_with @movie\n\tend",
"def show\r\n @movie = session[:movies][params[:id].to_i]\r\n end",
"def movie_page(selected_movie)\r\n movie_html = movie_url(selected_movie)\r\n Nokogiri::HTML(open(movie_html))\r\n end",
"def show\n @title = 'Movie details + | ' + @movie.title\n end",
"def show; @video.show; end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end",
"def show\n \t@movie = Tmdb::Movie.detail(params[:id])\n \t@images = Tmdb::Movie.images(params[:id])\n \t@cast = Tmdb::Movie.casts(params[:id])\n \t@trailers = Tmdb::Movie.trailers(params[:id])\n \t@similar_movies = Tmdb::Movie.similar_movies(params[:id])\n end",
"def show\n @movies = Genre.find(params[:id]).movies\n p @movies\n end",
"def show\n if @movie\n render json: { data: @movie }, status: 200\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @movie_info = MovieInfo.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie_info }\n end\n end",
"def show\n @cinemas_movie = CinemasMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cinemas_movie }\n end\n end",
"def show\n @movie = @catalogue.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n format.json { render :json => @movie }\n end\n end",
"def show\n #render json: params\n #@movie = Movie.find(params[:id])\n render html:'ciao io sono index'+@movie.to_s\n #render json: @movie\n end",
"def show\n # check if movie is already saved to db, otherwise load from moviedb api\n if Movie.exists?(params[:id])\n p 'exists'\n @movie = Movie.find(params[:id])\n else\n p 'doesn\\'t exists'\n @movie = Movie.create_from_tmdb params[:id]\n end\n end",
"def show\n @page_title = @genre.name\n @pagy, @movies = pagy(@genre.movies.where(status: 0).order(popularity: :desc, release_date: :desc), items: @per_page)\n end",
"def show\n\t# require 'net/http'\n\trequire 'open-uri'\n\trequire 'json'\n\n @movie = Movie.find(params[:id])\n\tresponse = {}\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movie?partner=YW5kcm9pZC12M3M&format=json&filter=movie&profile=small&mediafmt=mp4&code=\"+ @movie.alloCineCode.to_s, :proxy => @@proxyUTC).read)[\"movie\"]\n\tresponse[\"title\"]=@alloCineJson[\"title\"]\n\tresponse[\"directors\"]=@alloCineJson[\"castingShort\"][\"directors\"]\n\tresponse[\"actors\"]=@alloCineJson[\"castingShort\"][\"actors\"]\n\tresponse[\"synopsisShort\"]=@alloCineJson[\"synopsisShort\"]\n\tresponse[\"releaseDate\"]=@alloCineJson[\"release\"][\"releaseDate\"]\n\tresponse[\"poster\"]=@alloCineJson[\"poster\"][\"href\"]\n\tresponse[\"runtime\"]=@alloCineJson[\"runtime\"]\n\t@trailerInfoJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/media?format=json&partner=aXBhZC12MQ&profile=small&mediafmt=mp4&code=\"+ @alloCineJson[\"trailer\"][\"code\"].to_s).read)[\"media\"]\n\tresponse[\"trailer\"]=@trailerInfoJson[\"rendition\"][0][\"href\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: response }\n end\n end",
"def show\n @film = Film.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @film }\n end\n end",
"def show\n @video = Video.find(params[:id])\n end",
"def show\n @unseen_movie = UnseenMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unseen_movie }\n end\n end",
"def show\n @watched_movie = WatchedMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @watched_movie }\n end\n end",
"def set_movie_show\n @movie_show = MovieShow.find(params[:id])\n end",
"def show\n @bollywood_movie = BollywoodMovie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bollywood_movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n @serie = Serie.where(movie_id: @movie)\n end",
"def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end",
"def index\n @movie = Movie.find(params[:movie_id])\n end",
"def show\n @video = Video.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def show\n # If an old id or a numeric id was used to find the record, then\n # the request path will not match the movie_path, and we should do\n # a 301 redirect that uses the current friendly id.\n if request.path != movie_path(@movie)\n return redirect_to @movie, :status => :moved_permanently\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n format.js {\n }\n end\n end",
"def show\n session[:return_to] = request.referer\n @movie = Movie.find(params[:id])\n if @movie.nil?\n redirect_to action: :index\n end\n end",
"def movie(id, details = nil)\n get(\"/catalog/titles/movies/#{id.to_s}#{details.nil? ? \"\" : \"/#{details}\"}\")\n end",
"def show\n # raise cookies[:movie_name].inspect\n # @movie = Movie.find(params[:id])\n # respond_to do |format|\n # format.html\n # format.pdf { render pdf: generate_pdf(@movie)}\n # end\n end",
"def movie_page\r\n\t Scraper.new.movie_page(self)\r\n\tend",
"def show\n @movie = Movie.find(params[:id])\n\n unless @movie.omdb_checked_date && 6.months.since(@movie.omdb_checked_date) < Date.current\n Omdb.info(@movie)\n end\n\n unless @movie.tmdb_checked_date && 6.months.since(@movie.tmdb_checked_date) < Date.current\n TmdbWrapper.info(@movie)\n end\n\n # Guidebox turn off\n # unless @movie.guidebox_checked_date && 1.month.since(@movie.guidebox_checked_date) < Date.current\n # @sources = Guidebox.sources(@movie)\n # end\n\n @movie.reload\n\n render :show, layout: false\n end",
"def moviePage\n 1197628\nend",
"def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n \n # Section 11.6 Figure 11.12(b) - modified for new partial file name\n # http://pastebin.com/ajk95r8D\n #render :partial => 'movie_ajax', :object => @movie and return if request.xhr?\n # actually, the return statement is superfluous!\n render :partial => 'movie_ajax', :object => @movie if request.xhr?\n \n # will render app/views/movies/show.html.haml by default \n end",
"def show\n @page_title = @recommendation.movie.title\n end",
"def show\n\t\t@msubtitle = Msubtitle.find(params[:id])\n\t\t@movies= @msubtitle.movies.order('name asc')\n end",
"def show\n @movie = Movie.find(params[:id])\n @movie.set_kind_of_movie\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.includes(:trailer).find_by_id(params[:id])\n if @movie.trailer.blank?\n @movie.trailer = search_trailer(@movie)\n end\n end",
"def show\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end",
"def show\n @movie_item = MovieItem.find(params[:id])\n\t\tredirect_to root_path, :notice => \"You are not supposed to view this page.\"\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @movie_item }\n# end\n end",
"def show\n @video = Video.find_by(slug: params[:id])\n end",
"def show\n @room = @video.room\n authorize! @room\n @stream_url_ready = S3_BUCKET_HLS.object(\"#{ENV[\"SERVER_STAGE\"]}/stream/#{@video.s3_key}/index.m3u8\").exists?\n @page_title = @video.title\n end",
"def show\n @movie = @school.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end",
"def show\n respond_with Movie.search(params[:id])\n # respond_with movie: movie\n end",
"def movie_page\r\n\t TopOneHundredMovies::Scraper.new.movie_page(self)\r\n\tend",
"def set_movie\n @movie = Movie.retrieve params[:id]\n if not @movie\n flash[:alert] = \"Movie not found\"\n index and render 'index', status: 404\n end\n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def show\n @player = Player.find(params[:id])\n @page_title = \"Meet #{@player.full_name}\"\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @player }\n end\n end",
"def show\n movie = Movie.find(params[:id])\n if movie.nil?\n render json: {message: \"movie not found\"}, status: :ok\n else\n render json: movie, status: :ok, serializer: Movies::Show::MovieSerializer\n end\n end",
"def show\n @stay_in = \"Chi Tiết Phim\"\n @admin_movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html { admin_movie_path(@admin_movie) }\n format.json { render json: @admin_movie }\n end\n end",
"def show\n ok, data = RemoteData.omdb_query(@movie.imdb)\n if ok\n @plot = data[:Plot]\n @poster_url = data[:Poster] unless data[:Poster] == 'N/A'\n else\n flash[:warning] = 'Cannot retrieve details from IMDB'\n end\n if user_signed_in?\n @recommend_state = nil\n if current_user.likes?(@movie)\n @recommend_state = 'liked'\n elsif current_user.dislikes?(@movie)\n @recommend_state = 'disliked'\n end\n @star_class = current_user.bookmarks?(@movie) ? 'star' : 'star-o'\n end\n end",
"def show\n @movie_list_item = MovieListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie_list_item }\n end\n end",
"def show\n @page = Page.find(params[:id])\n # render show.html.erb\n end",
"def show\n @page = Page.find(params[:id])\n # render show.html.erb\n end",
"def show\n @pages = Page.find(params[:id])\n #renders show.html.erb\n end",
"def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def detail\n mv = Tmdb::Movie.detail(params[:id].to_i).to_h\n mv = mv.delete_if { |key, value| %w[production_companies spoken_languages production_countries genres].include?(key.to_s) }\n @movie = Movie.new(mv.to_h)\n respond_to do |format|\n if @movie\n format.json { render :show, status: :created }\n else\n format.json do\n render json: @movie.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def show\n @mwod_video_link = MwodVideoLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mwod_video_link }\n end\n end",
"def show\n \n @page = Page.find(params[:id])\n #render :show - app/views/pages/show.html.erb\n end",
"def show\n @hambrief = Hambrief.find(:first, :conditions => ['episode = ?', params[:id]])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hambrief }\n end\n end",
"def show\n @controller = controller_name\n @action = action_name\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def show\n @movie = @category.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @film = @festival.films.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @film }\n end\n end",
"def show\n @park = Park.find(params[:id])\n @movies = @park.movies\n \n end",
"def show\n @movie_format = MovieFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie_format }\n end\n end",
"def show\n @subject = Subject.find_by_hashed_id(params[:id])\n page_title([\"Subject\", @subject.name])\n respond_to do |format|\n format.html { render :layout => 'application' }\n end\n end",
"def show\n @page = Page.find(params[:id])\n # renders a page\n end",
"def show\n @user = set_user\n @list = set_list\n @movie = set_movie\n end",
"def show\n @lift = Lift.find(params[:id])\n @videos = Lift.find(params[:id]).videos\n end"
] |
[
"0.80090827",
"0.80090827",
"0.7872392",
"0.7804057",
"0.7804057",
"0.7804057",
"0.770676",
"0.76332664",
"0.7608977",
"0.75263554",
"0.7416698",
"0.73925024",
"0.7374953",
"0.73438805",
"0.7318688",
"0.7309998",
"0.7309998",
"0.7309998",
"0.7309998",
"0.7309998",
"0.7309998",
"0.73013854",
"0.73013854",
"0.72942746",
"0.72882265",
"0.7235031",
"0.72297424",
"0.7197713",
"0.71744263",
"0.70972365",
"0.70858574",
"0.7073081",
"0.7063922",
"0.70511925",
"0.703723",
"0.7032546",
"0.70052266",
"0.69962335",
"0.6978566",
"0.69753075",
"0.696667",
"0.69532657",
"0.69367206",
"0.6924901",
"0.6898529",
"0.6897466",
"0.6891411",
"0.6884866",
"0.6879807",
"0.68771476",
"0.6872785",
"0.6868604",
"0.6862211",
"0.6859552",
"0.68568665",
"0.68528575",
"0.6846349",
"0.68428856",
"0.68416876",
"0.6834909",
"0.68102175",
"0.6808616",
"0.6808567",
"0.67932206",
"0.67771065",
"0.6773278",
"0.67705935",
"0.67701167",
"0.67701167",
"0.67701167",
"0.6742472",
"0.6706528",
"0.6676678",
"0.6675873",
"0.66712373",
"0.66503495",
"0.66503495",
"0.6647827",
"0.66344655",
"0.6628824",
"0.6628824",
"0.6628824",
"0.6628824",
"0.6628824",
"0.6628824",
"0.6628824",
"0.66268134",
"0.662077",
"0.6620416",
"0.6619095",
"0.66178",
"0.66097474",
"0.65918535",
"0.6590784",
"0.6586893",
"0.6579008",
"0.65699893",
"0.6568695",
"0.65384007"
] |
0.76875836
|
8
|
Show the edit form for a movie
|
def edit
@movie = Movie.find params[:id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit\n\t\t@movie = Movie.find_by_id(params[:id])\n\tend",
"def edit\n movie = Movie.find(params[:movie_id])\n @review = Review.find(params[:id])\n @movie = Movie.find(params[:movie_id])\n end",
"def edit\n\t\t@adminfilm = Film.find(params[:id])\n\tend",
"def edit\n # Renders the edit form\n end",
"def edit\n\t\t@page_name = \" - Edit Show\"\n\tend",
"def edit\n @video = Video.find(params['id'])\n end",
"def update\n @movie = Movie.find(params[:id])\n if @movie.update_attributes(allowparams)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n if @movie.update_attributes(allowparams)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\n end",
"def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(params[:movie])\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\nend",
"def edit\n @show = Show.find(params[:id])\n\t@title = \"Editing \" + @show.name\n end",
"def new\n @movie = Movie.find(params[:movie_id])\n end",
"def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(movie_params)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit'\n end\n end",
"def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(movie_params)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit'\n end\n end",
"def edit\n\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n end",
"def edit\r\n \r\n end",
"def edit\r\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n\n end",
"def edit\n puts \".............. >>> extraction_form_armms_controller::edit \"\n @extraction_form_arm = ExtractionFormArm.find(params[:id])\n\t@extraction_form = ExtractionForm.find(@extraction_form_arm.extraction_form_id)\n\t@project = Project.find(@extraction_form.project_id)\n \t@efid = @extraction_form_arm.extraction_form_id\n @editing = true\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(movie_params)\n format.html { redirect_to @movie, notice: 'La pelicula ha sido actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n edit\n end",
"def show\n id = params[:id]\n @movie = Movie.find(id)\n end",
"def show\n id = params[:id]\n @movie = Movie.find(id)\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] |
[
"0.825996",
"0.76103204",
"0.7520529",
"0.70916474",
"0.7088207",
"0.70296353",
"0.70012397",
"0.70012397",
"0.6998794",
"0.6952281",
"0.69053036",
"0.68934786",
"0.68934786",
"0.6844361",
"0.67545134",
"0.67545134",
"0.67545134",
"0.6734904",
"0.6734622",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.67089564",
"0.6691331",
"0.6686999",
"0.6675462",
"0.6674046",
"0.6664335",
"0.6664335",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66573405"
] |
0.8229228
|
3
|
Update a movie with given info from 'edit' form and redirect to the movie's page.
|
def update
@movie = Movie.find params[:id]
if @movie.update_attributes(movie_params)
flash[:notice] = "#{@movie.title} was successfully updated."
redirect_to movie_path(@movie)
else
render 'edit'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(params[:movie])\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\nend",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(@movie, :notice => 'Movie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(@movie, :notice => 'Movie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(movie_params)\n format.html { redirect_to @movie, notice: 'La pelicula ha sido actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n if @movie.update_attributes(allowparams)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n if @movie.update_attributes(allowparams)\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(edit_movie_path(@movie), :notice => 'Movie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to movie_url(@movie), notice: \"Movie was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html {redirect_to @movie, notice: 'Movie was successfully updated.'}\n format.json {render :show, status: :ok, location: @movie}\n else\n format.html {render :edit}\n format.json {render json: @movie.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie_info = MovieInfo.find(params[:id])\n \n respond_to do |format|\n if @movie_info.update_attributes(params[:movie_info])\n format.html { redirect_to @movie_info, notice: 'Movie info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @theatre_movie.update(theatre_movie_params)\n format.html { redirect_to @theatre_movie, notice: 'Theatre movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @theatre_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n movie = Movie.find(params[:movie_id])\n review = Review.find(params[:id])\n review.update(review_params)\n redirect_to '/movies/#{movies.id}/reviews/#{review.id}'\n end",
"def update\n\n\n prepare_movie(false)\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.json { render :show, status: :ok, location: @movie }\n else\n format.json do\n render json: @movie.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params_update)\n format.html { redirect_to user_list_movies_url, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n @movie.reload\n if @movie.update_attributes(params[:movie])\n flash[:notice] = 'Movie was successfully updated.'\n format.html { render 'maintenance/index', :layout => 'maintenance' }\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @omdb_movie.update(omdb_movie_params)\n format.html { redirect_to @omdb_movie, notice: 'Omdb movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @omdb_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @theatre_movie.update(theatre_movie_params)\n format.html { redirect_to @theatre_movie, notice: 'Theatre movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @theatre_movie }\n else\n format.html { render :edit }\n format.json { render json: @theatre_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = self.current_user.movies.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n flash[:notice] = 'Movie was successfully updated.'\n format.html { redirect_to([@school,@movie]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @movie = Movie.find params[:id]\n end",
"def edit\n @movie = Movie.find params[:id]\n end",
"def edit\n @movie = Movie.find params[:id]\n end",
"def update\n respond_to do |format|\n if @tmdbmovie.update(tmdbmovie_params)\n format.html { redirect_to @tmdbmovie, notice: 'Tmdbmovie was successfully updated.' }\n format.json { render :show, status: :ok, location: @tmdbmovie }\n else\n format.html { render :edit }\n format.json { render json: @tmdbmovie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actors_movie.update(actors_movie_params)\n format.html { redirect_to @actors_movie, notice: 'Actors movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @actors_movie }\n else\n format.html { render :edit }\n format.json { render json: @actors_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t@movie = Movie.find_by_id(params[:id])\n\tend",
"def update\n add_director\n add_actors\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cinemas_movie = CinemasMovie.find(params[:id])\n\n respond_to do |format|\n if @cinemas_movie.update_attributes(params[:cinemas_movie])\n format.html { redirect_to @cinemas_movie, :notice => 'Cinemas Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cinemas_movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@adminfilm = Film.find(params[:id])\n \t\tif @adminfilm.update(adminfilm_params)\n \t\tredirect_to '/adminCool'\n \t\telse\n \t\trender 'edit'\n \t\tend\n\tend",
"def update\n if @film.update(film_params) || current_user.admin?\n flash[:notice] = \"Film was successfuly updated.\"\n redirect_to film_path(@film)\n else\n render 'edit'\n end\n end",
"def update\n authorize! :update, @movie\n\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_model.update(movie_model_params)\n format.html { redirect_to @movie_model, notice: 'Movie model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @genres_movie.update(genres_movie_params)\n format.html { redirect_to @genres_movie, notice: 'Genres movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @genres_movie }\n else\n format.html { render :edit }\n format.json { render json: @genres_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie_item = MovieItem.find(params[:id])\n\n respond_to do |format|\n if @movie_item.update_attributes(params[:movie_item])\n format.html { redirect_to @movie_item, notice: 'Movie item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = @category.movies.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n flash[:notice] = 'Movie was successfully updated.'\n format.html { redirect_to(category_movie_url(@category, @movie)) }#, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cinema_movie.update(cinema_movie_params)\n format.html { redirect_to @cinema_movie, notice: 'Cinema movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @cinema_movie }\n else\n format.html { render :edit }\n format.json { render json: @cinema_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @watched_movie = WatchedMovie.find(params[:id])\n\n respond_to do |format|\n if @watched_movie.update_attributes(params[:watched_movie])\n format.html { redirect_to @watched_movie, notice: 'Watched movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watched_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stay_in = \"Chỉnh Sửa Phim\"\n @admin_movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @admin_movie.update_attributes(params[:movie])\n format.html { redirect_to admin_movie_path(@admin_movie), notice: 'Sửa phim thành công.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bollywood_movie = BollywoodMovie.find(params[:id])\n\n respond_to do |format|\n if @bollywood_movie.update_attributes(params[:bollywood_movie])\n format.html { redirect_to @bollywood_movie, :notice => 'Bollywood movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bollywood_movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to @movie, notice: \"Movie was successfully updated.\" }\n format.json { render :show, status: :ok, location: @movie }\n format.js\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @unseen_movie = UnseenMovie.find(params[:id])\n\n respond_to do |format|\n if @unseen_movie.update_attributes(params[:unseen_movie])\n format.html { redirect_to @unseen_movie, notice: 'Unseen movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unseen_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_movie.update(type_movie_params)\n format.html { redirect_to @type_movie, notice: 'Type movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_movie }\n else\n format.html { render :edit }\n format.json { render json: @type_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role_in_a_movie = RoleInAMovie.find(params[:id])\n\n respond_to do |format|\n if @role_in_a_movie.update_attributes(params[:role_in_a_movie])\n format.html { redirect_to @role_in_a_movie, notice: 'Role in a movie was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_in_a_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @movimiento.update(movimiento_params)\n redirect_to [:edit, @movimiento], notice: t('action.update')\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @film.update(film_params)\n format.html { redirect_to @film, notice: 'Film mis a jour.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @film.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie_list_item = MovieListItem.find(params[:id])\n\n respond_to do |format|\n if @movie_list_item.update_attributes(params[:movie_list_item])\n format.html { redirect_to(@movie_list_item, :notice => 'Movie list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movies_ive_watched.update(movies_ive_watched_params)\n format.html { redirect_to @movies_ive_watched, notice: 'Movies ive watched was successfully updated.' }\n format.json { render :show, status: :ok, location: @movies_ive_watched }\n else\n format.html { render :edit }\n format.json { render json: @movies_ive_watched.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @film_actor.update(film_actor_params)\n format.html { redirect_to @film_actor, notice: 'Film actor was successfully updated.' }\n format.json { render :show, status: :ok, location: @film_actor }\n else\n format.html { render :edit }\n format.json { render json: @film_actor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n movie = Movie.find(params[:movie_id])\n @review = Review.find(params[:id])\n @movie = Movie.find(params[:movie_id])\n end",
"def update\n respond_to do |format|\n if @movie_crew.update(movie_crew_params)\n format.html { redirect_to @movie_crew, notice: \"Movie crew was successfully updated.\" }\n format.json { render :show, status: :ok, location: @movie_crew }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @movie_crew.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_movie\n @movie = Movie.find(params[:id])\n redirect_to movies_path, alert: 'Il film non è stato trovato' unless @movie\n end",
"def update\n @movie_list = MovieList.find(params[:id])\n\n respond_to do |format|\n if @movie_list.update_attributes(params[:movie_list])\n format.html { redirect_to(@movie_list, :notice => 'Movie list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movie_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_show.update(movie_show_params)\n format.html { redirect_to @movie_show, notice: \"Movie show was successfully updated.\" }\n format.json { render :show, status: :ok, location: @movie_show }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @movie_show.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @campeonato = Campeonato.find(params[:id])\n\n if @campeonato.update_attributes(params[:campeonato])\n redirect_to(@campeonato, :notice => 'Campeonato foi alterado com sucesso.')\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @film.update(film_params)\n format.html { redirect_to @film, notice: 'Filme atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @film.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @moviie.update(moviie_params)\n format.html { redirect_to @moviie, notice: 'Moviie was successfully updated.' }\n format.json { render :show, status: :ok, location: @moviie }\n else\n format.html { render :edit }\n format.json { render json: @moviie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @film_genre.update(film_genre_params)\n format.html { redirect_to @film_genre, notice: 'Film genre was successfully updated.' }\n format.json { render :show, status: :ok, location: @film_genre }\n else\n format.html { render :edit }\n format.json { render json: @film_genre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_participant.update(movie_participant_params)\n format.html { redirect_to @movie_participant, notice: 'Movie participant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @movie_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @moviepost.update(moviepost_params)\n format.html { redirect_to @moviepost, notice: 'Moviepost was successfully updated.' }\n format.json { render :show, status: :ok, location: @moviepost }\n else\n format.html { render :edit }\n format.json { render json: @moviepost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mov.update(mov_params)\n format.html { redirect_to @mov, notice: 'Mov was successfully updated.' }\n format.json { render :show, status: :ok, location: @mov }\n else\n format.html { render :edit }\n format.json { render json: @mov.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_company.update(movie_company_params)\n format.html { redirect_to @movie_company, notice: 'Movie company was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_company }\n else\n format.html { render :edit }\n format.json { render json: @movie_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actormovie.update(actormovie_params)\n format.html { redirect_to @actormovie, notice: 'Actormovie was successfully updated.' }\n format.json { render :show, status: :ok, location: @actormovie }\n else\n format.html { render :edit }\n format.json { render json: @actormovie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stay_in = \"Chỉnh Sửa Hãng Sản Xuất\"\n @admin_movie_maker = MovieMaker.find(params[:id])\n\n respond_to do |format|\n if @admin_movie_maker.update_attributes(params[:movie_maker])\n format.html { redirect_to admin_movie_maker_path(@admin_movie_maker), notice: 'Sửa hãng sản xuất thành công.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_movie_maker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movie = Movie.find(params[:id])\n if params[:movie][:actors]\n params[:movie][:actors].map!{ |id|\n Actor.find(id)\n }\n else\n params[:movie][:actors] = []\n end\n if params[:movie][:genres]\n params[:movie][:genres].map!{ |id|\n Genre.find(id)\n }\n else\n params[:movie][:genres] = []\n end\n if params[:movie][:directors]\n params[:movie][:directors].map!{ |id|\n Director.find(id)\n }\n else\n params[:movie][:directors] = []\n end\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @add_moderator_to_film = AddModeratorToFilm.find(params[:id])\n\n respond_to do |format|\n if @add_moderator_to_film.update_attributes(params[:add_moderator_to_film])\n format.html { redirect_to(@add_moderator_to_film, :notice => 'Add moderator to film was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @add_moderator_to_film.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_event.update(movie_event_params)\n format.html { redirect_to @movie_event, notice: 'Movie event was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_event }\n else\n format.html { render :edit }\n format.json { render json: @movie_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movimiento = Movimiento.find(params[:id])\n\n respond_to do |format|\n if @movimiento.update_attributes(params[:movimiento])\n flash[:notice] = 'Movimiento actualizado correctamente.'\n format.html { redirect_to(@movimiento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @movimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @filmmaker = Filmmaker.find(params[:id])\n\n respond_to do |format|\n if @filmmaker.update_attributes(params[:filmmaker])\n format.html { redirect_to @filmmaker, notice: 'Filmmaker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @filmmaker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @add_users_to_film = AddUsersToFilm.find(params[:id])\n\n respond_to do |format|\n if @add_users_to_film.update_attributes(params[:add_users_to_film])\n format.html { redirect_to(@add_users_to_film, :notice => 'Add users to film was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @add_users_to_film.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @filmmaker.update(filmmaker_params)\n format.html { redirect_to @filmmaker, notice: 'Filmmaker was successfully updated.' }\n format.json { render :show, status: :ok, location: @filmmaker }\n else\n format.html { render :edit }\n format.json { render json: @filmmaker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Video.find(params[:id]).update(video_params)\n redirect_to \"/videos/#{params[:id]}\"\n end",
"def update\n if @episode.update(episode_params)\n flash[:success] = \"Episode was successfully updated\"\n redirect_to episode_path(@episode)\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to videos_path, notice: 'Video was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end"
] |
[
"0.8081152",
"0.79287755",
"0.79287755",
"0.790696",
"0.78645736",
"0.78645736",
"0.78550804",
"0.7852934",
"0.7849249",
"0.77856565",
"0.77856565",
"0.77856565",
"0.77856565",
"0.77856565",
"0.77856565",
"0.77854705",
"0.77325064",
"0.77325064",
"0.77325064",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.77266264",
"0.76141274",
"0.7589395",
"0.7578731",
"0.7574952",
"0.75558513",
"0.75312734",
"0.7528653",
"0.75276494",
"0.75272423",
"0.749994",
"0.7427743",
"0.7427743",
"0.7427743",
"0.7417575",
"0.73889416",
"0.7388047",
"0.7356839",
"0.7322221",
"0.7309048",
"0.7304009",
"0.7291159",
"0.72902036",
"0.7287572",
"0.72615117",
"0.7250895",
"0.7229342",
"0.72217953",
"0.72213495",
"0.7200412",
"0.717568",
"0.71693105",
"0.7148091",
"0.71276677",
"0.71109533",
"0.71044517",
"0.708295",
"0.704029",
"0.70061195",
"0.6997452",
"0.6991853",
"0.69796187",
"0.69721067",
"0.693386",
"0.6933313",
"0.6929944",
"0.69246894",
"0.6924206",
"0.69071686",
"0.68958527",
"0.68952125",
"0.6887086",
"0.6881476",
"0.68795264",
"0.68623984",
"0.6850167",
"0.681744",
"0.6816296",
"0.6798484",
"0.6791858",
"0.6786674",
"0.6785948",
"0.677857",
"0.6769134"
] |
0.8066088
|
2
|
Delete a movie and redirect to the movies page.
|
def destroy
@movie = Movie.find params[:id]
@movie.destroy
flash[:notice] = "Deleted '#{@movie.title}'."
redirect_to movies_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n redirect_to root_path\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Movie.find(params[:id]).destroy \n flash[:success] = \"Movie was successfully deleted.\"\n redirect_to index_url\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html {redirect_to movies_url, notice: 'Movie was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @omdb_movie.destroy\n respond_to do |format|\n format.html { redirect_to omdb_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.js\n end\n end",
"def destroy\n # Find the movie in the movies table using the id\n # passed in via the path.\n # @movie = Movie.find(params[:id])\n\n # Delete the row from the movies table.\n # using ActiveRecord#destroy method\n @movie.destroy\n\n\n respond_to do |format|\n # Show all the movies, index action\n format.html { redirect_to movies_url, notice: \"You deleted a Movie\"}\n format.json { head :no_content} # do nothing as a response.\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: '削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tmdbmovie.destroy\n respond_to do |format|\n format.html { redirect_to tmdbmovies_url, notice: 'Tmdbmovie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theatre_movie.destroy\n respond_to do |format|\n format.html { redirect_to theatre_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unseen_movie = UnseenMovie.find(params[:id])\n @unseen_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to unseen_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to user_list_movies_path, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @movie\n @movie.destroy\n respond_to do |format|\n format.html do\n redirect_to movies_url, notice: \"Movie was successfully destroyed.\"\n end\n end\n end",
"def destroy\n @admin_movie = Movie.find(params[:id])\n @admin_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = @category.movies.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(category_movies_url(@category)) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @watched_movie = WatchedMovie.find(params[:id])\n @watched_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to watched_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cinemas_movie = CinemasMovie.find(params[:id])\n @cinemas_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to cinemas_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_movie = UsersMovie.find(params[:id])\n @users_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_movies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @genres_movie.destroy\n respond_to do |format|\n format.html { redirect_to genres_movies_url, notice: 'Genres movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_info = MovieInfo.find(params[:id])\n @movie_info.destroy\n \n respond_to do |format|\n format.html { redirect_to movie_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = self.current_user.movies.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(school_movies_path(@school)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @film.destroy\n flash[:alert] = 'Film was successfully destroyed.'\n redirect_to films_path\n end",
"def destroy\n @theatre_movie.destroy\n respond_to do |format|\n format.html { redirect_to theatre_movies_url, notice: 'Theatre movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actors_movie.destroy\n respond_to do |format|\n format.html { redirect_to actors_movies_url, notice: 'Actors movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cinema_movie.destroy\n respond_to do |format|\n format.html { redirect_to cinema_movies_url, notice: 'Cinema movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @film.destroy\n respond_to do |format|\n format.html { redirect_to films_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @film.destroy\n respond_to do |format|\n format.html { redirect_to films_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @movie\n\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bollywood_movie = BollywoodMovie.find(params[:id])\n @bollywood_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to bollywood_movies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_in_a_movie = RoleInAMovie.find(params[:id])\n @role_in_a_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to role_in_a_movies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @movie.destroy\n respond_to do |format|\n format.html { redirect_to movies_url, notice: \"Movie was successfully destroyed.\" }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @movie_list_item = MovieListItem.find(params[:id])\n @movie_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(movie_list_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie_model.destroy\n respond_to do |format|\n format.html { redirect_to movie_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_crew.destroy\n respond_to do |format|\n format.html { redirect_to movie_crews_url, notice: \"Movie crew was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_list = MovieList.find(params[:id])\n @movie_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(movie_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @film_genre.destroy\n respond_to do |format|\n format.html { redirect_to film_genres_url, notice: 'Film genre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movies_ive_watched.destroy\n respond_to do |format|\n format.html { redirect_to movies_ive_watcheds_url, notice: 'Movies ive watched was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categories_movie.destroy\n respond_to do |format|\n format.html { redirect_to categories_movies_url, notice: 'Categories movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_show.destroy\n respond_to do |format|\n format.html { redirect_to movie_shows_url, notice: \"Movie show was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie.destroy\n end",
"def destroy\n @dvd = Dvd.find(params[:id])\n\t@genre = @dvd[:genre]\n @dvd.destroy\n\n respond_to do |format| \n\t#link back to where we came from using genre of destroyed DVD\n format.html { redirect_to(:controller => \"dvds\", :genre => @genre) }\n format.json { head :ok }\n end\n end",
"def destroy\n @add_users_to_film = AddUsersToFilm.find(params[:id])\n @add_users_to_film.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_users_to_films_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @users_movie = UsersMovie.find(params[:id])\n @users_movie.destroy\n end",
"def destroy\n @type_movie.destroy\n respond_to do |format|\n format.html { redirect_to type_movies_url, notice: 'Type movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @episode = Episode.find(params[:id])\n movie = @episode.movie\n flash[:notice] = \"剧集#{@episode.title} 已经被删除\"\n \n @episode.destroy\n\n respond_to do |format|\n format.html { redirect_to movie_url(movie) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie = @catalogue.movies.find(params[:id])\n @movie.inactivate\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.json { render :json => {:success => true} }\n end\n end",
"def destroy\n @admin_movie_maker = MovieMaker.find(params[:id])\n @admin_movie_maker.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_movie_makers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_participant.destroy\n respond_to do |format|\n format.html { redirect_to movie_participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movimiento.destroy\n redirect_to movimientos_url, notice: t('action.delete')\n end",
"def destroy\n @film_actor.destroy\n respond_to do |format|\n format.html { redirect_to film_actors_url, notice: 'Film actor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @filmmaker = Filmmaker.find(params[:id])\n @filmmaker.destroy\n\n respond_to do |format|\n format.html { redirect_to filmmakers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mov.destroy\n respond_to do |format|\n format.html { redirect_to movs_url, notice: 'Mov was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_moderator_to_film = AddModeratorToFilm.find(params[:id])\n @add_moderator_to_film.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_moderator_to_films_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movieupload.destroy\n respond_to do |format|\n format.html { redirect_to movieuploads_url, notice: 'Movieupload was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moviie.destroy\n respond_to do |format|\n format.html { redirect_to moviies_url, notice: 'Moviie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n redirect_to '/lifts', notice: \"video deleted\"\n end",
"def destroy\n @director = Director.find(params[:id])\n @director.destroy\n\n respond_to do |format|\n format.html { redirect_to directors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_cast.destroy\n respond_to do |format|\n format.html { redirect_to movie_casts_url, notice: \"Movie cast was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @countrys_movie.destroy\n respond_to do |format|\n format.html { redirect_to countrys_movies_url, notice: 'Countrys movie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if @movie_category.movies.count > 0\n format.html { redirect_to movie_categories_url, notice: { movie_category_error: 'Atencion! No se puede eliminar ya que es utilizada en peliculas.' } }\n else\n @movie_category.destroy\n format.html { redirect_to movie_categories_url }\n format.json { head :no_content }\n end\n end \n end",
"def destroy\n @movie_role.destroy\n respond_to do |format|\n format.html { redirect_to movie_roles_url, notice: 'Movie role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8053855",
"0.8044876",
"0.801782",
"0.8010855",
"0.8010855",
"0.8010855",
"0.8010855",
"0.8010855",
"0.8010855",
"0.8010855",
"0.79602176",
"0.79566145",
"0.79566145",
"0.79566145",
"0.7895408",
"0.7895408",
"0.7895408",
"0.7895408",
"0.77677155",
"0.77301943",
"0.76772344",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.76760286",
"0.7660912",
"0.7632199",
"0.76242936",
"0.76177907",
"0.75986326",
"0.757013",
"0.75427073",
"0.7538139",
"0.7537364",
"0.75157815",
"0.75044",
"0.7493304",
"0.74900347",
"0.7485484",
"0.74677813",
"0.7426569",
"0.7415404",
"0.73950684",
"0.73783064",
"0.7352662",
"0.7340615",
"0.7318022",
"0.7318022",
"0.73074573",
"0.7281979",
"0.72725487",
"0.7263033",
"0.72527707",
"0.72478473",
"0.722968",
"0.7224099",
"0.71722347",
"0.71594405",
"0.71525204",
"0.71514326",
"0.7141695",
"0.7103124",
"0.70929176",
"0.7083615",
"0.70829016",
"0.708106",
"0.7075988",
"0.70684874",
"0.7043211",
"0.70184165",
"0.7006442",
"0.699652",
"0.6993399",
"0.694897",
"0.6942187",
"0.6942092",
"0.69414884",
"0.6921419",
"0.6920865",
"0.6910793",
"0.6895051",
"0.6884002"
] |
0.8188732
|
1
|
Check if SSH connection is closed +connection+:: SSH connection to check
|
def closed?(connection)
return true if connection.closed?
begin
# Hack to check connection isn't dead
connection.exec!('true') unless connection.busy?
rescue Net::SSH::Exception, SystemCallError => e
return true
end
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def close\n Timeout.timeout(3) { @connector.close }\n true\n rescue\n warn \"ssh connection could not be closed gracefully\"\n Metriks.meter('worker.vm.ssh.could_not_close').mark\n false\n ensure\n buffer.stop\n @buffer = nil\n end",
"def closed?\n\t\treturn @ssh_session.nil? || @ssh_session.closed?\n\tend",
"def connected?\n start_ssh {|ssh| } # do nothing\n rescue *CONNECTION_EXCEPTIONS => ex\n @connection_error = ex\n return false\n else\n return true\n end",
"def closed?\n @connection_state == :closed\n end",
"def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end",
"def close()\n #N Without this check, we'll be trying to close the connection even if there isn't one, or it was already closed\n if @connection != nil\n #N Without this we won't get feedback about the SSH connection being closed\n puts \"Closing SSH connection to #{user}@#{host} ...\"\n #N Without this the connection won't actually get closed\n @connection.close()\n #N Without this we won't know the connection has been closed, because a nil @connection represents \"no open connection\"\n @connection = nil\n end\n end",
"def closed?\n @connection.closed?\n end",
"def connection_closed\n @state_mutex.synchronize do\n if @state == :created or @state == :wait_response\n @value = ROSServiceCallError.new(\"Connection closed.\")\n @state = :closed\n @state_cond.signal\n else\n @state = :closed\n end\n end\n end",
"def closed?\n @connection.nil?\n end",
"def closed?\n @socket.closed?\n end",
"def disconnected?; connection_state == :disconnected end",
"def disconnecting?; connection_state == :disconnecting end",
"def connected?\n if @ssh\n return true\n else\n return false\n end\n end",
"def test_connection_closed?\n assert_equal false, @conn.closed?\n @conn.disconnect\n assert_equal true, @conn.closed?\n end",
"def closed?\n !@port.is_open\n end",
"def close\n log 'closing connection'\n @ssh.close\n end",
"def connection_closed\n close\n end",
"def connection_closed\n end",
"def tcp_ssh_alive(hostname,port=22)\n tcp_socket = TCPSocket.new(hostname, port)\n readable = IO.select([tcp_socket], nil, nil, 5)\n if readable\n Chef::Log.debug(\"sshd accepting connections on #{hostname}, banner is #{tcp_socket.gets}\")\n true\n else\n false\n end\n \n rescue Errno::ETIMEDOUT\n false\n rescue Errno::EPERM\n false\n rescue Errno::ECONNREFUSED\n sleep 2\n false\n rescue Errno::EHOSTUNREACH, Errno::ENETUNREACH\n sleep 2\n false\n ensure\n tcp_socket && tcp_socket.close\n end",
"def close_ssh_session(session)\n session.close\n session = nil\n true\n end",
"def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end",
"def connected?\n !socket.closed?\n end",
"def abort()\n if @ssh_session && !@ssh_session.closed? then\n #try to close connection gracefully\n @ssh_session.close\n # and if it won't, send out the hunter to bring in Snowwhite's heart after some time\n Thread.new do\n sleep 5\n @ssh_session.shutdown! unless @ssh_session.nil? || @ssh_session.closed?\n end\n end\n end",
"def closed?\n @sock.closed?\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/process/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFlow at #{@host}\")\n end\n end",
"def test_should_report_not_connected_when_new\n c = LibSSH.connect 'hostname'\n assert (not c.connected?)\n end",
"def closed?\n socket.closed?\n end",
"def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end",
"def sftp_close_connection(connection)\n connection.close!(connection)\nend",
"def sftp_close_connection(connection)\n connection.close!(connection)\nend",
"def connected?\n !closed?\n end",
"def connected?\n !closed?\n end",
"def closed?\n @socket.nil? or @socket.closed?\n end",
"def ssh?\n true\n end",
"def closed?\n socket.closed?\n end",
"def closed?\n !@socket || @socket.closed?\n end",
"def connected?\n @connection && !@connection.expired?\n end",
"def port_open?\n begin\n Timeout.timeout(1) do\n begin\n s = TCPSocket.new(@host, @port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n return false\n end\n\n false\n end",
"def check_connection_state\n # Has the connection been established in the meantime? If yes, shut\n # down the work queues thread, all work will be done in this thread \n # from now on. \n if cached_connection_established?\n @work_queue.shutdown\n end\n end",
"def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end",
"def port_open?(host, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(host, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n end\n return false\nend",
"def closed?\n @socket.nil?\n end",
"def closed?\n @server.closed?\n end",
"def connected?\n not @sp.closed?\n end",
"def disconnect\n info 'closing connection to host'\n @connected = false\n end",
"def is_available_via_ssh?\n res = nil\n\n if @cache_timeout\n if @cache.has_key?(:is_available_via_ssh?)\n if (Time.now.to_i - @cache[:is_available_via_ssh?][:time]) < @cache_timeout\n @logger.debug(sprintf('using cached is_available_via_ssh?[%s] from [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n return @cache[:is_available_via_ssh?][:status]\n end\n end\n end\n\n if @ssh.nil? or @ssh.closed?\n begin\n res = self.connect_ssh_tunnel()\n rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::ECONNRESET => e\n res = false\n end\n\n end\n\n if res.nil? or res.is_a?(Net::SSH::Connection::Session)\n begin\n self.run('echo functional test of SSH tunnel')\n res = true\n rescue\n res = false\n end\n end\n\n if @cache_timeout\n @cache[:is_available_via_ssh?] = Hash.new unless @cache[:is_available_via_ssh?].class.eql?(Hash)\n @cache[:is_available_via_ssh?][:time] = Time.now.to_i\n @cache[:is_available_via_ssh?][:status] = res\n @logger.debug(sprintf('caching is_available_via_ssh?[%s] at [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n end\n\n res\n end",
"def ifHostUp(host)\n Net::Ping::TCP.econnrefused = true\n Net::Ping::TCP.new(host).ping?\n end",
"def close_connection\n @socket.close if @socket and not @socket.closed?\n @connection.close if @connection and not @connection.closed?\n\n @socket = @connection = nil\n\n return true\n end",
"def connection_refused\n @connection_refused || code == 0\n end",
"def close\n ssh.close if @_ssh\n end",
"def closed?\n @state == :disconnected\n end",
"def port_open?(node)\n Timeout::timeout(node.timeout) do\n begin\n TCPSocket.new(node.host, node.port).close\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n false\n end\n end\n rescue Timeout::Error, SocketError\n false\n end",
"def ensure_connected! \n if @ssh_options[:timeout]\n total_timeout = @ssh_options[:timeout] * 2\n else\n total_timeout = 30\n end\n # puts \"Total timeout: #{total_timeout}\"\n @connections=[]\n hosts_to_connect = @hosts.inject(0) {|sum,h| sum += (h.connect_failed ? 0:1)}\n # puts \"#{hosts_to_connect} to connect\"\n @hosts.each do |host|\n if @connection_cache[host.name] || host.connected\n @connection_mutex.synchronize { @connections << {:connection=>@connection_cache[host.name], :host=>host} }\n host.connected=true\n elsif !host.connect_failed\n Thread.new {\n begin\n #puts \"Connecting #{host.name}\" \n c = Net::SSH.start(host.name, @user_name, @ssh_options)\n @connection_cache[host.name] = c\n @connection_mutex.synchronize { @connections << {:connection=>c, :host=>host} }\n host.connected=true\n #puts \"Connected #{host.name}\" \n rescue Exception => e\n host.connect_failed = true\n host.connected=false\n error \"Unable to connect to #{host.name}\\n#{e.message}\"\n @connection_mutex.synchronize {@connections << {:connection=>nil, :host=>host} }\n host.exception=e\n end \n }\n end\n end\n s = Time.now\n loop do\n l=0\n @connection_mutex.synchronize { l = @connections.length }\n break if l == hosts_to_connect\n sleep(0.1)\n if Time.now - s > total_timeout\n puts \"Warning -- total connection time expired\"\n puts \"Failed to connect:\"\n hosts.each do |h|\n unless h.connected\n puts \" #{h.name}\" \n h.connect_failed=true\n # TODO: Need to handle this situations much better. Attempt to kill thread and/or mark connection in cache as unreachable\n end\n end\n break\n end\n end \n end",
"def test_connection_open?\n assert_equal true , @conn.open?\n @conn.disconnect\n assert_equal false, @conn.open?\n end",
"def disconnect!; true; end",
"def busy?(connection)\n connection.busy?\n end",
"def connected?; connection_state == :connected end",
"def stage_over_connection?\n\t\tfalse\n\tend",
"def ssh?\n @session.transport.class.to_s.include?('SSH')\n end",
"def connection_status_done; end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFile at #{@host}\")\n end\n end",
"def connection_closed(handler, reason=nil)\n logger.info [\"Connection to Voldemort node #{host}:#{port} closed\", reason].compact.join(': ')\n @handler = FailHandler.new(self) if handler.equal? @handler\n @health = :bad\n @closing_deferrable.succeed if @closing_deferrable\n end",
"def disconnection_successful\n @disconnection_deferrable.succeed\n\n self.close_connection\n end",
"def disconnect\n return false if @connection.nil?\n @connection.logout\n @connection.disconnected? ? true : @connection.disconnect rescue nil\n end",
"def safe_timeout(conn, meth, name)\n Timeout.timeout(5) { conn.send(meth) }\n true\nrescue Timeout::Error\n $stderr.puts \"Timed out waiting to close #{name} connection\"\n false\nrescue Exception => ex\n $stderr.puts(\"#{ex.class}: #{ex.message}\")\n false\nend",
"def disconnected?\n status == DISCONNECTED\n end",
"def connection_check\n handle_action_exceptions(__method__) do\n check_connection\n end\n rescue RToolsHCKConnectionError => e\n if @json\n { 'result' => 'Failure', 'message' => e.message }\n else\n puts \"WARNING: #{e.message}\"\n false\n end\n end",
"def closed?\n status == 'closed'\n end",
"def sanity_check\n raise Net::SSH::Exception, \"session not open\" unless @open\n end",
"def closed?\n status == \"closed\"\n end",
"def disconnect\n connection { |conn| conn.disconnect }\n true\n end",
"def check_tunnel_timeout\n if tunnel_timeout?\n W 'Tunnel timeout. Disconnecting from server.'\n disable_tunnel_timeouts\n close_connection_after_writing\n end\n end",
"def close_connection\n if defined?(@socket) and @socket.is_a?(OpenSSL::SSL::SSLSocket)\n @socket.close\n @socket = nil\n end\n \n if defined?(@connection) and @connection.is_a?(TCPSocket)\n @connection.close\n @connection = nil\n end\n \n return true if @connection.nil? and @socket.nil?\n end",
"def check_host\n result = `ping -q -c 2 #{@conn[:host]}`\n # return true or false if exit status is 0\n $?.exitstatus == 0\n end",
"def disconnect!\n retrieve_connection.close if @connection\n @connection = nil\n true\n end",
"def closed?\n state == \"closed\"\n end",
"def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end",
"def disconnection_successful\n exec_callback_yielding_self(:disconnect)\n close_connection\n closed!\n end",
"def explicit_close?\n /close/i =~ @request['connection']\n end",
"def closed?\n self.status.is_closed?\n end",
"def closed?\n self.status.is_closed?\n end",
"def connect_error?\n @connerror || false\n end",
"def up?\n # We have to determine the port outside of the block since it uses\n # API calls which can only be used from the main thread in JRuby on\n # Windows\n ssh_port = port\n\n Timeout.timeout(env.config.ssh.timeout) do\n execute(:timeout => env.config.ssh.timeout,\n :port => ssh_port) { |ssh| }\n end\n\n true\n rescue Net::SSH::AuthenticationFailed\n raise Errors::SSHAuthenticationFailed\n rescue Timeout::Error, Errno::ECONNREFUSED, Net::SSH::Disconnect,\n Errors::SSHConnectionRefused, Net::SSH::AuthenticationFailed\n return false\n end",
"def conn_error?(key)\n c = get_connection_by_key(key)\n c && c.error?\n end",
"def closed?\n return @peer.closed?\n end",
"def closed?\n !open?\n end",
"def data_connection_closed(connection_id)\n return unless @connections.delete(connection_id)\n D \"Connection #{connection_id} closed by this end\"\n send_command CloseConnectionCommand.new(connection_id)\n end",
"def closed?\n end",
"def closed?\n end",
"def closed?\n with_timeout { not listening? }\n end",
"def poll\n buffer_size = @outstanding.size\n read_handshake unless handshake_seen?\n connection.handle(read_message, self)\n true\n rescue Errno::EAGAIN\n @outstanding.size != buffer_size\n rescue PeerError, EOFError => error\n log \"dropping connection: #{error.message}\"\n sessions.delete self\n begin\n connection.send_data error, io\n io.close\n rescue\n end\n true\n end",
"def close\n end_session\n if connected? && connection.CloseConnection.nil?\n @connected = false\n @connection = nil\n Connection.connections = Connection.connections - [self]\n end\n return !@connected # Returns false if CloseConnection failed.\n end",
"def vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end",
"def can_close?; end",
"def portainer?(ip, segundos=1) \n Timeout::timeout(segundos) do \n begin\n TCPSocket.new(ip, \"#{$port}\").close # Check Portainer port.\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError\n false # If Exception, do not count this host.\n end\n end\n rescue Timeout::Error # If Timeout, do not count this host.\n false\nend",
"def postgres_keep_alive\n stat = @connection.status()\n rescue PGError => e\n @logger.info(\"Postgresql connection lost: #{e}\")\n @connection = postgres_connect\n if (stat = PGconn.CONNECTION_BAD) then\n @logger.info(\"Postgresql connection lost. Reconnect.\")\n @connection = postgres_connect\n end\n end",
"def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end",
"def when_channel_closed(channel)\n debug { \"sftp channel closed\" }\n @channel = nil\n @state = :closed\n end",
"def connected?\n if @connection\n @connection.stat\n @connection.errno.zero?\n else\n false\n end\n end",
"def eof?\n @sock.closed?\n end"
] |
[
"0.72463757",
"0.71900713",
"0.7141059",
"0.70817316",
"0.70251876",
"0.7020031",
"0.66902846",
"0.6634494",
"0.6586284",
"0.6509211",
"0.6489014",
"0.6468289",
"0.64608103",
"0.63966924",
"0.63942343",
"0.6351752",
"0.6337756",
"0.63358283",
"0.631936",
"0.62726146",
"0.62523484",
"0.6249091",
"0.6239647",
"0.62298614",
"0.62102973",
"0.62081295",
"0.61593753",
"0.614436",
"0.61437446",
"0.61437446",
"0.6140129",
"0.6140129",
"0.611875",
"0.610137",
"0.6090175",
"0.60747343",
"0.60669154",
"0.60666186",
"0.6060574",
"0.60548866",
"0.6035801",
"0.603144",
"0.60254204",
"0.6003639",
"0.5984613",
"0.59841",
"0.5981671",
"0.59727395",
"0.5971378",
"0.5953896",
"0.59524107",
"0.59515554",
"0.5949707",
"0.5941466",
"0.59292656",
"0.59262604",
"0.59119105",
"0.5901683",
"0.589973",
"0.58945996",
"0.5857478",
"0.584998",
"0.58460265",
"0.5844435",
"0.58437055",
"0.584356",
"0.5842194",
"0.5821969",
"0.58219224",
"0.5821651",
"0.5808685",
"0.5808515",
"0.5801223",
"0.57982075",
"0.57928294",
"0.57876885",
"0.57860136",
"0.577758",
"0.5775783",
"0.5753554",
"0.5753554",
"0.5746898",
"0.57425874",
"0.5742568",
"0.5739712",
"0.5736759",
"0.5735535",
"0.5732827",
"0.5732827",
"0.5730968",
"0.57254213",
"0.57207924",
"0.5708457",
"0.5705259",
"0.56999683",
"0.5692978",
"0.5688216",
"0.5686982",
"0.5677729",
"0.5677458"
] |
0.83323675
|
0
|
Check if SSH connection is busy +connection+:: SSH connection to check
|
def busy?(connection)
connection.busy?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def connected?\n start_ssh {|ssh| } # do nothing\n rescue *CONNECTION_EXCEPTIONS => ex\n @connection_error = ex\n return false\n else\n return true\n end",
"def closed?(connection)\n return true if connection.closed?\n begin \n # Hack to check connection isn't dead\n connection.exec!('true') unless connection.busy?\n rescue Net::SSH::Exception, SystemCallError => e\n return true\n end\n return false\n end",
"def tcp_ssh_alive(hostname,port=22)\n tcp_socket = TCPSocket.new(hostname, port)\n readable = IO.select([tcp_socket], nil, nil, 5)\n if readable\n Chef::Log.debug(\"sshd accepting connections on #{hostname}, banner is #{tcp_socket.gets}\")\n true\n else\n false\n end\n \n rescue Errno::ETIMEDOUT\n false\n rescue Errno::EPERM\n false\n rescue Errno::ECONNREFUSED\n sleep 2\n false\n rescue Errno::EHOSTUNREACH, Errno::ENETUNREACH\n sleep 2\n false\n ensure\n tcp_socket && tcp_socket.close\n end",
"def is_available_via_ssh?\n res = nil\n\n if @cache_timeout\n if @cache.has_key?(:is_available_via_ssh?)\n if (Time.now.to_i - @cache[:is_available_via_ssh?][:time]) < @cache_timeout\n @logger.debug(sprintf('using cached is_available_via_ssh?[%s] from [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n return @cache[:is_available_via_ssh?][:status]\n end\n end\n end\n\n if @ssh.nil? or @ssh.closed?\n begin\n res = self.connect_ssh_tunnel()\n rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::ECONNRESET => e\n res = false\n end\n\n end\n\n if res.nil? or res.is_a?(Net::SSH::Connection::Session)\n begin\n self.run('echo functional test of SSH tunnel')\n res = true\n rescue\n res = false\n end\n end\n\n if @cache_timeout\n @cache[:is_available_via_ssh?] = Hash.new unless @cache[:is_available_via_ssh?].class.eql?(Hash)\n @cache[:is_available_via_ssh?][:time] = Time.now.to_i\n @cache[:is_available_via_ssh?][:status] = res\n @logger.debug(sprintf('caching is_available_via_ssh?[%s] at [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n end\n\n res\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/process/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFlow at #{@host}\")\n end\n end",
"def ifHostUp(host)\n Net::Ping::TCP.econnrefused = true\n Net::Ping::TCP.new(host).ping?\n end",
"def check_host\n result = `ping -q -c 2 #{@conn[:host]}`\n # return true or false if exit status is 0\n $?.exitstatus == 0\n end",
"def connected?\n if @ssh\n return true\n else\n return false\n end\n end",
"def ensure_connected! \n if @ssh_options[:timeout]\n total_timeout = @ssh_options[:timeout] * 2\n else\n total_timeout = 30\n end\n # puts \"Total timeout: #{total_timeout}\"\n @connections=[]\n hosts_to_connect = @hosts.inject(0) {|sum,h| sum += (h.connect_failed ? 0:1)}\n # puts \"#{hosts_to_connect} to connect\"\n @hosts.each do |host|\n if @connection_cache[host.name] || host.connected\n @connection_mutex.synchronize { @connections << {:connection=>@connection_cache[host.name], :host=>host} }\n host.connected=true\n elsif !host.connect_failed\n Thread.new {\n begin\n #puts \"Connecting #{host.name}\" \n c = Net::SSH.start(host.name, @user_name, @ssh_options)\n @connection_cache[host.name] = c\n @connection_mutex.synchronize { @connections << {:connection=>c, :host=>host} }\n host.connected=true\n #puts \"Connected #{host.name}\" \n rescue Exception => e\n host.connect_failed = true\n host.connected=false\n error \"Unable to connect to #{host.name}\\n#{e.message}\"\n @connection_mutex.synchronize {@connections << {:connection=>nil, :host=>host} }\n host.exception=e\n end \n }\n end\n end\n s = Time.now\n loop do\n l=0\n @connection_mutex.synchronize { l = @connections.length }\n break if l == hosts_to_connect\n sleep(0.1)\n if Time.now - s > total_timeout\n puts \"Warning -- total connection time expired\"\n puts \"Failed to connect:\"\n hosts.each do |h|\n unless h.connected\n puts \" #{h.name}\" \n h.connect_failed=true\n # TODO: Need to handle this situations much better. Attempt to kill thread and/or mark connection in cache as unreachable\n end\n end\n break\n end\n end \n end",
"def check_connection_state\n # Has the connection been established in the meantime? If yes, shut\n # down the work queues thread, all work will be done in this thread \n # from now on. \n if cached_connection_established?\n @work_queue.shutdown\n end\n end",
"def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end",
"def available?\n # If we haven't tried an ssh command yet, @available will be nil. Running\n # a first no-op command will populate it to true or false.\n if @available.nil?\n ssh_cmd 'echo ping' rescue nil\n end\n @available\n end",
"def is_online?\n #Uses a SYN ping vs ICMP to avoid firewall issues.\n #Tries likely ports to determine if computer is up\n tls = Net::Ping::TCP.new(remote_repository, 443, 1)\n http = Net::Ping::TCP.new(remote_repository, 80, 1)\n ssh = Net::Ping::TCP.new(remote_repository, 22, 1)\n tls.ping or http.ping or ssh.ping\n end",
"def connected?\n @connection && !@connection.expired?\n end",
"def reachable?\n ping\n true\n rescue Orocos::ComError\n false\n end",
"def alive?\n\t\tconnection.alive?\n\tend",
"def alive?\n\t\tconnection.alive?\n\tend",
"def busy?\n !(@status == :wait || @status == :disabled || @status == :error)\n end",
"def connectable?\n begin; ping; rescue; false; end\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end",
"def waited_on_connect?\n @waited_on_connect\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFile at #{@host}\")\n end\n end",
"def busy?()\n\t\tcommand_center.busy?\n\tend",
"def wait_connection; end",
"def wait_connection; end",
"def busy?\n status == :busy\n end",
"def connected?; connection_state == :connected end",
"def connected?\n (conn=self.conn) && conn.connected? && @pid == Process.pid || false\n end",
"def host_avail?(hostname)\n host_available = false\n puts \"Pinging host #{hostname}...\"\n exit_status = system(\"ping -q -c 1 #{hostname} >/dev/null 2>&1\")\n if exit_status\n puts \" --> Host #{hostname} is available.\"\n host_available = true\n else\n puts \" --> Host #{hostname} is unavailable!\"\n end\n host_available\n end",
"def active? # :nodoc:\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @raw_connection.ping\n rescue OracleEnhanced::ConnectionException\n false\n end",
"def busy?\n status == \"busy\"\n end",
"def active_connection?\n synchronize do\n @reserved_connections.fetch(current_connection_id) do\n return false\n end\n end\n end",
"def check_connection\n logger.debug \"Checking connection (#{is_connected?})\"\n is_connected? || connect_database\n # return connection status\n is_connected?\n end",
"def check_connection\n logger.debug \"Checking connection (#{is_connected?})\"\n is_connected? || connect_database\n # return connection status\n is_connected?\n end",
"def get_ssh_connection\n conn = nil\n attempts = 0\n 5.times do |attempt|\n @lock.synchronize do\n if @connection_pool.count > 0\n conn = @connection_pool.shift\n end\n end\n unless conn\n params = {\n :paranoid => false,\n :user_known_hosts_file => '/dev/null',\n :timeout => 5,\n }\n params[:keys] = Jetpants.ssh_keys if Jetpants.ssh_keys\n begin\n @lock.synchronize do \n conn = Net::SSH.start(@ip, 'root', params)\n end\n rescue => ex\n output \"Unable to SSH on attempt #{attempt + 1}: #{ex.to_s}\"\n conn = nil\n next\n end\n end\n \n # Confirm that the connection works\n if conn\n begin\n result = conn.exec!('echo ping').strip\n raise \"Unexpected result\" unless result == 'ping'\n @available = true\n return conn\n rescue\n output \"Discarding nonfunctional SSH connection\"\n conn = nil\n end\n end\n end\n @available = false\n raise \"Unable to obtain working SSH connection to #{self} after 5 attempts\"\n end",
"def active_connection?\n connection_id = current_connection_id\n if conn = @reserved_connections.fetch(connection_id, nil)\n !! conn.in_use? # synchronize { conn.in_use? }\n else\n false\n end\n end",
"def connected?\n connection { |conn| conn.alive? }\n end",
"def connected?\n if @connection\n @connection.stat\n @connection.errno.zero?\n else\n false\n end\n end",
"def checkin_connection(conn)\n @available_connections << conn\n if USE_WAITER\n @waiter.signal\n Thread.pass\n end\n conn\n end",
"def good?\n\t\t\t\t\t@stream.connected?\n\t\t\t\tend",
"def active?\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @connection.ping\n rescue OracleEnhancedConnectionException\n false\n end",
"def stage_over_connection?\n\t\tfalse\n\tend",
"def ssh?\n true\n end",
"def connection_status\n \t@current_connection = ConnectionInfo.where(\"disconnected_at is null\").first\n end",
"def connected?\n return false unless @connection\n return false unless @connection.started?\n true\n end",
"def getSshCheckThread(key, host)\n return Thread.new(key, host) { |hostKey, actual_host|\n \n shutDown = false\n \r\n # sleep for the time specified for SSH_TIMEOUT\n sleep($SSH_TIMEOUT)\n \n while($exit_flag == false)\n \n sshConnectionAttempt = 0\n checkSuccessfull = false\n \n # Try to establish a ssh connection\n # On success reset error counter\n begin\n ssh = Net::SSH.start(host[:IP], $SSH_USER, {:auth_methods => \"publickey\"})\n ssh.close\n \n $Log.info \"SSH: Host #{host[:Name]} alive...\"\n \n # if host has been successfully checked earlier\n # we don't need to set the \"wakeSSH\" flag\n # that prevents us from unnecessary locking of the host list\n if(checkSuccessfull != true)\n checkSuccessfull = true\n $hostListMutex.synchronize{\n $state.change(hostKey,$state.wakeSSH)\n }\n end\n \n sshConnectionAttempt = 0\n \n \n # If connection is refused error counter is incremented\n rescue(Errno::ECONNREFUSED)\n $Log.warn \"SSH: Host #{host[:Name]} refused ssh connection...\"\n $Log.warn \"SSH: Attempt #{host[:wakeAttempt]}\"\n \n sshConnectionAttempt += 1\n \n checkSuccessfull = false\n \n $hostListMutex.synchronize{\n $state.change(hostKey,$state.isWake)\n }\n \n # On authetication error something seriously is wrong\n # so the error counter is set to maximum\n rescue(Net::SSH::AuthenticationFailed)\n $Log.error \"SSH: Authentication failed on host #{host[:Name]}\"\n \n sshConnectionAttempt = $NUM_WAKE_ATTEMPTS\n \n checkSuccessfull = false\n \n $hostListMutex.synchronize{\n $state.change(hostKey,$state.isWake)\n }\n \n # On socket error something seriously is wrong\n # so the error counter is set to maximum\n rescue\n $Log.error \"SSH: Socket error on host #{host[:Name]}\"\n \n sshConnectionAttempt = $NUM_WAKE_ATTEMPTS\n \n checkSuccessfull = false\n \n $hostListMutex.synchronize{\n $state.change(hostKey,$state.isWake)\n }\n end\n \n # If error counter is at maximum the time when that happens is recorded\n # and the thread is terminated\n if(sshConnectionAttempt >= $NUM_WAKE_ATTEMPTS )\n \n $hostListMutex.synchronize{\r\n \r\n # if the host is intended to run always\r\n # the something seriously is wrong and therefore\r\n # error status is set\n if($hostList[hostKey][:PXE][:wake] == true)\n $Log.error \"SSH: Fatal Error (#{actual_host[:Name]})\"\n $state.change(hostKey,$state.sshError)\r\n \r\n # else a ping thread is created because it is assumed\r\n # that someone shut down the host\n else\n $state.change(hostKey,$state.ReadyForWakeUp)\n $hostList[hostKey][:pingThread] = getPingThread(key, host)\n $hostList[hostKey][:sshThread] = nil\n end\n }\n break\n end\n \r\n # sleep for the time specified for SSH_CHECK_INTERVAL\n sleep($SSH_CHECK_INTERVAL)\n \n end\n $Log.info \"SSH: ssh thread for \\\"#{host[:Name]}\\\" terminated\"\n }\nend",
"def connected?(conn)\n conn && conn.active?\n end",
"def connected?\n @host && @port\n end",
"def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return false\n end",
"def up?\n # We have to determine the port outside of the block since it uses\n # API calls which can only be used from the main thread in JRuby on\n # Windows\n ssh_port = port\n\n Timeout.timeout(env.config.ssh.timeout) do\n execute(:timeout => env.config.ssh.timeout,\n :port => ssh_port) { |ssh| }\n end\n\n true\n rescue Net::SSH::AuthenticationFailed\n raise Errors::SSHAuthenticationFailed\n rescue Timeout::Error, Errno::ECONNREFUSED, Net::SSH::Disconnect,\n Errors::SSHConnectionRefused, Net::SSH::AuthenticationFailed\n return false\n end",
"def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\nend",
"def active?\n !!@raw_connection&.ping\n end",
"def connected?\n @status == :connected\n end",
"def test_should_report_not_connected_when_new\n c = LibSSH.connect 'hostname'\n assert (not c.connected?)\n end",
"def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\n end",
"def connected?\r\n @connection && @connection.connected?\r\n end",
"def status\r\n connection.status\r\n end",
"def connected?\n !connection.blank?\n end",
"def test_connection\n @pool.hold {|conn|}\n true\n end",
"def connected?\n @connection.present?\n end",
"def connected?\r\n !@conn.nil?\r\n end",
"def connected?\n @conn.connected? && @channel.open?\n end",
"def is_connected?\n if @connection == nil\n return false\n else \n return true\n end\n end",
"def await_ssh(host)\n puts \"Awaiting sshd on #{host}\"\n backoff_loop do\n begin\n sock = connect_timeout(host, 22, 1)\n break\n rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EHOSTDOWN\n # Nothing, these are expected\n ensure\n sock&.close\n end\n end\n end",
"def active_connection?\n @reserved_connections.fetch(current_connection_id) { return false }.in_use?\n end",
"def link_alive?\n !!socket && !socket.closed? && !@dead && @disabled_tx == 0\n end",
"def connected?\n !socket.closed?\n end",
"def connection?\n check = Netchecker.new() \n @alive = check.check_url(\"google.com\", 80) \n end",
"def can_we_connect\n\t\tbegin\n\t\t\t@sys_time = @manager.get_value(\"sysUpTime.0\")\n\t\trescue SNMP::RequestTimeout => e\n\t\t\tprint_error(\"#{e}\")\n\t\t\tprint_error(\"Can't connect using '#{@string.chomp}'!\")\n\t\t\t$fail=1\n\t\tend\n\tend",
"def connection\n #N Without this check, we would get a new connection even though we already have a new one\n if @connection == nil\n #N Without this, we don't get feedback about an SSH connection being opened\n puts \"Opening SSH connection to #{user}@#{host} ...\"\n #N Without this, we won't actually connect to the SSH host\n @connection = Net::SSH.start(host, user)\n end\n return @connection\n end",
"def connected?\n\t\t@conn.connected?\n\tend",
"def connection_refused\n @connection_refused || code == 0\n end",
"def usable?\n [:connected, :connecting].include?(@status)\n end",
"def port_open?(ip, port, timeout)\n\n\tstart_time = Time.now\n\tcurrent_time = start_time\n \twhile (current_time - start_time) <= timeout\n\t\tbegin\n \t\t TCPSocket.new(ip, port)\n \t\t return true\n \t rescue Errno::ECONNREFUSED\n \t\t\tsleep 0.1\n \t\tend\n \t\tcurrent_time = Time.now\n \tend\n\n \treturn false\n\n end",
"def vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end",
"def ready?(host, timeout = 60, sleep_time = 10, options = {})\n timeout_at = Time.now + timeout\n ip = resolve_host(host)\n return false if ip.empty?\n\n msg = \"Waiting for host #{host} (#{ip}); next attempt in #{sleep_time} seconds until #{timeout_at}\"\n\n nobj = Node.find_by_name(host)\n reboot_requesttime = nobj[:crowbar_wall][:wait_for_reboot_requesttime] || 0\n\n wait_until(msg, timeout_at.to_i, sleep_time, options) do\n port_open?(ip, 22) && reboot_done?(ip, reboot_requesttime, options) && ssh_cmd(ip, runlevel_check_cmd(host))\n end\n end",
"def viable?\n\t\t\t\t\t\t@ready && @stream&.connected?\n\t\t\t\t\tend",
"def ping?\n tcp_ping.ping?\n end",
"def alive?\n Utils::NetworkUtils.port_open?(@host, @port)\n end",
"def connected?\n !@connections.empty?\n end",
"def valid?\n ping\n end",
"def connected?()\n (self.remote_address rescue nil) ? true : false\n end",
"def ping?\n cmd = \"ping -c #{@count} -i #{@wait} #{@host}\"\n\n # Execute command and handle resulting exit status from command.\n Open3.popen3(cmd) do |_, _, stderr, thread|\n case thread.value.exitstatus\n when 0 # At least one response was heard from the specified host.\n return true\n when 1 # (Linux) The transmission was successful but no responses were received.\n return false\n when 2 # (OSX) The transmission was successful but no responses were received.\n return false\n else # Error\n raise StandardError, \"Unknown return value from execution of command: #{cmd.inspect}\"\n end\n end\n end",
"def connection_status\n @connection_status ||= @node['connectionStatus']\n end",
"def connected?\n !!(@connection && @connection.status == PGconn::CONNECTION_OK)\n rescue PGError\n false\n end",
"def online?\n sock = UDPSocket.new()\n online = false\n begin\n sock.connect('193.0.14.129', 25) # that address is k.root-servers.net\n online = true\n sock.close\n rescue Exception => exception\n puts \"\n------------------------------------------------------------\nCannot bind to socket:\n #{exception}\n\nThis is an indication you have network problems.\nNo online tests will be run!!\n------------------------------------------------------------\n\"\n end\n online\nend",
"def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end",
"def port_open?\n begin\n Timeout.timeout(1) do\n begin\n s = TCPSocket.new(@host, @port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n return false\n end\n\n false\n end",
"def connection_status\n @connection_status ||= @node['connectionStatus']\n end",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n try_sleep = resource[:try_sleep]\n\n success = validator.attempt_connection\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for an HTTP service to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice(\"Failed to make an HTTP connection; sleeping #{try_sleep} seconds before retry\")\n sleep try_sleep\n success = validator.attempt_connection\n end\n\n if success\n Puppet.debug(\"Connected to the host in #{Time.now - start_time} seconds.\")\n else\n Puppet.notice(\"Failed to make an HTTP connection within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def check\n tcp_socket_request\n mark_message \"Ping check to #{host}:#{port} successful\"\n rescue => e\n mark_message \"Error: '#{e}'\"\n mark_failure\n end",
"def connected?\n status == CONNECTED\n end",
"def updateExists(host)\n Net::SSH.start(host, \"vagrant\", :config => ['./ssh_config']) do |ssh|\n ssh.open_channel do |channel|\n\n channel.on_data do |ch, data|\n @output << data\n end\n\n channel.exec(\"yum -q check-update\") do |ch, success|\n\n end\n\n channel.on_request \"exit-status\" do |ch, data|\n #return lambda { return data.read_long}\n @do_yum_update = 'true' if data.read_long == 100\n end\n\n channel.on_close do |ch|\n\n end\n\n end\n ssh.loop\n end\nend",
"def busy?\n @busy\n end",
"def busy?\n @busy\n end",
"def is_connected?\n\t\tif @connection == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def connecting?\n\t\treturn @connection_thread\n\tend",
"def ping\n stats\n true\n rescue Errno::ECONNREFUSED\n false\n end",
"def available?\n @available && connected?\n end"
] |
[
"0.7125103",
"0.7113677",
"0.6865184",
"0.67932945",
"0.67154586",
"0.66424054",
"0.66414",
"0.6624428",
"0.6595834",
"0.658586",
"0.65762615",
"0.65313566",
"0.6405135",
"0.63832116",
"0.6379563",
"0.6370428",
"0.6370428",
"0.63554823",
"0.63304424",
"0.63084054",
"0.6288727",
"0.628278",
"0.62744915",
"0.6251684",
"0.62448317",
"0.62448317",
"0.62427217",
"0.6222587",
"0.6217969",
"0.6214637",
"0.6201851",
"0.6181479",
"0.61658406",
"0.61581045",
"0.61581045",
"0.6136974",
"0.6135305",
"0.61147475",
"0.61039144",
"0.6065954",
"0.6056292",
"0.6036212",
"0.6031591",
"0.60296226",
"0.6029208",
"0.60158503",
"0.6014635",
"0.6005861",
"0.60041434",
"0.59954965",
"0.59907323",
"0.5982513",
"0.59798694",
"0.596756",
"0.5967295",
"0.5966133",
"0.5964258",
"0.5956272",
"0.5953446",
"0.59487593",
"0.5948652",
"0.5948522",
"0.5930142",
"0.59294355",
"0.5916956",
"0.5914427",
"0.5901125",
"0.58936286",
"0.588395",
"0.58833176",
"0.5881114",
"0.5866137",
"0.58593893",
"0.5858775",
"0.5841152",
"0.5840586",
"0.5831912",
"0.58261186",
"0.58254284",
"0.5824179",
"0.5823387",
"0.5814098",
"0.58140326",
"0.58109283",
"0.5810447",
"0.58083206",
"0.580759",
"0.5802171",
"0.5801445",
"0.580102",
"0.5798463",
"0.5797741",
"0.5795613",
"0.5793619",
"0.57790726",
"0.57790726",
"0.57757324",
"0.57700187",
"0.57674676",
"0.57649016"
] |
0.7712347
|
0
|
Get new SSH connection
|
def get_new
logger.debug "Establishing connection for #{creep.user}@#{creep.host} passwd:#{creep.password}"
ssh = Net::SSH.start(creep.host, creep.user, {:password => creep.password, :verbose => (ENV['SSH_DEBUG'] && ENV['SSH_DEBUG'].to_sym) || :fatal })
ssh.send_global_request("keepalive@openssh.com")
ssh
rescue Net::SSH::Exception => ex
logger.error "There was an exception in method get_new for SSConnection. Details #{ex}:\n#{ex.backtrace}"
return nil
rescue SystemCallError => ex
logger.error "There was an system error in method get_new for SSConnection. Details #{ex}:\n#{ex.backtrace}"
return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end",
"def connection\n #N Without this check, we would get a new connection even though we already have a new one\n if @connection == nil\n #N Without this, we don't get feedback about an SSH connection being opened\n puts \"Opening SSH connection to #{user}@#{host} ...\"\n #N Without this, we won't actually connect to the SSH host\n @connection = Net::SSH.start(host, user)\n end\n return @connection\n end",
"def ssh\n @ssh ||= @remote.connect\n @remote\n end",
"def getSSHConnectionHelper()\n return SSHConnection.new\n end",
"def get_ssh_connection\n conn = nil\n attempts = 0\n 5.times do |attempt|\n @lock.synchronize do\n if @connection_pool.count > 0\n conn = @connection_pool.shift\n end\n end\n unless conn\n params = {\n :paranoid => false,\n :user_known_hosts_file => '/dev/null',\n :timeout => 5,\n }\n params[:keys] = Jetpants.ssh_keys if Jetpants.ssh_keys\n begin\n @lock.synchronize do \n conn = Net::SSH.start(@ip, 'root', params)\n end\n rescue => ex\n output \"Unable to SSH on attempt #{attempt + 1}: #{ex.to_s}\"\n conn = nil\n next\n end\n end\n \n # Confirm that the connection works\n if conn\n begin\n result = conn.exec!('echo ping').strip\n raise \"Unexpected result\" unless result == 'ping'\n @available = true\n return conn\n rescue\n output \"Discarding nonfunctional SSH connection\"\n conn = nil\n end\n end\n end\n @available = false\n raise \"Unable to obtain working SSH connection to #{self} after 5 attempts\"\n end",
"def get_ssh_session\n ssh = nil\n begin\n ssh = Net::SSH.start(@node, @user, :password => @password)\n ssh.loop(true)\n rescue Exception => e\n puts \"Unknown Net:SSH Exception : #{e.message}\"\n return nil\n end\n ssh\n end",
"def connection(options = {})\n @connection ||= Net::SSH::Connection::Session.new(transport(options), options)\n end",
"def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end",
"def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end",
"def connection\n Net::SSH.start(\n ip, username, :password => password, :port => port\n ) {|ssh| yield ssh }\n end",
"def init_ssh_session\n @ssh_session.close if !(@ssh_session.nil? or !@ssh_session.closed?)\n ssh_opts = ssh_connection_options\n @log.info(\"Opening ssh connection to #{ssh_opts[:host]} as user #{ssh_opts[:user]}\")\n @ssh_session = ::Net::SSH.start(ssh_opts[:host], ssh_opts[:user])\n return @ssh_session\n end",
"def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end",
"def create_new_connection(options, &block)\n cleanup!\n @connection_options = options\n @connection = Kitchen::Transport::Ssh::Connection.new(options, &block)\n end",
"def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end",
"def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end",
"def connect\n if @connection && !@connection.closed?\n # There is a chance that the socket is closed despite us checking\n # 'closed?' above. To test this we need to send data through the\n # socket.\n begin\n @connection.exec!(\"\")\n rescue IOError\n @logger.info(\"Connection has been closed. Not re-using.\")\n @connection = nil\n end\n\n # If the @connection is still around, then it is valid,\n # and we use it.\n if @connection\n @logger.debug(\"Re-using SSH connection.\")\n return yield @connection if block_given?\n return\n end\n end\n\n # XXX: We need to raise some exception if SSH is not ready\n ssh_info = @machine.ssh_info\n\n # Build the options we'll use to initiate the connection via Net::SSH\n opts = {\n :port => ssh_info[:port],\n :keys => [ssh_info[:private_key_path]],\n :keys_only => true,\n :user_known_hosts_file => [],\n :paranoid => false,\n :config => false,\n :forward_agent => ssh_info[:forward_agent]\n }\n\n # Check that the private key permissions are valid\n Vagrant::Util::SSH.check_key_permissions(ssh_info[:private_key_path])\n\n # Connect to SSH, giving it a few tries\n connection = nil\n begin\n exceptions = [Errno::ECONNREFUSED, Net::SSH::Disconnect, Timeout::Error]\n connection = retryable(:tries => @machine.config.ssh.max_tries, :on => exceptions) do\n Timeout.timeout(@machine.config.ssh.timeout) do\n @logger.info(\"Attempting to connect to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}\")\n Net::SSH.start(ssh_info[:host], ssh_info[:username], opts)\n end\n end\n rescue Timeout::Error\n # This happens if we continued to timeout when attempting to connect.\n raise Vagrant::Errors::SSHConnectionTimeout\n rescue Net::SSH::AuthenticationFailed\n # This happens if authentication failed. We wrap the error in our\n # own exception.\n raise Vagrant::Errors::SSHAuthenticationFailed\n rescue Net::SSH::Disconnect\n # This happens if the remote server unexpectedly closes the\n # connection. This is usually raised when SSH is running on the\n # other side but can't properly setup a connection. This is\n # usually a server-side issue.\n raise Vagrant::Errors::SSHDisconnected\n rescue Errno::ECONNREFUSED\n # This is raised if we failed to connect the max amount of times\n raise Vagrant::Errors::SSHConnectionRefused\n rescue NotImplementedError\n # This is raised if a private key type that Net-SSH doesn't support\n # is used. Show a nicer error.\n raise Vagrant::Errors::SSHKeyTypeNotSupported\n end\n\n @connection = connection\n\n # This is hacky but actually helps with some issues where\n # Net::SSH is simply not robust enough to handle... see\n # issue #391, #455, etc.\n sleep 4\n\n # Yield the connection that is ready to be used and\n # return the value of the block\n return yield connection if block_given?\n end",
"def return_client()\n Net::SSH.start('qa-host','root',:password=>'fortigate')\nend",
"def conn(pty_needed=false)\n Scutil.find_connection(@hostname, @username, pty_needed=false, @options)\n end",
"def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end",
"def ssh\n platform_service(:ssh)\n end",
"def spawn_connection\n connect\n end",
"def ssh\n tries = 1\n @ssh ||= begin\n Net::SSH.start(self, self['user'], self['ssh'])\n rescue\n tries += 1\n if tries < 4\n puts \"Try #{tries} -- Host Unreachable\"\n puts 'Trying again in 20 seconds'\n sleep 20\n retry\n end\n end\n end",
"def initialize_ssh; end",
"def connect(&block)\n begin\n Puppet.debug \"Trying to connect to #{host} as #{user}\"\n @ssh = Net::SSH.start(host, user, :port => port, :password => password, :timeout => timeout,\n :paranoid => Net::SSH::Verifiers::Null.new,\n :global_known_hosts_file=>\"/dev/null\")\n rescue TimeoutError\n raise TimeoutError, \"SSH timed out while trying to connect to #{host}\"\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, \"SSH auth failed while trying to connect to #{host} as #{user}\"\n rescue Net::SSH::Exception => error\n raise Puppet::Error, \"SSH connection failure to #{host}\"\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty {|ch, success| raise \"Failed to open PTY\" unless success}\n\n channel.send_channel_request('shell') do |ch, success|\n raise 'Failed to open SSH SHELL Channel' unless success\n\n ch.on_data {|ch, data| @buf << data}\n ch.on_extended_data {|ch, type, data| @buf << data if type == 1}\n ch.on_close {@eof = true}\n\n @channel = ch\n expect(default_prompt, &block)\n return\n end\n end\n @ssh.loop\n end",
"def connect(&block)\n @output = []\n @channel_data = ''\n\n begin\n Puppet.debug(\"connecting to #{host} as #{user}\")\n @ssh = Net::SSH.start(host, user, port: port, password: password, timeout: timeout, verify_host_key: false)\n rescue TimeoutError\n raise TimeoutError, _('timed out while opening an ssh connection to the host'), $ERROR_INFO.backtrace\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, _('SSH authentication failure connecting to %{host} as %{user}') % { host: host, user: user }, $ERROR_INFO.backtrace\n rescue Net::SSH::Exception\n raise Puppet::Error, _('SSH connection failure to %{host}') % { host: host }, $ERROR_INFO.backtrace\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty { |_ch, success| raise _('failed to open pty') unless success }\n\n channel.send_channel_request('shell') do |ch, success|\n raise _('failed to open ssh shell channel') unless success\n\n ch.on_data { |_, data| @buf << data }\n ch.on_extended_data { |_, type, data| @buf << data if type == 1 }\n ch.on_close { @eof = true }\n\n @channel = ch\n expect(default_prompt, &block)\n # this is a little bit unorthodox, we're trying to escape\n # the ssh loop there while still having the ssh connection up\n # otherwise we wouldn't be able to return ssh stdout/stderr\n # for a given call of command.\n # rubocop:disable Lint/NonLocalExitFromIterator\n return\n # rubocop:enable Lint/NonLocalExitFromIterator\n end\n end\n @ssh.loop\n end",
"def connect(opts={})\n if Mario::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n # Command line options\n command_options = [\"-p #{options[:port]}\", \"-o UserKnownHostsFile=/dev/null\",\n \"-o StrictHostKeyChecking=no\", \"-o IdentitiesOnly=yes\",\n \"-i #{options[:private_key_path]}\"]\n command_options << \"-o ForwardAgent=yes\" if env.config.ssh.forward_agent\n\n if env.config.ssh.forward_x11\n # Both are required so that no warnings are shown regarding X11\n command_options << \"-o ForwardX11=yes\"\n command_options << \"-o ForwardX11Trusted=yes\"\n end\n\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n pid = nil\n pid = fork if Util::Platform.leopard? || Util::Platform.tiger?\n Kernel.exec \"ssh #{command_options.join(\" \")} #{options[:username]}@#{options[:host]}\".strip if pid.nil?\n Process.wait(pid) if pid\n end",
"def save_ssh_connection(conn)\n conn.exec! 'cd ~'\n @lock.synchronize do\n @connection_pool << conn\n end\n rescue\n output \"Discarding nonfunctional SSH connection\"\n end",
"def new_connection; end",
"def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end",
"def sshAndScp\n return contentHost.sshAndScp\n end",
"def config_ssh(username, host, options = nil)\n @ssh = SSH.new(username, host, options)\n end",
"def kind\n :ssh\n end",
"def create_new_connection(options, &block)\n if defined?(@connection)\n logger.debug(\"[SSH] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection_options = options\n conn = Connection.new(options, &block)\n\n # Cisco IOS requires a special implementation of `Net:SSH`. This uses the\n # SSH transport to identify the platform, but then replaces SSHConnection\n # with a CiscoIOSConnection in order to behave as expected for the user.\n if defined?(conn.platform.cisco_ios?) && conn.platform.cisco_ios?\n ios_options = {}\n ios_options[:host] = @options[:host]\n ios_options[:user] = @options[:user]\n # The enable password is used to elevate privileges on Cisco devices\n # We will also support the sudo password field for the same purpose\n # for the interim. # TODO\n ios_options[:enable_password] = @options[:enable_password] || @options[:sudo_password]\n ios_options[:logger] = @options[:logger]\n ios_options.merge!(@connection_options)\n conn = CiscoIOSConnection.new(ios_options)\n end\n\n @connection = conn unless conn.nil?\n end",
"def connect\n @connection_pool.get_connection\n end",
"def connect\n connection.connect\n nil\n end",
"def establish_connection(opts)\n retry_connection(opts) do\n Net::SSH.start(hostname, username, options)\n end\n end",
"def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end",
"def ssh?\n true\n end",
"def connect\n Connection.new\n end",
"def open(&block)\n\t\tif @ssh_session && !@ssh_session.closed? then\n\t\t\t@@logger.warn(\"trying to open an already opened ssh connection\")\n\t\t\traise \"trying to open an already opened ssh connection\"\n\t\tend\n\t\t\n\t\t@@logger.info(\"opening ssh connection with parameters: \" + @parameters.to_s)\n\t\n\t\tparameters = @parameters.clone()\n\t\thost = @parameters[:host]\n\t\tuser = @parameters[:user]\n\t\t\n\t\tparameters.delete(:host)\n\t\tparameters.delete(:user)\n\t\t\n\t\tif @parameters[:keys] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:key_data] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:password] then\n\t\t\t@@logger.info(\"Starting SSH session with password authentication\")\n\t\telse\n\t\t\t@@logger.error(\"No SSH authentication method found in parameters\")\n\t\t\traise \"No authentication method found\"\n\t\tend\n\n\t\tconnected = false\n\t\ttrials = 5\n\t\twhile !connected and trials > 0\n\t\t\tbegin\n\t\t\t\t@ssh_session = Net::SSH.start(host, user, parameters)\n\t\t\t\tconnected = true\n\t\t\trescue Exception => e\n\t\t\t\t@@logger.warn(\"connection attempt failed due to #{e.backtrace}\")\n\t\t\tend\n\t\t\ttrials -= 1\n\t\t\tif !connected\n\t\t\t\tsleep(20)\n\t\t\tend\n\t\tend\n\t\n\t\tif block then\n\t\t\tyield self\n\t\t\tclose\n\t\tend\n\tend",
"def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend",
"def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && !@password.empty?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end",
"def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end",
"def open\n connect\n rescue Object => anything\n begin\n @ssh.shutdown!\n rescue ::Exception # rubocop:disable Lint/HandleExceptions, Lint/RescueException\n # swallow exceptions that occur while trying to shutdown\n end\n\n raise anything\n end",
"def test_should_report_not_connected_when_new\n c = LibSSH.connect 'hostname'\n assert (not c.connected?)\n end",
"def scpConnection\n return connection.scp\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def connection\n @connection ||= KJess::Connection.new( host, port )\n end",
"def session\n @session ||= Ssh::Session.new(name,\n :host => '127.0.0.1',\n :port => ssh_port,\n :username => ENV.fetch(\"TRAVIS_CI_ENV_USERNAME\", 'travis'),\n :private_key_path => File.expand_path('keys/vagrant'),\n :buffer => Travis::Worker.config.shell.buffer,\n :timeouts => Travis::Worker.config.timeouts\n )\n end",
"def connect\n return true if connected?\n\n cmd = ssh_cmd quote_cmd(LOGIN_LOOP), :sudo => false\n\n @parent_pid, inn, out, err = popen4 cmd.join(\" \")\n inn.sync = true\n\n data = \"\"\n ready = nil\n start_time = Time.now.to_i\n\n until ready || out.eof?\n data << out.readpartial(1024)\n ready = data =~ /ready/\n\n raise TimeoutError if timed_out?(start_time, LOGIN_TIMEOUT)\n end\n\n unless connected?\n disconnect\n host_info = [@user, @host].compact.join(\"@\")\n raise ConnectionError, \"Can't connect to #{host_info}\"\n end\n\n inn.close rescue nil\n out.close rescue nil\n err.close rescue nil\n\n @parent_pid\n end",
"def connect(&block)\n options = { port: @port }\n\n if @password then\n options[:password] = @password\n else\n options[:keys] = @key\n end\n\n if block\n Net::SSH.start @host, @user, options do |ssh|\n @ssh = ssh\n yield ssh\n @ssh = nil\n end\n else\n @ssh = Net::SSH.start @host, @user, options\n end\n end",
"def connected?\n if @ssh\n return true\n else\n return false\n end\n end",
"def connect\n begin\n Net::SSH.start(@host,@login,password:@password) do |sf|\n @ssh = sf\n Logger.<<(__FILE__,\"INFO\",\"Connected at #{@login}@#{@host}\")\n yield\n end\n rescue => e\n Logger.<<(__FILE__,\"ERROR\",e.message)\n raise e\n end\t\n Logger.<<(__FILE__,\"INFO\",\"Disconnected from #{@login}@#{@host}\")\n @sftp = nil\t\n end",
"def connection\n @connection = create_connection! unless connected?\n @connection\n end",
"def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end",
"def socket(options = {})\n @socket ||= Net::SSH::Test::Socket.new\n end",
"def session(retry_options = {})\n if ssh_gateway\n @session ||= establish_connection_via_gateway({\n retries: connection_retries.to_i,\n delay: connection_retry_sleep.to_i,\n }.merge(retry_options))\n else\n @session ||= establish_connection({\n retries: connection_retries.to_i,\n delay: connection_retry_sleep.to_i,\n }.merge(retry_options))\n end\n end",
"def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend",
"def establish_connection_via_gateway(opts)\n retry_connection(opts) do\n gateway_options = options.merge(port: ssh_gateway_port)\n Net::SSH::Gateway.new(ssh_gateway,\n ssh_gateway_username, gateway_options).ssh(hostname, username, options)\n end\n end",
"def establish_connection(options={})\n\t\tconnection.ensure_tunnel(options)\n\tend",
"def connect(t = -1)\n # If we already have a connection and we aren't pipelining, close it.\n if (self.conn)\n if !pipelining?\n close\n else\n return self.conn\n end\n end\n\n timeout = (t.nil? or t == -1) ? 0 : t\n\n self.conn = Rex::Socket::Tcp.create(\n 'PeerHost' => self.hostname,\n 'PeerPort' => self.port.to_i,\n 'LocalHost' => self.local_host,\n 'LocalPort' => self.local_port,\n 'Context' => self.context,\n 'SSL' => self.ssl,\n 'SSLVersion' => self.ssl_version,\n 'Proxies' => self.proxies,\n 'Timeout' => timeout\n )\n end",
"def start_ssh(&session)\n config = self.class.ssh_config\n Net::SSH.start( config[:host],\n config[:user],\n config.fetch(:options, { }),\n &session )\n end",
"def connect_server(hostname)\n exec \"ssh #{hostname}\"\n exit 0\n end",
"def connect\n nodes.each do |k,v|\n rs_storage = RSpec.configuration.rs_storage[:nodes][k]\n raise RuntimeError, \"No internal storage for node #{k}\" if rs_storage.nil?\n\n ipaddress = rs_storage[:ipaddress]\n raise RuntimeError, \"No ipaddress provided from launch phase for node #{k}\" if ipaddress.nil?\n\n chan = ssh_connect(:host => k, :user => 'root', :net_ssh_options => {\n :keys => vmconf[:ssh_keys].split(\":\"),\n :host_name => ipaddress,\n })\n RSpec.configuration.rs_storage[:nodes][k][:ssh] = chan\n end\n\n nil\n end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_type; end",
"def connect_options(options)\n connect_options = {:ssh_options=>{}}\n if options[:port]\n connect_options[:ssh_options][:port] = options[:port]\n end\n if options[:ip]\n connect_options[:ssh_options][:host_name] = options[:ip]\n end\n return connect_options\n end",
"def tunnel_peer\n \n sock=self.ssh.transport.socket\n misc, host, port= sock.getpeername\n return \"#{host}:#{port}\"\n end",
"def conn\n\t\treturn @conn ||= self.connect\n\tend",
"def connect(&block)\n return_result = nil\n # the sftp.start method does not seem to return the last thing you execute\n start_sftp_session do |sftp_session|\n return_result = yield SessionWrapper.new(self, sftp_session)\n end\n return_result\n end",
"def start\n conf = RecursiveOpenStruct.new(Net::SSH::Config.load(SSH_CONFIG, @server.host))\n chost = @server.host.colorize((@server.color || 'default').to_sym)\n\n Net::SSH.start(conf.host, conf.user, keys: conf.identityfile) do |ssh|\n ssh.open_channel do |channel|\n channel.on_data do |ch, data|\n data.lines.each do |line|\n @queue.push(\"[#{chost}] #{line}\")\n end\n end\n\n channel.exec(\"tail -f #{@path}\")\n end\n end\n end",
"def connection_factory type\n config = Myreplicator.configs[self.source_schema]\n puts self.source_schema\n puts config\n case type\n when :ssh\n if config.has_key? \"ssh_password\"\n return Net::SSH.start(config[\"ssh_host\"], config[\"ssh_user\"], :password => config[\"ssh_password\"])\n\n elsif(config.has_key? \"ssh_private_key\")\n return Net::SSH.start(config[\"ssh_host\"], config[\"ssh_user\"], :keys => [config[\"ssh_private_key\"]])\n end\n when :sftp\n if config.has_key? \"ssh_password\"\n return Net::SFTP.start(config[\"ssh_host\"], config[\"ssh_user\"], :password => config[\"ssh_password\"])\n\n elsif(config.has_key? \"ssh_private_key\")\n return Net::SFTP.start(config[\"ssh_host\"], config[\"ssh_user\"], :keys => [config[\"ssh_private_key\"]])\n end \n end\n end",
"def scp_connect\n # Connect to SCP and yield the SCP object\n connect do |connection|\n scp = Net::SCP.new(connection)\n return yield scp\n end\n rescue Net::SCP::Error => e\n # If we get the exit code of 127, then this means SCP is unavailable.\n raise Vagrant::Errors::SCPUnavailable if e.message =~ /\\(127\\)/\n\n # Otherwise, just raise the error up\n raise\n end",
"def start_session\n ssh_opts = filter_ssh_options(options)\n @ssh = Net::SSH.start(options[:hostname], options[:username], ssh_opts)\n rescue Net::SSH::Disconnect\n retry_count = retry_count.to_i + 1\n sleep 30 and retry if retry_count < 5\n raise(SSHCannotConnect, Errstr::CANNOT_CONNECT % options[:hostname])\n end",
"def connection\n @connection ||= make_connection\n end",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n options = { :port => config.port, :keys => [config.private_key_path] }\n @shell = Net::SSH.start(config.host, config.username, options).shell\n end",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n Travis::Worker::Utils::HardTimeout.timeout(15) do\n @connector.connect\n end\n if @config.platform == :osx\n info \"unlocking keychain\" unless silent\n exec(\"security unlock-keychain -p #{config.keychain_password}\")\n end\n true\n rescue Timeout::Error\n warn \"Timed out attempting to open SSH connection\"\n raise\n end",
"def transport(options = {})\n @transport ||= Net::SSH::Transport::Session.new(\n options[:host] || \"localhost\",\n options.merge(kex: \"test\", host_key: \"ssh-rsa\", append_all_supported_algorithms: true, verify_host_key: :never, proxy: socket(options))\n )\n end",
"def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n end\n \n info \"Transport is #{ @session.transport.class }\"\n end",
"def get_ssh_info\n\n h = Hash.new()\n\n if @ssh_info.class.eql?(Hash)\n @logger.debug('using cached SSH info')\n h = @ssh_info\n else\n\n res = self.vagrant(sprintf('ssh-config %s', @name))\n\n res.split(\"\\n\").each do |line|\n if line.match(/HostName (.*?)$/)\n h[:hostname] = $1\n elsif line.match(/User (\\w*?)$/)\n h[:user] = $1\n elsif line.match(/Port (\\d*?)$/)\n h[:ssh_port] = $1\n elsif line.match(/IdentityFile (.*?)$/)\n h[:identity_file] = $1\n @logger.info(sprintf('vagrant specified key[%s] differs from provided[%s], will use both', @sshkey, h[:identity_file]))\n end\n end\n\n @ssh_info = h\n end\n\n h\n end",
"def ssh(host, user, options={}, &block)\n local_port = open(host, options[:port] || 22)\n\n begin\n Net::SSH.start(\"127.0.0.1\", user, options.merge(:port => local_port), &block)\n ensure\n close(local_port) if block || $!\n end\n end",
"def close\n ssh.close if @_ssh\n end",
"def initialize(host, user, password)\n @host = host\n @connection = Net::SSH.start(@host, user, :password => password)\n end",
"def ssh?\n @session.transport.class.to_s.include?('SSH')\n end",
"def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end",
"def connection\n CryptKeeper::Connection.http_instance\n end",
"def open_tcp_socket()\n\n ## $stderr.print(\"h: #{@host}, p: #{@port}\\n\")\n\n tcp_socket = nil\n slog(:on_connecting, log_params)\n Timeout::timeout(@connect_timeout, Stomp::Error::SocketOpenTimeout) do\n tcp_socket = TCPSocket.open(@host, @port)\n end\n tcp_socket\n end",
"def connection\n @connection.connect\n end",
"def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end",
"def connect (host, username,port=22)\n begin\n pw = get_password(host, username)\n\n tunnelhost = host\n if @connections.key?(host.to_sym)\n port = @connections[host.to_sym]\n tunnelhost = 'localhost'\n @@log.debug(\"Found local-port forward on port \"+port.to_s) \n end\n\n @connections[host.to_sym] = Net::SSH.start(tunnelhost, username, :password => pw, :port => port)\n rescue Net::SSH::AuthenticationFailed\n retry\n end\n end",
"def connect\r\n if @opts[:threadsafe]\r\n @conns = Knj::Threadhandler.new\r\n \r\n @conns.on_spawn_new do\r\n self.spawn\r\n end\r\n \r\n @conns.on_inactive do |data|\r\n data[:obj].close\r\n end\r\n \r\n @conns.on_activate do |data|\r\n data[:obj].reconnect\r\n end\r\n else\r\n @conn = self.spawn\r\n end\r\n end",
"def connect!(force_reconnect = false)\n if self.connected?\n @logger.debug(\"SSH connection to server name='#{@name}', host=#{self.hostname} already established\")\n if not force_reconnect\n return\n else\n @logger.debug(\"Forcing SSH reconnect for server name='#{@name}', host=#{self.hostname}\")\n end\n end\n\n @logger.info(\"Establishing SSH connection to server name='#{@name}', host='#{self.hostname}', user '#{self.username}'\")\n begin\n @ssh = Net::SSH.start(self.hostname, self.username, port: @config['ssh_port'] || 22, timeout: 2, non_interactive: true)\n rescue Net::SSH::AuthenticationFailed => msg\n raise Acme::Distributed::ServerError, \"Could not establish SSH connection to server name='#{@name}': #{msg}\"\n rescue StandardError => msg\n raise Acme::Distributed::ServerError, \"Could not establish SSH connection to server name='#{@name}': #{msg}\"\n end\n end",
"def local_connect(body)\n host = _pop_token(body)\n port = _pop_token(body).to_i\n if host.length < 1\n begin\n host, port = @var[:last_connection]\n rescue\n raise \"usage: /connect <hostname> [port]\"\n end\n end\n port = 9000 if port == 0\n begin\n connect(host, port)\n @var[:last_connection] = [ host, port ]\n _save_env\n rescue\n _notice \"Could not connect to #{host}:#{port} - #{$!}\", :error\n end\nend",
"def ssh(*args)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n options << ssh_uri\n options += args\n\n return system('ssh',*options)\n end",
"def connection\n retrieve_connection\n end"
] |
[
"0.7704465",
"0.753015",
"0.7499289",
"0.7486356",
"0.7360706",
"0.7253392",
"0.7141851",
"0.7062906",
"0.7006936",
"0.68804973",
"0.68083835",
"0.6803162",
"0.668882",
"0.6650494",
"0.66315615",
"0.66134554",
"0.65821123",
"0.6515367",
"0.6503821",
"0.64943033",
"0.64000446",
"0.63404226",
"0.6338874",
"0.6253709",
"0.6253499",
"0.6240924",
"0.624039",
"0.6231926",
"0.6210763",
"0.6186592",
"0.61760473",
"0.61753345",
"0.61741245",
"0.6168011",
"0.61498296",
"0.6106113",
"0.6075948",
"0.6071267",
"0.6065379",
"0.60555416",
"0.6052398",
"0.6015099",
"0.6010837",
"0.6000812",
"0.5998089",
"0.5990454",
"0.5982558",
"0.59694964",
"0.59694964",
"0.59694964",
"0.59528726",
"0.5951873",
"0.59426266",
"0.5924173",
"0.5913951",
"0.5905257",
"0.5903423",
"0.5880815",
"0.5827904",
"0.58193225",
"0.5811376",
"0.5777527",
"0.5774017",
"0.5763144",
"0.57392097",
"0.57285833",
"0.5715686",
"0.5701723",
"0.5701723",
"0.5701723",
"0.5701723",
"0.5693787",
"0.56922644",
"0.56869143",
"0.56829345",
"0.56732553",
"0.5672872",
"0.5658383",
"0.5651415",
"0.56394356",
"0.5639254",
"0.5637618",
"0.56345344",
"0.56293976",
"0.5605655",
"0.5602634",
"0.5594221",
"0.5593114",
"0.5559405",
"0.5537253",
"0.55278087",
"0.5527073",
"0.55263823",
"0.55243975",
"0.5513766",
"0.55069244",
"0.54979193",
"0.54942733",
"0.54881734",
"0.54531235"
] |
0.7589419
|
1
|
Execute command on SSH connection +connection+:: SSH connection +command+:: command to execute
|
def execute(connection, command)
stdout = ""
stderr = ""
connection.exec!(command) do |ch, stream, data|
stderr << data if stream == :stderr
stdout << data if stream == :stdout
end
[stdout, stderr]
rescue Net::SSH::Exception => ex
logger.error "There was an exception in method execute for SSHConnection. Details #{ex}:\n#{ex.backtrace}"
kill_connection(connection)
raise NoFreeConnectionError
rescue SystemCallError => ex
logger.error "There was an system error in method get_new for SSConnection. Details #{ex}:\n#{ex.backtrace}"
kill_connection(connection)
raise NoFreeConnectionError
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end",
"def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ssh[\"user\"]) do |ssh|\n\t\t\tresult = ssh.exec!(\"cmd /c #{command}\")\n\t\tend\n\t\tresult\n\tend",
"def exec(command, options={})\n ssh.exec(command, options)\n end",
"def ssh_command(com, username, pass)\n Net::SSH.start(SERVER, username, {:password => pass}) do |ssh|\n ssh.exec! com\n end\n end",
"def command_send(command)\n\t\t# Check target\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\n\t\t# Prepare command\n\t\tcommand = command.gsub('\"', '\\\\\"')\n\t\tcommand = command.gsub('$', '\\\\$')\n\n\t\t# Execute and return result\n\t\t_ssh = `ssh -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" -t #{@config[\"ssh\"][\"username\"]}@#{@ip} \"#{command}\" 2>/dev/null`\n\t\treturn _ssh.strip\n\tend",
"def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend",
"def shell_execute(connection, command, **opts)\n opts = {\n sudo: false,\n shell: nil\n }.merge(opts)\n\n sudo = opts[:sudo]\n shell = (opts[:shell] || machine_config_ssh.shell).to_s\n\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n marker_found = false\n data_buffer = ''\n stderr_marker_found = false\n stderr_data_buffer = ''\n\n tfile = Tempfile.new('vagrant-ssh')\n remote_ext = shell == \"powershell\" ? \"ps1\" : \"bat\"\n remote_name = \"#{machine_config_ssh.upload_directory}\\\\#{File.basename(tfile.path)}.#{remote_ext}\"\n\n if shell == \"powershell\"\n base_cmd = \"powershell -File #{remote_name}\"\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nRemove-Item #{remote_name}\nWrite-Host #{CMD_GARBAGE_MARKER}\n[Console]::Error.WriteLine(\"#{CMD_GARBAGE_MARKER}\")\n#{command}\nSCRIPT\n else\n base_cmd = remote_name\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nECHO OFF\nECHO #{CMD_GARBAGE_MARKER}\nECHO #{CMD_GARBAGE_MARKER} 1>&2\n#{command}\nSCRIPT\n end\n\n tfile.close\n upload(tfile.path, remote_name)\n tfile.delete\n\n base_cmd = shell_cmd(opts.merge(shell: base_cmd))\n @logger.debug(\"Base SSH exec command: #{base_cmd}\")\n\n ch.exec(base_cmd) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n\n if !marker_found\n data_buffer << data\n marker_index = data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(data_buffer)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n if !stderr_marker_found\n stderr_data_buffer << data\n marker_index = stderr_data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n stderr_data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(stderr_data_buffer.lstrip)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n\n # Close the channel, since after the exit status we're\n # probably done. This fixes up issues with hanging.\n ch.close\n end\n\n end\n end\n\n begin\n keep_alive = nil\n\n if @machine.config.ssh.keep_alive\n # Begin sending keep-alive packets while we wait for the script\n # to complete. This avoids connections closing on long-running\n # scripts.\n keep_alive = Thread.new do\n loop do\n sleep 5\n @logger.debug(\"Sending SSH keep-alive...\")\n connection.send_global_request(\"keep-alive@openssh.com\")\n end\n end\n end\n\n # Wait for the channel to complete\n begin\n channel.wait\n rescue Errno::ECONNRESET, IOError\n @logger.info(\n \"SSH connection unexpected closed. Assuming reboot or something.\")\n exit_status = 0\n pty = false\n rescue Net::SSH::ChannelOpenFailed\n raise Vagrant::Errors::SSHChannelOpenFail\n rescue Net::SSH::Disconnect\n raise Vagrant::Errors::SSHDisconnected\n end\n ensure\n # Kill the keep-alive thread\n keep_alive.kill if keep_alive\n end\n\n # Return the final exit status\n return exit_status\n end",
"def exec!(cmd)\n connect! unless @connected\n if using_ssh?\n logger.debug(\"ssh: \" + cmd)\n ssh_session.exec!(cmd)\n else\n logger.debug(cmd)\n `#{cmd}`\n end\n end",
"def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end",
"def simple_ssh_command(host, user, command, timeout = 300)\n over_ssh(host: host, user: user, timeout: timeout) do |server|\n server.cd '/tmp'\n # Need to use sudo\n server.enable_sudo\n # scary...\n server.disable_safe_mode\n\n server.execute command\n end\n end",
"def run_command(machine, command, logger = @log)\n logger.info(\"Running command '#{command}' on the '#{machine['network']}' machine\")\n within_ssh_session(machine) do |connection|\n ssh_exec(connection, command, logger)\n end\n end",
"def ssh_exec!(ssh, command)\n\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(command) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data+=data\n end\n\n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n\n {\n :out => stdout_data,\n :err => stderr_data,\n :exit_code => exit_code,\n :exit_signal => exit_signal\n }\n end",
"def exec_cmd cmd\n t = Time.now\n results = \"\"\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch,success|\n unless success\n Logger.<<(__FILE__,\"INFO\",\"Could Not execute command #{cmd}\")\n abort\n end\n # stdout\n channel.on_data do |ch,data|\n results += data\n end\n # stderr\n channel.on_extended_data do |ch,type,data|\n Logger.<<(__FILE__,\"ERROR\",\"Error from the cmd #{cmd} : #{data}\")\n abort\n end\n channel.on_close do |ch|\n end\n end\n end\n # wait for the command to finish\n @ssh.loop\n Logger.<<(__FILE__,\"DEBUG\",\"SFTP Command executed in #{Time.now - t} sec\") if @opts[:v]\n results.split\n end",
"def exec(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t @ssh_session.open_channel do |ch|\n\t @@logger.info(\"Executing command '#{command}'\")\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.debug(\"Command sucessfully executed\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n end\n ch.on_close do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n\n ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"\")\n exit_status = 127\n end\n end\n\t ch.wait\n\t end\n\t\n\t return exit_status\n\tend",
"def ssh_exec!(ssh, command)\n stdout_data = ''\n stderr_data = ''\n exit_code = nil\n exit_signal = nil\n ssh.open_channel do |channel|\n channel.exec(command) do |_ch, success|\n unless success\n abort 'FAILED: couldn\\'t execute command (ssh.channel.exec)'\n end\n channel.on_data do |_ch, data|\n stdout_data += data\n puts stdout_data\n end\n\n channel.on_extended_data do |_ch, _type, data|\n stderr_data += data\n puts stderr_data\n end\n\n channel.on_request('exit-status') do |_ch, data|\n exit_code = data.read_long\n end\n\n channel.on_request('exit-signal') do |_ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n [stdout_data, stderr_data, exit_code, exit_signal]\nend",
"def shell_execute(connection, command, sudo=false)\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Determine the shell to execute. If we are using `sudo` then we\n # need to wrap the shell in a `sudo` call.\n shell = @machine.config.ssh.shell\n shell = \"sudo -H #{shell}\" if sudo\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n ch.exec(shell) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n if block_given?\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stdout: #{data}\")\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n if block_given?\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n end\n\n # Set the terminal\n ch2.send_data \"export TERM=vt100\\n\"\n\n # Output the command\n ch2.send_data \"#{command}\\n\"\n\n # Remember to exit or this channel will hang open\n ch2.send_data \"exit\\n\"\n\n # Send eof to let server know we're done\n ch2.eof!\n end\n end\n\n # Wait for the channel to complete\n channel.wait\n\n # Return the final exit status\n return exit_status\n end",
"def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end",
"def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend",
"def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end",
"def run(cmd, host_ip)\n user = 'root'\n ip = host_ip\n port = 22\n\n @cmd = system \"ssh -p #{port} #{user}@#{ip} '#{cmd}'\" \n logger.info @cmd\n end",
"def exec(command, input = nil)\n result = command_results.build\n result.start! command, input\n exit_code = nil\n ssh_channel = @net_ssh.open_channel do |channel|\n channel.exec command do |_, success|\n if success\n channel.send_data input if input\n channel.eof!\n channel.on_data do |_, data|\n result.append_to_stdout! data\n end\n channel.on_extended_data do |_, type, data|\n result.append_to_stderr! data if type == :stderr\n end\n channel.on_request 'exit-status' do |_, data|\n exit_code = data.read_long\n end\n channel.on_request 'exit-signal' do |_, data|\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = data.read_long\n end\n else\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = 255\n channel.close\n end\n end\n end\n ssh_channel.wait\n result.completed! exit_code || 0\n end",
"def ssh_exec(command)\n stdout_data = ''\n stderr_data = ''\n exit_status = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.request_pty do |ch, success|\n raise 'Could not obtain pty' unless success\n\n ch.on_data do |ch, data|\n good_info data\n\n if data.match /sudo\\] password/\n unless ssh_options[:password]\n ssh_options[:password] = prompt(\"\\n<ROSH> Enter your password: \", false)\n end\n\n ch.send_data \"#{ssh_options[:password]}\\n\"\n ch.eof!\n end\n\n stdout_data << data\n end\n\n run_info(command)\n r = ch.exec(command)\n channel.close if r\n end\n\n channel.on_extended_data do |_, data|\n bad_info data.to_s\n stderr_data << data\n end\n\n channel.on_request('exit-status') do |_, data|\n exit_status = data.read_long\n end\n\n channel.on_request('exit-signal') do |_, data|\n exit_signal = data.read_long\n end\n end\n\n ssh.loop\n\n SSHResult.new(stdout_data, stderr_data, exit_status, exit_signal)\n end",
"def run_command_via_connection(command)\n command = command.shelljoin if command.is_a? Array\n command = ['sh', '-c', command]\n res = lxd.execute(command)\n CommandResult.new res.stdout, res.stderr, res.exitstatus\n end",
"def exec_ssh(command, args, setting)\n puts \"#{Time.now} call #{self.class}##{__method__}\"\n ssh_options = ssh_option_init(setting)\n\n user = setting[\"ssh\"][\"user\"]\n host = setting[\"ssh\"][\"host\"]\n remote_dir = setting[\"dir\"][\"remote\"]\n\n Net::SSH.start(host, user, ssh_options) do |session|\n case command\n when :scp\n puts \"#{Time.now} scp: from #{args} to #{user}@#{host}:#{remote_dir}\"\n return Net::SCP.new(session).upload!(args, remote_dir, {:verbose => 'useful'})\n when :ssh\n return session.exec!(\"bash -c '#{args}'\").chomp!\n end\n end\n rescue Net::SSH::AuthenticationFailed => ex\n puts \"1\"\n puts \"class:#{ex.class} #{ex.message}\"\n return ex.class\n rescue Errno::ECONNREFUSED => ex\n puts \"2\"\n puts \"class:#{ex.class} #{ex.message}\"\n rescue => ex\n puts \"3\"\n puts \"class:#{ex.class} #{ex.message}\"\n end",
"def execute(command)\n @session.blocking_call do\n @native_channel.exec(command)\n end\n end",
"def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end",
"def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end",
"def dispatch(command, return_output = false)\n Vanagon::Utilities.remote_ssh_command(\"#{@target_user}@#{@target}\", command, @target_port, return_command_output: return_output)\n end",
"def command(args = {}, escape = true)\n SSH.command compile(args), escape\n end",
"def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end",
"def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end",
"def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend",
"def ssh_exec!(ssh)\n output_data = ''\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(@command) do |ch, success|\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\" unless success\n\n channel.on_data do |_, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_extended_data do |_, type, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_request('exit-status') { |_, data| exit_code = data.read_long }\n\n channel.on_request('exit-signal') { |_, data| exit_signal = data.read_long }\n end\n end\n\n ssh.loop\n [output_data, exit_code, exit_signal]\n end",
"def run(command)\n retried = false\n\n begin\n result = ssh_exec(command)\n Rosh::Shell::CommandResult.new(nil, result.exit_status, result.stdout, result.stderr)\n rescue StandardError => ex\n log \"Error: #{ex.class}\"\n log \"Error: #{ex.message}\"\n log \"Error: #{ex.backtrace.join(\"\\n\")}\"\n\n if ex.class == Net::SSH::AuthenticationFailed\n if retried\n bad_info 'Authentication failed.'\n else\n retried = true\n password = prompt(\"\\n<ROSH> Enter your password: \", false)\n ssh_options.merge! password: password\n log \"Password added. options: #{ssh_options}\"\n @ssh = new_ssh\n retry\n end\n end\n\n if ex.class == Net::SSH::Disconnect\n if retried\n bad_info 'Tried to reconnect to the remote host, but failed.'\n else\n log 'Host disconnected us; retrying to connect...'\n retried = true\n @ssh = new_ssh\n run(command)\n retry\n end\n end\n\n Rosh::Shell::CommandResult.new(ex, 1)\n end\n end",
"def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end",
"def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end",
"def execute_command(command)\n end",
"def execute_command(command)\n end",
"def execute(command)\n invoke_command(command, nil)\n end",
"def do_ssh_cmd(cmd='uname -a')\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n \n begin\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data += data\n end\n \n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n \n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n end\n end\n @ssh.loop\n rescue Net::SSH::Exception => e\n abort \"Net:SSH Exception : #{e.message}\"\n rescue Exception => e\n abort \"Unknown Exception : #{e.message}\"\n end\n {:stdout => stdout_data, :stderr => stderr_data, :exit_code => exit_code}\n end",
"def execute(command, options = { })\n defaults = { :out_console => true }\n options = defaults.merge(options)\n # open a new channel and configure a minimal set of callbacks, then run\n # the event loop until the channel finishes (closes)\n last_exit = -1\n channel = session.open_channel do |ch|\n\n #request pty for sudo stuff and so\n ch.request_pty do |ch, success|\n raise \"Error requesting pty\" unless success\n end\n \n ch.exec \"#{command}\" do |ch, success|\n raise \"could not execute command\" unless success\n\n\n # \"on_data\" is called when the process writes something to stdout\n ch.on_data do |c, data|\n STDOUT.print data if options[:out_console]\n\n end\n\n # \"on_extended_data\" is called when the process writes something to stderr\n ch.on_extended_data do |c, type, data|\n STDOUT.print data if options[:out_console]\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n last_exit = data.read_long\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n last_exit = data.read_long\n end\n\n end\n end\n channel.wait\n last_exit\n end",
"def execute(command)\n @command = command\n self\n end",
"def ssh(commandString, dryRun)\n #N Without this we won't have a description to display (although the value is only used in the next statement)\n description = \"SSH #{user}@#{host}: executing #{commandString}\"\n #N Without this the command description won't be echoed\n puts description\n #N Without this check, the command will execute even when it's only meant to be a dry run\n if not dryRun\n #N Without this, the command won't execute, and we won't have the output of the command\n outputText = connection.exec!(commandString)\n #N Without this check, there might be a nil exception, because the result of exec! can be nil(?)\n if outputText != nil then\n #N Without this, the output text won't be broken into lines\n for line in outputText.split(\"\\n\") do\n #N Without this, the code iterating over the output of ssh won't receive the lines of output\n yield line\n end\n end\n end\n end",
"def run_command(user, host, cmd)\n ping(user, host) do\n my_text = IO.popen(\"ssh #{user}@#{host} 'bash'\", \"w+\")\n my_text.write(cmd)\n my_text.close_write\n my_rtn = my_text.readlines.join('\\n')\n Process.wait(my_text.pid)\n my_text.close\n return my_rtn\n end\n end",
"def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend",
"def remote_command command, options={}\n return unless running?\n returning({ :stdout => '', :stderr => '', :exit_status => nil }) do |output|\n remote_stdout, remote_stderr, exit_code = '', '', nil\n Net::SSH.start(public_ip, options[:user] || \"root\", {:paranoid => false}.merge(options)) do |connection|\n connection.open_channel do |channel|\n channel.on_data { |ch, data| output[:stdout] += data }\n channel.on_extended_data { |ch, type, data| output[:stderr] += data }\n channel.on_request(\"exit-status\") do |p, data|\n output[:exit_status] = data.read_long\n end\n channel.exec(command) do |ch, executing|\n raise \"Could not execute: #{command}\" unless executing\n end\n end\n end\n end\n end",
"def execute_command(command)\n @stdin.puts command\n end",
"def run_ssh_in_terminal(command)\n puts \"running #{command} in terminal\"\n Net::SSH.start(get_access_ip, 'ubuntu', keys: @aws_setup_information[@environment.to_sym][:keyPath]) do |ssh|\n signal = ssh.open_channel do |channel|\n channel.send_channel_request 'shell' do |_ch, success|\n if success\n puts 'user shell started successfully'\n else\n puts 'could not start user shell'\n end\n end\n channel.on_data do |_term, data|\n STDOUT.sync = true\n puts data\n end\n channel.request_pty do |channel, _data|\n channel.send_data(\"#{command}\\n\")\n channel.send_data(\"exit\\n\")\n end\n end\n signal.wait\n end\n end",
"def ssh!(hostspec, script)\n CommandRunner.instance.ssh! hostspec, script\n end",
"def remote_command(command, password = nil)\n Net::SSH.start(remote_ip, 'git', :password => password) do |ssh|\n output = ssh.exec!(\"cd #{remote_app_name}\")\n unless output =~ /No such file or directory/\n ssh.exec(\"cd #{remote_app_name} && #{command}\")\n else\n puts \"Your application has not yet been deployed to your Webby.\"\n puts \"To issue remote commands from the Webby, you must first push your application.\"\n end\n end\n end",
"def ssh(iCmd)\n check_expected_call('SSH', :Host => @SSHHost, :Login => @SSHLogin, :Cmd => iCmd) do\n ssh_RBPTest(iCmd)\n end\n end",
"def execute(command)\n end",
"def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"def execute_ssh(commands)\n commands = [commands] unless commands.is_a? Array\n result = \"\"\n Net::SSH.start settings.remote_server, settings.remote_user do |ssh|\n commands.each do |command|\n was_error = false\n logger.info \"ssh: #{command}\"\n ssh.exec! command do |channel, stream, data|\n case stream\n when :stdout\n logger.info data\n result += \"#{data}\\n\" unless data.empty?\n when :stderr\n logger.error data\n was_error = true\n end\n end\n throw \"Exception during ssh, look in log file\" if was_error\n end\n end\n result\n end",
"def ssh_execute(server, username, password, key, cmd)\n return lambda {\n exit_status = 0\n result = []\n\n params = {}\n params[:password] = password if password\n params[:keys] = [key] if key\n\n begin\n Net::SSH.start(server, username, params) do |ssh|\n puts \"Connecting to #{server}\"\n ch = ssh.open_channel do |channel|\n # now we request a \"pty\" (i.e. interactive) session so we can send data\n # back and forth if needed. it WILL NOT WORK without this, and it has to\n # be done before any call to exec.\n\n channel.request_pty do |ch_pty, success|\n raise \"Could not obtain pty (i.e. an interactive ssh session)\" if !success\n end\n\n channel.exec(cmd) do |ch_exec, success|\n puts \"Executing #{cmd} on #{server}\"\n # 'success' isn't related to bash exit codes or anything, but more\n # about ssh internals (i think... not bash related anyways).\n # not sure why it would fail at such a basic level, but it seems smart\n # to do something about it.\n abort \"could not execute command\" unless success\n\n # on_data is a hook that fires when the loop that this block is fired\n # in (see below) returns data. This is what we've been doing all this\n # for; now we can check to see if it's a password prompt, and\n # interactively return data if so (see request_pty above).\n channel.on_data do |ch_data, data|\n if data =~ /Password:/\n password = get_sudo_pw unless !password.nil? && password != \"\"\n channel.send_data \"#{password}\\n\"\n elsif data =~ /password/i or data =~ /passphrase/i or\n data =~ /pass phrase/i or data =~ /incorrect passphrase/i\n input = get_input_for_pw_prompt(data)\n channel.send_data \"#{input}\\n\"\n else\n result << data unless data.nil? or data.empty?\n end\n end\n\n channel.on_extended_data do |ch_onextdata, type, data|\n print \"SSH command returned on stderr: #{data}\"\n end\n\n channel.on_request \"exit-status\" do |ch_onreq, data|\n exit_status = data.read_long\n end\n end\n end\n ch.wait\n ssh.loop\n end\n if $debug\n puts \"==================================================\\nResult from #{server}:\"\n puts result.join\n puts \"==================================================\"\n end\n rescue Net::SSH::AuthenticationFailed\n exit_status = 1\n puts \"Bad username/password combination\"\n rescue Exception => e\n exit_status = 1\n puts e.inspect\n puts e.backtrace\n puts \"Can't connect to server\"\n end\n\n return exit_status\n }\n end",
"def execute_remote_command(server, cmd)\n ssh(server, cmd).status == 0\n end",
"def run_remote_command(command)\n # Finds the remote ip and stores it in \"remote_ip\"\n parse_remote_ip\n \n # Finds the remote ip and stores it in \"remote_app_name\"\n parse_remote_app_name\n \n begin\n remote_command(command)\n rescue Net::SSH::AuthenticationFailed\n HighLine.track_eof = false\n password = ask(\"Enter your password: \") { |q| q.echo = '' }\n remote_command(command, password)\n end\n end",
"def container_ssh_command\n # Get the container's SSH info\n info = @machine.ssh_info\n return nil if !info\n info[:port] ||= 22\n\n # Make sure our private keys are synced over to the host VM\n ssh_args = sync_private_keys(info).map do |path|\n \"-i #{path}\"\n end\n\n # Use ad-hoc SSH options for the hop on the docker proxy \n if info[:forward_agent]\n ssh_args << \"-o ForwardAgent=yes\"\n end\n ssh_args.concat([\"-o Compression=yes\",\n \"-o ConnectTimeout=5\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\"])\n\n # Build the SSH command\n \"ssh #{info[:username]}@#{info[:host]} -p#{info[:port]} #{ssh_args.join(\" \")}\"\n end",
"def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end",
"def ssh_action(command, id, host, action)\n command_exe = SSHCommand.run(command, host, log_method(id))\n\n if command_exe.code == 0\n result = :success\n else\n result = :failure\n end\n\n send_message(ACTION[action],RESULT[result],id)\n end",
"def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend",
"def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end",
"def ssh_cmd(cmd, attempts=3)\n attempts ||= 1\n conn = get_ssh_connection\n cmd = [cmd] unless cmd.is_a? Array\n result = nil\n cmd.each do |c|\n failures = 0\n begin\n result = conn.exec! c\n rescue\n failures += 1\n raise if failures >= attempts\n output \"Command \\\"#{c}\\\" failed, re-trying after delay\"\n sleep(failures)\n retry\n end\n end\n save_ssh_connection conn\n return result\n end",
"def run_command_via_connection(_command, &_data_handler)\n raise NotImplementedError, \"#{self.class} does not implement #run_command_via_connection()\"\n end",
"def exec!(command, timeout=nil)\n logger.info(\"Executing: #{command}\")\n stderr,stdout = '', ''\n stdout, stderr = timeout_execution(timeout, \"exec!(#{command})\") do\n @connection_pool.exec(command)\n end\n logger.info(\"STDERR: #{stderr}\") unless stderr.empty?\n logger.info(\"STDOUT: #{stdout}\") unless stdout.empty?\n logger.info(\"Executing done\")\n stdout\n end",
"def rcon_exec(command)\n raise RCONNoAuthError unless @rcon_authenticated\n\n @rcon_socket.send RCONExecRequest.new(@rcon_request_id, command)\n @rcon_socket.send RCONTerminator.new(@rcon_request_id)\n\n response = []\n begin\n response_packet = @rcon_socket.reply\n if response_packet.is_a? RCONAuthResponse\n @rcon_authenticated = false\n raise RCONNoAuthError\n end\n response << response_packet.response\n end while response.size < 3 || response_packet.response.size > 0\n\n response.join('').strip\n end",
"def ssh_command(ssh_info)\n command_options = %W[\n -o Compression=yes\n -o DSAAuthentication=yes\n -o LogLevel=#{ssh_info[:log_level] || 'FATAL'}\n -o StrictHostKeyChecking=no\n -o UserKnownHostsFile=/dev/null\n ]\n\n if ssh_info[:forward_x11]\n command_options += %w[\n -o ForwardX11=yes\n -o ForwardX11Trusted=yes\n ]\n end\n\n if ssh_info[:forward_agent]\n command_options += %w[-o ForwardAgent=yes]\n end\n\n ssh_info[:private_key_path].each do |path|\n command_options += ['-i', path]\n end\n\n if ssh_info[:port]\n command_options += ['-p', ssh_info[:port]]\n end\n\n \"ssh #{command_options.join(' ')}\"\n end",
"def execute(command, live_stream = false)\n machine = @chef_provisioning.connect_to_machine(name, @current_chef_server)\n machine.execute_always(command, stream: live_stream)\n end",
"def execute\n parse_command\n run_command(command)\n end",
"def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end",
"def execute(connection)\n \n # Register the command as a connection listener, so we can receive response messages\n # from the server.\n connection.add_connection_listener(self)\n \n # Send the message.\n connection << self\n \n # Create a conditinal monitor variable.\n self.synchronize do\n @response_received ||= self.new_cond\n end\n \n return self\n \n end",
"def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end",
"def execute(command)\n sh('-c',command)\n end",
"def execute_command(command)\n system(command)\n end",
"def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end",
"def exec(cmd)\n\t\tbegin\n\t\t\tout = cmd_exec(cmd).chomp\n\t\trescue ::Timeout::Error => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\trescue EOFError => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\tend\n\tend",
"def remote_command(command)\n socket = TCPSocket.new(@host, @port)\n socket.puts command\n\n data = \"\"\n until (line = socket.readline) =~ /END/\n data << line\n end\n\n socket.close\n data\n end",
"def execute(task_family, ip, command)\n cmd = \"docker exec -i -t `#{docker_ps_task(task_family)}` #{command}\"\n Open3.popen2e(ssh_cmd(ip) + \" '#{cmd}' \") do |stdin, stdout, stderr, status_thread|\n stdout.each_line do |line|\n puts line\n end\n end\n end",
"def chef_exec(cmd)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/#{cmd}\", sudo: true\n end",
"def execute(command)\n system(command)\n end",
"def ssh_cmd!(cmd)\n ssh_cmd cmd, false\n end",
"def construct_cmd\n cmd = \"ssh -i #{@key} \" \\\n \"-o StrictHostKeyChecking=no -o BatchMode=yes \" \\\n \"-o ConnectTimeout=#{@timeout} \" \\\n \"#{@user}@#{@host} \\\"#{@cmd}\\\"\"\n @logger.debug(cmd)\n cmd\n end",
"def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end",
"def execute(cmd)\n send(*cmd)\n end",
"def ssh_ruby(host, username, command, compression=false, request_pty=false, &block)\n debug \"Opening Net::SSH connection to #{host}, #{username}, #{command}\"\n exit_status = 0\n options = {:compression => compression}\n options[:verbose] = :debug if debug?\n Net::SSH.start(host, username, options) do |session|\n #:nocov:\n channel = session.open_channel do |channel|\n if request_pty\n channel.request_pty do |ch, success|\n say \"pty could not be obtained\" unless success\n end\n end\n channel.exec(command) do |ch, success|\n channel.on_data do |ch, data|\n print data\n end\n channel.on_extended_data do |ch, type, data|\n print data\n end\n channel.on_close do |ch|\n debug \"Terminating ... \"\n end\n channel.on_request(\"exit-status\") do |ch, data|\n exit_status = data.read_long\n end\n yield channel if block_given?\n channel.eof!\n end\n end\n session.loop\n #:nocov:\n end\n raise RHC::SSHCommandFailed.new(exit_status) if exit_status != 0\n rescue Errno::ECONNREFUSED => e\n debug_error e\n raise RHC::SSHConnectionRefused.new(host, username)\n rescue Net::SSH::AuthenticationFailed => e\n debug_error e\n raise RHC::SSHAuthenticationFailed.new(host, username)\n rescue SocketError => e\n debug_error e\n raise RHC::ConnectionFailed, \"The connection to #{host} failed: #{e.message}\"\n end",
"def execute_command(command)\n %x{#{command}}\n end",
"def ssh(path_of_servers, command)\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n Open3.capture3(ssh_str(_path_of_servers, command))\n end",
"def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && !@password.empty?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end",
"def expect_ssh(host, user, password, commands, verbose=false, opts={})\n @verbose = verbose\n\n def log(message)\n STDERR.puts message if @verbose\n end\n\n output = \"\"\n opts[:password] = password if opts[:password].nil?\n Net::SSH.start(host, user, opts) do |ssh|\n log \"started session\"\n channel = ssh.open_channel do |channel, success|\n log \"opened channel\"\n channel.send_channel_request \"shell\" do |ch, success|\n raise \"couldn't start shell\" unless success\n ch.on_data do |ch, data|\n log \"received data: #{data}\"\n output << data\n end\n commands.each do |command|\n log \"sending command: #{command}\"\n ch.send_data \"#{command}\\n\"\n end\n yield channel if block_given?\n end\n end\n ssh.loop\n end\n return output\nend",
"def ssh(*ssh_args)\n args = ['ssh',\n '-o', 'BatchMode=yes',\n '-o', 'ConnectionAttempts=5',\n '-o', 'ConnectTimeout=30',\n '-o', 'ServerAliveInterval=60',\n '-o', 'TCPKeepAlive=yes',\n '-x', '-a',\n '-i', @ssh_key,\n '-l', @destination_user,\n @destination_host\n ] +\n ssh_args.map { |a| a ? a : '' }\n\n puts args.join(\" \" ) if @verbose\n system(*args)\nend",
"def command command_string\n connection.command self.id, nil, command_string\n end",
"def ssh_send_url_ruby(host, username, command, content_url)\n content_url = URI.parse(URI.encode(content_url.to_s))\n ssh_ruby(host, username, command) do |channel|\n HTTPClient.new.get_content(content_url) do |chunk|\n channel.send_data chunk\n end\n end\n end",
"def ssh_channel_exec_instr(ssh, instr, on_data)\n instr_success = false\n channel = ssh.open_channel do |chnl|\n chnl.exec(instr) do |ch, success|\n instr_success = success\n ch.on_data { |_c, data| on_data.call(data) }\n ch.on_extended_data { |_c, _t, data| on_data.call(data) }\n end\n end\n channel.wait\n instr_success\n end",
"def run_ssh_command(ssh_command, loops = 5, command_delay = 5)\n result = ''\n done = true\n (0...loops).each do\n begin\n Net::SSH.start(get_access_ip, 'ubuntu', keys: @aws_setup_information[@environment.to_sym][:keyPath]) do |ssh|\n result = ssh.exec!(ssh_command).to_s\n end\n rescue StandardError\n done = false\n sleep command_delay\n end\n break if done\n end\n result\n end",
"def do_command\n _, cmd, _, atype, addr_length = @data.unpack(\"C5\")\n header_length = 0\n\n case atype\n when 1, 4 # 1: ipv4, 4 bytes / 4: ipv6, 16 bytes\n ip_length = 4 * atype\n host = IPAddr.ntop @data[4, ip_length]\n port = @data[4 + ip_length, 2].unpack('S>').first\n header_length = ip_length + 6\n when 3 # domain name\n host = @data[5, addr_length]\n port = @data[5 + addr_length, 2].unpack('S>').first\n header_length = addr_length + 7\n else\n panic :address_type_not_supported\n end\n\n case cmd\n when 1\n send_data reply_data(:success)\n @connection = EventMachine.connect(Config.remote_server_host, Config.remote_server_port, Connection)\n @connection.server = self\n @connection.send_encoded_data(\"#{host}:#{port}\")\n @connection.send_encoded_data(@data[header_length, -1])\n clear_data\n Fiber.yield\n when 2, 3 # bind, udp\n panic :command_not_supported\n else\n panic :command_not_supported\n end\n end",
"def send_command(command)\n @client.write \"#{command}\\r\\n\"\n end",
"def run_command_via_connection(cmd)\n # Run the command.\n run_result = Mixlib::ShellOut.new(cmd)\n run_result.run_command\n\n # Wrap the results in a structure that Train expects...\n OpenStruct.new(\n # And meddle with the stdout along the way.\n stdout: Rot13.rotate(run_result.stdout),\n stderr: run_result.stderr,\n exit_status: run_result.exitstatus\n )\n end",
"def enter_command(cmd)\n @socket.print(\"#{cmd}\\n\")\n end",
"def exec(*args)\n command = args.shift\n\n arguments = Array.new\n arguments << %(sudo) if (@use_sudo == true)\n arguments << command\n arguments << args\n arguments = arguments.flatten.compact.join(' ')\n\n output = Array.new\n\n if @ssh.is_a?(ZTK::SSH)\n output << @ssh.exec(arguments, :silence => true, :ignore_exit_status => true).output\n else\n if @ssh.respond_to?(:exec!)\n output << @ssh.exec!(arguments)\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n\n output.join.strip\n end",
"def send_text(command)\n @session.connection.puts(command)\n end"
] |
[
"0.81134766",
"0.7724965",
"0.7619228",
"0.73882395",
"0.73754287",
"0.7322456",
"0.73076254",
"0.72847396",
"0.71318823",
"0.7131707",
"0.7095224",
"0.7080898",
"0.7080515",
"0.7065923",
"0.7028007",
"0.70088345",
"0.6996272",
"0.69564044",
"0.688075",
"0.68699884",
"0.6865162",
"0.68640643",
"0.6860071",
"0.6858843",
"0.685606",
"0.68053913",
"0.6782879",
"0.67281127",
"0.67124414",
"0.6697888",
"0.6697888",
"0.6683487",
"0.66519725",
"0.662247",
"0.66224694",
"0.65996855",
"0.6598858",
"0.6598858",
"0.65863085",
"0.65837616",
"0.6564621",
"0.65546703",
"0.65162474",
"0.65062225",
"0.649883",
"0.64809775",
"0.64724094",
"0.6464047",
"0.646193",
"0.64521414",
"0.6442423",
"0.6427439",
"0.6417703",
"0.640824",
"0.6403273",
"0.6402033",
"0.6396981",
"0.63559663",
"0.63448817",
"0.6335062",
"0.6334631",
"0.6304075",
"0.630134",
"0.62930393",
"0.6289586",
"0.6284907",
"0.6275142",
"0.6270836",
"0.6269727",
"0.62530684",
"0.6246332",
"0.6238628",
"0.6230237",
"0.6226284",
"0.62201506",
"0.6218592",
"0.6198229",
"0.6196087",
"0.61760855",
"0.61712104",
"0.61690706",
"0.6154332",
"0.6146523",
"0.614314",
"0.6126732",
"0.6120423",
"0.6109089",
"0.610841",
"0.61006695",
"0.6095164",
"0.60696715",
"0.6055913",
"0.6047576",
"0.6042366",
"0.6040809",
"0.6034843",
"0.6033915",
"0.6019898",
"0.60065395",
"0.6000333"
] |
0.7539133
|
3
|
Kill SSH connection +connection+:: SSH connection
|
def kill_connection(connection)
connection.shutdown!
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end",
"def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end",
"def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end",
"def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end",
"def abort()\n if @ssh_session && !@ssh_session.closed? then\n #try to close connection gracefully\n @ssh_session.close\n # and if it won't, send out the hunter to bring in Snowwhite's heart after some time\n Thread.new do\n sleep 5\n @ssh_session.shutdown! unless @ssh_session.nil? || @ssh_session.closed?\n end\n end\n end",
"def close\n @net_ssh.close\n @net_ssh = nil\n end",
"def close()\n #N Without this check, we'll be trying to close the connection even if there isn't one, or it was already closed\n if @connection != nil\n #N Without this we won't get feedback about the SSH connection being closed\n puts \"Closing SSH connection to #{user}@#{host} ...\"\n #N Without this the connection won't actually get closed\n @connection.close()\n #N Without this we won't know the connection has been closed, because a nil @connection represents \"no open connection\"\n @connection = nil\n end\n end",
"def close\n log 'closing connection'\n @ssh.close\n end",
"def kill( conn_id )\n\t\tself.request( :kill, :id => conn_id )\n\tend",
"def stop\n @ssh.close if @ssh\n super.stop\n end",
"def logout!\n @ssh.close\n @ssh = nil\n end",
"def close\n ssh.close if @_ssh\n end",
"def kill(pid)\n check_connection\n @protocol.kill_command pid\n self\n end",
"def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end",
"def kill_connection(output_number)\n @connections[output_number] = nil\n end",
"def close\n @channel.close if @channel\n @channel = nil\n @ssh.close if @close_all and @ssh\n end",
"def kill_process(pid)\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n ssh.exec! \"kill #{pid}\"\n end\n end",
"def close\n Timeout.timeout(3) { @connector.close }\n true\n rescue\n warn \"ssh connection could not be closed gracefully\"\n Metriks.meter('worker.vm.ssh.could_not_close').mark\n false\n ensure\n buffer.stop\n @buffer = nil\n end",
"def close_ssh_session(session)\n session.close\n session = nil\n true\n end",
"def stop\n @pid ? Process.kill('TERM', @pid) : close_connection\n end",
"def disconnect; @connection.close end",
"def sftp_close_connection(connection)\n connection.close!(connection)\nend",
"def sftp_close_connection(connection)\n connection.close!(connection)\nend",
"def disconnect\n info 'closing connection to host'\n @connected = false\n end",
"def kill\n server.kill\n end",
"def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end",
"def kill\n return nil if @dead\n \n @int_lock_req.synchronize do\n @int_sock_req.send_array [\"KILL\"]\n @int_sock_req.recv_array\n end\n \n @int_sock_req.close\n @int_sock_push.close\n \n true\n end",
"def kill(options)\n \n msg = \"kill\"\n cn = nil\n host = nil\n port = nil\n \n # Searching Options\n cn = options[\"CommonName\"] if options.has_key?(\"CommonName\")\n host = options[\"Host\"] if options.has_key?(\"Host\")\n port = options[\"Port\"] if options.has_key?(\"Port\")\n \n if !cn.nil?\n msg.concat(\" #{cn}\")\n @sock.cmd(\"String\" => msg , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/) do |c|\n print c\n end\n else\n if !host.nil? && !port.nil? \n msg.concat(\" #{host}:#{port}\")\n @sock.cmd(\"String\" => msg , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n else \n puts \"Net::OpenVPN Kill Error (Common Name or Host:Port Combination needed)\"\n end\n end\n end",
"def stop!\n @connections.each do |connection|\n puts \" -> stopping '#{connection.connection_id}'\"\n connection.disconnect\n end\n\n SweetieBot.log 'Stopped.'\n end",
"def deregister_tunnel_connection(connection)\n @tunnel_connections.delete connection.connection_id\n control_connection = connection.control_connection\n @tunnel_connections_by_control[control_connection].delete connection\n end",
"def kill(nickname, comment = \"Connection killed\")\n send_data(\"KILL #{nickname} :#{comment}\".strip)\n end",
"def cleanup\n\t\tcleanup_ssh\n\n\tend",
"def kill() end",
"def terminate_connection\n @intentionally_closed = true\n close_connection\n end",
"def disconnect!() @connections.each_value(&:disconnect) end",
"def destroy_connection\r\n\tbegin\r\n\t\t@sock.close if @sock\r\n\tensure\r\n\t\t@connected=false\r\n\tend\r\n end",
"def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end",
"def kill\n shutdown\n end",
"def kill\n send(:kill)\n end",
"def close_remote(port, host = \"127.0.0.1\") \r\n ensure_open! \r\n\r\n @session_mutex.synchronize do \r\n @session.forward.cancel_remote(port, host) \r\n end \r\n end",
"def disconnect\r\n @connection.close_connection\r\n @connection = nil\r\n end",
"def cleanup!(h)\n Sudo::System.kill h[:pid]\n Sudo::System.unlink h[:socket]\n end",
"def close()\n @connection.disconnect\n @connection = nil\n end",
"def disconnect\n @connection.close if connected?\n @connection = nil\n end",
"def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end",
"def destroy\n connection.close\n end",
"def disconnect\n @conn.close\nend",
"def disconnect\n @thread.kill\n @socket.close\n end",
"def disconnect_connection(c)\n c.close\n end",
"def disconnect!\n @connection.logoff rescue nil\n end",
"def disconnect()\n @connection.stop()\n @timer.stop()\n @broadcast.stop()\n end",
"def close_remote_srv_conn\n if @socket_srv\n @socket_srv.close\n @log.debug \"close_remote_srv_conn requested\"\n @cup_gui.log_sometext \"Bye, connessione col server terminata\\n\"\n @rd_sock_thread.join\n @socket_srv = nil\n end\n rescue => detail\n @log.error \"Server connection error (#{$!})\\n\"\n @log.error detail.backtrace.join(\"\\n\")\n ensure\n @socket_srv = nil \n end",
"def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end",
"def kill!() end",
"def quit!\n command \"quit\" if alive?\n ensure\n @alive = false\n @socket = nil\n File.delete(@socket_path) if File.exist?(@socket_path)\n end",
"def stop\n log \"closing connection\"\n @running = false\n client.stop!\n log \"closed\"\n end",
"def shutdown_connection\n teardown_timers\n @conn.shutdown if @conn.respond_to? :shutdown\n @conn.terminate if @conn.respond_to? :terminate\n @conn = nil\n end",
"def disconnect!; end",
"def remove_and_close(connection)\n @connections.delete(connection)\n close_connection(connection)\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n Log.debug(\"Disconnecting from Stomp\")\n @connection.disconnect\n end",
"def kill\n sig :KILL\n end",
"def disconnect\n if threaded[:connection]\n threaded[:connection].disconnect\n threaded[:connection] = nil\n end\n end",
"def close_remote(port, host = \"127.0.0.1\")\n ensure_open!\n\n @session_mutex.synchronize do\n @session.forward.cancel_remote(port, host)\n end\n end",
"def disconnect\n @connection.logout\n end",
"def destroy\n @sock.cmd(\"String\"=>\"quit\")\n @sock.close\n end",
"def disconnect\n _logout\n @connection.close\n end",
"def stop_gracefully\n @connections_to_stop = 0\n\n Signal.trap \"SIGTERM\", stop\n Signal.trap \"SIGINT\", stop\n Signal.trap \"SIGQUIT\", stop\n end",
"def unbind\n puts \"Connection terminated #{@my_connection_index}) #{@my_address} - #{@signature}\"\n\n pp self.inspect if error?\n\n # TODO: Remove connection from $connection_list\n end",
"def disconnect!\n context.with_connection do |connection|\n connection.disconnect!\n end\n @monitor.stop! and true\n end",
"def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend",
"def disconnect\n @hazel.shutdown\n end",
"def handle_disconnect *args\n args.each do |c|\n host, port = *c.split(\":\")\n conn = @node.connections.select{|c| c.host == host && c.port == port.to_i}.first\n conn.close_connection if conn\n end\n {:state => \"Disconnected\"}\n end",
"def local_quit(body)\n ### send notice of disconnection?\n Kernel.exit\nend",
"def disconnect\n raise \"Not connected. did you forget to call connect?\" unless @_socket\n @_socket.close\n @_socket = nil\n print \"Disconnected\\n\" if @_verbose\n EtherShell::ShellDsl.nothing\n end",
"def kill\n @accepting = false\n @iost.close rescue nil # force termination now\n @iost = nil\n end",
"def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConnections()\n end",
"def term(conn)\r\n if conn\r\n begin\r\n conn.quit\r\n ensure\r\n conn.close\r\n\t \r\n end\r\n end\r\n exit\r\nend",
"def disconnect!\n @connection.close rescue nil\n end",
"def server_stop\n Process.kill 'INT', 0\n end",
"def kill\n @executor.shutdownNow\n nil\n end",
"def disconnect; end",
"def disconnect; end",
"def shutdown\n connection.write(\"shutdown\")\n end",
"def quit(msg = false)\n thread[:socket].close\n thread[:socket] = nil\n debug \"[DEBUG] User #{thread[:user]} disconnected.\"\n \"221 Laterz\"\n end",
"def close\n conn.write(\"(api-quit)\") if connected?\n rescue Errno::ECONNRESET\n ensure\n self.conn = nil\n end",
"def kill\n Souffle::Log.info \"#{@node.log_prefix} Killing node...\"\n provider.kill([@node])\n end",
"def stop!\n return unless started?\n return if @process.nil?\n\n SSHTunnel.logger.info \"Stopping tunnel : #{self}\"\n\n @process.terminate\n @process.wait\n @started = false\n @process = nil\n end",
"def disconnect\n self.remote.close\n end",
"def disconnect!(timeout: 120)\n start_time = ::Gitlab::Metrics::System.monotonic_time\n\n while (::Gitlab::Metrics::System.monotonic_time - start_time) <= timeout\n break if pool.connections.none?(&:in_use?)\n\n sleep(2)\n end\n\n pool.disconnect!\n end",
"def kill\n signal(\"KILL\", scope: :all)\n cleanup\n end",
"def destroy\n requires :vpn_connection_id\n\n service.delete_vpn_connection(vpn_connection_id)\n true\n end",
"def disconnect(host)\n shutdown\n end",
"def local_disconnect(body)\n @connection.disconnect\n _network_init\n _notice \"disconnected\", :global\nend",
"def terminate()\n connection.nodes.terminate(uuid).tap{ self.forget }\n end",
"def shell_close()\n self.kill\n end",
"def cleanup\n\t\tputs \"Reconectando...\"\n\t\t@reconect = true\n\t\tcheck_ip_integrity\n\t\t@server.close\n\t\t@response.kill\n\t\t@request.kill\n\tend"
] |
[
"0.78902334",
"0.74020976",
"0.7323594",
"0.7260872",
"0.6967944",
"0.68434197",
"0.68269557",
"0.67401654",
"0.6717816",
"0.66854787",
"0.65052295",
"0.6493948",
"0.6479168",
"0.64440835",
"0.64433104",
"0.64343905",
"0.6426265",
"0.6341712",
"0.63246053",
"0.6255591",
"0.6255117",
"0.6241632",
"0.6241632",
"0.6157763",
"0.6129697",
"0.60979825",
"0.6062191",
"0.6061821",
"0.60610265",
"0.60602635",
"0.60594165",
"0.6048498",
"0.60266125",
"0.60235393",
"0.6020751",
"0.6008614",
"0.5995399",
"0.5994199",
"0.59674966",
"0.5953665",
"0.5943817",
"0.59163606",
"0.5909849",
"0.5904965",
"0.58984613",
"0.5895763",
"0.58955264",
"0.5883185",
"0.5867367",
"0.5865247",
"0.5858698",
"0.58433205",
"0.58426267",
"0.5838488",
"0.5829539",
"0.58268285",
"0.58238715",
"0.5819767",
"0.58126307",
"0.58014613",
"0.58014613",
"0.58014613",
"0.58014613",
"0.5795548",
"0.5781454",
"0.5761578",
"0.57538736",
"0.5745721",
"0.57435876",
"0.5732917",
"0.5729671",
"0.57213086",
"0.5721014",
"0.57158154",
"0.57005435",
"0.5697005",
"0.5685418",
"0.5680767",
"0.5678719",
"0.567787",
"0.5667392",
"0.56668293",
"0.5664186",
"0.56524533",
"0.5623798",
"0.5623798",
"0.5620556",
"0.56135356",
"0.5601133",
"0.55986947",
"0.5595816",
"0.5594749",
"0.5594265",
"0.55886436",
"0.5585661",
"0.5585567",
"0.55847156",
"0.5583224",
"0.5577149",
"0.55706155"
] |
0.74455947
|
1
|
Build a Response after a completed request.
|
def initialize(client, res)
@client = client
@status = res.status
@headers = res.headers
@env = res.env
@body = res.body
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_response(connection, request); end",
"def finish_request\n if (400..499).include? response.code\n set_error_body(response.code)\n end\n end",
"def build_response\n { status: :success, data: {} }\n end",
"def finish_request\n unless @error\n response.headers['Location'] = \"/orders?id=#{@order.id}\"\n response.body = @order.to_json\n end\n end",
"def finish_response; end",
"def build_response\n enrich_object(fawry_api_response)\n end",
"def finish(response, bypass_memoization = nil)\n if bypass_memoization\n @response = response\n else\n self.response = response\n end\n self.response.request = self\n execute_callbacks\n response\n end",
"def finish\n @app.log_request\n if json?\n log.h_debug(\"Serializing response into JSON\")\n @body = [ActiveSupport::JSON.encode(@body)]\n end\n super\n end",
"def response\n request.respond(:ok, DEFAULT_HEADERS.dup, build_response.to_json)\n rescue TypeError, KeyError, JSON::ParserError\n request.respond(400, DEFAULT_HEADERS.dup,\n \"Cannot process request. Check your arguments.\")\n rescue => e\n request.respond(500, DEFAULT_HEADERS.dup, e.message)\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def execute!\n validate_request!\n\n build_response!\n end",
"def create_response(request)\n response = Response.new\n end",
"def build_response(connection, request)\n app.call(build_env(connection, request))\n end",
"def out\n return @response.finish\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def finalize\n res = RResponse.new\n begin\n order = Order.finalize(params[:id])\n Invoice.create(\n :order => order,\n :created_by => self.current_user.account\n ) \n res.msg = 'Order ' + order.bill_number.to_s + ' ' + order.order_status.name\n res.success = true\n rescue Order::FinalizeError => e\n raise e \n end\n respond(res)\n \n \n end",
"def response\n process\n @response.to_a\n end",
"def finish_response\n @channel.push(@response)\n @response = nil\n command\n end",
"def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end",
"def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end",
"def response\n @response ||= request!(true)\n end",
"def finalize_response(resp)\n resp.tap do |r|\n r.response[:limit] = r.response.items.size - 1\n r.response[:moreItems] = false\n end\n end",
"def build_response(response)\n \"HTTP/1.1 #{response[:status_code]} #{response[:status_message]}\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{response[:bytesize]}\\r\\n\" +\n \"Connection: close\\r\\n\"\n end",
"def finish\n @length = @body.length if @body.is_a?(DelayedBody) && !@headers[RodaResponseHeaders::CONTENT_LENGTH]\n super\n end",
"def response\n @response ||= events_builder.response\n rescue => e\n Rails.logger.error(e)\n nil\n end",
"def on_success(_request, response)\n response\n end",
"def response\n parse_request\n do_something\n put_response\n end",
"def to_response\n return [@status, @headers, @body]\n end",
"def complete!\n load_attributes_from_response(post(:complete))\n end",
"def request\n self.response = prepare_response(http_communication.content)\n end",
"def build\n if @resp[:expectUserResponse]\n raise NotImpementedError, 'Conversations are not implemented now'\n end\n\n @resp[:finalResponse] = { richResponse: @rich_response }\n end",
"def response\n @response ||= connection.post(query)\n end",
"def response\n @_response\n end",
"def response\n connection.send(request_method) do |req|\n req.url path\n req.headers['LicenseID'] = client.license_id\n req.headers['Host'] = client.host\n req.headers['Connection'] = 'Keep-Alive'\n req.headers['Expect'] = '100-continue'\n req.headers['Content-Type'] = 'text/xml'\n req.body = body\n end\n end",
"def completed(request, op)\n request.complete!\n end",
"def build_response(session_end = true)\n response_object = build_response_object(session_end)\n response = Hash.new\n response[:version] = @version\n response[:sessionAttributes] = @session_attributes unless @session_attributes.empty?\n response[:response] = response_object\n response.to_json\n end",
"def on_complete(env)\n assert_response_ok(env[:status], env[:body])\n env[:body] = case env[:status]\n when 204\n {\n :data => {},\n :errors => [],\n :metadata => {},\n }\n else\n parse(env[:body])\n end\n end",
"def response\n # Dump it to JSON\n MultiJson.dump({\n status: @app_response.status,\n headers: @app_response.headers,\n body: @app_response.body\n })\n end",
"def on_complete(env)\n status = env[:status]\n\n logger.tagged(*tags) do\n log_response_status(status) { formatter.response(env) }\n logger.debug { formatter.response_body(env) }\n end\n end",
"def response\n @response ||= begin\n if self.class.http_method == :post\n self.class.post path, :body => post_data\n else\n self.class.send self.class.http_method, path\n end\n end\n end",
"def build_response(resource_name)\n response = yield\n resource = response_successful?(response) ? resource_name : \"error\"\n\n response_object = Montage::Response.new(response.status, response.body, resource)\n\n set_token(response_object.token.value) if resource_name == \"token\" && response.success?\n\n response_object\n end",
"def response\n return launch_response if @echo_request.launch_request?\n return end_session_response if @echo_request.session_ended_request?\n\n ResponseFactory.new(@echo_request, @echo_response).response\n # SessionFactory.new(@echo_request, @echo_response).response\n end",
"def create_Found_Response(request_path)\n\tbody = File.read(request_path)\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(body)\n\tgeneric_Generate_Response(initial,headers,body)\nend",
"def build_response(sender, options={}, force=false)\n self.responses.build(response_options(sender, options)) if force || allows_response?(sender)\n end",
"def on_complete(env)\n env[:body] = case env[:status]\n when 204\n parse('{}')\n else\n parse(env[:body], env[:response_headers])\n end\n end",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def response; return @response end",
"def callback\n return response if called\n self.response = k.inject(\n env.merge(RESPONSE_BODY => body ,\n RESPONSE_STATUS => status,\n RESPONSE_HEADERS => headers,\n RESPONSE_SOCKET => socket,\n FAIL => ((env[FAIL]||[]) + [error]).compact,\n LOG => env[LOG] ||[])){ |r, i| i.call(r) }\n ensure\n self.called = true\n end",
"def finish_request!\n\t\t\t\tcancel_timeout\n\t\t\t\t\n\t\t\t\t# Cancel an existing request if it is in flight:\n\t\t\t\tif @request\n\t\t\t\t\t@request.close_connection\n\t\t\t\t\t@request = nil\n\t\t\t\tend\n\t\t\tend",
"def finish\n begin\n _call = direction\n if _call.present?\n _call.finish(params) if defined?(_call.finish)\n end\n rescue => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n end\n render :plain => '', content_type: \"text/html\", :status => 200\n end",
"def response\n @response || perform and @response\n end",
"def api_response\n if last_response != @last_response\n @last_response = last_response\n @api_response = ApiResponse.new(last_response.body)\n\n else\n @api_response ||= ApiResponse.new(last_response.body)\n end\n end",
"def build_object(resp)\n return resp unless resp.respond_to?(:merge)\n @build_object ||= final_object_class.new(resp.merge(additional_hash_to_serialize_after_response))\n end",
"def create_response(request, http_response, body = nil)\n HttpOperationResponse.new(request, http_response, body)\n end",
"def body\n @response.body if success?\n end",
"def call\n with(response: response)\n end",
"def finalize!(renderable)\n # As determined above, get all adapters that implement a +finalize+\n # method and iterate over those adapters.\n @_finalize_adapters.each do |adapter|\n # Instantiate a new instance. We do this to ensure that we\n # definitely have the latest data / options following data\n # manipulation by the +call!+ method.\n a = adapter.new(data, options)\n\n # Call +finalize+ on the adapter and set +renderable+ to its\n # response.\n renderable = a.finalize(renderable)\n end\n\n # Return the very final response object. Just after this is called,\n # we call +render+ with this value.\n renderable\n end",
"def finalize\n # Validations have already been run by this point so the response may be invalid.\n # So we don't use validate: false or save! We just want to save it if it's valid.\n elmo_response.save if elmo_response\n end",
"def on_success(request, result)\n request.success(output(request, result))\n end",
"def response_block\n create_response_block\n end",
"def response_block\n create_response_block\n end",
"def rails_controller_response\n controller_response = rails_controller_instance.response\n\n response.status = controller_response.status\n response.headers.merge! controller_response.headers\n response.write controller_response.body\n\n request.halt\n end",
"def response body=nil, status=nil\n return @current.response unless body\n\n response.status status || 200\n response.body body\n throw :done\n end",
"def response\n @response\n end",
"def response\n get_header_and_body\n end",
"def response(&_)\n if block_given?\n @response ||= Response.new\n yield @response\n end\n @response\n end",
"def prepare_response(response)\n response\n end",
"def filter_response(request, response)\n finished = \"======= [WebFinger] HTTP REQUEST FINISHED =======\"\n WebFinger.logger.info ['-' * 50, response.dump, finished].join(\"\\n\")\n end",
"def run\n @response ||= build_response catch_halt{ @handler.run }\n end",
"def response!\n return response if !response.errors?\n\n raise response.to_exception\n end",
"def response(arguments = {})\n Response.new(self, arguments)\n end",
"def returns(response)\n @response = response\n self\n end",
"def process_response\n LOGGER.debug \"WORLDCAT DISCOVERY - Response from target: #{@response_status}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Headers: #{@response_headers.collect{ |k,v| \"#{k} = #{v}\" }.join(', ')}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Body: uncomment line!\"\n LOGGER.debug @response_body\n \n @response_body\n end",
"def perform\n response\n end",
"def finish_with( http_status, message, otherstuff={} )\n\t\thttp_response = otherstuff.merge( :status => http_status, :message => message )\n\t\tthrow :finish, http_response\n\tend",
"def response\n @reponse ||= website_overview_builder.response\n rescue => e\n Rails.logger.error(e)\n nil\n end",
"def build_response(json)\n klass = AdaptivePayments.const_get(operation.to_s + \"Response\")\n klass.from_json(json.to_s)\n end",
"def response\n @response\n end",
"def finish_response\n close unless keep_alive?\n\n @parser.reset\n @socket.reset_counter if @socket.respond_to?(:reset_counter)\n reset_timer\n\n @pending_response = false\n end",
"def response\n @response ||= Net::HTTP.new(uri.host).request(request)\n end",
"def response\n @response ||= Rack::Response.new\n end",
"def finish(*args, &block)\n self['Content-Type'] ||= 'text/html;charset=utf-8'\n @block = block if block\n if [204, 205, 304].include?(status.to_i)\n header.delete \"Content-Type\"\n header.delete \"Content-Length\"\n close\n [status.to_i, header, []]\n else\n [status.to_i, header, body]\n end\n end",
"def update_response(processed)\n case processed\n when Integer then response.status = processed\n when String,NilClass then response.body << processed.to_s\n when Array\n response.status = processed[0].to_i\n if response.respond_to?(:headers=)\n response.headers = processed[1]\n else\n processed[1].each do |key, value|\n response[key] = value\n end\n end\n response.body = processed[2].respond_to?(:each) ? processed[2] : [processed[2]]\n when Hash\n response.status = processed[:status].to_i if processed.key?(:status)\n response.headers.update(processed[:headers]) if processed.key?(:headers)\n response.body = processed[:body].respond_to?(:each) ? processed[:body] : [processed[:body]] if processed.key?(:body)\n end\n end",
"def response #:nodoc:\n current_params = request.params\n @response ||= {}\n return @response[current_params] if @response.has_key? current_params\n response_object = Response.new self\n response_object.load_data\n @response[current_params] = response_object\n end",
"def do_request\n\t\t\tself.response = post_request(options)\n\t\tend",
"def last_response\n defined?(super) ? super : response\n end",
"def to_response\n return @response.to_response\n end",
"def respond(response)\n unless response.committed?\n write_status(response)\n write_headers(response)\n write_body(response)\n end\n end",
"def response\r\n @response\r\n end",
"def upstream_response\n http = EM::HttpRequest.new(url).get\n logger.debug \"Received #{http.response_header.status} from NextBus\"\n http.response\n end",
"def finished?\n super && response_received?\n end",
"def finished?\n super && response_received?\n end",
"def to_response\n\t\t\t\t@details.merge(:code => @code)\n\t\t\tend",
"def build_response\n return { \"error\": \"invalid account or no billable accounts\" } if @accounts.blank?\n\n response = []\n total_devices = 0\n total_firewalls = 0\n total_mailboxes = 0\n total_cost = 0\n @accounts.each do |acc|\n next if acc.trial?\n\n subtotal = ((@devices[acc.path] || 0) + (@firewalls[acc.path] || 0))\n total_cost += subtotal\n total_devices += @devices[acc.path] || 0\n total_firewalls += @firewalls[acc.path] || 0\n total_mailboxes += @mailboxes[acc.path] || 0\n response << {\n name: acc.name,\n devices: @devices[acc.path] || 0,\n firewalls: @firewalls[acc.path] || 0,\n mailboxes: @mailboxes[acc.path] || 0,\n subtotal: subtotal\n }\n end\n\n {\n total_devices: total_cost,\n devices: total_devices,\n firewalls: total_firewalls,\n mailboxes: total_mailboxes,\n details: response,\n billing_start_date: @start_date,\n billing_end_date: @end_date\n }\n end",
"def finish ; request.session.save ; @response.finish ; end",
"def build_response_document(object, options)\n results = JSONAPI::OperationResults.new\n\n if object.respond_to?(:to_ary)\n results.add_result(build_collection_result(object, options))\n else\n record = turn_into_resource(object, options)\n results.add_result(JSONAPI::ResourceOperationResult.new(:ok, record))\n end\n\n @_response_document = create_response_document(results)\n end",
"def response(text, status = 200, headers = {})\n raise \"Cannot respond multiple times\" unless @response.nil?\n @response = Rack::Response.new([text].flatten, status, headers)\n end",
"def success_response(api_response, response)\n @response_details = response[:envelope][:body][:create_pickup_reply]\n end",
"def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end",
"def generic_Generate_Response(initial,headers,body)\n\ts=initial\n\ts << \"\\r\\n\" << headers # headers start in second line\n\tif body.length>0\n\t\ts << \"\\r\\n\" << body # body start after a blank line, first \\r\\n is for change line from headers, second is for blank line\n\tend\n\treturn s\nend",
"def perform!\n @request_time = Time.now\n\n http_resp = adapter.make_request(@method, @resource.uri, @body, @header)\n @response = Resourceful::Response.new(uri, *http_resp)\n @response.request_time = @request_time\n @response.authoritative = true\n\n @response\n end"
] |
[
"0.6723987",
"0.64348507",
"0.63734627",
"0.63716674",
"0.63516384",
"0.619561",
"0.614567",
"0.6076125",
"0.60224813",
"0.60162836",
"0.5997525",
"0.59915036",
"0.59800273",
"0.59693545",
"0.59434205",
"0.59384334",
"0.5905336",
"0.5889386",
"0.58407074",
"0.58407074",
"0.5752285",
"0.5743162",
"0.57338977",
"0.56787807",
"0.5618602",
"0.5597304",
"0.55961436",
"0.559118",
"0.55640614",
"0.55619216",
"0.5532994",
"0.55169606",
"0.5507572",
"0.55063236",
"0.5499032",
"0.5484782",
"0.5455655",
"0.5452571",
"0.54415435",
"0.5437744",
"0.54370683",
"0.5428792",
"0.54225755",
"0.539162",
"0.5388822",
"0.53876203",
"0.538333",
"0.5382218",
"0.53767985",
"0.5376482",
"0.5376085",
"0.53739655",
"0.536987",
"0.5360862",
"0.53523916",
"0.53519374",
"0.5349154",
"0.53463525",
"0.53413546",
"0.53396434",
"0.53396434",
"0.5323592",
"0.53206855",
"0.5307245",
"0.5304149",
"0.5291217",
"0.52711946",
"0.52678055",
"0.5259326",
"0.5250746",
"0.52489454",
"0.5246905",
"0.5245029",
"0.52448285",
"0.52432084",
"0.5242432",
"0.52408105",
"0.5231237",
"0.52295595",
"0.5215457",
"0.5206099",
"0.5205509",
"0.5204505",
"0.5200942",
"0.51846635",
"0.5184652",
"0.51716673",
"0.5166091",
"0.51536816",
"0.5140272",
"0.5139895",
"0.5139895",
"0.51373667",
"0.51371616",
"0.5135597",
"0.51279235",
"0.51255906",
"0.5108924",
"0.5106856",
"0.5099344",
"0.50972205"
] |
0.0
|
-1
|
Turn parsed contents from an API response into a Resource or collection of Resources.
|
def process_data(hash)
Array(hash).map do |hash|
Resource.new(client, hash, resource_relations, resources_key)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def parse_resource(parsed_json)\n name, fields = parsed_json[0], parsed_json[1]\n res = CFDoc::Model::Resource.new(name)\n parse_element(res, fields)\n res\n end",
"def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"def hydrate_list(resource_type,param)\n # skip if given an http response object\n return param if param.kind_of? Faraday::Response\n param.collect do |json_hash|\n Localwiki::make_one(resource_type,json_hash)\n end\n end",
"def turn_source_into_resource(record)\n return record if record.kind_of?(JSONAPI::Resource)\n @request.source_klass.new(record, context)\n end",
"def elements\n begin\n if %w(tags posts).include?(@resource.to_s)\n return parsed_response[@resource.to_s][singular_r_name] || []\n elsif %w(bundles).include?(@resource.to_s)\n return parsed_response[@resource.to_s].empty? ? [] : parsed_response[@resource.to_s].map {|el| el[singular_r_name] } \n end\n rescue NoMethodError => e \n return parsed_response\n end\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def results_from(response)\n response.data.collect do |obj|\n case resource\n when RedboothRuby::Client\n next unless resource_form_hash(obj.merge(session: session))\n resource_form_hash(obj.merge(session: session))\n else\n resource.new(obj.merge(session: session))\n end\n end.compact\n end",
"def result\n NestedResourceConverter.for(JSON.parse(json, symbolize_names: true)).result\n end",
"def parse(content)\n @response = []\n if ( content.respond_to?(:body) )\n @response = JSON.parse(content.body)\n else\n @response = JSON.parse(content)\n end\n @complete_items = @response[\"items\"]\n @raw_items = @response[\"items\"].map{|i| i['raw']}\n end",
"def from_response(resource_class, response)\n case response['Content-Type']\n when nil\n response.body\n when %r{application/pdf}\n response.body\n when %r{text/html}\n response.body\n when %r{text/plain}\n response.body\n when %r{application/octet-stream}\n response.body\n when %r{text/xml}\n if response['location']\n response['location']\n else\n response.body\n end\n when %r{application/json}\n record = from_json resource_class, response.body\n if record.nil?\n record = resource_class.new\n record.uri = response['location']\n end\n\n session_id = extract_session_id(response)\n record.instance_eval {\n @clazz = resource_class\n @etag = response['ETag']\n @session_id = session_id\n @pagination_max_nb_records = response['X-Killbill-Pagination-MaxNbRecords'].to_i unless response['X-Killbill-Pagination-MaxNbRecords'].nil?\n @pagination_total_nb_records = response['X-Killbill-Pagination-TotalNbRecords'].to_i unless response['X-Killbill-Pagination-TotalNbRecords'].nil?\n @pagination_next_page = response['X-Killbill-Pagination-NextPageUri']\n @response = response\n }\n record\n else\n raise ArgumentError, \"#{response['Content-Type']} is not supported by the library\"\n end\n end",
"def transform_Resource(o, scope)\n Types::TypeFactory.resource(o.type, o.title)\n end",
"def deserialize(xml, options = {})\n build_resource(REXML::Document.new(xml).root)\n end",
"def fetch\n response = RestClient.get \"http://pokeapi.co/#{resource_uri}\"\n update(resource_data: JSON.parse(response))\n end",
"def format_response(response)\n items = []\n body = JSON.parse(response.body)\n if response.code.to_i == 200\n body['items'].each do |item|\n items << { title: item['title'], link: item['link'], snippet: item['snippet'] }\n end\n else\n items << format_errors(body)\n end\n items\n end",
"def parse_catalog(catalog)\n classes = nil\n resources = nil\n results = Hash.new()\n\n if catalog.is_a?(String)\n begin\n JSON.parse!(catalog)\n rescue\n raise InternalError.new(sprintf('unable to parse catalog[%s] as JSON', catalog))\n end\n end\n\n unless catalog.has_key?('data') and catalog['data'].has_key?('classes')\n raise InternalError.new(sprintf('catalog does not contain a classes key[%s]', catalog))\n end\n\n unless catalog.has_key?('data') and catalog['data'].has_key?('resources')\n raise InternalError.new(sprintf('catalog does not contain a resources key[%s]', catalog))\n end\n\n raw_resources = catalog['data']['resources']\n\n raw_resources.each do |r|\n # samples of eacb type of resource is available at\n # https://github.com/chorankates/rouster/issues/20#issuecomment-18635576\n #\n # we can do a lot better here\n type = r['type']\n case type\n when 'Class'\n classes.push(r['title'])\n when 'File'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :file\n resources[name][:directory] = false\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:file] = true\n resources[name][:group] = r['parameters'].has_key?('group') ? r['parameters']['group'] : nil\n resources[name][:mode] = r['parameters'].has_key?('mode') ? r['parameters']['mode'] : nil\n resources[name][:owner] = r['parameters'].has_key?('owner') ? r['parameters']['owner'] : nil\n resources[name][:contains] = r.has_key?('content') ? r['content'] : nil\n\n when 'Group'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :group\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:gid] = r['parameters'].has_key?('gid') ? r['parameters']['gid'] : nil\n\n when 'Package'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :package\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:version] = r['ensure'] =~ /\\d/ ? r['ensure'] : nil\n\n when 'Service'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :service\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:state] = r['ensure']\n\n when 'User'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :user\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:home] = r['parameters'].has_key?('home') ? r['parameters']['home'] : nil\n resources[name][:gid] = r['parameters'].has_key?('gid') ? r['parameters']['gid'] : nil\n resources[name][:group] = r['parameters'].has_key?('groups') ? r['parameters']['groups'] : nil\n resources[name][:shell] = r['parameters'].has_key?('shell') ? r['parameters']['shell'] : nil\n resources[name][:uid] = r['parameters'].has_key?('uid') ? r['parameters']['uid'] : nil\n\n else\n raise NotImplementedError.new(sprintf('parsing support for [%s] is incomplete', type))\n end\n\n end\n\n # remove all nil references\n resources.each_key do |name|\n resources[name].each_pair do |k,v|\n unless v\n resources[name].delete(k)\n end\n end\n end\n\n\n results[:classes] = classes\n results[:resources] = resources\n\n results\n end",
"def each\n return enum_for :each unless block_given?\n\n return if @response.nil?\n\n # We trust that the field exists and is an Enumerable\n @response[@resource_field].each do |resource|\n resource = @format_resource.call resource if @format_resource\n yield resource\n end\n end",
"def from_collection(client_ref, response)\n response.body.to_xml.xpath('/*/*').map do |entity|\n convert(client_ref, entity)\n end\n end",
"def index\n @api_v1_resources = Api::V1::Resource.all\n end",
"def raw_data_to_response_object(data)\n case data['status']\n when 'success'\n if data['flags']['paginated'] && data['data'].is_a?(Array)\n MoonropeClient::Responses::PaginatedCollection.new(self, data)\n else\n MoonropeClient::Responses::Success.new(self, data)\n end\n when 'parameter-error' then MoonropeClient::Responses::ParameterError.new(self, data)\n when 'access-denied' then MoonropeClient::Responses::AccessDenied.new(self, data)\n when 'validation-error' then MoonropeClient::Responses::ValidationError.new(self, data)\n else\n MoonropeClient::Response.new(self, data)\n end\n end",
"def parse(response)\n case response\n when Hash\n response.each_with_object({}) do |(key, value), new_hash|\n new_hash[camel_case_to_snake_case(key).to_sym] = parse(value)\n end\n when Array\n response.map { |item| parse item }\n else\n response\n end\n end",
"def manipulate_resource_list(resources)\n new_resources = []\n\n # Set up date pages if the appropriate templates have been specified\n @blog_data.articles.group_by { |a| a.date.year }.each do |year, year_articles|\n new_resources << year_page_resource(year, year_articles) if @generate_year_pages && @year_template\n\n year_articles.group_by { |a| a.date.month }.each do |month, month_articles|\n new_resources << month_page_resource(year, month, month_articles) if @generate_month_pages && @month_template\n\n month_articles.group_by { |a| a.date.day }.each do |day, day_articles|\n new_resources << day_page_resource(year, month, day, day_articles) if @generate_day_pages && @day_template\n end\n end\n end\n\n resources + new_resources\n end",
"def convert_resource(name, resource)\n \n props = value_from_path(resource, [\"Properties\"]) || {}\n props = keys_to_underscore props\n \n case resource['Type']\n when \"AWS::EC2::Instance\"\n @output['nodes'] << convert_instance(name, resource)\n\n when \"AWS::ElasticLoadBalancing::LoadBalancer\"\n listeners = value_from_path(props, [\"listeners\"]) || []\n props[\"listeners\"] = listeners.map{|listener| \n fields_to_v1(:listener, fields_to_i(:listener, keys_to_underscore(listener)))\n } \n @output['services'] << { \"name\" => name, \"type\" => \"load_balancer\", \n \"provisioning\" => { \"load_balancer_options\" => props } }\n\n when \"AWS::AutoScaling::AutoScalingGroup\"\n @output['nodes'] << convert_auto_scaling_group(name, resource)\n end\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def flatten_resource(obj)\n return { :resource_id => obj.id, :resource_type => (obj.respond_to?(:base_class) ? obj.base_class.to_s : obj.class.base_class.to_s) } unless obj.is_a?(Array)\n { :resource_id => obj.collect{ |o| o.id }, :resource_type => obj.collect{ |o| (o.respond_to?(:base_class) ? o.base_class.to_s : o.class.base_class.to_s) } }\n end",
"def construct_new_resource(response)\n data = JSON.parse(response.body, symbolize_names: true)\n new(data)\n end",
"def scrape_resources(opts = {})\n BBLib::HashStruct.new.tap do |hash|\n resources.each do |resource|\n hash[resource.name] = resource.retrieve(opts)\n end\n end\n end",
"def initialize(id, auth_token = nil)\n super id, auth_token\n return if self.class.linked_resources.nil?\n\n self.class.linked_resources.each do |resource|\n if APIResource.singular? resource.to_s\n # Get single resource\n self.class.send :define_method, resource do\n response = Clever.request :get, get_link_uri(resource), {}, headers\n return Util.convert_to_clever_object response\n end\n else\n # Get list of nested resources\n self.class.send :define_method, resource do |filters = {}|\n Clever::NestedResource.new get_link_uri(resource), filters, headers\n end\n end\n end\n end",
"def as_resource(options = {})\n links = self_link\n\n if is_collection?\n links[:web] = {\n :href => \"#{@@web_url}/#{pk}\"\n }\n end\n \n resource = {\n :id => pk,\n :accession => objectnumber,\n :sort_number => sortnumber,\n :sort_title => sort_title,\n :sort_name => sort_name,\n :constituents => constituents.map {\n |c| c.as_resource({'no_objects' => true, 'no_bio' => true})\n },\n :titles => titles.as_resource,\n :series => series == nil ? nil : series.as_resource,\n :dates => date_resource(datebegin, dateend, dated),\n :sites => sites.count > 0 ? sites.map {\n |s| s.as_resource({'no_objects' => true})} : nil,\n :movements => movements.count > 0 ? movements.map {\n |m| m.as_resource({'no_objects' => true})} : nil,\n :acquisition => acquisition != nil ? \n acquisition.as_resource({'no_objects' => true}) : nil,\n :exhibitions => exhibitions.count > 0 ? exhibitions.map {\n |e| {\n :location => location(e.pk) != nil ? location(e.pk).as_resource : nil,\n :exhibition => e.as_resource({'no_objects' => true})\n }\n } : nil,\n :edition => edition,\n :medium => medium,\n :dimensions => dimensions,\n :credit => creditline,\n :has_essay => has_essay?,\n :has_extended_label => has_essay?,\n :copyright => copyright,\n :current_location => current_location == nil ? \n nil : current_location.as_resource,\n :media => media.count > 0 ? media.map { |m|\n m.as_resource\n } : nil,\n :object_types => object_types.count > 0 ? object_types.map { |t|\n t.as_resource({'no_objects' => true})\n } : nil,\n :permanent_collection => permanent_collection?,\n :recent_acquisition => is_recent_acquisition?,\n :_links => links\n }\n\n if options['no_essay'] != 'true'\n resource[:essay] = essay\n resource[:extended_label] = extended_label\n end\n\n return resource\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def fetch(options = {})\n url = build_url(options)\n puts \"Getting #{url}\"\n\n json = get_response(url)\n\n if self.is_json?\n data = JSON.parse(json)\n else\n data = XmlSimple.xml_in(json)\n end\n\n # TODO: Raise hell if there is a problem\n\n collection = OpenCongressApi::Collection.build(json_result(data))\n collection.map!{|result| format_result(result)}\n end",
"def resource_relations\n @resource_relations ||= Relation.from_links(client,\n decoded_body[:links])\n end",
"def _load(resource)\n return if resource.nil?\n\n @_attributes = {}.with_indifferent_access\n\n resource.each do |key, value|\n definition = self.class.schema[key]\n\n if definition == :time\n _update_attribute(key, value ? Time.parse(value) : nil)\n next\n end\n\n if definition.is_a?(Class) && definition.include?(EntryLoader)\n _update_attribute(key, value ? definition.new(client, value) : nil)\n next\n end\n\n # if schema definition is [Class]\n if definition.is_a?(Array) && definition.first.include?(EntryLoader)\n\n # just set attribute to an empty array if value is no array or empty\n if !value.is_a?(Array) || value.empty?\n _update_attribute(key, [])\n next\n end\n\n if value.first.is_a?(Integer)\n # If value is an integer, this is the id of an object which's class can be\n # retreived from definition. Load a future object that can on access retreive the\n # data from the api and convert it to a proper object.\n _update_attribute(key, value.map { |id| Future.new(client, definition.first, id) })\n else\n # Otherwise the value *is* the content of the object\n _update_attribute(key, value.map { |item| definition.first.new(client, item) })\n end\n next\n end\n\n _update_attribute(key, value.is_a?(Hash) ? value.with_indifferent_access : value)\n end\n end",
"def convert!\n resource\n end",
"def as_resource()\n # Titles might have NULL, 0 (not assigned), or 7 (multiple) as \n # the language. Return nil for all of these\n resource = {\n :title => title,\n :language => [nil, 0, 7].include?(languageid) ? nil : \n languages.codes.language_code,\n :type => titletypes.titletype,\n :order => displayorder,\n :prepend => nil,\n :append => nil\n }\n\n # These titletypes are use to indicate the phrasing of a series \n # title\n #\n # 7 = from the series X\n # 15 = from the X series \n # 16 = from X\n #\n # We'll break that up into a phrase to prepend and/or append to the \n # title when it is displayed\n if [7, 15, 16].include?(titletypeid)\n resource[:type] = \"Series\"\n phrase = titletypes.titletype.match(/\\((.+)\\)/)\n if phrase == nil\n raise UnknownSeriesFormatError, \"Cannot parse series title format \\\"#{collection_tms_titletypes.titletype}\\\"\"\n end\n\n affixes = phrase[1].match(/^(.+)?(X)(.+)?$/)\n if affixes[1] != nil\n resource[:prepend] = affixes[1].strip\n end\n\n if affixes[3] != nil\n resource[:append] = affixes[3].strip\n end\n end\n \n resource\n end",
"def hydrate(resource_type,param)\n # skip if given an http response object\n return param if param.kind_of? Faraday::Response\n Localwiki::make_one(resource_type,param)\n end",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def build_resource(node)\n resource = root_resource(node)\n \n node.elements.each do |el|\n type = calculate_node_type(el)\n resource.values << case type\n \n when :link : build_link(el, type)\n when :datetime\n Restful.attr(el.name, DateTime.parse(el.text), type)\n when :resource\n build_resource(el)\n when :array\n Restful.collection(el.name, el.elements.map { |child| build_resource(child) }, type)\n else \n Restful.attr(el.name, el.text, type)\n end\n end\n\n resource\n end",
"def resources\n body && [*body]\n end",
"def parse_response(response, klass=nil, parent=nil)\n return false if response.status >= 400\n\n body = Yajl::Parser.parse(response.body) rescue nil\n klass = (klass || self)\n\n case body\n when Array\n Collection.new(parent, klass, body.map { |o| klass.new(o) })\n when Hash\n klass.new(body)\n else\n body\n end\n end",
"def convert!\n @resource ||= resource\n end",
"def update \n items = changed_since(last_run)\n resources = []\n items.each do |item|\n resource = construct_resource(item)\n resource.populate\n resources << resource\n end\n return resources\n end",
"def manipulate_resource_list(resources)\n return resources unless @generate_tag_pages\n\n resources + @blog_data.tags.map do |tag, articles|\n tag_page_resource(tag, articles)\n end\n end",
"def object response\n if response.is_a? Array\n return response.collect{ |object| \"Skydrive::#{object[\"type\"].capitalize}\".constantize.new(self, object)}\n else\n return \"Skydrive::#{response[\"type\"].capitalize}\"\n end\n end",
"def scrape_resources(topic)\n \n #The query parameters: (update according to your search query)\n q = \"#{topic.name}\"; #the search query\n pageNumber = 1 #the number of requested page\n pageSize = WebScraperOptions[:numSearchResults] #the size of a page\n autoCorrect = false #autoCorrectspelling\n safeSearch = true #filter results for adult content\n \n response = Unirest.get \"https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/Search/WebSearchAPI?q=#{q}&pageNumber=#{pageNumber}&pageSize=#{pageSize}&autoCorrect=#{autoCorrect}&safeSearch=#{safeSearch}\",\n headers:{\n \"X-RapidAPI-Key\" => Contextual_Web_Search_Key\n }\n \n resources = []\n \n #Go over each resulting item\n response.body[\"value\"].each do |webPage|\n \n #Get the web page metadata \n url = webPage[\"url\"]\n \n # Removes html tags from title and titleizes the string.\n title = ActionView::Base.full_sanitizer.sanitize(webPage[\"title\"])\n title = title.titleize\n \n # Removes html tags from excerpt\n excerpt = ActionView::Base.full_sanitizer.sanitize(webPage[\"description\"]).truncate(200)\n \n # User with id of 2 is the web scraper.\n content = { link: url, video: \"\", text: \"\", excerpt: excerpt }\n res = Resource.new(name: title, content: content.to_json, topic_id: topic.id, user_id: 2) \n if res.save \n resources << res \n else \n raise 'Resource could not be saved!'\n end \n end \n resources \n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def object_class_from_response(response)\n kind = object_kind_from_response(response)\n object_class_from_kind(kind)\n end",
"def items\n # [obj_or_array].flatten makes this always be an array (lastfm gives\n # the single object when it's not an array)\n [main_result[response_type]].flatten.compact rescue []\n end",
"def parse\n start_section\n\n n = length\n start = @file.tell\n\n while n > 0\n pos = @file.tell\n @resources << PSD::Resource.read(@file)\n n -= @file.tell - pos\n end\n\n unless n == 0\n @file.seek start + length\n end\n\n end_section\n return @resources\n end",
"def parse_base\n @name = json['resource']\n @params = json['parameters']\n @result_sets = json['resultSets']\n\n result_sets.each do |result_set|\n result_set_name = result_set['name'].underscore\n if valid_result_sets.include? result_set_name.to_sym\n instance_variable_set \"@#{result_set_name}\", row_set_to_array_of_hashes(result_set['headers'], result_set['rowSet'])\n singleton_class.class_eval do; attr_accessor result_set_name; end\n else\n raise BadResponseError.new(\"Unexpected result set name #{result_set_name}.\")\n end\n end\n end",
"def load_resources\n\t\tListing\n\t\t@resources = YAML::load(File.open('listings.yml'))\n\tend",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def parse_resources(results)\n # Resource name is everything to the left of the colon in the \"describe\" string\n mapped = {}\n final_results = []\n results.map do |result|\n status = result['status']\n resource = result[\"code_desc\"].scan(/^(.+):.+$/).last.first\n mapped[resource] = status if mapped[resource].nil? || mapped[resource] == \"passed\"\n end\n mapped.keys.each { |result| final_results.push({\"status\"=>\"#{mapped[result]}\", \"resource\"=>\"#{result}\"}) }\n return final_results\nend",
"def process_array response, body\n body.map do |element|\n from_response response, element\n end\n end",
"def parse_apis apis_yaml\n apis_yaml.map { |api_yaml| parse_api api_yaml }\n end",
"def object_list_response(node, type)\n node = clean_node node\n class_name = ZIMBRA_TYPES_HASH[type][:class].name.gsub(/Zimbra::/, '')\n Zimbra::BaseService::Parser.response(class_name, node, false)\n end",
"def parse_resource(resource)\n # return a hash of information\n parsed = {\n 'name' => resource.name,\n 'type' => resource.type,\n }\n\n parsed\n end",
"def convert_to_resource\n resource_type = @selector.scan(TO_RESOURCE_REGEX).flatten.first\n resource = Puppet::Type.type(resource_type)\n all_attributes = resource.allattrs.collect(&:to_s)\n cleaned_value = @value.value.collect { |k, v| all_attributes.include?(k) ? [k, v] : nil }.compact\n { @value.keys.first => Hash[cleaned_value] }\n end",
"def get_character_movies_from_api(character_name)\n #make the web request\n\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n counter = 1\n films = []\n\n\n while films.size <= 1 do\n\n response_hash[\"results\"].find do |item_name|\n\n if item_name[\"name\"].downcase == character_name.downcase\n films = item_name[\"films\"]\n puts \"Film found\"\n films.collect! do |film_url|\n response_film_url = RestClient.get(film_url)\n response_film_url_hash = JSON.parse(response_film_url)\n response_film_url_hash[\"title\"]\n end\n puts \"Film Convert\"\n return films\n elsif response_hash[\"next\"] == nil\n return puts \"Character not found.\"\n end\n\n counter += 1\n\n response_string = RestClient.get(response_hash[\"next\"])\n response_hash = JSON.parse(response_string)\n end\nend\n\n\n #films = []\n #response_hash[\"results\"].find do |item_name|\n #\n # if item_name[\"name\"].downcase == character_name.downcase\n # films = item_name[\"films\"]\n # end\n #end\n\n #if response_hash[\"results\"][0][\"name\"].downcase == character_name\n # films = response_hash[\"results\"][0][\"films\"]\n #end\n\n #films.collect! do |film_url|\n # response_film_url = RestClient.get(film_url)\n # response_film_url_hash = JSON.parse(response_film_url)\n # response_film_url_hash[\"title\"]\n #end\n\n\n\n\n # iterate over the response hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls, make a web request to each URL to get the info\n # for that film\n # return value of this method should be collection of info about each film.\n # i.e. an array of hashes in which each hash reps a given film\n # this collection will be the argument given to `print_movies`\n # and that method will do some nice presentation stuff like puts out a list\n # of movies by title. Have a play around with the puts with other info about a given film.\nend",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def load_data(c)\n return nil unless c.has_key?(\"data\")\n\n #single resource, but instantiate it and stick it in an Array\n return [mapped_type(c[\"data\"][\"type\"]).new(c[\"data\"], self)] if c[\"data\"].is_a? Hash\n\n # Instantiate Resources for each array element\n return c[\"data\"].map{|d| mapped_type(d[\"type\"]).new(d, self)}\n end",
"def parse_response(text, opts = {})\n opts = { :count => 1 }.merge(opts || {})\n\n return [] if opts[:count] <= 0\n\n resp = JSON.parse(text, :symbolize_names => true)\n\n results = resp[:list].map do |res|\n {\n :id => res[:defid],\n :word => res[:word],\n :author => res[:author],\n :permalink => res[:permalink],\n :definition => res[:definition].strip,\n :example => res[:example].strip,\n :upvotes => res[:thumbs_up],\n :downvotes => res[:thumbs_down],\n }\n end\n\n results.take opts[:count]\n end",
"def deserialize(api_version, response, return_type)\n body = response.body\n\n # handle file downloading - return the File instance processed in request callbacks\n # note that response body is empty when the file is written in chunks in request on_body callback\n return @tempfile if return_type == 'File'\n\n return nil if body.nil? || body.empty?\n\n if response.headers['Content-Encoding'].eql?('gzip') then\n gzip = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)\n body = gzip.inflate(body)\n gzip.close\n end\n\n # return response body directly for String return type\n return body if return_type == 'String'\n\n # ensuring a default content type\n content_type = response.headers['Content-Type'] || 'application/json'\n\n fail \"Content-Type is not supported: #{content_type}\" unless json_mime?(content_type)\n\n begin\n data = JSON.parse(\"[#{body}]\", :symbolize_names => true)[0]\n rescue JSON::ParserError => e\n if %w(String Date Time).include?(return_type)\n data = body\n else\n raise e\n end\n end\n\n convert_to_type data, return_type, api_version\n end",
"def initialize(klass, resource_path)\n url = \"#{ApiClient.config.path}#{resource_path}\"\n @collection = ApiClient::Parser.response(ApiClient::Dispatcher.get(url), url)\n @collection.map! do |attributes|\n klass.new(attributes)\n end\n end",
"def resources\n @resources ||= @internal_struct[:resources] || {}\n end",
"def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"def from_json(resource_class, json)\n # e.g. DELETE\n return nil if json.nil? or json.size == 0\n data = JSON.parse json\n\n if data.is_a? Array\n records = Resources.new\n data.each do |data_element|\n if data_element.is_a? Enumerable\n records << instantiate_record_from_json(resource_class, data_element)\n else\n # Value (e.g. String)\n records << data_element\n end\n end\n records\n else\n instantiate_record_from_json(resource_class, data)\n end\n end",
"def faux_api_response\n api_response_data = [\n {\n \"id\" => \"col-aaaaa\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-aaaaa\",\n \"status\" => \"rejected\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => \"2013-08-13T13:21:58Z\",\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-aaaaa\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-aaaaa\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n },\n {\n \"id\" => \"col-bbbbb\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-bbbbb\",\n \"status\" => \"pending\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => nil,\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-aaaaa\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-aaaaa\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n },\n {\n \"id\" => \"col-ccccc\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-ccccc\",\n \"status\" => \"pending\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => nil,\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-bbbbb\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-bbbbb\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n }\n ]\n # Collection#load is private in fog so we can't just pass our collection\n # into get the correct object initialised.\n api_response_data.map do |datum|\n Fog::Brightbox::Compute::UserCollaboration.new(datum)\n end\n end",
"def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end",
"def find_all\n response = fetch()\n new(response)\n end",
"def fetch_listings(format=nil)\n result = nil\n raw = fetch_raw(format)\n case self.format\n when 'xml'\n # parse xml raw\n result = XmlSimple.xml_in raw, { 'ForceArray' => false, 'AttrPrefix' => true }\n when 'json'\n result = JSON.parse(raw)\n end\n result = raw unless result\n result\n end",
"def jsonapi_deserialize(document)\n\n # Optional fields, if present, convert to snake/symbol\n # data - (if present, flatten it accordingly to jsonapi spec)\n # include\n # fields\n # filter\n # sort\n # page\n # platform\n\n # Duplicate document and convert to JSON\n # if document.is_a?(ActionController::Parameters)\n # primary_data = document.dup.as_json\n if document.respond_to?(:permit!)\n # Handle Rails params...\n primary_data = document.dup.require(:data).permit!.as_json\n elsif document.is_a?(Hash)\n primary_data = document.as_json.deep_dup\n else\n return {}\n end\n\n # This is the hash that is going to be returned\n parsed = {}\n parsed['include'] = primary_data['include'] if primary_data['include']\n parsed['fields'] = primary_data['fields'] if primary_data['fields']\n parsed['filter'] = primary_data['filter'] if primary_data['filter']\n parsed['sort'] = primary_data['sort'] if primary_data['sort']\n parsed['page'] = primary_data['page'] if primary_data['page']\n parsed['platform'] = primary_data['platform'] if primary_data['platform']\n\n # Convert primary_data to snake_case\n _primary_data = primary_data.deep_transform_keys(&:underscore)\n\n if _primary_data['data']\n relationships = _primary_data['data']['relationships'] || {}\n parsed['id'] = _primary_data['id'] if _primary_data['id']\n\n # Map _primary_data['data']['attributes'] to parsed hash\n if _primary_data['data']['attributes'].respond_to? :each\n _primary_data['data']['attributes'].each do |key, val|\n parsed[key] = val\n end\n end\n\n relationships.map do |assoc_name, assoc_data|\n assoc_data = (assoc_data || {})['data'] || {}\n rel_name = jsonapi_inflector.singularize(assoc_name)\n\n if assoc_data.is_a?(Array)\n parsed[\"#{rel_name}_ids\"] = assoc_data.map { |ri| ri['id'] }.compact\n next\n end\n\n parsed[\"#{rel_name}_id\"] = assoc_data['id']\n if (options['polymorphic'] || []).include?(assoc_name)\n rel_type = jsonapi_inflector.classify(assoc_data['type'].to_s)\n parsed[\"#{rel_name}_type\"] = rel_type\n end\n end\n end\n\n # Convert to symbols before returning to client\n parsed.deep_transform_keys!(&:to_sym)\n end",
"def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end",
"def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end",
"def build_collection_result(object, options)\n records = build_collection(object, options)\n result_options = result_options(object, options)\n\n if related_resource_operation?(options)\n source_resource = turn_source_into_resource(options[:source])\n relationship_type = get_source_relationship(options)\n\n JSONAPI::RelatedResourcesOperationResult.new(\n :ok,\n source_resource,\n relationship_type,\n records,\n result_options\n )\n else\n JSONAPI::ResourcesOperationResult.new(:ok, records, result_options)\n end\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def parse_response(response)\n object = nil\n\n if response.body and !response.body.empty?\n object = MultiJson.load response.body\n end\n\n object\n end",
"def response_to_array(response, key, model)\n JSON.parse(response.body)[key].map{|item| model.new(item) } rescue []\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def init_from_response_body!\n return unless self.response_body\n self.objects. init_from_hal(self.response_body);\n self.links. init_from_hal(self.response_body);\n self.attributes.init_from_hal(self.response_body);\n self.loaded = true\n self\n end",
"def parse_content(response, item)\n\n # Create XML document\n document = REXML::Document.new(response)\n\n # Ini output array\n out = Array.new()\n\n # looking for item\n REXML::XPath.each(document, item) {\n |e| out << e\n }\n\n out\n end",
"def get_object(resource, type, id, location = 0) #:yields: data_object\n header = {\n 'Accept' => mimemap.keys.join(',')\n }\n\n data = {\n 'Resource' => resource,\n 'Type' => type,\n 'ID' => id,\n 'Location' => location.to_s\n }\n\n response = request(@urls['GetObject'], data, header)\n results = block_given? ? 0 : []\n\n if response['content-type'] && response['content-type'].include?('text/xml')\n # This probably means that there was an error.\n # Response parser will likely raise an exception.\n rr = @response_parser.parse_object_response(response.body)\n return rr\n elsif response['content-type'] && response['content-type'].include?('multipart/parallel')\n content_type = process_content_type(response['content-type'])\n\n# TODO: log this\n# puts \"SPLIT ON #{content_type['boundary']}\"\n boundary = content_type['boundary']\n if boundary =~ /\\s*'([^']*)\\s*/\n boundary = $1\n end\n parts = response.body.split(\"\\r\\n--#{boundary}\")\n\n parts.shift # Get rid of the initial boundary\n\n# TODO: log this\n# puts \"GOT PARTS #{parts.length}\"\n\n parts.each do |part|\n (raw_header, raw_data) = part.split(\"\\r\\n\\r\\n\")\n\n# TODO: log this\n# puts raw_data.nil?\n next unless raw_data\n\n data_header = process_header(raw_header)\n data_object = RETS::DataObject.new(data_header, raw_data)\n\n if block_given?\n yield data_object\n results += 1\n else\n results << data_object\n end\n end\n else\n info = {\n 'content-type' => response['content-type'], # Compatibility shim. Deprecated.\n 'Content-Type' => response['content-type'],\n 'Object-ID' => response['Object-ID'],\n 'Content-ID' => response['Content-ID']\n }\n\n if response['Transfer-Encoding'].to_s.downcase == \"chunked\" || response['Content-Length'].to_i > 100 then\n data_object = RETS::DataObject.new(info, response.body)\n if block_given?\n yield data_object\n results += 1\n else\n results << data_object\n end\n end\n end\n\n results\n end",
"def parse_response\n if @http_response.body && @http_response.respond_to?(:headers) && @http_response.headers['Content-Type']\n if @http_response.headers['Content-Type'].include?('xml')\n parse_xml_response\n elsif @http_response.headers['Content-Type'].include?('json')\n parse_json_response\n end\n else\n parse_unknown_response\n end\n end",
"def decorated_collection\n @collection.map do |element|\n Resource.new(element, @controller)\n end\n end",
"def extract_response_documents(response)\n return [response.body] unless @request_href.match(/\\.(atom|rss|xml)$|\\.(atom|rss|xml)\\?/)\n\n # RSS Feed case:\n response_bodies = []\n\n SimpleRSS.parse(response.body).items.each do |i|\n doc = \"\"\n i.each {|k, v| doc += \"#{k} is #{v}. \"}\n response_bodies.push doc\n end\n\n return response_bodies\n end",
"def get_resources(authorization, \n user_id = nil, \n page = 1, \n per_page = 10)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/resources'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'user_id' => user_id,\n 'page' => page,\n 'per_page' => per_page\n }, array_serialization: Configuration.array_serialization\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetResourcesResponse.from_hash(decoded)\n end",
"def parse_response(response)\n return response unless response.respond_to?(:body)\n\n JSON.parse(response.body, symbolize_names: true)\n rescue StandardError => e\n puts \"Error parsing response from #{api_path}\"\n handle_error(e)\n end",
"def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n film_urls = get_film_urls(character_hash, character)\n\n parse_character_movies(parse_films(film_urls))\nend",
"def each\n return enum_for :each unless block_given?\n\n # We trust that the field exists and is an Enumerable\n resources.each do |resource|\n resource = @format_resource.call resource if @format_resource\n yield resource\n end\n end",
"def get_character_movies_from_api(character)\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n results = []\n still_searching = true\n\n while still_searching\n results << character_hash[\"results\"] # results pushed into results array on every loop iteration\n if character_hash[\"next\"]\n next_page = RestClient.get(character_hash[\"next\"])\n character_hash = JSON.parse(next_page)\n else\n still_searching = false\n end\n end\n\n results = results.flatten\n results = results.select {|chara| chara[\"name\"].downcase == character}\n # results is an array containing a hash\n\n if results.length > 0\n film_hash = results[0][\"films\"].map do |film_url|\n film = RestClient.get(film_url)\n film = JSON.parse(film)\n end\n end\nend",
"def parse_output(parsed_json)\n # a Resource is an array of [name, {fields_hash}]\n name, fields = parsed_json[0], parsed_json[1]\n output = CFDoc::Model::Output.new(name)\n parse_element(output, fields)\n output\n end",
"def resources\n @resources ||= []\n end",
"def extract_titles(resources)\n titles = []\n\n resources.each do |resource|\n titles << resource[:resource_id]\n end\n\n titles\nend",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def parse_response(response)\n find_elements(name.split('::').last.downcase, response).map do |e|\n new id: e.attr('id').to_i, name: e.text\n end\n end",
"def resource\n @resource ||= resource_klass.new object\n end",
"def as_jsonapi_data(klass, resources_name, resources,\n resource_ids, options = {})\n incl = options[:include]\n\n ids_cache = options[:ids_cache] || {}\n clause_done = options[:clause_done] || []\n\n fields = extract_fields(options[:fields], resources_name)\n\n whitelist = if klass.respond_to?(:jsonapi_methods)\n method_def = klass.jsonapi_methods[:get] || klass.jsonapi_methods[:post]\n method_def.nil? ? [] : method_def.attributes\n else\n []\n end\n\n jsonapi_fields = if fields.nil?\n whitelist\n else\n Set.new(fields).keep_if {|f| whitelist.include?(f) }.to_a\n end\n\n links = jsonapi_linkages(klass, resources, resource_ids,\n :ids_cache => ids_cache, :clause_done => clause_done, :resolve => incl)\n\n resources_as_json = resources.collect do |r|\n r_id = r.id\n l = links.keys.inject({}) do |memo, k|\n\n link_data = links[k]\n\n memo[k] = {\n :links => {\n :self => \"#{request.base_url}/#{resources_name}/#{r_id}/relationships/#{k}\",\n :related => \"#{request.base_url}/#{resources_name}/#{r_id}/#{k}\"\n }\n }\n\n unless link_data.nil?\n ids = link_data.data[r_id]\n case ids\n when Array, Set\n memo[k].update(:data => ids.to_a.collect {|id| {:type => link_data.type, :id => id} })\n when String\n memo[k].update(:data => {:type => link_data.type, :id => ids})\n end\n end\n memo\n end\n data = {\n :type => klass.short_model_name.singular,\n :id => r_id\n }\n attrs = r.as_json(:only => jsonapi_fields)\n data[:attributes] = attrs unless attrs.empty?\n data[:relationships] = l unless l.nil? || l.empty?\n data\n end\n\n unless (resources_as_json.size == 1) && options[:unwrap].is_a?(TrueClass)\n return resources_as_json\n end\n\n resources_as_json.first\n end",
"def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end",
"def get_resource_cards(all=false)\n presenter = ResourcesPresenter.new(@cms_site, all)\n _resources = presenter.resources\n\n _resources[:url] = get_cms_url(_resources[:url])\n _resources[:cards].map! do |c|\n page = c[:page]\n file = cms_fragment_render(:file, page)\n link = cms_fragment_render(:link, page)\n url = file.present? || link.present? ? nil : get_cms_url(page.full_path)\n\n c.merge(\n date: DateTime.parse(cms_fragment_render(:published_date, page)).strftime('%d %B %y'),\n url: url,\n summary: cms_fragment_render(:summary, page),\n fileUrl: file,\n linkUrl: link,\n linktTile: cms_fragment_render(:link_title, page)\n )\n end\n\n @items = _resources\n end",
"def get_nested_resource_objects\n end"
] |
[
"0.6266874",
"0.6256729",
"0.5978951",
"0.5937778",
"0.58817714",
"0.580093",
"0.57782364",
"0.57701606",
"0.556774",
"0.55476534",
"0.546559",
"0.541274",
"0.5399567",
"0.5370187",
"0.5341814",
"0.53283954",
"0.5315843",
"0.5304021",
"0.5290699",
"0.5267092",
"0.52644753",
"0.52576846",
"0.52572715",
"0.52455366",
"0.5241622",
"0.52297246",
"0.51923114",
"0.5188078",
"0.51542944",
"0.51462126",
"0.5140516",
"0.51267695",
"0.51173174",
"0.50958115",
"0.5085389",
"0.50745946",
"0.50731623",
"0.505802",
"0.5055408",
"0.50523853",
"0.50434184",
"0.5042328",
"0.5041291",
"0.5026026",
"0.50255495",
"0.50210917",
"0.5020456",
"0.50192493",
"0.5017748",
"0.5014406",
"0.4999017",
"0.49893603",
"0.49873924",
"0.4981984",
"0.49812984",
"0.49774542",
"0.49735427",
"0.49727744",
"0.4964676",
"0.4961463",
"0.49590373",
"0.49557763",
"0.49495384",
"0.4948257",
"0.49441686",
"0.49357346",
"0.49329892",
"0.49308693",
"0.4922854",
"0.49182582",
"0.49125496",
"0.49075413",
"0.49023587",
"0.49023587",
"0.48996395",
"0.4896237",
"0.4895638",
"0.48835632",
"0.48796877",
"0.4874046",
"0.48712018",
"0.4864822",
"0.48523256",
"0.48519006",
"0.4850309",
"0.4847584",
"0.48453957",
"0.48340696",
"0.48242915",
"0.4820948",
"0.4820724",
"0.48179522",
"0.48170096",
"0.4816214",
"0.4814031",
"0.4813871",
"0.48096144",
"0.4808712",
"0.48048264",
"0.4804583"
] |
0.49966282
|
51
|
Return name of the key in the response body hash where fetched resources are, like bookings or rentals
|
def resources_key
decoded_body.keys.delete_if { |key|
SPECIAL_JSONAPI_FIELDS.include?(key)
}.pop
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def response_key\n self.class.response_key\n end",
"def name\n response[\"name\"]\n end",
"def key_name\n data[:key_name]\n end",
"def entity_key\n resource_name.underscore.to_sym\n end",
"def response_keys\n @response_keys ||= [\n 'content_size',\n 'content_type',\n 'created_at',\n 'effective_url',\n 'failed_at',\n 'failed_cid',\n 'failed_content_size',\n 'failed_content_type',\n 'failed_effective_url',\n 'failed_response_checksum',\n 'failed_response_cookie',\n 'failed_response_headers',\n 'failed_response_proto',\n 'failed_response_status_code',\n 'failed_response_status',\n 'fetched_at',\n 'fetched_from',\n 'fetching_at',\n 'fetching_try_count',\n 'forced_fetch',\n 'fresh',\n 'gid',\n 'hostname',\n 'job_id',\n 'job_status',\n 'parsed_at',\n 'parsing_at',\n 'parsing_fail_count',\n 'parsing_failed_at',\n 'parsing_status',\n 'parsing_try_count',\n 'parsing_updated_at',\n 'response_checksum',\n 'response_cookie',\n 'response_headers',\n 'response_proto',\n 'response_status_code',\n 'response_status',\n 'status',\n 'to_fetch',\n 'total_failures',\n 'total_requests',\n 'total_successes'\n ]\n end",
"def key_for(resource_name)\n [prefix, resource_name].join\n end",
"def get_resource_name\n\t\t@name + '_' + @hot.resources_list.length.to_s unless @name.empty?\n\tend",
"def resource_name\n resource_specification.name\n end",
"def json_key\n root || _type || object.class.model_name.to_s.underscore\n end",
"def resource_item_name\n resource_name.to_s.singularize.to_sym\n end",
"def resource_item_name\n resource_name.to_s.singularize.to_sym\n end",
"def name\n object[\"name\"]\n end",
"def get_key_from_result(res)\n res.fetch('id', {}).fetch('S', nil)\n end",
"def identifier\n fetch_response.display_identifier\n end",
"def name_key\n return base_key + \".name\"\n end",
"def name\n @curie_hash['name']\n end",
"def json_key\n root || _type ||\n begin\n object.class.model_name.to_s.underscore\n rescue ArgumentError\n 'anonymous_object'\n end\n end",
"def extract_resource_name_from_tag\n tags = resource[:tags] ? resource[:tags].map { |k,v| {key: k, value: v} } : []\n tags << {key: 'Name', value: name}\n end",
"def root_resource_name\n components.keys.first.to_s\n end",
"def message_keys action_name, status\n parent_resources = resource_definition.parent_resources\n resource_name = resource_definition.resource_name\n keys = []\n\n unless parent_resources.empty?\n parent_names = parent_resources.map(&:resource_name).join('.')\n\n if status\n keys << \"resources.#{parent_names}.#{resource_name}.#{action_name}.\"\\\n \"#{status}\"\n end # if\n keys << \"resources.#{parent_names}.#{resource_name}.#{action_name}\"\n end # unless\n\n keys << \"resources.#{resource_name}.#{action_name}.#{status}\" if status\n keys << \"resources.#{resource_name}.#{action_name}\"\n keys << \"resources.#{resource_name}.action.#{status}\" if status\n keys << \"resources.#{resource_name}.action\"\n keys << \"resources.#{action_name}.#{status}\" if status\n keys << \"resources.#{action_name}\"\n keys << \"resources.action.#{status}\" if status\n keys << 'resources.action'\n end",
"def [](key)\n response_object[key]\n end",
"def resource_name\n resource[:name].gsub(/\\s/, '_').downcase.singularize\n end",
"def name\n @resource.name\n end",
"def get_books(response)\n response[\"items\"]\nend",
"def name\n record.resource_id\n end",
"def retrieveKeyOfObjectType(resourceUri , resourceType , uriAttributeMap)\n\n if(resourceType == \"cifs-share-acls\")\n apiUri = \"/api/1.0/slo/cifs-shares/\"+uriAttributeMap[:cifs_share_key]+\"/\"+resourceType\n uriAttributeMap.delete(:cifs_share_key)\n elsif ($resourceTypePlural == \"snapshots\")\n apiUri = \"/api/1.0/slo/file-shares/\"+uriAttributeMap[:file_share_key]+\"/\"+resourceType\n uriAttributeMap.delete(:file_share_key)\n else\n apiUri = resourceUri\n end\n apiUri += '?'\n first = 1\n\n uriAttributeMap.each do |key, value|\n if (first == 0)\n apiUri += '&'\n end\n first = 0\n apiUri += key.to_s + '=' + value.to_s\n end\n key = transport.get_key(apiUri,resourceType)\n if(key)\n return key\n else\n return false\n end\n end",
"def resource_item_name\n current_definition.resource_item_name\n end",
"def fetch(key)\n return @body.fetch(key.upcase, nil)\n end",
"def fetch_key(reflection)\n case reflection.macro\n when :belongs_to then link_belongs_to(reflection)\n when :has_many then link_has_many(reflection)\n when :has_one then link_has_one(reflection)\n end\n end",
"def resource_key_for(field)\n @resource_key_for[field] ||= begin\n return field unless foreign_keys.include?(field)\n relationships.find { |r| r.foreign_key == field }.name.to_sym\n end\n end",
"def key\n attributes[:key]\n end",
"def key\n self.class.item_name\n end",
"def enclosing_resource_name\n enclosing_resource.class.name.underscore\n end",
"def resource_sym\n mapping.singular\n end",
"def resources_name\n @resources_name ||= resource_specification.name.pluralize\n end",
"def details_key; end",
"def service_name\n resource[:name]\n end",
"def event_memo_for(key)\n ::JSON.parse(@response.body.gsub(/.*(\\{.*\\}).*/, '\\1'))[key.to_s]\n end",
"def resource_name\n current_definition.resource_name\n end",
"def response_key? key\n self.response_keys.include? key.to_s.strip\n end",
"def resource_name\n return @resource_name\n end",
"def resource_name\n return @resource_name\n end",
"def resource_name\n return @resource_name\n end",
"def name\n @name ||= [action, resource.name, resource.type].compact.map(&:to_s).join('_').underscore\n end",
"def name\n data[:name]\n end",
"def key\n @key ||= name.to_s\n end",
"def response_for(key)\n message[key]\n end",
"def info(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |d, acc|\n info = extract_info(d)\n info.delete(:action)\n acc[info[:key]] = info\n end\n else\n info = extract_info(data)\n info.delete(:action)\n info\n end\n else\n nil\n end\n end",
"def key\n @attributes[:key]\n end",
"def key\n @attributes[:key]\n end",
"def get_key(name)\n return data_bag_item('rndc_keys', name).to_hash if node['dhcp']['use_bags']\n node['dhcp']['rndc_keys'].fetch name, ''\n end",
"def json_key(payload)\n File.join(\n 'repositories',\n payload.fetch(:data, :account, :name, 'default'),\n 'repository.json'\n )\n end",
"def get_response_hash(response, method)\n\t\t\treturn response[:envelope][:body][\"#{method}_response\".to_sym]\n\t\tend",
"def get_rebill_id()\n return @RESPONSE_HASH['REBID']\n end",
"def name\n self['name']\n end",
"def resource_name\n @resource_name\n end",
"def _name\n @link['name']\n end",
"def key(card_json); [card_json['set_name'], card_json['collector_num']]; end",
"def identifier\n rdf_resource\n end",
"def display_resource(recipe)\n recipe.name\n end",
"def display_resource(recipe)\n recipe.name\n end",
"def custom_key\n object.title\n end",
"def response_id\n self['id']\n end",
"def response_build_hash\n if @_config.json_root.present?\n begin\n fetch_from_body @_config.json_root\n rescue\n raise ResponseBuilderError, \"Could not find key #{@_config.json_root} in:\\n#{response_body}\"\n end\n else\n response_body\n end\n end",
"def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"def get_resource_key(res_id, xml_format=false)\n if res_id.is_a? String\n res_id = res_id.hex\n end\n\n # R.id integers are a concatenation of package_id, type_id, and entry index\n res_package = (res_id >> 24) & 0xFF\n res_type = (res_id >> 16) & 0xFF\n res_index = res_id & 0xFFFF\n\n package_element = @packages[res_package]\n if package_element == nil\n # This is not a resource we can parse\n return nil\n end\n\n res_spec = package_element.type_data[res_type-1]\n if res_spec == nil\n puts \"Could not find ResTypeSpec for #{res_package} #{res_type}\" if DEBUG\n return nil\n end\n\n entry = res_spec.types.entries[res_index]\n if entry == nil\n # There is no entry in our table for this resource\n puts \"Could not find #{res_spec.types.id} ResType chunk\" if DEBUG\n return nil\n end\n\n if xml_format\n return \"@#{res_spec.id}/#{entry.values[0].key}\"\n else\n return \"R.#{res_spec.id}.#{entry.values[0].key}\"\n end\n end",
"def resource_name\n @resource_name ||= get_resource_name\n end",
"def display_resource(book)\n book.title\n end",
"def resource_specific(responses, resource)\n logger.verbose(\"Looking through #{responses.size} matching cache \" \\\n \"entries for resource #{resource}.\")\n responses.select { |response| response.resource == resource }\n .map(&:token_response).first\n end",
"def resource_name\n @resource_name ||= self.class.to_s.underscore.gsub(%r{.*/([^/]+)\\z}, '\\1')\n end",
"def name_as_hash_key\n operation_as_string << @name << boost_as_string\n end",
"def key\n name.underscore.tr('/', '_').to_sym\n end",
"def resource(id)\n CODES.select{|hash| hash.has_key?(id.to_s)}[0]\n end",
"def resource_name\n resource.name.singularize.underscore\n end",
"def requests_get\n @attributes[:requests_get]\n end",
"def key\n (key_name || name).to_sym\n end",
"def resource_name\n resource_class.resource_name\n end",
"def name()\n @wrapped['name']\n end",
"def name()\n @wrapped['name']\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def rp_key\r\n self.class.rp_key\r\n end",
"def name\n @data['name']\n end",
"def resources\n @data.keys\n end",
"def lookup\n # gets a page (Hash) or a FB error\n page = @key_master.get_page(params[:name])\n respond_to do |format|\n format.json do\n render json: page, status: (page.is_a?(Hash) ? :ok : :not_found)\n end\n end\n end",
"def resources_name\n self.class.resources_name\n end",
"def names\n cached_json_for_searchbar = current_educator.student_searchbar_json\n\n if cached_json_for_searchbar\n render json: cached_json_for_searchbar\n else\n render json: SearchbarHelper.names_for(current_educator)\n end\n end",
"def names\n cached_json_for_searchbar = current_educator.student_searchbar_json\n\n if cached_json_for_searchbar\n render json: cached_json_for_searchbar\n else\n render json: SearchbarHelper.names_for(current_educator)\n end\n end",
"def pretty_resource_name\n Heroics.pretty_name(resource_name)\n end",
"def key\n @key.id2name\n end",
"def resource_base_name\n 'JSON'\n end",
"def display_resource(buyer)\n buyer.full_name\n end",
"def name\n @data['name']\n end",
"def api_keys\n rest_query(:api_key)\n end",
"def [](key)\n @response[key.to_s.camelcase(:lower)]\n end",
"def resource_name\n name.ns_underscore.pluralize\n end",
"def ref_key(hash)\n\t\t\t(REF_PROPERTIES.collect { |k| hash[k] } ).to_json\n\t\tend",
"def attribute_render_naming\n JSON_ATTRIBUTE_RENDER_NAMING\n end",
"def key\n @fact_name\n end"
] |
[
"0.6497969",
"0.6203025",
"0.5927049",
"0.58522993",
"0.5756338",
"0.573681",
"0.5632388",
"0.5599015",
"0.55635786",
"0.5557683",
"0.553708",
"0.5508156",
"0.5482203",
"0.5472907",
"0.54635125",
"0.5448371",
"0.5434228",
"0.5426645",
"0.54165304",
"0.5405529",
"0.54032314",
"0.53937393",
"0.53634185",
"0.5362383",
"0.53572375",
"0.5343426",
"0.53378797",
"0.5335009",
"0.5333099",
"0.53164387",
"0.5299847",
"0.5291647",
"0.5288255",
"0.5282111",
"0.527728",
"0.5259466",
"0.5252707",
"0.52452207",
"0.5220815",
"0.52077407",
"0.51992553",
"0.5198154",
"0.5198154",
"0.5198154",
"0.51942873",
"0.5190812",
"0.5185121",
"0.51807624",
"0.5173206",
"0.51675427",
"0.51675427",
"0.51620984",
"0.51611185",
"0.51508087",
"0.51493865",
"0.51432866",
"0.51348704",
"0.5133177",
"0.51296294",
"0.5124527",
"0.5122345",
"0.5122345",
"0.5116867",
"0.5116313",
"0.51091725",
"0.51085865",
"0.51079017",
"0.51057774",
"0.51053256",
"0.5095299",
"0.50892764",
"0.5085523",
"0.5083816",
"0.5083376",
"0.5078664",
"0.5065241",
"0.506522",
"0.5062363",
"0.50615704",
"0.50615704",
"0.50544643",
"0.50544643",
"0.50460464",
"0.5037534",
"0.5031351",
"0.5028075",
"0.50251025",
"0.50129277",
"0.50129277",
"0.50089407",
"0.50055015",
"0.5001041",
"0.5000296",
"0.49967137",
"0.49949583",
"0.49940985",
"0.49939856",
"0.49896201",
"0.4984405",
"0.4981954"
] |
0.6574003
|
0
|
Return an array of Resources from the response body
|
def resources
@resources ||= process_data(decoded_body[resources_key])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def resources\n body && [*body]\n end",
"def elements\n begin\n if %w(tags posts).include?(@resource.to_s)\n return parsed_response[@resource.to_s][singular_r_name] || []\n elsif %w(bundles).include?(@resource.to_s)\n return parsed_response[@resource.to_s].empty? ? [] : parsed_response[@resource.to_s].map {|el| el[singular_r_name] } \n end\n rescue NoMethodError => e \n return parsed_response\n end\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def resources\n @resources ||= []\n end",
"def resources\n @resources.values\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def index\n @api_v1_resources = Api::V1::Resource.all\n end",
"def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend",
"def index\n @resources = resource_class.send(:all)\n render json: @resources\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"def resources\n @resources\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end",
"def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end",
"def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end",
"def all\n api_get(path)\n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end",
"def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end",
"def all\n describe(resource_uri)\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\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 resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def all_clients\n resp = get CLIENT_API_PATH\n result = process_response(resp)\n return [] if result.empty? # In case response is {}\n result.each.map { |c| Resources::Client.new(c) }\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def items\n response[\"items\"]\n end",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def resource_all(stack)\n all_result_pages(nil, :body,\n \"ListStackResourcesResponse\", \"ListStackResourcesResult\",\n \"StackResourceSummaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListStackResources\",\n \"StackName\" => stack.id,\n )\n ),\n )\n end.map do |res|\n Stack::Resource.new(\n stack,\n :id => res[\"PhysicalResourceId\"],\n :name => res[\"LogicalResourceId\"],\n :logical_id => res[\"LogicalResourceId\"],\n :type => res[\"ResourceType\"],\n :state => res[\"ResourceStatus\"].downcase.to_sym,\n :status => res[\"ResourceStatus\"],\n :updated => res[\"LastUpdatedTimestamp\"],\n ).valid_state\n end\n end",
"def resources\n @resources ||= @internal_struct[:resources] || {}\n end",
"def results_from(response)\n response.data.collect do |obj|\n case resource\n when RedboothRuby::Client\n next unless resource_form_hash(obj.merge(session: session))\n resource_form_hash(obj.merge(session: session))\n else\n resource.new(obj.merge(session: session))\n end\n end.compact\n end",
"def resource_list\n self.resources\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def items\n # [obj_or_array].flatten makes this always be an array (lastfm gives\n # the single object when it's not an array)\n [main_result[response_type]].flatten.compact rescue []\n end",
"def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end",
"def get_responses(entries)\n responses = entries.map do |entry|\n entry.responses\n end\n responses.flatten.compact\n end",
"def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def resources\n @resources ||= {}\n end",
"def to_a\n resources\n end",
"def all\n results_from(response)\n end",
"def resources\n @data.keys\n end",
"def assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = Solr::Query.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = {}\n item['pid'] = doc.id\n item['files'] = assets_and_surrogates(doc)\n\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end",
"def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end",
"def resources\n Loader.resources.keys\n end",
"def resources\n @resources ||= Marshal.load(Marshal.dump(@@resources))\n end",
"def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end",
"def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end",
"def get_nested_resource_objects\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def index\n @resources = Resource.all\n converted_resources = @resources.map do |r|\n {\n id: r.id,\n name: r.name,\n timeLimit: r.time_limit,\n visible: r.visible,\n vaccine: r.vaccine,\n questions: r.questions\n }\n end\n render json: converted_resources, status: :ok\n end",
"def responses\n @responses ||= api::BatchResponse.new(responses: responses_by_request.values.uniq)\n end",
"def to_response\n []\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def get_linked_resources(resource_type, filters = {})\n Util.convert_to_clever_object Clever.request(:get, get_uri(resource_type), filters)[:data]\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def list\n ret = get()\n return [] if ret.is_a? Hash and ret.has_key? :error\n ret.map do |item|\n if item[:content_type].nil? or item[:content_type].empty? then\n item[:content_type] = 'application/json'\n end\n # XXX should this update the script header?\n RouteItem.new(item)\n end\n end",
"def responses\n object.questions.map do |q|\n Embedded::ResponseSerializer.new(q.filtered_responses.first,root: false)\n end\n end",
"def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\t@resources.push(File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end",
"def index\n respond_with(Response.collection_as_unity_JSON(:all))\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def resources(oneview_type = nil, oneview_name = nil)\n oneview_type = @options[:oneview_type] if oneview_type.nil?\n oneview_name = @options[:oneview_name] if oneview_name.nil?\n raise 'Oneview resource type must be specified.' if oneview_type.nil?\n\n # Determine the endpoint that needs to be called\n endpoint = format('/rest/%s', oneview_type)\n\n # Find the resources\n response = oneview_client.rest_get(endpoint)\n resources = oneview_client.response_handler(response)\n\n return resources if oneview_name.nil?\n\n # Filter the resources by the name if it has been specified\n resources['members'].select { |r| r['name'] == oneview_name }\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def all\n response = RestClient::Request.execute({\n url: \"https://#{connection.path}/apiv1/Get\",\n method: :get,\n verify_ssl: false,\n headers: { params: { typeName: geotab_reference_name, credentials: connection.credentials, search: formatted_conditions }}\n })\n\n body = MultiJson.load(response.body).to_ostruct_recursive\n\n if MultiJson.load(response.body).has_key?(\"error\")\n if body.error.errors.first.message.start_with?(\"Incorrect MyGeotab login credentials\")\n raise IncorrectCredentialsError, body.error.errors.first.message\n else\n raise ApiError, body.error.errors.first.message\n end\n else\n attributes = body.result\n results = []\n\n if attributes && attributes.any?\n attributes.each do |result|\n results.push(new(result, connection))\n end\n end\n\n reset\n\n results\n end\n end",
"def index\n @resources = Resource.all\n end",
"def resource_relations\n @resource_relations ||= Relation.from_links(client,\n decoded_body[:links])\n end",
"def get_resources(authorization, \n user_id = nil, \n page = 1, \n per_page = 10)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/resources'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'user_id' => user_id,\n 'page' => page,\n 'per_page' => per_page\n }, array_serialization: Configuration.array_serialization\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetResourcesResponse.from_hash(decoded)\n end",
"def collection\n resource_class.all\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def scrape_resources(opts = {})\n BBLib::HashStruct.new.tap do |hash|\n resources.each do |resource|\n hash[resource.name] = resource.retrieve(opts)\n end\n end\n end",
"def all(options = {})\n raise MethodNotAllowed.new(self, :all) unless self.class.permissions && self.class.permissions[:read]\n response_body = http_get(parse_params(options))\n response = parse_response(response_body, options)\n response_items = response.response_items || []\n end",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def resources\n @resources ||= begin\n resources = request_path.strip.\n split('/').\n compact.\n map(&:strip).\n each_with_index.\n select { |_, index| index % 2 == 1 }.\n map { |a, _| a.to_sym }\n\n *rest, tail = *resources\n if RAILS_METHODS.index(tail)\n rest\n else\n resources\n end\n end\n end",
"def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend",
"def process_array response, body\n body.map do |element|\n from_response response, element\n end\n end",
"def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"def list_assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = list_files_with_surrogates(doc)\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end",
"def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end",
"def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end",
"def index\n @resources = Resource.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def batch_responses\n return [@result] unless @batch_response\n # if batch response, generate array based on the response hash.\n @result.map do |r|\n next r unless r.is_a?(Hash)\n hash = r[SUCCESS] || r[ERROR]\n Parse::Response.new hash\n end\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def items\n @items ||= items_from_response\n end",
"def list\n @api.get(\"#{@api.path}/Images\")\n end"
] |
[
"0.7762595",
"0.73285437",
"0.69553196",
"0.6887481",
"0.6771974",
"0.66755265",
"0.661304",
"0.661304",
"0.661304",
"0.642064",
"0.6392817",
"0.6371199",
"0.634188",
"0.6317118",
"0.6308756",
"0.62940305",
"0.6287624",
"0.62645566",
"0.6253435",
"0.625116",
"0.6240897",
"0.62210095",
"0.618597",
"0.6176389",
"0.61494356",
"0.6108506",
"0.61019427",
"0.6093635",
"0.6086067",
"0.60823816",
"0.60779124",
"0.6060155",
"0.60562515",
"0.6051669",
"0.60514367",
"0.60453665",
"0.6044161",
"0.6044091",
"0.6037064",
"0.60332036",
"0.6011926",
"0.59848595",
"0.5978077",
"0.5956662",
"0.5952519",
"0.59302956",
"0.59198266",
"0.59166557",
"0.5904239",
"0.59027565",
"0.58986425",
"0.5892558",
"0.58844805",
"0.58811617",
"0.58779484",
"0.587548",
"0.58676845",
"0.5836665",
"0.5830998",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58292085",
"0.58280957",
"0.5792847",
"0.57878417",
"0.57808924",
"0.5778238",
"0.5778131",
"0.5777528",
"0.5777528",
"0.5777528",
"0.57619727",
"0.57601964",
"0.575612",
"0.5755763",
"0.5751784",
"0.57455945",
"0.57430667",
"0.5716677",
"0.5713801",
"0.57130766",
"0.56813043",
"0.56748784",
"0.5674503",
"0.56703305",
"0.56681544",
"0.56666476",
"0.5659615",
"0.5647994",
"0.5647305",
"0.56452006",
"0.5640529",
"0.5637336"
] |
0.73566824
|
1
|
Returns a Hash of relations built from given links templates. These relations are the same for each resource, so we calculate them once here and pass to every top level resource.
|
def resource_relations
@resource_relations ||= Relation.from_links(client,
decoded_body[:links])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def links\n _links = { self: polymorphic_url(record_with_ancestor_chain(@record)) }\n\n resources.each do |name, resource|\n _links.update(name => polymorphic_url(record_with_ancestor_chain(resource)))\n end\n\n sub_resources.each do |sub_resource|\n _links.update(sub_resource => polymorphic_url(record_with_ancestor_chain(@record) << sub_resource))\n end\n\n { _links: _links }\n end",
"def hash\n [fully_qualified_rel, raw_href, templated?].hash\n end",
"def hash\n [fully_qualified_rel,\n raw_href,\n templated?].hash\n end",
"def links\n @links ||= lambda do \n raw_links.map do |link|\n hash = {}\n link.keys.each do |key|\n hash[key] = link[key]\n end\n hash\n end\n end.call\n end",
"def hash\n [fully_qualified_rel,\n tmpl.pattern,\n templated?].hash\n end",
"def gen_relations(shapes)\n @relations = Hash.new\n shapes.each do |shape1|\n @relations[shape1.id] = Array.new\n shapes.each do |shape2|\n if shape1 != shape2\n @relations[shape1.id] << {shape2.id => shape1.get_relation(shape2)}\n end\n end\n end\n end",
"def map_relations\n self.resource_relations = {}\n model.alchemy_resource_relations.each do |name, options|\n relation_name = name.to_s.gsub(/_id$/, \"\") # ensure that we don't have an id\n association = association_from_relation_name(relation_name)\n foreign_key = association.options[:foreign_key] || \"#{association.name}_id\".to_sym\n collection = options[:collection] || resource_relation_class(association).all\n resource_relations[foreign_key] = options.merge(\n model_association: association,\n name: relation_name,\n collection: collection\n )\n end\n end",
"def find_relations(resource_uri, actual_resource_data, type)\n out = {\n sections: {},\n relations: []\n }\n\n puts \"- properties to find size[#{actual_resource_data.size}]\" if @console_output\n\n time = Benchmark.realtime {\n out[:relations] = actual_resource_data.map! { |resource_data|\n section_group = resource_data[:section].scan(SCAN_REGEXP[:group])\n\n type_key = resource_data[:section].force_encoding('utf-8')\n\n out[:sections][type_key] ||= {\n type: section_group[0][0],\n from: section_group[0][1].to_i,\n to: section_group[0][2].to_i,\n }\n\n result = get_predicates_by_link(resource_uri, resource_data[:link], type)\n\n resource_data[:properties] = result[:properties]\n resource_data[:strict_properties] = result[:strict_properties]\n\n resource_data\n }.compact || []\n }\n\n out[:time] = time.round(2)\n\n puts \"- properties found in #{out[:time]}\" if @console_output\n\n out\n end",
"def relations\n @relations ||= {}\n end",
"def hash\n [links, organization_id].hash\n end",
"def expand_links(actual_params)\n ResourceTemplates.new(\n select{|rt| (rt.positional_params(rt.parent) - rt.optional_params).empty?}.map {|rt|\n {\n \"name\" => rt.name,\n \"rel\" => rt.rel,\n \"uri_template\" => rt.partial_expand_uri_template(rt.uri_template, actual_params),\n \"path_template\" => rt.partial_expand_uri_template(rt.path_template, actual_params),\n \"params\" => rt.params - actual_params.keys,\n \"optional_params\" => rt.optional_params - actual_params.keys,\n \"options\" => rt.options\n }\n })\n end",
"def links\n _links = parent_link.update({\n self: { href: @controller.polymorphic_url(collection_hierarchy) }\n })\n\n { _links: _links }\n end",
"def to_hash\n @relations.each_with_object({}) do |(rel,val), obj|\n rel = rel.to_s\n\n hashed_val = val.map(&:to_hash)\n if val.length == 1 && !single_item_arrays?\n hashed_val = val.first.to_hash\n end\n\n obj[rel] = hashed_val\n end\n end",
"def to_hash\n hash = {}\n \n hash[\"name\"] = name if name && !name.empty?\n hash[\"rel\"] = rel if rel && !rel.empty?\n hash[\"uri_template\"] = uri_template if uri_template && !uri_template.empty?\n hash[\"path_template\"] = path_template if path_template && !path_template.empty?\n\n hash[\"params\"] = params if params && !params.empty?\n hash[\"optional_params\"] = optional_params if optional_params && !optional_params.empty?\n hash[\"options\"] = options if options && !options.empty?\n\n hash[\"resource_templates\"] = resource_templates.to_parsed if !resource_templates.empty?\n \n hash\n end",
"def get_relations_hash(project_id = nil, base_ids = nil, sort = false)\n\t\treturn [] if base_ids == []\n\t\tget_relations(project_id, base_ids, sort).as_json\n\tend",
"def hash\n [principals, relation].hash\n end",
"def get_resources_for_template block\n resource_hash = { resource1: block.firstres, resource2: block.secondres }\n return resource_hash \n end",
"def hash\n [rel, href].hash\n end",
"def create_reference_to_subpaths_map(references, asset_aggregator)\n out = { }\n references.each { |r| out[r] = r.aggregate_subpaths(asset_aggregator) }\n out\n end",
"def relations\n @relations ||= process_rels\n end",
"def relations_by_type\n relations = {}\n for i in 0..(self.relations.count-1)\n type = self.relations(i).type.first\n relations[type] ||= []\n relations[type] += self.relations(i).id\n end\n relations\n end",
"def process_rels\n links = ( @headers[\"Link\"] || \"\" ).split(', ').map do |link|\n href, name = link.match(/<(.*?)>; rel=\"(\\w+)\"/).captures\n\n [name.to_sym, Relation.from_link(@agent, name, :href => href)]\n end\n\n Hash[*links.flatten]\n end",
"def to_parsed\n map {|resource_template| resource_template.to_hash}\n end",
"def taggings_with_slugs(links)\n links_with_slugs = {}\n\n # We still call topics \"specialist sectors\" in rummager.\n links_with_slugs[\"specialist_sectors\"] = links[\"topics\"].to_a.map do |content_item|\n content_item[\"base_path\"].sub(\"/topic/\", \"\")\n end\n\n links_with_slugs[\"mainstream_browse_pages\"] = links[\"mainstream_browse_pages\"].to_a.map do |content_item|\n content_item[\"base_path\"].sub(\"/browse/\", \"\")\n end\n\n links_with_slugs[\"organisations\"] = links[\"organisations\"].to_a.map do |content_item|\n content_item[\"base_path\"].sub(\"/government/organisations/\", \"\").sub(\"/courts-tribunals/\", \"\")\n end\n\n links_with_slugs[\"primary_publishing_organisation\"] = links[\"primary_publishing_organisation\"].to_a.map do |content_item|\n content_item[\"base_path\"].sub(\"/government/organisations/\", \"\").sub(\"/courts-tribunals/\", \"\")\n end\n\n links_with_slugs[\"taxons\"] = content_ids_for(links, \"taxons\")\n\n links_with_slugs\n end",
"def hash_by_uri\n @hash_by_uri ||= begin\n result = {}\n flatten_hierarchy.each do |c|\n result[c.uri.to_s]=c\n end\n result\n end\n end",
"def top_level_links\n links = @options.fetch(:base_links, {})\n\n links.merge!(@operation_results.links)\n\n @operation_results.results.each do |result|\n links.merge!(result.links)\n\n # Build pagination links\n if result.is_a?(JSONAPI::ResourcesOperationResult) || result.is_a?(JSONAPI::RelatedResourcesOperationResult)\n result.pagination_params.each_pair do |link_name, params|\n if result.is_a?(JSONAPI::RelatedResourcesOperationResult)\n relationship = result.source_resource.class._relationships[result._type.to_sym]\n links[link_name] = @serializer.link_builder.relationships_related_link(result.source_resource, relationship, query_params(params))\n else\n links[link_name] = @serializer.query_link(query_params(params))\n end\n end\n end\n end\n\n links.deep_transform_keys { |key| @key_formatter.format(key) }\n end",
"def to_hash\n ret = {}\n \n self.methods.each do |method|\n name = method.id2name.gsub('=', '')\n val = self.method(name).call if method.id2name[-1] == '=' and self.respond_to?(name) \n ret[\"#{name}\"] = val unless val.nil? or ['!', 'others', 'resources'].include?(name)\n end\n \n ret[\"resources\"] = self.resources.collect { |resource| resource.to_hash }\n \n ret\n end",
"def relations=(links = nil)\n @relations = if links\n Relation.from(links).inject(@relations || {}) do |map, rel|\n map.update rel.name => rel.merge(@schema, @schema.all)\n end\n else\n {}\n end\n end",
"def create_subpath_to_references_map(references, reference_to_subpaths_map)\n out = { }\n references.each do |r|\n reference_to_subpaths_map[r].each do |subpath|\n out[subpath] ||= [ ]\n out[subpath] << r\n end\n end\n out\n end",
"def prepare_links!\n links_def = find_links_definition or return\n \n links_def.rel2block.each do |link|\n links.update_link(Feature::Hypermedia::Hyperlink.new.tap do |hyperlink| # create Hyperlink representer.\n hyperlink.rel = link[:rel]\n hyperlink.href = run_link_block(link[:block])\n end)\n end\n end",
"def resources\n ([self] + parent_groups).reverse.inject({}) do |memo, group|\n begin\n memo.merge(group.poise_spec_helpers[:resources] || {})\n rescue NoMethodError\n memo\n end\n end\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 links\n links = Hash.new([])\n order = []\n each_with_rescue(@notes) do |note|\n order << note.row\n links[note.row] += [link_helper(note)]\n end\n\n html = ''\n order.uniq!\n order.each do |row|\n html << \"#{row.is_a?(String) ? row : row.to_s.camelize}: #{links[row].join(\" | \\n\")}<br />\"\n end\n html\n end",
"def resource2hash(resources)\n JSON.parse resources.to_h.to_json\n end",
"def relations\n return @relations if defined?(@relations)\n\n relations = injected_options.fetch(:relations, nil)\n relations = allowed_options.fetch(:relations, []) if relations.nil?\n\n @relations = Relations.new(relations, includes)\n end",
"def normalize_links\n @links.map! do |link|\n relationship = case link\n when Symbol, String then @relationships[link]\n when Associations::Relationship then link\n end\n\n if relationship.respond_to?(:links)\n relationship.links\n else\n relationship\n end\n end\n\n @links.flatten!\n @links.uniq!\n end",
"def links\n url = @controller.request.url\n url = url.split('.')[0..-2].join('.') if url =~ /\\.\\w+$/\n\n parent_url = url.split('/')[0..-2].join('/')\n parent_name = parent_url.split('/')[0..-2].last.singularize\n\n _links = {\n self: { href: url },\n parent_name => { href: parent_url }\n }\n\n { _links: _links }\n end",
"def as_template\n result_hash = {}\n\n 🌊[:columns].each_with_object(result_hash) do |column|\n result_hash[column] = read_attribute_for_template(column)\n end\n\n 🌊[:associations].each do |association|\n records = send(association)\n result_hash[association] = if records.respond_to?(:to_ary)\n records.to_ary.map { |r| r.as_template }\n else\n records.as_template\n end\n end\n\n result_hash\n end",
"def resource_relations_names\n resource_handler.resource_relations.collect { |_k, v| v[:name].to_sym }\n end",
"def relationship_links(source)\n {}\n end",
"def links\n curations = self.curations.select do |curation|\n curation.rating != '0' and curation.status != 'deleted'\n end\n\n links = curations.map do |curation|\n link = Link.find(curation.link_id)\n owner = User.find(link.link_owner)\n link_for_app = {\n curation_id: curation.id,\n link_id: link.id,\n status: curation.status,\n rating: curation.rating,\n date_added: curation.created_at,\n url: link.url,\n url_type: link.url_type,\n title: link.title,\n image: link.image,\n comment: curation.comment,\n shared_with: people_shared_with(link, owner),\n tags: curation.tags,\n owner: {\n name: owner.name,\n phone: owner.phone,\n }\n }\n link_for_app\n end\n links.sort_by { |link| link[:date_added] }.reverse\n end",
"def generate_person_and_task_relations(relations)\n relations.each_pair { |person_id, values|\n values.each { |task_id|\n @db_base.map_task_to_person(person_id, task_id)\n }\n }\n end",
"def get_associated_assembly_cmp_refs\n ndx_ret = {}\n get_objs(cols: [:assembly_templates]).each do |r|\n component_template = r[:component_template]\n pntr = ndx_ret[component_template[:id]] ||= component_template.merge(component_refs: [])\n pntr[:component_refs] << r[:component_ref].merge(r.hash_subset(:id, :display_name, :node, :assembly_template))\n end\n ndx_ret.values\n end",
"def resolve_collections\n @resolved_collections = resolved_associations_map.inject({}) do |hash, (k,v)|\n collection_records = []\n collection_associations = Array.wrap(v[:associations])\n collection_associations.each do |association|\n add_records_from_collection_association(relation, association, collection_records)\n end\n collection_records.flatten!\n collection_records.compact!\n collection_records.uniq!\n hash[k] = collection_records\n hash\n end\n end",
"def model_relationships\n hash = ActiveSupport::OrderedHash.new\n reflect_on_all_associations.map { |i| hash[i.name] = i.macro }\n return hash\n end",
"def relationships\n @relationships ||= {}\n end",
"def links\n valid_link_keys = %w(mandate new_customer_bank_account organisation parent_event payment payout previous_customer_bank_account refund subscription )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: '',\n\n new_customer_bank_account: '',\n\n organisation: '',\n\n parent_event: '',\n\n payment: '',\n\n payout: '',\n\n previous_customer_bank_account: '',\n\n refund: '',\n\n subscription: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def references_hash\n {\n 'http://schema.org/url' => @metadata['landing_page'],\n 'http://resources.arcgis.com/en/help/arcgis-rest-api' => @metadata['url']\n }\n end",
"def links\n valid_link_keys = %w(creditor creditor_bank_account )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n creditor: '',\n\n creditor_bank_account: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def as_json(request)\n {\n :links => [\n *models.map { |k,v| {:rel => k, :href => request.add_path(k).full_path } },\n {:rel => 'self', :href => request.full_path}\n ]\n }\n end",
"def get_relations\n # Descobrir as relacoes:\n # Orientados\n # Projetos de Pesquisa\n # Producoes Bibliograficas\n # Consultar o RP de cada uma\n # Somar os RPs e retornar\n orientados = self.get_relations_of_orientados\n projetos = self.get_relations_of_projetos_pesquisa\n producoes = self.get_relations_of_producoes_bibliograficas\n\n relations = (orientados | projetos | producoes).delete self.id\n return relations.to_a\n end",
"def load_relations\n relations = Relation.registry(gateways, relation_classes)\n RelationRegistry.new(relations)\n end",
"def prepare_links!(*args)\n compile_links_for(_link_configs, *args).each do |link| \n rel = link.delete :rel\n links[rel] = link\n end\n end",
"def source_relations\n query = \"at:link[@rel = '#{Rel[repository.cmis_version][:relationships]}']/@href\"\n link = data.xpath(query, NS::COMBINED)\n if link.length == 1\n link = Internal::Utils.append_parameters(link.text, \"relationshipDirection\" => \"source\", \"includeSubRelationshipTypes\" => true)\n Collection.new(repository, link)\n else\n raise \"Expected exactly 1 relationships link for #{key}, got #{link.length}, are you sure this is a document/folder?\"\n end\n end",
"def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end",
"def ddd_relations_to_hash(ddd)\n ret = {}\n ddd.each do |d|\n d[:relations].each do |r|\n if ret.key?(r[:full_relation_name])\n raise \"duplicate relation #{r[:full_relation_name]}\"\n end\n ret[r[:full_relation_name]] = r\n end\n end\n ret\n end",
"def map_entity_relations\n assignments = @db_base.query_assignments\n results = Hash.new()\n assignments.each { |result|\n results[result[\"P_Id\"]] = result[\"T_Id\"]\n }\n return results\n end",
"def content_entries_with_relationships_to_hash\n [].tap do |updates|\n self.with_relationships.each do |(slug, content_entry)|\n changes = {}\n\n content_entry.content_type.fields.each do |field|\n case field.type.to_sym\n when :belongs_to\n if target_id = content_entry.dynamic_getter(field.name).try(:_id)\n changes[\"#{field.name}_id\"] = target_id\n end\n when :many_to_many\n target_ids = content_entry.dynamic_getter(field.name).map(&:_id).compact\n unless target_ids.empty?\n changes[\"#{field.name}_ids\"] = target_ids\n end\n end\n end\n\n updates << { _id: content_entry._id, slug: slug }.merge(changes)\n end\n end\n end",
"def relations_info\n self::RELATIONS_INFO\n end",
"def links\n each_link.to_set\n end",
"def hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\n end",
"def get_relation_data_as_hash(query) \n return {} if @relations.nil? or @relations.empty?\n\n includes = get_includes(query)\n\n reldata = {}\n\n @relations.each do |name, relation| \n unless includes.find_index(name).nil?\n sql = get_relation_query_sql(relation, query)\n tables = get_relation_tables(relation)\n data = cached_query(sql,tables)\n reldata[name] = map_to_hash_of_arrays_by_key(data,'_table_key')\n remove_key_from_hash_of_arrays!(reldata[name],'_table_key')\n end\n end\n reldata\n end",
"def link_data\n data = {}\n @options[:tags].keys.each do |key|\n data[key.to_sym] = self.instance_eval(key.to_s)\n end\n data\n end",
"def all_by_name(h = {})\n inject(h) do |hash, resource_template|\n hash[resource_template.name] = resource_template if resource_template.name\n resource_template.resource_templates.all_by_name(hash)\n hash\n end\n h\n end",
"def to_create_resources\n resources = {}\n\n @data.each_key {|topkey|\n\n # The top level key is the interface name\n ifname = topkey.to_sym\n\n if @data[topkey][:addrs]\n if @data[topkey][:addrs].is_a? Array\n @data[topkey][:addrs].each {|i|\n if i =~ /inet6 /\n key = \"ifconfig_#{ifname}_ipv6\"\n elsif i =~ /inet /\n key = \"ifconfig_#{ifname}\"\n else\n key = \"ifconfig_#{ifname}\"\n end\n\n # Set the value property on the resource\n resources[key] = {\n \"value\" => i,\n }\n }\n else\n key = \"ifconfig_#{ifname}\"\n resources[key] = {\n \"value\" => @data[topkey][:addrs],\n }\n end\n end\n\n if @data[topkey][:aliases] and @data[topkey][:aliases].is_a? Array\n @data[topkey][:aliases].each_with_index {|a,i|\n key = \"ifconfig_#{ifname}_alias#{i}\"\n resources[key] = {\n \"value\" => a,\n }\n }\n end\n }\n\n Puppet.debug(\"Returning resources: #{resources}\")\n\n resources\n end",
"def links(data)\n\tlinks =\n\t\tdata.collect do |course, deps|\n\t\t\tdeps.collect do |dependency|\n\t\t\t\t[course, dependency]\n\t\t\tend\n\t\tend\n\tlinks =\n\t\tlinks.flatten(1).collect do |course, dependency|\n\t\t\t{\n\t\t\t\t'source' => dependency,\n\t\t\t\t'target' => course,\n\t\t\t\t'color' => '#3399FF'\n\t\t\t}\n\t\tend\n\t\n\treturn links\nend",
"def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end",
"def prepare_links!(*args)\n # TODO: move this method to _links or something so it doesn't need to be called in #serialize.\n compile_links_for(link_configs, *args).each do |lnk|\n links.add(lnk) # TODO: move to LinkCollection.new.\n end\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def extended_json(resource)\n return resource.as_json.to_hash unless resource.respond_to?(:links)\n return resource.as_json.to_hash unless resource.links.kind_of?(Occi::Core::Links)\n\n links = resource.links\n ext_json = resource.as_json\n ext_json.links = links.as_json\n ext_json.to_hash\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 build_relationship_token_map\n rel_map = HashExtra[Hash.new{|h,k| h[k] = Set.new}]\n my_name = name_sym.to_s # no leading module names\n relationships.each do |(rel_name,)|\n toks = (rel_name.split('_') - [my_name])\n toks.each{|tok| rel_map[tok].add(rel_name)}\n end\n rel_map\n end",
"def media_file_references\n mf_references = {}\n\n self.collectionobject_links.each do |co_link|\n begin\n co_resource = Resource.find(co_link.resource_id)\n\n MediaFile.where('sourceable_id=? AND resource_id=?', co_link.id, self.id).find_each do |media_resource|\n if media_resource.access == 1 and media_resource.display_collectionobject_link == 1\n mf_references[co_resource.id] = [co_resource.title, co_resource.collection_identifier]\n end\n end\n rescue => e\n # noop\n end\n end\n return mf_references\n end",
"def relations\n _relations\n end",
"def relations\n _relations\n end",
"def hash\n [_self, _links, _schema, _revision, _system_owned, display_name, description, tags, _create_user, _protection, _create_time, _last_modified_time, _last_modified_user, id, resource_type, path, parent_path, unique_id, relative_path, children, overridden, marked_for_delete, tcp_closed, tcp_opening, udp_single, tcp_finwait, tcp_first_packet, tcp_closing, tcp_established, udp_multiple, icmp_error_reply, udp_first_packet, icmp_first_packet].hash\n end",
"def link_to_target_refs(to_link_array)\n return if to_link_array.empty?\n create_ngrs_objs_hash = to_link_array.inject({}) do |h, to_link_el|\n h.merge(Input::BaseNodes.target_ref_link_hash(to_link_el.node_instance_id, to_link_el.target_ref.id))\n end\n create_objs_hash = { node_group_relation: create_ngrs_objs_hash }\n Model.input_hash_content_into_model(@target.id_handle(), create_objs_hash)\n end",
"def links\n return unless current_user\n\n {}.tap do |links|\n links[:accept] = accept_api_space_path(object) if can_accept?\n links[:add_data] = add_data_api_space_path(object) if can_edit?\n links[:show] = api_space_path(object) if can_access? || current_user.review_space_admin?\n links[:delete] = delete_api_space_path(object) if can_delete?\n links[:lock] = lock_api_space_path(object) if can_lock?\n links[:unlock] = unlock_api_space_path(object) if can_unlock?\n links[:update] = api_space_path(object) if can_update?\n links[:update_tags] = tags_api_space_path(object) if can_update?\n links[:apps] = api_apps_path(object) if can_access?\n links[:files] = api_files_path(object) if can_access?\n links[:workflows] = api_workflows_path(object) if can_access?\n links[:jobs] = api_jobs_path(object) if can_access?\n links[:members] = members_api_space_path(object) if can_access?\n links[:show_shared] = api_space_path(object.space) if object.confidential?\n\n if object.shared? && confidential_space\n links[:show_private] = api_space_path(confidential_space)\n end\n end\n end",
"def get_rels\n @rels = []\n @heads.each_with_index do |h1, i|\n @heads[i+1..-1].each do |h2|\n path = @graph.shortest_path(h1, h2)\n s = path.shift\n o = path.pop\n @rels << [s, path, o] if (path & @heads).empty?\n end\n end\n end",
"def relations\n Relations::RelationTraverser.new(@internal_node)\n end",
"def related_data\n @resource.related_identifiers.where(verified: true).where(hidden: false).map do |ri|\n { relation: ri.relation_type_friendly&.camelize(:lower), identifier: ri.related_identifier }\n end || []\n end",
"def references\n references = Hash.new\n properties.each do |key, value|\n next if key == 'event_type'\n if key.match(/^(.*)_(username|id|hostname)/)\n reference_type = $1\n column = $2.to_sym\n Optopus::Models.list.each do |model|\n if model.respond_to?(:table_name) && model.table_name.singularize == reference_type\n references[reference_type] = model.where(column => value).first\n break\n end\n end\n end\n end\n references\n end",
"def subresources\n if any?\n { collection_rel => self }\n else\n {}\n end\n end",
"def build_links(hash)\n html = \"\"\n if hash.is_a?(Array)\n html << '<ul>'\n hash.each do |link|\n html << '<li>' << link_to(t(link[\"rel\"]), localize_url(link[\"href\"])) << '</li>'\n end\n html << '</ul>'\n else\n html << link_to(t(hash[\"rel\"]), localize_url(hash[\"href\"]))\n end\n html\n end",
"def hash\n {\n \"name\" => @name,\n \"policies\" => {\n \"attached\" => @attached_policies,\n \"inlines\" => @inlines.flatten,\n \"static\" => @statics,\n \"templates\" => @templates\n }\n }\n end",
"def relation_aliases\n @relation_aliases ||= relations.inject(HashWithIndifferentAccess.new) do |h, (k, v)|\n store_as = Mongoid::Compatibility::Version.mongoid7_or_newer? ? v.store_as : v[:store_as]\n h[store_as || k] = k\n h\n end\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def serialize_resource(resource)\n link_id, link_type = link_id_and_type(resource)\n\n linkage = if link_id\n {\n inverse_id => link_id,\n :type => link_type\n }\n else\n nil\n end\n\n {\n linkage: linkage,\n related: url_for(resource)\n }\n end",
"def build_links(links)\n return [] if links.nil?\n\n links.map { |k, v| HelpScout::Link.new(Util.underscore(k.to_s).to_sym, v[:href]) }\n end",
"def error_links_hash\n {\n sign_in: {\n text: I18n.t('devise.sessions.new.sign_in'),\n url: url_helpers.new_user_session_path\n },\n sign_up: {\n text: I18n.t('devise.registrations.new.sign_up'),\n url: url_helpers.new_user_registration_path\n },\n permissions: {\n text: I18n.t('models.permissions.request_permissions'),\n url: url_helpers.new_access_request_projects_path\n },\n confirm: {\n text: I18n.t('devise.shared.links.confirm_account'),\n url: url_helpers.new_user_confirmation_path\n },\n reset_password: {\n text: I18n.t('devise.shared.links.reset_password'),\n url: url_helpers.new_user_password_path\n },\n resend_unlock: {\n text: I18n.t('devise.shared.links.unlock_account'),\n url: url_helpers.new_user_unlock_path\n }\n }\n end",
"def references\n references_hash.to_json\n end",
"def generate_embedded_relations\n translation.embed_tables.each do |table|\n extract_embedded_relations(table)\n end\n end",
"def create_resources_table(flattened_resources)\n table = []\n if (flattened_resources.nil? || flattened_resources.size == 0)\n return table\n end\n\n # Headings.\n base_headings = [ 'resource', 'type', 'depends_on', 'instance', 'id' ]\n attr_headings = []\n flattened_resources.each do |r|\n r['attributes'].keys.each do |k|\n attr_headings << k unless attr_headings.include?(k)\n end\n end\n table << base_headings + attr_headings\n\n # Resource data corresponding to headings.\n flattened_resources.each do |r|\n table << get_resource_row(r, attr_headings)\n end\n\n table\nend",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def to_hash\n h = self.href.nil? ? '' : self.href\n r = self.rel.nil? ? '' : self.rel\n t = self.title.nil? ? '' : self.title\n y = self.type.nil? ? '' : self.type\n\n { \n \"href\" => h,\n \"type\" => y,\n \"rel\" => r,\n \"title\" => t\n }\n end",
"def links\n @links.values\n end",
"def program_files_parent_children_relations\n\n return @program_files_parent_children_relations if @program_files_parent_children_relations\n\n hash = {}\n\n program_files.each do |program_file|\n\n if program_file.parent_id > 0\n hash[program_file.parent_id] = [] unless hash[program_file.parent_id]\n hash[program_file.parent_id].push program_file\n end\n end\n\n @program_files_parent_children_relations = hash\n\n return hash\n end",
"def to_hash\n co_hash = {\"url_ver\" => openurl_ver, \"url_ctx_fmt\" => \"info:ofi/fmt:kev:mtx:ctx\"}\n\n @admin.each_key do |k|\n co_hash[k] = @admin[k][\"value\"] if @admin[k][\"value\"]\n end\n\n {@referent => \"rft\", @referringEntity => \"rfe\", @requestor => \"req\", @referrer => \"rfr\"}.each do |ent, abbr|\n co_hash.merge!(ent.to_hash(abbr)) unless ent.empty?\n end\n\n # svc and res are arrays of ContextObjectEntity\n {@serviceType => \"svc\", @resolver => \"res\"}.each do |ent_list, abbr|\n ent_list.each do |ent|\n co_hash.merge!(ent.to_hash(abbr)) unless ent.empty?\n end\n end\n co_hash\n end",
"def data_hash\n primary, included =\n resources_processor.process(Array(@data), @include, @fields)\n {}.tap do |hash|\n hash[:data] = @data.respond_to?(:to_ary) ? primary : primary[0]\n hash[:included] = included if included.any?\n end\n end"
] |
[
"0.6595661",
"0.65907323",
"0.654232",
"0.64447886",
"0.6328597",
"0.62418365",
"0.6220117",
"0.615945",
"0.6116255",
"0.6105717",
"0.60604036",
"0.6035628",
"0.6001539",
"0.59550875",
"0.5911503",
"0.57904536",
"0.5782197",
"0.5757096",
"0.5727869",
"0.56643",
"0.5663024",
"0.56503797",
"0.5623018",
"0.5611473",
"0.55948013",
"0.55635744",
"0.5508262",
"0.5480032",
"0.54058266",
"0.5399707",
"0.53911495",
"0.53848016",
"0.5376176",
"0.5376026",
"0.5366696",
"0.53622526",
"0.5358748",
"0.53447556",
"0.53274775",
"0.5324175",
"0.5263419",
"0.5254252",
"0.5248674",
"0.52478564",
"0.5245002",
"0.52399755",
"0.5235276",
"0.5230976",
"0.52268136",
"0.5222966",
"0.5212408",
"0.5210559",
"0.51958746",
"0.5174675",
"0.51611584",
"0.5144092",
"0.51330113",
"0.5130014",
"0.5124804",
"0.5123982",
"0.51193386",
"0.510156",
"0.5097412",
"0.5082244",
"0.5063911",
"0.50633717",
"0.5058445",
"0.5058349",
"0.5057618",
"0.5047994",
"0.5047813",
"0.50255674",
"0.5013366",
"0.5012951",
"0.5012951",
"0.50108695",
"0.50049245",
"0.50030446",
"0.4985947",
"0.49788678",
"0.4972815",
"0.4971503",
"0.49531046",
"0.4948489",
"0.4940986",
"0.49292746",
"0.49268144",
"0.49268144",
"0.49226797",
"0.49188873",
"0.4914023",
"0.49072236",
"0.49056548",
"0.49040166",
"0.49011815",
"0.48927635",
"0.4891064",
"0.4889861",
"0.48837376",
"0.4882688"
] |
0.62498623
|
5
|
Return a Hash of relations to other pages built from 'Link' response header
|
def relations
@relations ||= process_rels
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_rels\n links = ( @headers[\"Link\"] || \"\" ).split(', ').map do |link|\n href, name = link.match(/<(.*?)>; rel=\"(\\w+)\"/).captures\n\n [name.to_sym, Relation.from_link(@agent, name, :href => href)]\n end\n\n Hash[*links.flatten]\n end",
"def links\n data['links']\n end",
"def links\n @links ||= lambda do \n raw_links.map do |link|\n hash = {}\n link.keys.each do |key|\n hash[key] = link[key]\n end\n hash\n end\n end.call\n end",
"def links\n @links.values\n end",
"def links\n @data[\"_links\"]\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def link_headers\n yield if block_given?\n return '' unless response.include? 'Link'\n\n response['Link'].split(\",\\n\").map do |line|\n url, *opts = line.split(';').map(&:strip)\n \"<link href=\\\"#{url[1..-2]}\\\" #{opts.join ' '} />\"\n end.join \"\\n\"\n end",
"def links\n _links = parent_link.update({\n self: { href: @controller.polymorphic_url(collection_hierarchy) }\n })\n\n { _links: _links }\n end",
"def hash\n [links, organization_id].hash\n end",
"def links\n\t\t@links.keys\n\tend",
"def links\n each_link.to_set\n end",
"def relationship_links(source)\n {}\n end",
"def related_content(options = {})\n api_url = \"/collections/#{self.collection.attributes[:token]}/pages/#{@attributes[:identifier]}/related\"\n response = @muddyit.send_request(api_url, :get, options, nil)\n results = []\n response.each { |result|\n # The return format needs sorting out here .......\n results.push :page => @attributes[:collection].pages.find(result['identifier']), :count => result['count']\n }\n return results\n end",
"def links\n metadata[:links] || Set.new\n end",
"def links()\n return @links\n end",
"def links_and_their_aliases(page_hash)\n @links.inject([]) do |results, link|\n results.concat([link].concat(page_hash[link].aliases))\n end\n end",
"def links_and_their_aliases(page_hash)\n @links.inject([]) do |results, link|\n results.concat([link].concat(page_hash[link].aliases))\n end\n end",
"def add_links\n link_root = \"http://#{request.server_name}:#{request.port}/api/businesses?page=\"\n response.headers['Link'] = \"<#{link_root}1>; rel='first', <#{link_root}#{@businesses.total_pages}>; rel='last'\"\n\n if @businesses.next_page\n response.headers['Link'] << \", <#{link_root}#{@businesses.next_page}>; rel='next'\"\n @links['next'] = \"#{link_root}#{@businesses.next_page}\"\n end\n\n if @businesses.previous_page\n response.headers['Link'] << \", <#{link_root}#{@businesses.previous_page}>; rel='prev'\"\n @links['prev'] = \"#{link_root}#{@businesses.previous_page}\"\n end\n end",
"def meta_links\n @meta_links ||= @internal_struct[:meta_links]\n end",
"def references_hash\n {\n 'http://schema.org/url' => @metadata['landing_page'],\n 'http://resources.arcgis.com/en/help/arcgis-rest-api' => @metadata['url']\n }\n end",
"def internal_links\n respond_with @page.internal_links\n end",
"def internal_links\n respond_with @page.internal_links\n end",
"def as_json(request)\n {\n :links => [\n *models.map { |k,v| {:rel => k, :href => request.add_path(k).full_path } },\n {:rel => 'self', :href => request.full_path}\n ]\n }\n end",
"def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\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 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 links\n return @links\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def links_and_their_aliases(page_hash)\n links.inject([]) do |results, link|\n results.concat([link].concat(page_hash[link].aliases))\n end\n end",
"def link\n @headers[:link]\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def ensmallen_links\n links = []\n (self.urls + self.media).each do |link|\n links << {\n 'url' => link.url.to_s,\n 'display_url' => link.display_url.to_s,\n 'expanded_url' => link.expanded_url.to_s,\n 'indices' => link.indices\n }\n end\n\n #always sort results, so clients can easily reverse to loop and s//\n links.sort { |x,y| x['indices'][0] <=> y['indices'][0] }\n end",
"def vdoc_links\n return @link_set if defined? @link_set\n \n @link_set = Set.new\n pages.each {|page| @link_set << page.display_name }\n @link_set\n end",
"def links\n curations = self.curations.select do |curation|\n curation.rating != '0' and curation.status != 'deleted'\n end\n\n links = curations.map do |curation|\n link = Link.find(curation.link_id)\n owner = User.find(link.link_owner)\n link_for_app = {\n curation_id: curation.id,\n link_id: link.id,\n status: curation.status,\n rating: curation.rating,\n date_added: curation.created_at,\n url: link.url,\n url_type: link.url_type,\n title: link.title,\n image: link.image,\n comment: curation.comment,\n shared_with: people_shared_with(link, owner),\n tags: curation.tags,\n owner: {\n name: owner.name,\n phone: owner.phone,\n }\n }\n link_for_app\n end\n links.sort_by { |link| link[:date_added] }.reverse\n end",
"def links\n @data.links ||= parsed_document.search(\"//a\") \\\n .map {|link| link.attributes[\"href\"] \\\n .to_s.strip}.uniq rescue nil\n end",
"def link\n object[\"link\"]\n end",
"def generateLinks()\n links = {}\n \n $doc.pages.each do |page|\n page.markdown.each do |line|\n headerMatch = line.match(/^(#+)\\s+(.*?)\\s+@@(.*?)$/)\n if headerMatch\n headerLevel = headerMatch[1].length\n headerTitle = headerMatch[2]\n headerID = headerMatch[3]\n if links[headerID]\n puts \"ERROR: #{headerID} already exists.\"\n exit 1\n end\n if headerLevel == 1\n links[headerID] = \"#{page.id}.htm\"\n else\n links[headerID] = \"#{page.id}.htm##{headerID}\"\n end\n end\n end\n end\n \n links[\"toc\"] = \"index.htm\"\n \n return links\nend",
"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 links; end",
"def links; end",
"def hash\n [rel, href].hash\n end",
"def all_links\n Link.all\n end",
"def all_links\n Link.all\n end",
"def all_links\n Link.all\n end",
"def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end",
"def handle_links(json) end",
"def links\n url = @controller.request.url\n url = url.split('.')[0..-2].join('.') if url =~ /\\.\\w+$/\n\n parent_url = url.split('/')[0..-2].join('/')\n parent_name = parent_url.split('/')[0..-2].last.singularize\n\n _links = {\n self: { href: url },\n parent_name => { href: parent_url }\n }\n\n { _links: _links }\n end",
"def links\n valid_link_keys = %w(mandate new_customer_bank_account organisation parent_event payment payout previous_customer_bank_account refund subscription )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: '',\n\n new_customer_bank_account: '',\n\n organisation: '',\n\n parent_event: '',\n\n payment: '',\n\n payout: '',\n\n previous_customer_bank_account: '',\n\n refund: '',\n\n subscription: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def resource_relations\n @resource_relations ||= Relation.from_links(client,\n decoded_body[:links])\n end",
"def links\n @links ||= []\n @links\n end",
"def links\n links = Hash.new([])\n order = []\n each_with_rescue(@notes) do |note|\n order << note.row\n links[note.row] += [link_helper(note)]\n end\n\n html = ''\n order.uniq!\n order.each do |row|\n html << \"#{row.is_a?(String) ? row : row.to_s.camelize}: #{links[row].join(\" | \\n\")}<br />\"\n end\n html\n end",
"def links\n valid_link_keys = %w(creditor creditor_bank_account )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n creditor: '',\n\n creditor_bank_account: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def link\n\t\t\t@data['link']\n\t\tend",
"def normalize_links\n @links.map! do |link|\n relationship = case link\n when Symbol, String then @relationships[link]\n when Associations::Relationship then link\n end\n\n if relationship.respond_to?(:links)\n relationship.links\n else\n relationship\n end\n end\n\n @links.flatten!\n @links.uniq!\n end",
"def remote_pages\n @link_collector.remote_pages\n end",
"def process_link_header(response)\n\n linkheader = LinkHeader.parse(response.headers[:link]).to_a\n\n next_link, last_link = nil, nil\n\n #### extract the interesting header links\n linkheader.each { |link|\n next_link ||= header_link_for_rel(link, 'next')\n last_link ||= header_link_for_rel(link, 'last')\n }\n\n # If there is more data on another page log that.\n if !next_link.nil?\n page_estimate = \"\"\n # Log last_page and per_page values from the 'last' url so can get rough estimate of total number of\n # entries for query. Note: We use the page/per_page information because it turns out that Canvas puts that\n # in the URL. However that isn't a standard and we shouldn't rely on it for processing.\n if !last_link.nil?\n p = Regexp.new(/page=(\\d+)&per_page=(\\d+)/)\n p.match(last_link)\n last_page, per_page = $1, $2\n page_estimate = \"last_page: #{last_page} page_size: #{per_page} \"\n end\n logger.warn \"#{self.class.to_s}:#{__method__}:#{__LINE__}: pagination: #{page_estimate} next_link: #{next_link}\"\n end\n\n # return the raw next link (or an empty string)\n next_link.nil? ? \"\" : next_link\n end",
"def linking_metadata\n metadata = Hash.new\n LinkingMetadata.append_service_linking_metadata(metadata)\n LinkingMetadata.append_trace_linking_metadata(metadata)\n metadata\n end",
"def links\n _links = { self: polymorphic_url(record_with_ancestor_chain(@record)) }\n\n resources.each do |name, resource|\n _links.update(name => polymorphic_url(record_with_ancestor_chain(resource)))\n end\n\n sub_resources.each do |sub_resource|\n _links.update(sub_resource => polymorphic_url(record_with_ancestor_chain(@record) << sub_resource))\n end\n\n { _links: _links }\n end",
"def links\n valid_link_keys = %w(mandate )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def links\n\t\t( 0...self.link_count ).collect do |i|\n\t\t\tself.link( i )\n\t\tend\n\tend",
"def collect_links(html)\n Hash[Nokogiri::HTML(html).css('a').collect {|node| [node.text.strip, node.attributes['href'].to_s]}]\n end",
"def source_relations\n query = \"at:link[@rel = '#{Rel[repository.cmis_version][:relationships]}']/@href\"\n link = data.xpath(query, NS::COMBINED)\n if link.length == 1\n link = Internal::Utils.append_parameters(link.text, \"relationshipDirection\" => \"source\", \"includeSubRelationshipTypes\" => true)\n Collection.new(repository, link)\n else\n raise \"Expected exactly 1 relationships link for #{key}, got #{link.length}, are you sure this is a document/folder?\"\n end\n end",
"def convictions_index_at_source\n page = get(base)\n page.search('div.listing-container ol li').map do |el|\n { 'link' => el.search('a').first['href'] }\n end\nend",
"def top_level_links\n links = @options.fetch(:base_links, {})\n\n links.merge!(@operation_results.links)\n\n @operation_results.results.each do |result|\n links.merge!(result.links)\n\n # Build pagination links\n if result.is_a?(JSONAPI::ResourcesOperationResult) || result.is_a?(JSONAPI::RelatedResourcesOperationResult)\n result.pagination_params.each_pair do |link_name, params|\n if result.is_a?(JSONAPI::RelatedResourcesOperationResult)\n relationship = result.source_resource.class._relationships[result._type.to_sym]\n links[link_name] = @serializer.link_builder.relationships_related_link(result.source_resource, relationship, query_params(params))\n else\n links[link_name] = @serializer.query_link(query_params(params))\n end\n end\n end\n end\n\n links.deep_transform_keys { |key| @key_formatter.format(key) }\n end",
"def target_relations\n query = \"at:link[@rel = '#{Rel[repository.cmis_version][:relationships]}']/@href\"\n link = data.xpath(query, NS::COMBINED)\n if link.length == 1\n link = Internal::Utils.append_parameters(link.text, \"relationshipDirection\" => \"target\", \"includeSubRelationshipTypes\" => true)\n Collection.new(repository, link)\n else\n raise \"Expected exactly 1 relationships link for #{key}, got #{link.length}, are you sure this is a document/folder?\"\n end\n end",
"def link\n return unless @data['link']\n link = @data['link']\n # Aozora has embed data, we just need to restructure it a bit\n @link ||= {\n kind: link['type'],\n title: link['title'],\n description: link['description'],\n url: link['url'],\n site_name: link['siteName'],\n image: link['images'].first\n }\n end",
"def linkPages\n @all_pages.each_value do |one_page|\n one_page.addPageLinks\n end\n @all_pages.each_value do |one_page|\n one_page.addMissingLinkNames\n end\n end",
"def links\n @payer_authorisation_links ||= Links.new(@links)\n end",
"def non_fulltext_links\n links = []\n other_customlinks = @record.fetch('CustomLinks',{})\n if other_customlinks.count > 0\n other_customlinks.each do |other_customlink|\n link_url = other_customlink['Url']\n link_label = other_customlink['Text']\n link_icon = other_customlink['Icon']\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'customlink-other'})\n end\n end\n\n links\n end",
"def index\n @links = {}\n @link_group_opts.each do |lo|\n links = Link.find_all_by_group(lo)\n @links[lo] = links\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end",
"def links\n linked_to.map{|to|[self,to]}\n end",
"def fetch_links!\n return if content_id.blank?\n\n links = Services.publishing_api.get_links(content_id)[\"links\"]\n\n self.lead_organisation_content_ids = links[\"lead_organisations\"] || []\n self.organisation_content_ids = links[\"organisations\"] || []\n self.people_content_ids = links[\"people\"] || []\n self.working_group_content_ids = links[\"working_groups\"] || []\n end",
"def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end",
"def link(link_rel)\n ls = self.links.select {|l| l[link_rel] }.map { |t| t.values }.flatten\n case ls.count\n when 1\n ls.first\n when 0\n nil\n else\n ls\n end\n end",
"def to_hash url\n doc = get_doc_for_url url\n count = 0\n page = {}\n page[:url] = url\n now = Time.now\n page[:create_date_seconds] = now.to_i\n page[:create_date] = now\n page[:subforum] = @subforum\n\n arr = Array.new\n h = {}\n links = doc.xpath(\"//table/tr/td/table/tr\")\n links.each_with_index do |li, i|\n x = li.css(\"td.title\")\n if !x.empty?\n #puts \" ---- title ----- #{x.count} \"\n count = x[0].text\n #puts count\n if x.count < 2\n # this block is for the next_url\n article_url = x[0].css(\"a\")[0][\"href\"] # link url\n #puts article_url\n h = {}\n h[:title] = count\n h[:article_url] = article_url\n more = count\n more_url = \"#{@host}/#{article_url}\"\n #arr << h\n page[:next_url] = more_url\n #puts li\n end\n break if x.count < 2\n\n # actual article url\n title = x[1].css(\"a\")[0].text # title\n article_url = x[1].css(\"a\")[0][\"href\"] # link url\n #puts article_url\n #puts title\n h = {}\n #h[:number] = count\n h[:title] = title\n # ask option does not have hostname since it is relative to HN\n if article_url.index(\"http\") != 0\n article_url = \"#{@host}/#{article_url}\"\n end\n\n h[:article_url] = article_url\n arr << h\n else \n x = li.css(\"td.subtext\")\n if !x.empty?\n fulltext = x.text\n #puts \" ---- subtext ----- (#{fulltext})\"\n submitter = nil\n submitter_url = nil\n comment = nil\n comments_url = nil\n t = x.css(\"a\")\n t.each_with_index do |tt, ii|\n case ii\n when 0\n submitter = tt.text\n submitter_url = tt[\"href\"]\n when 1\n comment = tt.text\n comments_url = tt[\"href\"]\n comments_url = \"#{@host}/#{comments_url}\"\n end\n end\n points = x.css(\"span\").text rescue \"\"\n #puts submitter\n #puts submitter_url\n #puts comment\n #puts comments_url\n #puts points\n h[:submitter] = submitter\n h[:submitter_url] = submitter_url\n h[:comment_count] = comment.to_i.to_s.rjust(4)\n h[:comments_url] = comments_url\n h[:points] = points.to_i.to_s.rjust(4)\n m = fulltext.scan(/\\d+ \\w+ ago/)\n if m\n #h[:age_text] = m.first\n h[:age_text] = m.first.scan(/\\d+ \\w/).first.rjust(4)\n h[:age] = human_age_to_unix(m.first)\n end\n #puts \"fulltext: #{fulltext} \"\n h[:byline] = fulltext\n end\n end\n end\n #return arr\n page[:articles] = arr\n return page\n end",
"def hash\n [fully_qualified_rel, raw_href, templated?].hash\n end",
"def to_link_json\n {\n sys: {\n type: 'Link',\n linkType: 'Upload',\n id: id\n }\n }\n end",
"def to_link_json\n {\n sys: {\n type: 'Link',\n linkType: 'Upload',\n id: id\n }\n }\n end",
"def links\n return unless success? and body\n\n doc = Nokogiri::HTML(@body)\n \n links = []\n\n doc.css('div.list-lbc a').each do |a|\n link = {\n :url => a['href'],\n :title => a.css('div.title').first.content.strip\n }\n\n link[:ad_id] = link[:url][/^http:\\/\\/www.leboncoin.fr\\/locations\\/(\\d+).*/,1]\n links << link\n yield link if block_given?\n end\n\n links\n end",
"def mp_trip_pages\n pages = Hash.new\n doc = utf_page \"w5_show?p_r=6151&p_k=1\"\n \n doc.search(\"//a[@class='doc_l']\").each do |x|\n mp_name = x.inner_text # cia vardas su skliaustuose esanciu kelioniu skaicum Vardas Pavarde (3/1)\n if mp_name.include? ')'\n pages[mp_name[0,mp_name.index('(')-1]] = denormalize( x.attributes['href'] )\n end\n end\n return pages\n end",
"def links\n typed_set(entities, Occi::Core::Link)\n end",
"def get_all_pages()\n a_links = self.xpath('//tr[1]/td/table/tr/td/a/@href')\n a_links.map {|a_link| a_link.value}\n end",
"def relations\n @relations ||= {}\n end",
"def sanger_phenotyping_details_links( colony_prefix, result_data=nil )\n sanger_phenotyping_setup\n links = JSON.parse( @@ms.cache.fetch(\"sanger-phenotyping-pheno_links\") )[colony_prefix]\n return links\nend",
"def links\n @event_links ||= Links.new(@links)\n end",
"def to_links(per_page = 100)\n htag_set = Set.new\n\n search = Twitter::Search.new\n @search.per_page(100).fetch.each do |msg|\n links = msg.text.split(\" \").select { |f| f.strip =~ /^https?:/ }\n links.each { |link| htag_set.add(link.strip) }\n end\n\n htag_set\n end",
"def image_links(chapter_url)\n\n {}\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def scrape_link_data(link)\n { title: link.text, link: link[:href] }\n end",
"def get_info_page_links(page)\n info_links = page.links_with(href: %r{info.html})\n if not info_links\n info_links = page.links_with(href: %r{aboutus.html})\n end\n if not info_links\n info_links = page.links_with(text: '会社概要')\n end\n return info_links\nend",
"def links\n @mandate_links ||= Links.new(@links)\n end",
"def get_messages_link_and_content()\n dputs __method__.to_s\n urls = {:public => []}\n # public messages\n message_req = setup_http_request($messages, @cookie)\n res = @http.request(message_req)\n urls[:public] = messages_parsing(res.body.force_encoding('utf-8'))\n msgs = {:public => []}\n until urls.empty?\n k, uu = urls.shift\n next if uu == nil\n uu.map{|u|\n get_conversations(u, k.to_s).map do |m|\n next if not m\n msgs[k] << m\n end\n }\n end\n # ex: {:public => [{:msg=>[\"[Aujourd'hui à 09h48] Miguel L : \\\"BONJOUR GREG vous arrive jusque a la gare pardieu\\\"\", \"...\"], :url=>\"/messages/respond/kAxP4rA...\", :token => \"XazeAFsdf...\"}], :private => [{:msg => ...}]\n return msgs\n end",
"def relationships\n @relationships ||= {}\n end",
"def related_data\n @resource.related_identifiers.where(verified: true).where(hidden: false).map do |ri|\n { relation: ri.relation_type_friendly&.camelize(:lower), identifier: ri.related_identifier }\n end || []\n end",
"def create_extra_links\n return nil unless @extra_links\n x_links = \"\"\n if (@extra_links.class==Hash)\n @extra_links.each do |k,v|\n x_links << \"<a href=\\\"#{v}\\\">#{k}</a> \"\n end\n elsif (@extra_links.class==Array)\n @extra_links.each do |link|\n x_links << \"<a href=\\\"#{link}\\\">#{link}</a> \"\n end \n else\n x_links = \"<a href=\\\"#{@extra_links.to_s}\\\">#{@extra_links.to_s}</a>\"\n end\n return x_links\n end",
"def hash\n [fully_qualified_rel,\n raw_href,\n templated?].hash\n end",
"def sitemap_links\n each_sitemap_link.to_a\n end"
] |
[
"0.7238136",
"0.71838653",
"0.71461916",
"0.69504577",
"0.690437",
"0.6677724",
"0.65880936",
"0.65880936",
"0.6564459",
"0.6523548",
"0.6505382",
"0.6477203",
"0.6468647",
"0.6451345",
"0.6440135",
"0.63840115",
"0.63826424",
"0.6371537",
"0.6371537",
"0.6370116",
"0.63573575",
"0.6346185",
"0.63228416",
"0.63228416",
"0.63074404",
"0.6271343",
"0.62635726",
"0.6260006",
"0.6245882",
"0.6245882",
"0.6245882",
"0.6196179",
"0.6195898",
"0.6181727",
"0.6171574",
"0.6171513",
"0.6152084",
"0.6127995",
"0.61141956",
"0.61008346",
"0.60971737",
"0.60803384",
"0.60803384",
"0.6071008",
"0.6070605",
"0.6070605",
"0.6070605",
"0.60680753",
"0.6066138",
"0.60550237",
"0.60328805",
"0.60144544",
"0.60126007",
"0.6008389",
"0.59814143",
"0.5979619",
"0.5973133",
"0.5969923",
"0.5943765",
"0.5941445",
"0.59297276",
"0.5907858",
"0.58969736",
"0.58906436",
"0.5876496",
"0.5868069",
"0.58678645",
"0.5866009",
"0.586401",
"0.58639693",
"0.5863872",
"0.5863488",
"0.58475775",
"0.5837061",
"0.5822125",
"0.5801662",
"0.5771871",
"0.57665145",
"0.57648754",
"0.5732966",
"0.5732966",
"0.57263154",
"0.57257855",
"0.5714452",
"0.57141256",
"0.5703297",
"0.56887305",
"0.56886077",
"0.5682354",
"0.5679243",
"0.5677283",
"0.5677283",
"0.5665175",
"0.5634569",
"0.56329775",
"0.5631256",
"0.56253064",
"0.56214523",
"0.56192684",
"0.5618662",
"0.5617685"
] |
0.0
|
-1
|
Returns a Hash of meta information taken from the response body
|
def meta
@meta ||= decoded_body[:meta]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def meta\n json_body.fetch('meta', {})\n end",
"def metadata\n {\n line: \"#{method.upcase} #{uri}\",\n headers: headers,\n body: body,\n }.compact\n end",
"def meta\n @meta ||= begin\n arr = @header_str.split(/\\r?\\n/)\n arr.shift\n arr.inject({}) do |hash, hdr|\n key, val = hdr.split(/:\\s+/, 2)\n hash[key.downcase] = val\n hash\n end\n end\n end",
"def meta_information\n @meta_hash ||= {}\n end",
"def meta\n meta = {}\n set_meta(meta)\n return meta\n end",
"def extract_meta\n end",
"def response_metadata=(_); end",
"def meta_data\n return nil unless success?\n\n @meta_data\n end",
"def meta_vars\n meta = Hash.new\n\n cl = self[\"Content-Length\"]\n ct = self[\"Content-Type\"]\n meta[\"CONTENT_LENGTH\"] = cl if cl.to_i > 0\n meta[\"CONTENT_TYPE\"] = ct.dup if ct\n meta[\"GATEWAY_INTERFACE\"] = \"CGI/1.1\"\n meta[\"PATH_INFO\"] = @path_info ? @path_info.dup : \"\"\n #meta[\"PATH_TRANSLATED\"] = nil # no plan to be provided\n meta[\"QUERY_STRING\"] = @query_string ? @query_string.dup : \"\"\n meta[\"REMOTE_ADDR\"] = @peeraddr.get_address.get_host_address\n meta[\"REMOTE_HOST\"] = @peeraddr.get_host_name\n #meta[\"REMOTE_IDENT\"] = nil # no plan to be provided\n meta[\"REMOTE_USER\"] = @user\n meta[\"REQUEST_METHOD\"] = @request_method.dup\n meta[\"REQUEST_URI\"] = @request_uri.to_s\n meta[\"SCRIPT_NAME\"] = @script_name ? @script_name.dup : \"\"\n meta[\"SERVER_NAME\"] = @host\n meta[\"SERVER_PORT\"] = @port.to_s\n meta[\"SERVER_PROTOCOL\"] = \"HTTP/\" + @config[:HTTPVersion].to_s\n meta[\"SERVER_SOFTWARE\"] = @config[:ServerSoftware].dup\n\n self.each{|key, val|\n next if /^content-type$/i =~ key\n next if /^content-length$/i =~ key\n name = \"HTTP_\" + key\n name.gsub!(/-/o, \"_\")\n name.upcase!\n meta[name] = val\n }\n\n meta\n end",
"def meta\n {\n source: @host,\n favicon: @favicon,\n url: @url,\n title: title,\n description: @description,\n keywords: keywords,\n image_url: @main_image,\n extractable: extractable?\n }\n end",
"def metadata\n @meta_data\n end",
"def meta\n @d[:meta]\n end",
"def response_data\n unless response.media_type.to_s =~ /^application\\/(.+)/\n raise \"Unexpected response type: #{response.media_type}\"\n end\n\n format = $1\n case format\n when 'xml'\n Hash.from_xml(response.body)\n when 'json'\n ActiveSupport::JSON.decode(response.body)\n else\n raise \"Unknown response format: #{format}\"\n end\n end",
"def metadata\n api_get(\"$metadata\").body\n end",
"def get_response_metadata\n NewRelic::Agent.record_api_supportability_metric(:get_response_metadata)\n return unless CrossAppTracing.cross_app_enabled?\n\n return unless (txn = Tracer.current_transaction)\n return unless (payload = txn.distributed_tracer.cross_app_payload)\n\n # must freeze the name since we're responding with it\n #\n txn.freeze_name_and_execute_if_not_ignored do\n # build response payload\n #\n rmd = {\n NewRelicAppData: payload.as_json_array(NON_HTTP_CAT_CONTENT_LENGTH)\n }\n\n # obfuscate the generated response metadata JSON\n #\n obfuscator.obfuscate(::JSON.dump(rmd))\n end\n rescue => e\n NewRelic::Agent.logger.error('error during get_response_metadata', e)\n end",
"def get_aws_metadata(response)\n metadata = {}\n response.each do |key, value|\n if key =~ /^#{METADATA_PREFIX}(.*)$/oi\n metadata[$1] = value\n end\n end\n return metadata\n end",
"def metadata\n value_of(:metadata, JSON.method(:pretty_generate), '{}')\n end",
"def response_body\n JSON.parse(response.body, symbolize_names: true)\n end",
"def last_response\n hash = @_res.scan(/h=([\\w_\\=\\/]+)[\\s]/).first\n timestamp = @_res.scan(/t=([\\w\\-:]+)[\\s]/).first\n status = @_res.scan(/status=([a-zA-Z0-9_]+)[\\s]/).first\n info = @_res.scan(/info=([\\w\\t\\S\\W]+)/).first\n \n return { \"h\" => hash, \"t\" => timestamp, \"status\" => status, \"info\" => info }\n end",
"def meta\n type = self.type\n return nil if type == :unknown\n return @raw['message'][\"headers\"][\"header\"].to_s if type == :query\n return @item['id'] if type == :notify\n nil\n end",
"def response\n get_header_and_body\n end",
"def metadata\n @data[:metadata]\n end",
"def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end",
"def parse_http_meta text\n headers = {}\n status = 200\n size = 0\n parts = text.split /^---$/\n if parts.length > 1\n for part in parts.last.split \"\\n\"\n if Oaf::Util.is_http_header? part\n headers.merge! Oaf::Util.get_http_header part\n elsif Oaf::Util.is_http_status? part\n status = Oaf::Util.get_http_status part\n else next\n end\n size += size == 0 ? 2 : 1 # compensate for delimiter\n end\n end\n [headers, status, size]\n end",
"def parsed_response\n response\n end",
"def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end",
"def meta_data\n @meta_data ||= params['metaData']\n end",
"def parse_metadata\n meta=Hash.new\n meta['hostname']=@xdr.string\n meta['name']=@xdr.string\n meta['spoof']=@xdr.uint32\n meta['type']=@xdr.string\n meta['name2']=@xdr.string\n meta['units']=@xdr.string\n slope=@xdr.uint32\n\n case slope\n when 0\n meta['slope']= 'zero'\n when 1\n meta['slope']= 'positive'\n when 2\n meta['slope']= 'negative'\n when 3\n meta['slope']= 'both'\n when 4\n meta['slope']= 'unspecified'\n end\n\n meta['tmax']=@xdr.uint32\n meta['dmax']=@xdr.uint32\n nrelements=@xdr.uint32\n meta['nrelements']=nrelements\n unless nrelements.nil?\n extra={}\n for i in 1..nrelements\n name=@xdr.string\n extra[name]=@xdr.string\n end\n meta['extra']=extra\n end\n return meta\n end",
"def response_body\n @response[:body]\n end",
"def metadata\n log \"retrieving container metadata from #{container_path}\"\n response = storage_client.head(container_path)\n custom = {}\n response.each_capitalized_name { |name|\n custom[name] = response[name] if name[/\\AX-Container-Meta-/]\n }\n {\n :objects => response[\"X-Container-Object-Count\"].to_i,\n :bytes => response[\"X-Container-Bytes-Used\"].to_i,\n :custom => custom,\n }\n end",
"def to_hash\n fail_on_non_200_family_if_specified\n\n if @response['content-type'].nil? || @response['content-type'].include?('json')\n begin\n JSON.parse(@response.body)\n rescue JSON::ParserError\n raise Exceptions::JsonBodyParseError.new(@response.body)\n end\n else\n @response.body\n end\n end",
"def metadata\n self[:metadata] || {}\n end",
"def parse_metadata(dropbox_raw_response) # :nodoc:\n begin\n raw_metadata = dropbox_raw_response['x-dropbox-metadata']\n metadata = JSON.parse(raw_metadata)\n rescue\n raise DropboxError.new(\"Dropbox Server Error: x-dropbox-metadata=#{raw_metadata}\",\n dropbox_raw_response)\n end\n return metadata\n end",
"def meta_data\n #object = instance_variable_get('@'+controller_name.singularize)\n object = instance_variable_get('@resource')\n meta = {}\n\n if object.kind_of? ActiveRecord::Base\n meta[:keywords] = object.meta_keywords if object[:meta_keywords].present?\n meta[:description] = object.meta_description if object[:meta_description].present?\n end\n\n #if meta[:description].blank? && object.kind_of?(Spree::Product)\n # meta[:description] = strip_tags(truncate(object.description, length: 160, separator: ' '))\n #end\n\n meta.reverse_merge!({\n keywords: current_store.meta_keywords,\n description: current_store.meta_description,\n }) if meta[:keywords].blank? or meta[:description].blank?\n meta\n end",
"def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def meta\n @hash.any? ? @hash : nil\n end",
"def meta_decode(meta)\n return {} if meta.empty?\n Marshal.load(Base64.decode64(meta))\n end",
"def parse_metadata_body(body)\n body.lines.each_with_object({}) do |line, hsh|\n k, v = line.strip.split\n hsh[k.to_sym] = v\n end\n end",
"def response\n @parsed_response ||= JSON.parse(@response.body, symbolize_names: true)\n end",
"def metadata\n Hash.from_xml(self[:metadata])['hash']\n end",
"def metadata\n {\n district_council: response[\"consellBarri\"]&.strip,\n district: response[\"barri\"]&.strip,\n document_number: document_number,\n }\n end",
"def to_h\n JSON.parse(@body, symbolize_names: true)\n end",
"def object_definition_metadata\n version = @account.api_version.nil? ? 'latest' : @account.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end",
"def object_definition_metadata\n version = self.api_version.nil? ? 'latest' : self.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end",
"def to_h\n JSON.parse(body)\n end",
"def metadata\n msg['metadata']||{}\n end",
"def body\n response.body\n end",
"def toHash\n raise ResponseError, \"Response body doesnot exist\" if @_responseBody.nil? || @_responseBody.empty?\n JSON.parse(@_responseBody) \n end",
"def get_metadata_response(metadata)\n if metadata.respond_to?(:has_key?)\n listing = []\n metadata.keys.sort.each do |key|\n value = metadata[key]\n if value.respond_to?(:has_key?)\n listing << key + '/'\n else\n listing << key\n end\n end\n return listing.join(\"\\n\")\n end\n return metadata\n end",
"def to_hash\n result = @response[:magic_response][:magic_result][:diffgram]\n result = strip_attributes(result)\n result = convert_dates_to_utc(result)\n\n if result.nil?\n return []\n end\n\n # All magic responses wrap their result in an ActionResponse element\n result = result.values.first\n\n # Often the first element in ActionResponse is an element\n # called ActionInfo, but in some cases it has a different name\n # so we just get the first element.\n result.values.first\n end",
"def metadata\n @metadata ||= {}\n end",
"def generate_metadata\n data = Hash.new\n data['id'] = self.id\n data['title'] = self.title\n data['author'] = self.author\n data['updated_at'] = self.updated_at\n return data\n end",
"def data\n @raw_response.body\n end",
"def process_metadata\n if @response\n self.resource.metadata[:http_version] = @response.http_version\n self.resource.metadata[:status] = @response.status\n self.resource.metadata[:reason] = @response.reason\n self.resource.metadata[:headers] = @response.headers\n end\n end",
"def info() \n \treturn self.response.info()\n\tend",
"def bio\n response[\"bio\"]\n end",
"def body\n @response.body\n end",
"def body\n @response.body\n end",
"def to_h\n # Deep dup\n JSON.parse(@meta.to_json, symbolize_names: true)\n end",
"def body(response)\n JSON.parse(response[:body])\n end",
"def body\n return {} if @raw_response.body.strip.empty?\n\n JSON.parse(@raw_response.body)\n end",
"def aws_get_metadata\n murl = 'http://169.254.169.254/latest/meta-data/'\n result = self.aws_get_url(murl)\n metadata = Hash.new()\n\n # TODO this isn't entirely right.. if the element ends in '/', it's actually another level of hash..\n result.split(\"\\n\").each do |element|\n metadata[element] = self.aws_get_url(sprintf('%s%s', murl, element))\n end\n\n metadata\n end",
"def metadata\n if any? && metadata_schema\n response = api('request',\n :uri => \"hm://metadata/#{resource_name}s\",\n :batch => true,\n :payload => map {|resource| {:uri => resource.metadata_uri}},\n :response_schema => metadata_schema\n )\n response['result']\n else\n []\n end\n end",
"def page_meta\n @page_meta ||= {}\n end",
"def meta\n {}\n end",
"def head\n {\n \"Host\" => HOST,\n \"Content-Type\" => CONTENT_TYPE,\n \"Accept-Encoding\" => ACCEPT_ENCODINGS.join(','),\n \"User-Agent\" => USER_AGENT,\n \"Authorization\" => \"#{ authorization }\",\n }\n end",
"def to_hash\n scrape_meta_data\n\n {\n 'url' => url,\n 'title' => title,\n 'links' => links,\n 'internal_links' => internal_links,\n 'external_links' => external_links,\n 'images' => images,\n 'charset' => charset,\n 'feed' => feed,\n 'content_type' => content_type\n }.merge @data.to_hash\n end",
"def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = meta_info_file_pathname.read.strip.split(':').map(&:to_i)\n {\n inode: inode,\n bytes_read: bytes_read\n }\n else\n {\n inode: nil,\n bytes_read: 0\n }\n end\n end",
"def metadata\n response = retrieve_metadata\n return response.body unless response.nil? || response.status == 404\n Geoblacklight.logger.error \"Could not reach #{@reference.endpoint}\"\n \"Could not reach #{@reference.endpoint}\"\n end",
"def body(response)\n JSON.parse(response.body)\n end",
"def to_hash\n {\n 'meta' => {\n 'version' => version,\n 'title' => title,\n 'subtitle' => subtitle,\n 'artist' => artist,\n 'album' => album,\n 'lyricist' => lyricist,\n 'composer' => composer,\n 'copyright' => copyright,\n 'transcriber' => transcriber,\n 'instructions' => instructions,\n 'notices' => notices\n }\n }\n end",
"def get(url)\n r = {}\n resp = open(url)\n r[:meta] = resp\n r[:body] = resp.read\n return r\nend",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n {\n version: 0,\n prefill: true,\n returnUrl: '/veteran-information'\n }\n end",
"def metadata\n {\n version: 0,\n prefill: true,\n returnUrl: '/veteran-information'\n }\n end",
"def body\n @body_result ||= JSON.parse(@rest_response.body, symbolize_names: true)\n end",
"def to_h\n {\n :name => @name,\n :type => @type,\n :metaData => @meta_data,\n :timestamp => @timestamp.iso8601(3)\n }\n end",
"def response_body; end",
"def response_body; end",
"def metadata\n @metadata ||= {}\n end",
"def get_metadata\n get_state.map do |get_state_resp|\n metadata = get_state_resp.dig(:data, :identity_state, :metadata)\n if metadata\n metadata.transform_values { |val| Utils.parse_string_or_byte_val(val) }\n else\n metadata\n end\n end\n end",
"def metadata\n @page.metadata\n end",
"def metadata(path)\n resp, data = get(path)\n meta = {}\n\n data.scan(/<input type=\"hidden\" name=\"__([A-Z]+)\" id=\"__[A-Z]+\" value=\"(.*?)\" \\/>/).each do |match|\n meta[\"__#{match[0]}\"] = CGI.escape(match[1])\n end\n\n meta\n end",
"def meta\n options[:meta]\n end",
"def metadata\n hash.inject([]){ |list, data| list << MetaData.new(data[0], data[1][0]) }\n end",
"def extractMetadata()\n Logging.LogScriptInfo \"Extract metadata from #{@logFile}...\"\n\n # Get the meta datas from the json report\n metas = { }\n metas['build_date'] = @jsonData['build_date']\n metas['build_time'] = @jsonData['build_time']\n metas['git_revision'] = @jsonData['git_revision']\n metas['options'] = @jsonData['sim']['options']\n metas['overrides'] = @jsonData['sim']['overrides']\n metas['statistics'] = @jsonData['sim']['statistics']\n @jsonData['sim']['players'].each do |player|\n if player['name'] == 'Template'\n metas['player'] = player\n end\n end\n metas['profilesets_overrides'] = { }\n @jsonData['sim']['profilesets']['results'].each do |player|\n next unless player['overrides']\n metas['profilesets_overrides'][player['name']] = player['overrides']\n end\n\n # Timestamps\n metas['build_timestamp'] = DateTime.parse(@jsonData['build_date'] + ' ' + @jsonData['build_time'] + ' ' + Time.now.strftime('%:z')).to_time.to_i\n metas['result_timestamp'] = Time.now.to_i\n\n # Add additional data\n metas.merge!(@additionalMetadata)\n\n return metas\n end",
"def metadata\n @metadata ||= (\n if md = /\\<\\!\\-\\-\\-(.*?)\\-{2,3}\\>\\s*\\Z/m.match(content)\n YAML.load(md[1])\n else\n {}\n end\n )\n end",
"def to_h\n h = {\n code: @code,\n msg: @msg,\n }\n h[:meta] = @meta unless @meta.empty?\n h\n end",
"def metadata\n @metadata ||= Mash.new\n end",
"def headers\n response.headers\n end",
"def read_meta(node)\n t = decompress_revision(node)\n return {} unless has_metadata?(t)\n \n mt = t[metadata_start..(metadata_end(t) - 1)]\n mt.split(\"\\n\").inject({}) do |hash, line|\n k, v = line.split(\": \", 2)\n hash[k] = v\n hash\n end\n end",
"def metadata\n return unless self[:metadata]\n\n self[:metadata].deep_symbolize_keys\n end",
"def metadata\n {\n title: flickr_title,\n description: description\n }\n end",
"def parse_response(response)\n status = RESPONSE_STATUSES.fetch(response.code) { raise \"Response not known\" }\n raise Amfetamine::RecordNotFound if status == :notfound\n body = if response.body && !(response.body.blank?)\n response.parsed_response\n else\n self.to_json\n end\n { :status => status, :body => body }\n end",
"def to_hash\n @parsed_body ||= JSON.parse(@body, symbolize_names: true)\n end",
"def body\n response.body.to_s\n end",
"def response_data\n @_response_data ||= Hash.new.with_indifferent_access\n end",
"def to_hash\n body.to_hash\n end"
] |
[
"0.8209115",
"0.703759",
"0.6809584",
"0.6728309",
"0.6629828",
"0.6614577",
"0.6594861",
"0.6567625",
"0.6565107",
"0.6482766",
"0.64749366",
"0.64748484",
"0.6464112",
"0.64502573",
"0.6447846",
"0.64390594",
"0.6412634",
"0.6396967",
"0.6360413",
"0.63546664",
"0.63276446",
"0.6285661",
"0.6280602",
"0.62795764",
"0.6256497",
"0.62317735",
"0.6215269",
"0.62068677",
"0.61913186",
"0.61894494",
"0.6184735",
"0.6183569",
"0.61816585",
"0.6174238",
"0.617007",
"0.6158596",
"0.6157828",
"0.61538017",
"0.614994",
"0.61335444",
"0.6132521",
"0.6128774",
"0.6121321",
"0.6113187",
"0.6101849",
"0.60993785",
"0.6090096",
"0.60525304",
"0.6048175",
"0.6037889",
"0.60362124",
"0.60286295",
"0.602699",
"0.6026183",
"0.6015339",
"0.6014593",
"0.6012054",
"0.59989697",
"0.59989697",
"0.59965426",
"0.5996002",
"0.5985827",
"0.5969979",
"0.5959936",
"0.5957004",
"0.5955837",
"0.5953121",
"0.59399253",
"0.59373",
"0.5915855",
"0.5915362",
"0.591491",
"0.59017336",
"0.58918315",
"0.58918315",
"0.58889693",
"0.58889693",
"0.588856",
"0.58846736",
"0.5878793",
"0.5878793",
"0.5861302",
"0.586111",
"0.58563715",
"0.58525676",
"0.584875",
"0.58386755",
"0.58376116",
"0.5836219",
"0.5826209",
"0.58225673",
"0.5819485",
"0.5808365",
"0.58036935",
"0.58022946",
"0.57937264",
"0.578808",
"0.5773244",
"0.57692087",
"0.57647836"
] |
0.7857405
|
1
|
PROBLEM: Given a string, write a method change_me which returns the same string but with all the words in it that are palindromes uppercased. input: string output: string (not the same object) rules: Explicit requirements: every palindrome in the string must be converted to uppercase. (Reminder: a palindrome is a word that reads the same forwards and backward). Palindromes are case sensitive ("Dad" is not a palindrome, but "dad" is.) Implicit requirements: the returned string shouldn't be the same string object. Data structure Algorithm Array > string create method change_me initialize variable result to store the final string split the string into each word by calling split initialize iterator to iterate through the array iterate through the array call method reverse on each word and check if it is the same as the original word if yes, the word is a palindrom, return the word in upcase if no, return the word as is finish iteration use .join with space to turn the array into a string.
|
def change_me(string)
result = []
words = string.split
iterator = 0
loop do
break if iterator == words.size
word = words[iterator]
if word.reverse == word
result << word.upcase
else
result << word
end
iterator += 1
end
result.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rearranger(str)\nstr = str.split(' ')\nfinal = str.reverse.join(' ')\nfinal = final.downcase\nend",
"def weirdcase(string)\n #gets array of strings, creates empty results array\n arr = string.split (' ')\n result = []\n\n #iterates over array of strings..\n arr.each do |i|\n #..breaking apart each string into another array of characters\n temp = i.chars\n #then iterating over that array of characters..\n (0..temp.length-1).each do |j|\n #..checking to see if that index is even. If so, make that letter uppercase\n if j.even?\n temp[j] = temp[j].upcase\n end\n end\n #after iterating through each letter and uppercasing the even indexes,\n #join the chars into a string, then append that string to results array\n result << temp.join('')\n end\n #after each individual word is modified, join the chars of results into one string,\n #then return that as the final result!\n return result.join(' ')\nend",
"def swapcase(string)\n split_string= string.split(' ')\n swapped_case_word = split_string.map do |word|\n split_word = word.split('')\n fixed_word = split_word.map do |char|\n if !char.upcase!\n char.downcase!\n else\n char.upcase\n end\n char\n end\n fixed_word.join\n end\n swapped_case_word.join(' ')\nend",
"def StringSwapForUs str\n swap_str = []\n str.split(\"\").each do |val|\n if val == val.upcase\n swap_str << val.downcase\n elsif val == val.downcase\n swap_str << val.upcase\n end\n end\n\n swap_str.join(\"\")\nend",
"def palindrome_substrings(string)\n\nend",
"def palindromes(words)\n words_array = words.split\n result = []\n words_array.each do |word|\n result << word.downcase if word.reverse == word\n end\n result.sort!{|a,b| a.downcase <=> b.downcase}\n result.each do |item|\n p item\n end\n end",
"def reverse_each_word(s_input)\n a_input = s_input.split # convert scentance to array\n reversed = \"\" # string to hold reversed scentance\n # go through each word\n\n a_input.each_with_index { |word, index|\n characters = word.split \"\" # split the word into an array\n characters = characters.reverse # reverse the chars in array\n # puts \"#{characters} #{characters.is_a?(Array)}\"\n new_word = characters.join \"\" # join characters array into a word\n if index == 0\n reversed << \"#{new_word}\" # shovel the new_word into the string reversed without space if first word\n else\n reversed << \" #{new_word}\" # shovel the new_word into the string reversed\n end\n }\n reversed\nend",
"def palindrome_permutation(string)\n # new_string = string.gsub(/\\s+/, \"\")\n # p new_string.length\n # permutation = new_string.chars\n # p \n\n\n # if new_string.length % 2 != 0\n # puts \"True. permutation\"\n # end\n\n # pal_split = string.split\n\n # pal0_split = pal_split[0].chars\n # removed_last_letter = pal0_split.pop\n # word_one = pal0_split.join\n # if word_one == pal_split[1].reverse\n # puts \"True permutations \"\n # else\n # puts \"no\"\n # end\n\n new_string = string.gsub(/\\s+/, \"\")\n reversed_word = new_string.reverse\n if new_string == reversed_word\n puts \"true.\"\n else \n puts \"false\"\n end \nend",
"def swapcase(string)\n string = string.split(' ')\n new_string = \"\"\n\n string.map! do |word|\n word = word.split('').map {|l| UPPERCASE.include?(l) ? l.downcase : l.upcase}\n word.join('')\n end\n\n string.join(' ')\nend",
"def swapcase(multi_word_string)\n word_arr = multi_word_string.split\"\" \n modified_arr = word_arr.map do |char|\n if char.match(/[a-z]/)\n char.upcase\n elsif char.match(/[A-Z]/)\n char.downcase\n else\n char\n end\n end\n modified_arr.join\"\"\nend",
"def palindrome(str)\n sub_arr = substrings(str)\n new_arr = []\n sub_arr.each do |word|\n new_arr << word if word == word.reverse\n end\n new_arr\nend",
"def reverse_each_word_with_each(string)\n original_array = string.split(\" \")\n return_array = []\n original_array.each do |string|\n return_array << string.reverse\n end\n return_array.join(\" \")\n\nend",
"def reverse_words_refactor(string)\n jumbled_letters = string.split(\" \").each {|word| word.reverse!}.join(\" \")\nend",
"def pal_test(string)\n# Create conditional statement if string == string.reverse.capitalize, the accessors will reverse the string and then capitalize the new first index\n# Included an || to the if conditional statement because I didn't account for the capitalization initially and the method can now be used for lowercase words as well\n if string == string.reverse.capitalize || string == string.reverse\n \"#{string} is a palindrome\"\n# Use string interpolation to give the output statement\n else string != string.reverse\n \"#{string} is not a palindrome\"\n end\n# Use a bang operator to return the opposite statement for when the string is not a palindrome\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n def reversed_array(array)\n array.collect do |string| \n string.reverse\n end\n end\n reversed_array(array).join(\" \")\nend",
"def simple_string\n old_string = \"Ruby is cool\"\n new_string = old_string.reverse.upcase\n puts new_string\nend",
"def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend",
"def translate string\n\n\t#This splits the string into an array of words\n\twords = string.split(\" \")\n\t\n\t#Goes through each word in array words\n\tfor i in 0...words.length\n\n\t\t#This splits each word into an array of characters\n\t\tcharacters = words[i].chars\n\n\t\t#If a word begins with a vowel, add \"ay\" to the end of the word\n\t\tif isVowel characters[0]\n\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\t#If a word does not begin with a vowel...\n\t\telse\n\n\t\t\t#While the first character is not a vowel, move it to the back of the word\n\t\t\twhile !(isVowel characters[0])\n\n\t\t\t\t#If the first character is a \"q,\"\n\t\t\t\tif characters[0] == \"q\"\n\n\t\t\t\t\t#and the next character is a \"u,\" push both the \"qu\" to the end\n\t\t\t\t\tif characters[1] == \"u\"\n\n\t\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\t\tcharacters.push(consonant)\n\t\t\t\t\t\tu = characters.shift\n\t\t\t\t\t\tcharacters.push(u)\n\n\t\t\t\t\tend\n\n\t\t\t\t#Otherwise, just push the first letter to the end\n\t\t\t\telse\n\n\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\tcharacters.push(consonant)\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Then add \"ay\" to the end of the word\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\tend\n\t\t\n\tend\n\n\t#Joins together all the words with a space in between them and returns the modified string as an answer\n\tanswer = words.join(\" \")\n\treturn answer\n\nend",
"def reverse_each_word(string)\n new_arr = string.split\n new_arr.collect do |word|\n word.reverse\n end.join(' ')\n \nend",
"def reverse_each_word(string)\n split_array = string.split(' ')\n reversed = []\n split_array.each do |word|\n reversed << word.reverse\n end\nreturn reversed.join(' ')\nend",
"def reverse_sentence(my_sentence)\n #1. check if my_sentence even exists\nif my_sentence.nil? || my_sentence == \"\" || my_sentence.length == 0\n return my_sentence\nend\n\n#example input: \"coffee is the best\"\n#output: #output: \"best is the coffee\"\n# 0 1 2 3\n#store into temp array = [\"coffee\", \"is\", \"the\", \"best\"]\n#2. SPLIT SENTENCE, SAVE INTO TEMP ARRAY\n#\\s+ = whitespace\n#\\S+ = everything else not caught by \\s whitespace\ntemp_array = my_sentence.split(/(\\s+|\\S+)/)\n\n#IMPORTANT BUSINESS LOGIC STARTS BELOW\n#make another array for storage = reversed_array = []\nreversed_array = []\n#LOOP, start at lastword = temp array.length - 1\ni = temp_array.length - 1\nwhile i >= 0\n # push word = \"best\" into reversed_array\n reversed_array.push(temp_array[i])\n #decrement \n i -= 1\nend\n\n#JOIN strings from reversed_array\n# ['12','34','35','231'].join(', ')\nreversed_sentence = reversed_array.join(\"\")\n\n#clear the input using mutations http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference\nmy_sentence.clear\n\n#use string manipulation\nmy_sentence.concat(reversed_sentence)\n\n#cannot do this because ruby is pass by value and not reference\n#my_sentence = reversed_sentence\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n reverse_array = array.collect {|word| word.reverse}\n reverse_string = reverse_array.join(\" \")\n return reverse_string\nend",
"def reverse_each_word(string)\n array = string.split\n array.each do |word|\n word.reverse!\n end\n array.join(\" \")\nend",
"def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 && char == char.reverse }\nend",
"def reverse_each_word(string)\n array = string.split(\" \") #can't enumerate on string, so must turn into an array.\n test_array = [] #creating a new array.\n array.collect do |string| #iterate over the string.\n test_array << string.reverse #adding the reverse string into the new empty array.\n end\n test_array.join(\" \") #making the array a string again. \nend",
"def palindrome_permutation(str)\n\nend",
"def weirdcase(string)\n result = []\n string.split(' ').each do |word|\n i = 0\n while i < word.length\n word[i] = if i.odd?\n word[i].upcase\n else\n word[i].downcase\n end\n i += 1\n end\n result << word\n end\n result.join\nend",
"def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend",
"def reverse_each_word(string)\n string_array = string.split(\" \");\n reverse_string_array = string_array.collect { |string| string.reverse};\n return reverse_string_array.join(\" \");\nend",
"def word_check str\n # set str to be lowercase str.downcase\n simple_str = str.downcase.delete(' ')\n\n # check if the str .reverse is the same\n if simple_str == simple_str.reverse\n \"#{str} is a palidrome\"\n else\n \"#{str} is not a palidrome\"\n end\nend",
"def SwapCase(str)\n string = str.split(\"\")\n arr = []\n\n string.each do |x|\n if x == x.upcase\n arr.push(x.downcase)\n end\n if x == x.downcase\n arr.push(x.upcase)\n end\n end\n\n arr2 = arr.join\n\nend",
"def palindromes(string)\n result = []\n all_substrings = substrings(string)\n all_substrings.each do |item|\n result << item if item.size > 1 && item == item.reverse\n end\n result\nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tnew_string += letter\n \t\tend\nend\n#Transform this new string into an array\n#Swap first and second word in array\n#Turn new word into string\n#Create empty array outside of loop\nnew_word = new_string.split(' ')\n new_word.reverse!\n\nnew_word.map {|names| names.capitalize!}\nnew_string = new_word.join(\" \")\nend",
"def reverse_each_word(string)\n original_array = string.split(\" \")\n new_array = []\n original_array.each do|string|\n new_array << string.reverse\n end\n new_array.join(\" \")\nend",
"def capitalize_words(string)\n\t\n\t#split up string into old array of words \n\told_words_array = string.split\n\t\n\t#set up new array of words \n\tnew_words_array = []\n\t\n\t#loop to go through each word\n\ti = 0 \n\twhile (i < old_words_array.length)\n\t\n\t\t#separate each word into characters\n\t\tchars = old_words_array[i].scan /\\w/\n\t\t\n\t\t#shift off first char \n\t\tfirst_char = chars.shift\n\t\t\n\t\t#make first char uppercase \n\t\tfirst_char = first_char.upcase\n\t\t\n\t\t#join first char with the rest of the chars \n\t\tchars = chars.unshift(first_char)\n\t\t\n\t\t#make the chars back into a string \n\t\tcapitalized_word = chars.join\"\"\n\t\t\n\t\t#put the string into new words array of strings \n\t\tnew_words_array.push(capitalized_word)\n\t\t\n\t\t#increase i \n\t\ti += 1 \n\t\n\tend\n\t\n\t#join new words array back into single string\n\treturn new_words_array.join(\" \")\n\t\nend",
"def reverse_each_word(string)\n sentence = string.split(\" \")\n sentence.collect do |word|\nword.reverse\nend.join(\" \")\nend",
"def reverse_each_word(string)\nstring = string.split(\" \")\nsentence1 = string.each {|a| a.reverse}\nsentence1.join(\" \")\nsentence2 = string.collect {|a| a.reverse}\nsentence2.join(\" \")\nend",
"def reverse_each_word(string)\n arrayOfReversedWords = string.split.collect do |letter|\n letter.reverse\n end\n arrayOfReversedWords.join(\" \")\nend",
"def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end",
"def reverse_each_word(string)\n strarray = string.split(\" \")\n new_string = strarray.collect {|word|\n word.reverse }\n new_string.join(\" \")\nend",
"def palindromes(string)\n array = substrings(string)\n array.select { |sub| sub == sub.reverse }\nend",
"def solution(string)\n string\n .split(\"\") # break chars\n .map { |char| char == char.upcase ? \" \" + char : char } # insert whitespace before uppercase chars\n .join(\"\") # reverts array to string\nend",
"def reverse_each_word(string)\n string = string.split\n reversed_string = []\n \n string.collect do |char|\n reversed_string.push(char.reverse)\n end\n \n return reversed_string.join(' ')\nend",
"def reverse_each_word(string) #collect returns new arr \n string.split(' ').collect {|i| i.reverse!}.join(' ')\nend",
"def change_name(name)\n # swapes names\n name = name.split(' ').reverse.join(' ')\n\n #change all consonant's\n name = name.downcase.split('').map do |l|\n if l.match(/[a,e,i,o,u,\\s]/)\n l = l\n #account for edge case\n elsif l == \"z\"\n l = \"b\"\n else\n l = l.next\n #fixes consonant's that changed into vowels\n if l.match(/[a,e,i,o,u]/)\n l.next\n else\n l = l\n end\n end\n end\n#Loop through vowles\n for i in 0..name.length()-1\n case name[i]\n when \"a\"\n name[i] = \"e\"\n when \"e\"\n name[i] = \"i\"\n when \"i\"\n name[i] = \"o\"\n when \"o\"\n name[i] = \"u\"\n when \"u\"\n name[i] = \"a\"\n end\n end\nname = name.join()\nname = name.split.map(&:capitalize).join(' ')\nputs name\nname\nend",
"def swap(string)\n\tswapper = string.split\n\tstring = swapper.reverse.join(\" \")\n\tstring.downcase!\n\tvowels = \"aeioua\"\n\tcon = \"bcdfghjklmnpqrstvwxyzb\"\n\tindex = 0\n\tfinal_string = \"\"\n\tstring.length.times do |index|\n\t\tif !con.include?(string[index]) && !vowels.include?(string[index])\n\t\t\tfinal_string.concat(\" \")\n\t\t\telsif vowels.include?(string[index])\n\t\t\tnext_vowel = vowels[vowels.index(string[index]) +1]\n\t\t\tfinal_string << next_vowel\n\t\t\telsif con.include?(string[index])\n\t\t\tnext_con = con[con.index(string[index]) +1]\n\t\t\tfinal_string << next_con\n\t\tend\n\t\tindex += 1\n\tend\n\tfinal_string = final_string.split.map! { |x| x.capitalize }.join(' ')\n\tfinal_string\nend",
"def reverse_each_word(sentence1)\n ## sentence1.split turns the string into an array, where each word is an element of the array. No spaces.\n sentence_array = sentence1.split\n sentence_array.collect { |word|\n \n ## .reverse! reverses each word \"in place\", not creating new\n word.reverse!\n }\n ## .join(\" \") takes the elements of the array, joins them as a string with a space between each \n sentence_array.join(\" \")\nend",
"def palindrome(str)\nend",
"def reverse_each_word(phrase)\n phrase.split.collect {|word| word.reverse}.join(\" \")\n \n end",
"def reverse_each_word(string)\n array_frm_string = string.split(\" \")\n rev_string = \"\"\n array_frm_string.collect do |word|\n rev_string << word.reverse + \" \"\n end\n rev_string.chop\nend",
"def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend",
"def swap(string)\n results = []\n\n string.split.each do |word|\n results << word.chars\n end\n\n results.each do |word|\n word[0], word[-1] = word[-1], word[0]\n end\n\n results.map(&:join).join(\" \")\nend",
"def reverse_words(input_string)\n string_array = input_string.split(\" \")\n return_string = \"\"\n string_array.each do |word|\n word_array = word.split(//)\n\n for i in 0...(word_array.length/2)\n temp = word_array[i]\n word_array[i] = word_array[((word_array.length-1)-i)]\n word_array[((word_array.length-1)-i)] = temp\n end\n \n return_string << word_array.join(\"\") + \" \"\n \n end\n \n return_string.slice!((return_string.length)-1)\n return return_string\n\nend",
"def palindrome_checker2 string\n # remove white space from argument using gsub (what being replaced, replacing with what?)\n lowercase_stripped_string = string.downcase.gsub(\" \", \"\")\n # Create a variable to hold stripped string argument reversed \n lowercase_stripped_string_reversed = lowercase_stripped_string.reverse\n # Compare string argument lowercased to string reversed and lowercased variable\n if lowercase_stripped_string == lowercase_stripped_string_reversed\n \"#{string} is a palindrome\"\n else\n \"#{string} is not a palindrome\" \n end\nend",
"def weirdcase(str)\n for i in 0..str.length-1\n if i % 2 != 0\n str[i] = str[i].upcase\n else\n str[i] = str[i].downcase\n end\n end\n str\nend",
"def is_palindrome(word) # define method with one parameter\n i = 0 # set i to zero for first index value is 0\n reversed_string = \"\" # create empty string to store concatenated string\n \n while i < word.length # run while loop as long as word length is greater than i value which increments by one\n char = word[i] # this stores each iteration of string characters\n reversed_string = char + reversed_string # this concatenates string characters in reverse order\n i +=1 # raises increment by one \n end # end loop\n return reversed_string == word # if statement that evaluates whether new string equals original\nend",
"def palindrome(string)\n string.downcase.split(/\\W+/).join('') == string.downcase.split(/\\W+/).join('').reverse\nend",
"def reverse_each_word(string)\n reversed = string.split(\" \").collect do |word|\n word.reverse\nend\n reversed.join(\" \")\nend",
"def reverse_each_word(sentence1)\n sentence1.split.collect {|word| word.reverse}.join(\" \")\n# new_array = []\n# reversed_words = []\n# new_array << sentence1.split.collect(&:reverse!).join(\" \")\n #reversed_words << new_array.collect(&:reverse!)\n #new_array.collect {|word| reversed_words << word.reverse}\n# sentence1.split('').reverse.join('').reverse\n #binding.pry\n #new_array\nend",
"def reverse_each_word(string)\n p string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n sentence_array = string.split(\" \")\n reversed_array = []\n sentence_array.collect do |string|\n reversed_array << string.reverse\n end\n reversed_array.join(\" \")\nend",
"def reverse_sentence(my_sentence)\n #check if my_sentence even exists\n if my_sentence.nil? || my_sentence == \"\" || my_sentence.length == 0\n return my_sentence\n end\n\n #example input: \"coffee is the best\"\n #output: #output: \"best is the coffee\"\n # 0 1 2 3\n #store into temp array = [\"coffee\", \"is\", \"the\", \"best\"]\n #split sentence\n #\n temp_array = my_sentence.split(/(\\s+|\\S+)/)\n\n #make another array for storage = reversed_array = []\n reversed_array = []\n #loop, start at lastword = temp array.length - 1\n i = temp_array.length - 1\n while i >= 0\n # push word = \"best\" into reversed_array\n reversed_array.push(temp_array[i])\n #decrement \n i -= 1\n end\n \n # ['12','34','35','231'].join(', ')\n reversed_sentence = reversed_array.join(\"\")\n \n #clear the input using mutations http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference\n my_sentence.clear\n\n #use string manipulation\n my_sentence.concat(reversed_sentence)\n\n #cannot do this because ruby is pass by value and not reference\n #my_sentence = reversed_sentence\nend",
"def palindrome_substrings(string)\narray = substrings(string)\npalindromes = []\n\n array.each do |ele|\n if palindrome?(ele) == true && ele.length > 1\n palindromes << ele\n end\nend\npalindromes\nend",
"def reverse_each_word(astring)\n astring.split(\" \").collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n array = array.collect do |word|\n word.reverse\n end\n string = array.join(\" \")\n string\nend",
"def is_palindrome(string)\n array = string.chars\n orginal_char_array = array.select do |char|\n /[A-Za-z]/.match char\n end\n \n char_array = array.select do |char|\n /[A-Za-z]/.match char\n end\n length = char_array.length\n first_index = 0\n last_index = length -1\n while first_index < last_index\n temp = char_array[first_index]\n char_array[first_index] = char_array[last_index]\n char_array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n \n if char_array.join.upcase == orginal_char_array.join.upcase\n return true\n else\n return false\n end\nend",
"def reverse_each_word(string)\n array = string.split \" \"\n array.collect { |word| word.reverse! }\n array.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n array.collect do |element|\n element.reverse!\n end\n array.join(\" \")\nend",
"def reverse_each_word(str)\r\n str = str.split(\" \")\r\n str.map do |word|\r\n word.reverse!\r\n end\r\n str.join(\" \")\r\nend",
"def reverse_each_word(string)\n words_arr = string.split\n reverse = words_arr.collect {|word| word.reverse}\n reverse.join(\" \")\nend",
"def reverse_each_word(string)\n new_string = string.split(\" \")\n new_array = new_string.collect do |item|\n item.reverse\n end\n\tnew_array.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence_array = sentence.split #convert to array\n reverse_sentence_array = sentence_array.collect do |word| #returns new array\n word.reverse #reverse order of returned argument\n end\n reverse_sentence = reverse_sentence_array.join(\" \") #returns the array to a string\n return reverse_sentence #run that puppy\nend",
"def reverse_each_word(string_sentence)\n array = string_sentence.split\n in_place_reverse_string_sentence = []\n array.collect do |element|\n in_place_reverse_string_sentence << element.reverse \n end\n in_place_reverse_string_sentence.join(\" \")\nend",
"def reverse_each_word(str)\n arr = str.split\n revArr = arr.collect do |word|\n word.reverse\n end\n revArr.join(\" \")\nend",
"def weirdcase(string)\n string.split(\" \").map do |word|\n word.split(\"\").each_with_index.map do |char, i|\n i.even? ? char.upcase : char.downcase\n end.join(\"\")\n end.join(\" \")\nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n new_arr = []\n holder = []\n i = 0\n while i < my_sentence.length\n if my_sentence[i] == \" \"\n new_arr << holder.join # [\"Hello\"]\n new_arr << \" \" # [\"Hello\", \" \"]\n holder = [] # empty array for the next word\n else\n holder << my_sentence[i]\n end\n i += 1\n end\n new_arr << holder.join # [\"Hello\", \" \", \"world\"]\n # creating the reversed string from the above array\n k = new_arr.length - 1\n i = 0\n while k >= 0\n if i < k\n temp = new_arr[i] # temporarly save words in the first half of the array\n new_arr[i] = new_arr[k] # swap each words in the array\n new_arr[k] = temp\n i += 1\n end\n k -= 1\n end\n # [\"world\", \" \", \"Hello\"]\n i = 0\n new_sentence = new_arr.join\n while i < new_sentence.length\n my_sentence[i] = new_sentence[i] #my_sentence at index 0 is replaced by new_sentence at index 0\n i += 1\n end\n return my_sentence\nend",
"def reverse_each_word(string)\n sentence = string.split()\n sentence.collect do |word|\n word.reverse!\n end\n sentence.join(\" \")\nend",
"def reverse_each_word(string)\n new_array = string.split\n reversed = new_array.collect do |word|\n word.reverse\n end\n reversed.join(' ')\nend",
"def palindromes(str)\n results = []\n 1.upto(str.length) do |idx|\n str.chars.each_cons(idx)\n .each {|subr| results << subr.join if subr.size > 1 && subr == subr.reverse}\n end\n results.sort \nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\n \nend",
"def palindromes(str)\n result = []\n array = substrings(str)\n array.each do |char|\n result << char if char.reverse == char && char.size > 1\n end\n result\nend",
"def reverse_each_word(string)\n string.split\n string.split.collect do |s|\n s.reverse!\n s.split.join(\" \")\n end\n .join(\" \")\nend",
"def reverse_each_word(string)\n rev_string = string.split\n rev_string.collect do |rev|\n rev.reverse!\n end\n return rev_string.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n \n array.collect do |element| \n element.reverse\n end.join(\" \")\nend",
"def swapcase(string)\n characters = string.split('').map do |char|\n if char =~ /[A-Z]/\n char.downcase\n elsif char =~ /[a-z]/\n char.upcase\n else\n char\n end\n end\n characters.join\n\n # new_string = ''\n # string.each_char do |char|\n # if UPPERCASE.include?(char)\n # new_string += char.downcase\n # else\n # new_string += char.upcase\n # end\n # end\n # p new_string\nend",
"def reverse_each_word(sentence)\narrayed = sentence.split (\" \")\nreversed = arrayed.collect {|i| i.reverse}\nreversed.join (\" \")\nend",
"def reverse_each_word(x) \n #Create a new array to store the split string\n array = []\n #Use .split to split the string into an array of strings\n array = x.split \n #Use collect enumerable to iterate over the elements of array and .reverse! to reverse each element\n array.collect{|n| n.reverse!}\n #Use .join on the array with ' ' to join the elements together with a space into a string\n array.join(' ')\nend",
"def reverse_sentence(my_sentence)\n \n return nil if my_sentence == nil\n \n # reverses all characters in sentence\n i = 0\n j = my_sentence.length - 1\n \n while i < my_sentence.length / 2\n temp_i = my_sentence[i]\n temp_j = my_sentence[j]\n \n my_sentence[i] = temp_j\n my_sentence[j] = temp_i\n \n i += 1 \n j -= 1\n end\n \n \n # reverses any words in the sentence\n i = 0\n word_start = 0\n word_end = 0\n in_word = true\n \n while i < my_sentence.length\n if ( my_sentence[i] == \" \" || i == my_sentence.length - 1 ) && in_word == true\n \n word_end = i \n word_end -= 1 if my_sentence[i] == \" \"\n \n word_length = word_end - word_start + 1\n count = 0\n \n while count < word_length / 2\n temp_start = my_sentence[word_start]\n temp_end = my_sentence[word_end]\n \n my_sentence[word_start] = temp_end\n my_sentence[word_end] = temp_start\n \n word_start += 1\n word_end -= 1\n count += 1\n end\n \n in_word = false\n end\n \n if my_sentence[i] != \" \" && in_word == false\n word_start = i\n in_word = true\n end\n \n i += 1\n end\n \n return my_sentence\nend",
"def reverse_sentence(my_sentence)\n if my_sentence != nil\n # Creates array of words and spaces\n words_array = words(my_sentence)\n\n # Revereses the order of the words\n length = words_array.length\n i = 0\n j = length - 1\n (length / 2).times do\n # selects word at smallest index that has not been swapped\n word_1 = words_array[i]\n # selects words at largest index that has not been swapped\n word_2 = words_array[j]\n \n words_array[i] = word_2\n words_array[j] = word_1\n \n i += 1\n j -= 1\n end\n \n reverse = words_array.join\n\n # Overrides original string with order of characters in reverse\n i = 0\n my_sentence.length.times do\n my_sentence[i] = reverse[i]\n i += 1\n end\n end\n\n return my_sentence\nend",
"def reverse_each_word(input_string)\n input_array = input_string.split(\" \")\n \n reverse_array = input_array.collect{ |each_word| each_word.reverse}\n reverse_array.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n array.collect {|words| words.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n new_array = []\n array.collect do |string|\n new_array << string.reverse \n end\n return new_array.join(\" \")\nend",
"def reverse_each_word(string)\n step_one = string.split(\" \")\n step_one.collect do |word| word.reverse\n \"#{word.reverse}\"\n end\n .join(\" \")\nend",
"def reverse_words(my_words) #with string_reverse\r\n return my_words if my_words.length < 2\r\n return string_reverse(my_words) if !my_words.include?(\" \")\r\n\r\n first = 0\r\n\r\n my_words.length.times do |last |\r\n if my_words[last].match(/\\s/)\r\n my_words[first...last] = string_reverse(my_words[first...last])\r\n first = last + 1\r\n elsif last == (my_words.length - 1)\r\n my_words[first..last] = string_reverse(my_words[first..last])\r\n end\r\n end\r\n\r\n return my_words\r\nend",
"def capitalize_each_word(phrase)\n finalString = \"\"\n array = phrase.split(\" \")\n array.each do |word|\n word[0] = word[0].upcase\n \n if word == array[0]\n puts word\n puts array[0]\n \n finalString += word\n else \n \n finalString += \" \" + word\n end\n end\n puts finalString\n return finalString\n\nend",
"def reverse_each_word(string)\n array = []\n array = string.split(\" \")\n array.collect do |word| \n word.reverse!\n end\n final_array = array.join(\" \")\n final_array\nend",
"def palindromes(string)\n all_substrings = all_substrings(string)\n palindromes = []\n all_substrings.each do |substring|\n palindromes << substring if substring == substring.reverse && substring.length > 1\n end\n palindromes\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend"
] |
[
"0.71505433",
"0.7049792",
"0.6892113",
"0.68268406",
"0.6826752",
"0.68225676",
"0.6807951",
"0.6806652",
"0.6799156",
"0.67507946",
"0.67364055",
"0.6729693",
"0.6688976",
"0.66532886",
"0.66393644",
"0.6638953",
"0.66371673",
"0.66154104",
"0.6612245",
"0.6607148",
"0.6605477",
"0.66022",
"0.65983206",
"0.6597903",
"0.6592646",
"0.65925205",
"0.6579107",
"0.65788805",
"0.6575824",
"0.65728533",
"0.6566928",
"0.6561473",
"0.65597624",
"0.6556922",
"0.655192",
"0.6544027",
"0.65403277",
"0.6527366",
"0.6522959",
"0.6519552",
"0.6518106",
"0.65179896",
"0.6515353",
"0.6514769",
"0.6514084",
"0.6508542",
"0.65079",
"0.65056837",
"0.65026796",
"0.6502275",
"0.6502188",
"0.65007305",
"0.64989924",
"0.6497084",
"0.64938176",
"0.6489784",
"0.64809245",
"0.6479368",
"0.64791644",
"0.6473152",
"0.64715046",
"0.6466941",
"0.6464939",
"0.6464397",
"0.64634556",
"0.64620596",
"0.6461894",
"0.64578754",
"0.6449869",
"0.6449529",
"0.64478076",
"0.64478076",
"0.6445796",
"0.64432526",
"0.6442366",
"0.64397174",
"0.64376616",
"0.6436022",
"0.64337796",
"0.6432469",
"0.6432279",
"0.6428211",
"0.64274806",
"0.64265954",
"0.6426303",
"0.64222",
"0.6419697",
"0.64167804",
"0.6416245",
"0.6409347",
"0.6406799",
"0.64063853",
"0.6404341",
"0.640329",
"0.64029855",
"0.64001733",
"0.63997704",
"0.63983214",
"0.63983214",
"0.63983214"
] |
0.7823821
|
0
|
GET /telefons/1 GET /telefons/1.xml
|
def show
@telefon = Telefon.find(params[:id])
respond_with(@telefon)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end",
"def show\n @telefone = Telefone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @telefone }\n end\n end",
"def show\n @telefono = @persona.telefonos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @telefono }\n end\n end",
"def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end",
"def show\n @telefononegocio = Telefononegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @telefononegocio }\n end\n end",
"def index\n @telefonos = @persona.telefonos.find(:all, :order => \"tipo ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @telefonos }\n end\n end",
"def show\n @telecom_room = TelecomRoom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @telecom_room }\n end\n end",
"def new\n @tipo_telefone = TipoTelefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end",
"def show\n @telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @telefono_empresa_cliente }\n end\n end",
"def index\n @telefones = Telefone.all\n listarContatos\n end",
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def new\n @telefone = Telefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @telefone }\n end\n end",
"def show\n @teleoperation = Teleoperation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teleoperation }\n end\n end",
"def show\n respond_with(@teleprovider)\n end",
"def set_telefone\n @telefone = Telefone.find(params[:id])\n end",
"def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end",
"def index\n @phone_numbers = @kontact_information.phone_numbers.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @phone_numbers }\n end\n end",
"def show\n @technocal_client_address = TechnocalClientAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @technocal_client_address }\n end\n end",
"def show\n @patrimonio = Patrimonio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def show\n @leilao = Leilao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @leilao }\n end\n end",
"def tournaments_info(tournament_id, tournament_type = 'sr:tournament')\n get(\"sports/en/tournaments/#{tournament_type}:#{tournament_id}/info.xml\")\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @phone = Phone.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @phone.to_xml }\n end\n end",
"def show\n @services_charger = ServicesCharger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @services_charger }\n end\n end",
"def show\n @finger = Finger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @finger }\n end\n end",
"def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @phone }\n end\n end",
"def show\n @detailed_retrofit = DetailedRetrofit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @detailed_retrofit }\n end\n end",
"def show\n @lote = Lote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lote }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @phone_number }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notifier }\n end\n end",
"def show\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def show\n @lien = Lien.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def show\n @tire = Tire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tire }\n end\n end",
"def show\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def feats\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lieu }\n end\n end",
"def show\n @tcliente = Tcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tcliente }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def show\n @lotto_type = LottoType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def show\n @geoname = Geoname.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"def show\n @ponto = Ponto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def show\n @moto_user_phone = MotoUserPhone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_user_phone }\n end\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fee_temps }\n format.json { render :text => get_json }\n end\n end",
"def show\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_tel }\n end\n end",
"def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocolo }\n end\n end",
"def show\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @online_retailer_user }\n end\n end",
"def index\n @telefonos = Telefono.all\n end",
"def show\n @phone_use = PhoneUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @phone_use }\n end\n end",
"def show\n @feat = @person.feats.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def index\n #@feats = Feat.find(:all)\n @feats = @character.feats.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end",
"def show\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def show\n @meant_it_rel = MeantItRel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meant_it_rel }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @online_retailer_users }\n end\n end",
"def show\n @phonecall = Phonecall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @phonecall }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def show\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_restaurante }\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 @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_nota }\n end\n end",
"def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n @telecom_room = TelecomRoom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telecom_room }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_recibo }\n end\n end",
"def show\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estatu }\n end\n end",
"def show\n @tipo_lista = TipoLista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_lista }\n end\n end",
"def show\n @invite_friend = InviteFriend.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @invite_friend.to_xml }\n end\n end",
"def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end",
"def show\n @phone_number = PhoneNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @phone_number }\n end\n end",
"def new\n @telefono_empresa_cliente = TelefonoEmpresaCliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telefono_empresa_cliente }\n end\n end",
"def show\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tservicio }\n end\n end",
"def show\n @tpago = Tpago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end",
"def show\n @domino = Domino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domino }\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 index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tenders }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def index\n @modele_telephones = ModeleTelephone.all\n end",
"def index\n @attendees = Attendee.paginate(:page => params[:page], :per_page => 40)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attendees }\n end\n end",
"def show\n @toilet = Toilet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @toilet }\n end\n end",
"def show\n @contactos = Contactos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contactos }\n end\n end",
"def show\n @technician = Technician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @technician }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @flight }\n end\n end",
"def show\n @tipo_fuente = TipoFuente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_fuente }\n end\n end",
"def show\n @old_twit = OldTwit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"def show\n @tipomensaje = Tipomensaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipomensaje }\n end\n end",
"def show\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abonne }\n end\n end",
"def index\n @contacts = Mailee::Contact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end",
"def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end",
"def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end",
"def index\n @telecreditos = Telecredito.all\n end",
"def show\n @offender = Offender.find(params[:id])\n\n respond_to do |format|\n format.mobile\n format.html # show.html.erb\n format.xml { render :xml => @offender }\n end\n end",
"def show\n @remocao = Remocao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @remocao }\n end\n end",
"def show\n @detour = Detour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @detour }\n end\n end",
"def show\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_empenho_iten }\n end\n end",
"def new\n @telefononegocio = Telefononegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @telefononegocio }\n end\n end"
] |
[
"0.68341696",
"0.6534509",
"0.6450768",
"0.6384626",
"0.62680596",
"0.62599754",
"0.618201",
"0.60888463",
"0.6009699",
"0.5956145",
"0.5891114",
"0.5880905",
"0.58773136",
"0.5776889",
"0.5772216",
"0.57183444",
"0.56809086",
"0.5665019",
"0.5638449",
"0.5620004",
"0.5589512",
"0.5568698",
"0.5551993",
"0.5539806",
"0.5535505",
"0.5525626",
"0.5521703",
"0.55160165",
"0.5509679",
"0.550622",
"0.5502012",
"0.55009127",
"0.5496881",
"0.54905593",
"0.54885554",
"0.5485184",
"0.54847336",
"0.5480426",
"0.547592",
"0.5475602",
"0.5471262",
"0.5467949",
"0.54637706",
"0.54614866",
"0.54571456",
"0.54562944",
"0.5453925",
"0.54535747",
"0.54504615",
"0.54503196",
"0.5446452",
"0.5445853",
"0.54380953",
"0.54366535",
"0.54341173",
"0.5420662",
"0.54201883",
"0.54182863",
"0.54157627",
"0.54154795",
"0.5414891",
"0.5414638",
"0.54045653",
"0.54036224",
"0.5401483",
"0.5398072",
"0.53965294",
"0.53926766",
"0.53898627",
"0.5387901",
"0.53863066",
"0.5380893",
"0.53789747",
"0.5377189",
"0.53763777",
"0.5374999",
"0.5366149",
"0.53599775",
"0.5357939",
"0.5357525",
"0.5357214",
"0.53509814",
"0.5346891",
"0.5346749",
"0.5344638",
"0.53430223",
"0.5342202",
"0.5339714",
"0.53378224",
"0.53338987",
"0.53283507",
"0.5323724",
"0.53176224",
"0.53176224",
"0.5315822",
"0.53146213",
"0.53110427",
"0.531093",
"0.53088295",
"0.53084886"
] |
0.611009
|
7
|
GET /telefons/new GET /telefons/new.xml
|
def new
@telefon = Telefon.new
respond_with(@telefon)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @tipo_telefone = TipoTelefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end",
"def new\n @telefone = Telefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @telefone }\n end\n end",
"def new\n @telefononegocio = Telefononegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @telefononegocio }\n end\n end",
"def new\n @telefono = @persona.telefonos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telefono }\n end\n end",
"def new\n @telecom_room = TelecomRoom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telecom_room }\n end\n end",
"def create\n @tipo_telefone = TipoTelefone.new(params[:tipo_telefone])\n\n respond_to do |format|\n if @tipo_telefone.save\n flash[:notice] = 'TipoTelefone was successfully created.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { render :xml => @tipo_telefone, :status => :created, :location => @tipo_telefone }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def new\n @telefono_empresa_cliente = TelefonoEmpresaCliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telefono_empresa_cliente }\n end\n end",
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone }\n end\n end",
"def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end",
"def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end",
"def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end",
"def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @phone }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @tipo_nota = TipoNota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_nota }\n end\n end",
"def new\n @teleoperation = Teleoperation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teleoperation }\n end\n end",
"def new\n @town = Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town }\n end\n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\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 @technocal_client_address = TechnocalClientAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @technocal_client_address }\n end\n end",
"def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end",
"def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end",
"def new\n @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end",
"def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end",
"def create\n @telefone = Telefone.new(params[:telefone])\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { render :json => @telefone, :status => :created, :location => @telefone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end",
"def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end",
"def new\n @abonne = Abonne.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abonne }\n end\n end",
"def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def new\n @tcliente = Tcliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tcliente }\n end\n end",
"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 @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flight }\n end\n end",
"def new\n @typo = Typo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @typo }\n end\n end",
"def new\n @todos = Todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todos }\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 @domino = Domino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domino }\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tweet }\n end\n end",
"def new\n @phone_number = PhoneNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone_number }\n end\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def new\n @tipo_tel = TipoTel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_tel }\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 @cuenta = Cuenta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuenta }\n end\n end",
"def new\n @cuenta = Cuenta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuenta }\n end\n end",
"def new\n @leilao = Leilao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @leilao }\n end\n end",
"def new\n @tipo_lista = TipoLista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_lista }\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 respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @foyer = Foyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foyer }\n end\n end",
"def new\n @cuenta = Cuenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuenta }\n end\n end",
"def create\n @telefone = Telefone.new(telefone_params)\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, notice: 'Telefone was successfully created.' }\n format.json { render :show, status: :created, location: @telefone }\n else\n format.html { render :new }\n format.json { render json: @telefone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tiposcontrato = Tiposcontrato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposcontrato }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @location_phone }\n end\n end",
"def new\n @contacto = Contacto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacto }\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n @tipo_fuente = TipoFuente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_fuente }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite }\n end\n end",
"def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @online_retailer_user }\n end\n end",
"def new\n @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\n end\n end",
"def new\n @tipomensaje = Tipomensaje.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipomensaje }\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 @lote = Lote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lote }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end",
"def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tender }\n end\n end",
"def new\n @partenaire = Partenaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partenaire }\n end\n end",
"def new\n @partenaire = Partenaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partenaire }\n end\n end",
"def new\n @tservicio = Tservicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tservicio }\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 @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @moto_user_phone = MotoUserPhone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_user_phone }\n end\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def new\n @tour = Tour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tour }\n end\n end",
"def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end",
"def new\n @persona = Persona.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end",
"def new\n @fan = Fan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fan }\n end\n end",
"def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @phonecall = Phonecall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phonecall }\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 @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dato }\n end\n end",
"def new\n @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dato }\n end\n end",
"def new\n @town_type = TownType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town_type }\n end\n end",
"def new\n @field_trip = FieldTrip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @field_trip }\n end\n end",
"def new\n @noticia = Noticia.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noticia }\n end\n end",
"def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end"
] |
[
"0.7528302",
"0.7430284",
"0.71283233",
"0.70270234",
"0.6983166",
"0.68951213",
"0.68887883",
"0.6811578",
"0.6797174",
"0.67958575",
"0.67915595",
"0.6783247",
"0.6779791",
"0.6730128",
"0.6730128",
"0.672596",
"0.671277",
"0.6712544",
"0.67093104",
"0.66870093",
"0.6685129",
"0.6680442",
"0.6664429",
"0.6650923",
"0.6640729",
"0.6639447",
"0.66352177",
"0.66239357",
"0.6619836",
"0.6619701",
"0.6610223",
"0.6587068",
"0.6582506",
"0.65740466",
"0.6567755",
"0.6561794",
"0.65539306",
"0.6553746",
"0.6550046",
"0.6548838",
"0.6547082",
"0.6542403",
"0.6542354",
"0.6539436",
"0.6539278",
"0.6536481",
"0.6531152",
"0.65244234",
"0.6524292",
"0.6524292",
"0.6520134",
"0.6518012",
"0.65164113",
"0.6513541",
"0.65095",
"0.65024775",
"0.6497476",
"0.6496341",
"0.64959705",
"0.6479629",
"0.64790887",
"0.6474854",
"0.64695996",
"0.64683217",
"0.64680713",
"0.646574",
"0.64655",
"0.6462437",
"0.646134",
"0.646134",
"0.6457093",
"0.64548725",
"0.645478",
"0.6452878",
"0.6452878",
"0.64502424",
"0.6450008",
"0.6449666",
"0.6449666",
"0.6447829",
"0.6447594",
"0.6445231",
"0.6445231",
"0.6444979",
"0.6439716",
"0.64361477",
"0.64321744",
"0.6428639",
"0.6428015",
"0.6426491",
"0.64209545",
"0.64209545",
"0.64209515",
"0.6417533",
"0.64160675",
"0.64160675",
"0.64133066",
"0.64117527",
"0.6408852",
"0.6408022"
] |
0.7050786
|
3
|
POST /telefons POST /telefons.xml
|
def create
@telefon = Telefon.new(params[:telefon])
@telefon.save
respond_with(@telefon)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @telefone_fornecedor = TelefoneFornecedor.new(telefone_fornecedor_params)\n\n respond_to do |format|\n if @telefone_fornecedor.save\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @telefone_fornecedor }\n else\n format.html { render :new }\n format.json { render json: @telefone_fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @telefone = Telefone.new(telefone_params)\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, notice: 'Telefone was successfully created.' }\n format.json { render :show, status: :created, location: @telefone }\n else\n format.html { render :new }\n format.json { render json: @telefone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @telefone = Telefone.new(params[:telefone])\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { render :json => @telefone, :status => :created, :location => @telefone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_telefone = TipoTelefone.new(params[:tipo_telefone])\n\n respond_to do |format|\n if @tipo_telefone.save\n flash[:notice] = 'TipoTelefone was successfully created.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { render :xml => @tipo_telefone, :status => :created, :location => @tipo_telefone }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @telefononegocio = Telefononegocio.new(params[:telefononegocio])\n\n respond_to do |format|\n if @telefononegocio.save\n format.html { redirect_to @telefononegocio, notice: 'Telefononegocio was successfully created.' }\n format.json { render json: @telefononegocio, status: :created, location: @telefononegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @telefononegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @telefono = @persona.telefonos.build(params[:telefono])\n\n respond_to do |format|\n if @telefono.save\n flash[:notice] = \"El Telefono #{@telefono.numero.to_s} se le ha agregado a #{@persona.nombre_completo}.\"\n format.html { redirect_to([@persona, @telefono]) }\n format.xml { render :xml => @telefono, :status => :created, :location => @telefono }\n else\n flash[:error] = \"Hubo un error creando el teléfono\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @telefono.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @telefone_cliente = TelefoneCliente.new(telefone_cliente_params)\n\n respond_to do |format|\n if @telefone_cliente.save\n format.html { redirect_to @telefone_cliente, notice: 'Telefone cliente was successfully created.' }\n format.json { render :show, status: :created, location: @telefone_cliente }\n else\n format.html { render :new }\n format.json { render json: @telefone_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def telefone_params\n params.require(:telefone).permit(:numero, :contato_id)\n end",
"def create\n @fornecedor = Fornecedor.new(fornecedor_params)\n @telefones = get_telefones\n @emails = get_emails\n respond_to do |format|\n if validate_telefones && validate_emails && @fornecedor.save # TODO: deal with validates errors messages\n add_telefones\n add_emails\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @fornecedor }\n else\n format.html { render :new, error: 'Erro.' }\n format.json { render json: @fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @telefone = Telefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @telefone }\n end\n end",
"def create\n @telfornecedor = Telfornecedor.new(telfornecedor_params)\n\n respond_to do |format|\n if @telfornecedor.save\n format.html { redirect_to @telfornecedor, notice: 'Telfornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @telfornecedor }\n else\n format.html { render :new }\n format.json { render json: @telfornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @telecredito = Telecredito.new(telecredito_params)\n\n respond_to do |format|\n if @telecredito.save\n format.html { redirect_to @telecredito, notice: 'Telecredito was successfully created.' }\n format.json { render :show, status: :created, location: @telecredito }\n else\n format.html { render :new }\n format.json { render json: @telecredito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_telefone\n @telefone = Telefone.find(params[:id])\n end",
"def new\n @tipo_telefone = TipoTelefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end",
"def telfornecedor_params\n params.require(:telfornecedor).permit(:cnpj, :telefone)\n end",
"def create\n @teleprovider = Teleprovider.new(teleprovider_params)\n\n if @teleprovider.save\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully created.')\n else\n respond_with(@teleprovider)\n end\n end",
"def create\n @teleoperation = Teleoperation.new(params[:teleoperation])\n\n respond_to do |format|\n if @teleoperation.save\n format.html { redirect_to @teleoperation, notice: 'Teleoperation was successfully created.' }\n format.json { render json: @teleoperation, status: :created, location: @teleoperation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teleoperation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @telefononegocio = Telefononegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @telefononegocio }\n end\n end",
"def telefone_fornecedor_params\n params.require(:telefone_fornecedor).permit(:ddd, :telefone, :Fornecedor_id)\n end",
"def new\n @telefono = @persona.telefonos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telefono }\n end\n end",
"def new\n @telefon = Telefon.new\n respond_with(@telefon)\n end",
"def postEntityFax( entity_id, number, description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['description'] = description\n return doCurl(\"post\",\"/entity/fax\",params)\n end",
"def set_telefone_fornecedor\n @telefone_fornecedor = TelefoneFornecedor.find(params[:id])\n end",
"def create\n @telefono = Telefono.new(telefono_params)\n\n respond_to do |format|\n if @telefono.save\n format.html { redirect_to @telefono, notice: 'Telefono was successfully created.' }\n format.json { render :show, status: :created, location: @telefono }\n else\n format.html { render :new }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_tel = TipoTel.new(params[:tipo_tel])\n\n respond_to do |format|\n if @tipo_tel.save\n format.html { redirect_to @tipo_tel, notice: 'Tipo tel was successfully created.' }\n format.json { render json: @tipo_tel, status: :created, location: @tipo_tel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_tel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @modele_telephone = ModeleTelephone.new(modele_telephone_params)\n\n respond_to do |format|\n if @modele_telephone.save\n format.html { redirect_to @modele_telephone, notice: 'Modele telephone was successfully created.' }\n format.json { render :show, status: :created, location: @modele_telephone }\n else\n format.html { render :new }\n format.json { render json: @modele_telephone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tel = Tel.new(tel_params)\n\n respond_to do |format|\n if @tel.save\n format.html { redirect_to @tel, notice: 'Tel was successfully created.' }\n format.json { render :show, status: :created, location: @tel }\n else\n format.html { render :new }\n format.json { render json: @tel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @telefono_empresa_cliente = TelefonoEmpresaCliente.new(params[:telefono_empresa_cliente])\n\n respond_to do |format|\n if @telefono_empresa_cliente.save\n format.html { redirect_to(@telefono_empresa_cliente, :notice => 'Telefono empresa cliente was successfully created.') }\n format.xml { render :xml => @telefono_empresa_cliente, :status => :created, :location => @telefono_empresa_cliente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @telefono_empresa_cliente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postEntityPhone( entity_id, number, trackable)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['trackable'] = trackable\n return doCurl(\"post\",\"/entity/phone\",params)\n end",
"def create\n @prospecto_telefono = ProspectoTelefono.new(prospecto_telefono_params)\n\n respond_to do |format|\n if @prospecto_telefono.save\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully created.' }\n format.json { render :show, status: :created, location: @prospecto_telefono }\n else\n format.html { render :new }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end",
"def create(to, from, url, optional_params = {})\n opts = { :To => to, :From => from, :Url => url }.merge(optional_params)\n response = Network.post(['Faxes'], opts)\n Fax.new(response)\n end",
"def update\n @telefon = Telefon.find(params[:id])\n @telefon.update_attributes(params[:telefon])\n respond_with(@telefon)\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end",
"def update\n respond_to do |format|\n if @telefone.update(telefone_params)\n format.html { redirect_to @telefone, notice: 'Telefone was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefone }\n else\n format.html { render :edit }\n format.json { render json: @telefone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create\n @fax_typ = FaxTyp.new(params[:fax_typ])\n\n respond_to do |format|\n if @fax_typ.save\n format.html { redirect_to @fax_typ, notice: 'Fax typ was successfully created.' }\n format.json { render json: @fax_typ, status: :created, location: @fax_typ }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fax_typ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addTelefone(contato)\n\tputs(\"\\n\\nDigite o novo numero:\")\n\ttel = Telefone.new\n\ttel.numero = Validacao.validaTelefone(gets.chomp)\n\ttel.id_contato = contato.id\n\tcontato.telefones.push(tel)\n\tContatoDAO.new.addTelefone(tel)\nend",
"def send_fax()\n begin\n bodyParams = {\n to: [{ phoneNumber: RECIPIENT }],\n # To send fax to multiple recipients, add more 'phoneNumber' object. E.g.\n #\n # to: [\n # { phoneNumber: \"Recipient1-Phone-Number\" },\n # { phoneNumber: \"Recipient2-Phone-Number\" }\n # ],\n faxResolution: \"High\",\n coverPageText: \"This is a demo Fax page from Ruby\"\n }\n files = [\n ['test.jpg', 'image/jpeg']\n ]\n\n endpoint = \"/restapi/v1.0/account/~/extension/~/fax\"\n resp = $platform.post(endpoint, payload: bodyParams, files: files)\n puts (\"Fax sent. Message id: \" + resp.body['id'].to_s)\n check_fax_message_status(resp.body['id'])\n rescue StandardError => e\n puts (e)\n end\nend",
"def create\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new(params[:add_phone_to_nouveau_ticket])\n\n respond_to do |format|\n if @add_phone_to_nouveau_ticket.save\n format.html { redirect_to @add_phone_to_nouveau_ticket, notice: 'Add phone to nouveau ticket was successfully created.' }\n format.json { render json: @add_phone_to_nouveau_ticket, status: :created, location: @add_phone_to_nouveau_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_phone_to_nouveau_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @telecom_room = TelecomRoom.new(params[:telecom_room])\n\n respond_to do |format|\n if @telecom_room.save\n format.html { redirect_to(@telecom_room, :notice => 'TelecomRoom was successfully created.') }\n format.xml { render :xml => @telecom_room, :status => :created, :location => @telecom_room }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @telecom_room.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fondo = Fondo.new(fondo_params)\n\n respond_to do |format|\n if @fondo.save\n format.html { redirect_to @fondo, notice: 'Fondo was successfully created.' }\n format.json { render :show, status: :created, location: @fondo }\n else\n format.html { render :new }\n format.json { render json: @fondo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_telefone_cliente\n @telefone_cliente = TelefoneCliente.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @telefone_fornecedor.update(telefone_fornecedor_params)\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefone_fornecedor }\n else\n format.html { render :edit }\n format.json { render json: @telefone_fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tenni = Tenni.new(params[:tenni])\n\n respond_to do |format|\n if @tenni.save\n format.html { redirect_to @tenni, notice: 'Tenni was successfully created.' }\n format.json { render json: @tenni, status: :created, location: @tenni }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenni.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teleprovider_params\n params.require(:teleprovider).permit(:name, :apn)\n end",
"def update\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n if @tipo_telefone.update_attributes(params[:tipo_telefone])\n flash[:notice] = 'TipoTelefone was successfully updated.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @technocal_client_address = TechnocalClientAddress.new(params[:technocal_client_address])\n\n respond_to do |format|\n if @technocal_client_address.save\n format.html { redirect_to([:admin, @technocal_client_address], :notice => 'TechnocalClientAddress criada com sucesso.') }\n format.xml { render :xml => @technocal_client_address, :status => :created, :location => @technocal_client_address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @technocal_client_address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @telefono_empresa_cliente = TelefonoEmpresaCliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telefono_empresa_cliente }\n end\n end",
"def create\n @user_telephone = UserTelephone.new(user_telephone_params)\n\n respond_to do |format|\n if @user_telephone.save\n format.html { redirect_to @user_telephone, notice: 'User telephone was successfully created.' }\n format.json { render :show, status: :created, location: @user_telephone }\n else\n format.html { render :new }\n format.json { render json: @user_telephone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tw_phone = TwPhone.new(tw_phone_params)\n\n respond_to do |format|\n if @tw_phone.save\n format.html { redirect_to @tw_phone, notice: 'Tw phone was successfully created.' }\n format.json { render :show, status: :created, location: @tw_phone }\n else\n format.html { render :new }\n format.json { render json: @tw_phone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nineteen = Nineteen.new(nineteen_params)\n\n respond_to do |format|\n if @nineteen.save\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nineteen }\n else\n format.html { render action: 'new' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etnia = Etnia.new(params[:etnia])\n\n respond_to do |format|\n if @etnia.save\n format.html { redirect_to @etnia, notice: 'Etnia was successfully created.' }\n format.json { render json: @etnia, status: :created, location: @etnia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end",
"def create\n @travel_fix = TravelFix.new(params[:travel_fix])\n @travel_fix.device = Device.where(params[:device]).first\n if @travel_fix.device.participant\n @travel_fix.participant = @travel_fix.device.participant\n end\n @travel_fix.save\n\n respond_to do |format|\n if @travel_fix.save\n format.html { redirect_to(@travel_fix, :notice => 'Travel fix was successfully created.') }\n format.xml { render :xml => @travel_fix, :status => :created, :location => mobile_enduro_travel_fix_url(@travel_fix) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel_fix.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @telefone = Telefone.find(params[:id])\n\n respond_to do |format|\n if @telefone.update_attributes(params[:telefone])\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def create\n @partenaire = Partenaire.new(params[:partenaire])\n\n respond_to do |format|\n if @partenaire.save\n flash[:notice] = I18n.t(:successfully_added_partner)\n format.html { redirect_to(partenaires_path()) }\n format.xml { render :xml => @partenaire, :status => :created, :location => @partenaire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partenaire.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @funcionario = Funcionario.new\n @funcionario.contato_telefones.build\n respond_with @funcionario, :location => new_admin_funcionario_path\n end",
"def new\n @teleoperation = Teleoperation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teleoperation }\n end\n end",
"def create\n @attend = Attend.new(params[:attend])\n\n respond_to do |format|\n if @attend.save\n AtndNotifier.received(@attend).deliver\n format.html { redirect_to @attend, notice: '参加登録に成功しました!' }\n format.json { render json: @attend, status: :created, location: @attend }\n\n p \"call format\"\n else\n format.html { render action: \"new\" }\n format.json { render json: @attend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @abonne = Abonne.new(params[:abonne])\n\n respond_to do |format|\n if @abonne.save\n flash[:notice] = 'Abonne was successfully created.'\n format.html { redirect_to(@abonne) }\n format.xml { render :xml => @abonne, :status => :created, :location => @abonne }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @abonne.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def prospecto_telefono_params\n params.require(:prospecto_telefono).permit(:Prospecto_id, :telefono, :TipoTelefono_id, :estatus)\n end",
"def create\n @phone_type = PhoneType.new(phone_type_params)\n\n respond_to do |format|\n if @phone_type.save\n format.html { redirect_to @phone_type, notice: 'Tipo Telefone criado com sucesso.' }\n format.json { render :show, status: :created, location: @phone_type }\n else\n format.html { render :new }\n format.json { render json: @phone_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n account_sid = 'AC14aa346613c89fec467663aad46c05a2'\n auth_token = '0e43d0a04e110f7faa2692e388b0c7f5'\n \n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n @city = params[:FromCity].capitalize\n @state = params[:FromState]\n\n render 'process_sms.xml.erb', :content_type => 'text/xml'\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @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 @nfer = Nfer.new(params[:nfer])\n\n respond_to do |format|\n if @nfer.save\n format.html { redirect_to @nfer, notice: 'Nfer was successfully created.' }\n format.json { render json: @nfer, status: :created, location: @nfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fax = Fax.new(fax_params)\n\n respond_to do |format|\n if @fax.save\n format.html { redirect_to @fax, notice: 'Fax was successfully created.' }\n format.json { render :show, status: :created, location: @fax }\n else\n format.html { render :new }\n format.json { render json: @fax.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @telefones = get_telefones\n @emails = get_emails\n respond_to do |format|\n if validate_telefones && validate_emails && @fornecedor.update(fornecedor_params) # TODO: deal with validates errors messages\n @fornecedor.telefones.each {|tel| tel.destroy}\n @fornecedor.emails.each {|mail| mail.destroy}\n add_telefones\n add_emails\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @fornecedor }\n else\n format.html { render :edit }\n format.json { render json: @fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wepon = Wepon.new(wepon_params)\n\n respond_to do |format|\n if @wepon.save\n format.html { redirect_to @wepon, notice: '追加されました' }\n format.json { render :show, status: :created, location: @wepon }\n else\n format.html { render :new }\n format.json { render json: @wepon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def create\n @tipomensaje = Tipomensaje.new(params[:tipomensaje])\n\n respond_to do |format|\n if @tipomensaje.save\n flash[:notice] = 'Tipomensaje was successfully created.'\n format.html { redirect_to(@tipomensaje) }\n format.xml { render :xml => @tipomensaje, :status => :created, :location => @tipomensaje }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipomensaje.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @telefone = Telefone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @telefone }\n end\n end",
"def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end",
"def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def telefone_cliente_params\n params.require(:telefone_cliente).permit(:ddd, :telefone, :Cliente_id)\n end",
"def create\n @user = User.new(params[:user])\n\n # RestClient.post(\"http://sms.ru/sms/send\", :api_id => \"9d3359eb-9224-2384-5d06-1118975a2cd2\", :to => \"79051916188\", :text => \"Ваш ID на велопробег #{@user.id}\")\n\n respond_to do |format|\n if @user.save\n\n \n\n format.html { redirect_to edit_user_path(@user), notice: 'Участник успешно создан!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { redirect_to root_path,\n notice: 'Поздравляем! Вы подали заявку на регистрацию. Для подтверждения регистрации \n необходимо внести взнос.' }\n end\n end\n end",
"def create\n @ponto = Ponto.new(params[:ponto])\n @ponto.entrada = Time.now\n\n respond_to do |format|\n if @ponto.save\n flash[:notice] = 'ENTRADA REALIZADA COM SUCESSO.'\n format.html { redirect_to(@ponto) }\n format.xml { render :xml => @ponto, :status => :created, :location => @ponto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ponto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @teather = Teather.new(teather_params)\n\n respond_to do |format|\n if @teather.save\n format.html { redirect_to @teather, notice: 'Teather was successfully created.' }\n format.json { render :show, status: :created, location: @teather }\n else\n format.html { render :new }\n format.json { render json: @teather.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frete = Frete.new(params[:frete])\n\n respond_to do |format|\n if @frete.save\n format.html { redirect_to @frete, notice: 'Frete was successfully created.' }\n format.json { render json: @frete, status: :created, location: @frete }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def socioeduk_tipo_telefone_params\n params.require(:socioeduk_tipo_telefone).permit(:descricao)\n end",
"def create\n @twet = Twet.new(twet_params)\n\n respond_to do |format|\n if @twet.save\n format.html { redirect_to @twet, notice: \"Twet was successfully created.\" }\n format.json { render :show, status: :created, location: @twet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @twet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @telecom_room = TelecomRoom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telecom_room }\n end\n end",
"def create\n fax_request = FaxRequest.new(fax_params)\n fax_request.client_receipt_date = Time.now\n fax_request.save!\n response = send_fax(fax_params)\n update_fax_request(fax_request,response)\n end",
"def create\n @restaurantes_proximo = RestaurantesProximo.new(restaurantes_proximo_params)\n\n respond_to do |format|\n if @restaurantes_proximo.save\n format.html { redirect_to @restaurantes_proximo, notice: 'Restaurantes proximo was successfully created.' }\n format.json { render :show, status: :created, location: @restaurantes_proximo }\n else\n format.html { render :new }\n format.json { render json: @restaurantes_proximo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end",
"def create\n @phone = Phone.new(params[:phone])\n\n respond_to do |format|\n if @phone.save\n flash[:notice] = 'Phone_number was successfully created.'\n format.html { redirect_to(@phone) }\n #format.xml { render :xml => @phone, :status => :created, :location => @phone }\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @phone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @twodstructureregion = Twodstructureregion.new(twodstructureregion_params)\n\n respond_to do |format|\n if @twodstructureregion.save\n format.html { redirect_to @twodstructureregion, notice: 'Twodstructureregion was successfully created.' }\n format.json { render :show, status: :created, location: @twodstructureregion }\n else\n format.html { render :new }\n format.json { render json: @twodstructureregion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def create\n @phone = Phone.new(params[:phone])\n @phone.charge! if params[:charging]\n\n respond_to do |format|\n if @phone.save\n flash[:notice] = \"Phone ##{@phone.ticket_number} was successfully added.\"\n format.html { redirect_to(:action => :index) }\n format.xml { render :xml => @phone, :status => :created, :location => @phone }\n else\n get_phones\n format.html { render :action => \"index\" }\n format.xml { render :xml => @phone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entrada = Entrada.new(params[:entrada])\n\n respond_to do |format|\n if @entrada.save\n format.html { redirect_to([:mngr, @entrada], :notice => 'Entrada was successfully created.') }\n format.xml { render :xml => @entrada, :status => :created, :location => @entrada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entrada.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tel_params\n params.require(:tel).permit(:tel)\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end"
] |
[
"0.6541166",
"0.6535863",
"0.65159786",
"0.6515896",
"0.63069904",
"0.5982625",
"0.5920416",
"0.59137285",
"0.59093666",
"0.59088534",
"0.58931625",
"0.5876067",
"0.57747906",
"0.5768522",
"0.57538944",
"0.56979185",
"0.5676436",
"0.56446403",
"0.56440073",
"0.5638536",
"0.56352276",
"0.559018",
"0.5584159",
"0.55308974",
"0.5515508",
"0.55085367",
"0.5478702",
"0.547104",
"0.53902036",
"0.5372126",
"0.53419805",
"0.5298091",
"0.5291991",
"0.5281051",
"0.5271808",
"0.52625704",
"0.5228244",
"0.52148014",
"0.5211476",
"0.5207938",
"0.519521",
"0.51796186",
"0.5169356",
"0.51691824",
"0.5160253",
"0.5155441",
"0.5155188",
"0.5094093",
"0.50857884",
"0.5084204",
"0.50771356",
"0.5076146",
"0.5066238",
"0.50661033",
"0.5060425",
"0.5056862",
"0.5053721",
"0.50458145",
"0.50446635",
"0.50428563",
"0.5041994",
"0.5039445",
"0.5033662",
"0.5032358",
"0.5027204",
"0.5014493",
"0.500909",
"0.50084966",
"0.50044924",
"0.4998033",
"0.49971923",
"0.49718222",
"0.4968672",
"0.49682844",
"0.49644628",
"0.49639732",
"0.49618408",
"0.494665",
"0.49405897",
"0.4922271",
"0.4922271",
"0.49219847",
"0.4910992",
"0.4906092",
"0.49055094",
"0.48948267",
"0.4894776",
"0.48941275",
"0.4891241",
"0.48900035",
"0.48897225",
"0.4889452",
"0.48867044",
"0.48859102",
"0.48774958",
"0.4875282",
"0.486939",
"0.48676667",
"0.48660213",
"0.48642087"
] |
0.6466172
|
4
|
PUT /telefons/1 PUT /telefons/1.xml
|
def update
@telefon = Telefon.find(params[:id])
@telefon.update_attributes(params[:telefon])
respond_with(@telefon)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n if @tipo_telefone.update_attributes(params[:tipo_telefone])\n flash[:notice] = 'TipoTelefone was successfully updated.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @telefone = Telefone.find(params[:id])\n\n respond_to do |format|\n if @telefone.update_attributes(params[:telefone])\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @telefone.update(telefone_params)\n format.html { redirect_to @telefone, notice: 'Telefone was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefone }\n else\n format.html { render :edit }\n format.json { render json: @telefone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_telefone\n @telefone = Telefone.find(params[:id])\n end",
"def update\n @telefononegocio = Telefononegocio.find(params[:id])\n\n respond_to do |format|\n if @telefononegocio.update_attributes(params[:telefononegocio])\n format.html { redirect_to @telefononegocio, notice: 'Telefononegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @telefononegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @telefono = @persona.telefonos.find(params[:id])\n\n respond_to do |format|\n if @telefono.update_attributes(params[:telefono])\n flash[:notice] = \"El Telefono #{@telefono.numero.to_s} de #{@persona.nombre_completo} se ha actualizado.\"\n format.html { redirect_to([@persona, @telefono]) }\n format.xml { head :ok }\n else\n flash[:error] = \"Hubo un error actualizando el teléfono\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @telefono.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 update\n respond_to do |format|\n if @telefone_fornecedor.update(telefone_fornecedor_params)\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefone_fornecedor }\n else\n format.html { render :edit }\n format.json { render json: @telefone_fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teleoperation = Teleoperation.find(params[:id])\n\n respond_to do |format|\n if @teleoperation.update_attributes(params[:teleoperation])\n format.html { redirect_to @teleoperation, notice: 'Teleoperation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teleoperation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_telefone_fornecedor\n @telefone_fornecedor = TelefoneFornecedor.find(params[:id])\n end",
"def update\n @telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])\n\n respond_to do |format|\n if @telefono_empresa_cliente.update_attributes(params[:telefono_empresa_cliente])\n format.html { redirect_to(@telefono_empresa_cliente, :notice => 'Telefono empresa cliente was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @telefono_empresa_cliente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n respond_to do |format|\n if @telefone_cliente.update(telefone_cliente_params)\n format.html { redirect_to @telefone_cliente, notice: 'Telefone cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefone_cliente }\n else\n format.html { render :edit }\n format.json { render json: @telefone_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @telecredito.update(telecredito_params)\n format.html { redirect_to @telecredito, notice: 'Telecredito was successfully updated.' }\n format.json { render :show, status: :ok, location: @telecredito }\n else\n format.html { render :edit }\n format.json { render json: @telecredito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fax_typ = FaxTyp.find(params[:id])\n\n respond_to do |format|\n if @fax_typ.update_attributes(params[:fax_typ])\n format.html { redirect_to @fax_typ, notice: 'Fax typ was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fax_typ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n if @tipo_tel.update_attributes(params[:tipo_tel])\n format.html { redirect_to @tipo_tel, notice: 'Tipo tel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_tel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @telefones = get_telefones\n @emails = get_emails\n respond_to do |format|\n if validate_telefones && validate_emails && @fornecedor.update(fornecedor_params) # TODO: deal with validates errors messages\n @fornecedor.telefones.each {|tel| tel.destroy}\n @fornecedor.emails.each {|mail| mail.destroy}\n add_telefones\n add_emails\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @fornecedor }\n else\n format.html { render :edit }\n format.json { render json: @fornecedor.errors, status: :unprocessable_entity }\n end\n end\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 doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def update(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 set_telefone_cliente\n @telefone_cliente = TelefoneCliente.find(params[:id])\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 rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @telecom_room = TelecomRoom.find(params[:id])\n\n respond_to do |format|\n if @telecom_room.update_attributes(params[:telecom_room])\n format.html { redirect_to(@telecom_room, :notice => 'TelecomRoom was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @telecom_room.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.find(params[:id])\n\n respond_to do |format|\n if @add_phone_to_nouveau_ticket.update_attributes(params[:add_phone_to_nouveau_ticket])\n format.html { redirect_to @add_phone_to_nouveau_ticket, notice: 'Add phone to nouveau ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @add_phone_to_nouveau_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tenni = Tenni.find(params[:id])\n\n respond_to do |format|\n if @tenni.update_attributes(params[:tenni])\n format.html { redirect_to @tenni, notice: 'Tenni was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenni.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_telefono\n @telefono = Telefono.find(params[:id])\n end",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner, notice: 'Partner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner, notice: 'Partner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_socioeduk_tipo_telefone\n @socioeduk_tipo_telefone = Socioeduk::TipoTelefone.find(params[:id])\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 @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n if @torneo.update_attributes(params[:torneo])\n format.html { redirect_to @torneo, notice: 'Torneo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n if @etnia.update_attributes(params[:etnia])\n format.html { redirect_to @etnia, notice: 'Etnia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n if @tservicio.update_attributes(params[:tservicio])\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @telefono.update(telefono_params)\n format.html { redirect_to @telefono, notice: 'Telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefono }\n else\n format.html { render :edit }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teather.update(teather_params)\n format.html { redirect_to @teather, notice: 'Teather was successfully updated.' }\n format.json { render :show, status: :ok, location: @teather }\n else\n format.html { render :edit }\n format.json { render json: @teather.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @teleprovider.update(teleprovider_params)\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully updated.')\n else\n respond_with(@teleprovider)\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @frete = Frete.find(params[:id])\n\n respond_to do |format|\n if @frete.update_attributes(params[:frete])\n format.html { redirect_to @frete, notice: 'Frete was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @domino = Domino.find(params[:id])\n\n respond_to do |format|\n if @domino.update_attributes(params[:domino])\n flash[:notice] = 'Domino was successfully updated.'\n format.html { redirect_to(@domino) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domino.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @niveis_ensino = NiveisEnsino.find(params[:id])\n\n respond_to do |format|\n if @niveis_ensino.update_attributes(params[:niveis_ensino])\n format.html { redirect_to(@niveis_ensino, :notice => 'Niveis ensino atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @niveis_ensino.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n if @relatorios.update_attributes(params[:relatorio])\n flash[:notice] = 'RELATORIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end",
"def update\n @tcliente = Tcliente.find(params[:id])\n\n respond_to do |format|\n if @tcliente.update_attributes(params[:tcliente])\n format.html { redirect_to(@tcliente, :notice => 'Tcliente was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tcliente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @foyer = Foyer.find(params[:id])\n\n respond_to do |format|\n if @foyer.update_attributes(params[:foyer])\n flash[:notice] = 'Le foyer a bien été mis à jour.'\n format.html { redirect_to(@foyer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @foyer.errors, :status => :unprocessable_entity }\n end\n end\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 @tipo_fuente = TipoFuente.find(params[:id])\n\n respond_to do |format|\n if @tipo_fuente.update_attributes(params[:tipo_fuente])\n format.html { redirect_to(@tipo_fuente, :notice => 'TipoFuente was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_fuente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @telefono = @persona.telefonos.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @phone_type.update_attributes(phone_type_params)\n format.html { redirect_to @phone_type, notice: 'Tipo Telefone atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @phone_type }\n else\n format.html { render :edit }\n format.json { render json: @phone_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @technocal_client_address = TechnocalClientAddress.find(params[:id])\n\n respond_to do |format|\n if @technocal_client_address.update_attributes(params[:technocal_client_address])\n format.html { redirect_to([:admin, @technocal_client_address], :notice => 'TechnocalClientAddress atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @technocal_client_address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trenton = Trenton.first\n\n respond_to do |format|\n if @trenton.update_attributes(params[:trenton])\n format.html { redirect_to about_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trenton.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 update\n @independent = @member.independents.find(params[:id])\n params[:independent][:phone] = params[:independent][:phone_areacode] + \"-\" + params[:independent][:phone_exchange] + \"-\" + params[:independent][:phone_subscriber]\n\n respond_to do |format|\n if @independent.update_attributes(params[:independent])\n format.html { redirect_to(@member, :notice => 'Independent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @independent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lotto_type = LottoType.find(params[:id])\n\n respond_to do |format|\n if @lotto_type.update_attributes(params[:lotto_type])\n format.html { redirect_to(@lotto_type, :notice => 'Lotto type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lotto_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @fax_document = FaxDocument.find(params[:id])\n \n respond_to do |format|\n if @fax_document.update_attributes(params[:fax_document])\n format.html { redirect_to(@fax_document, :notice => t(:fax_document_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fax_document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nineteen.update(nineteen_params)\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def telefone_params\n params.require(:telefone).permit(:numero, :contato_id)\n end",
"def update\n @nominee = Nominee.find(params[:id])\n\n respond_to do |format|\n if @nominee.update_attributes(params[:nominee])\n format.html { redirect_to @nominee, notice: 'Nominee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nominee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nano = Nano.find(params[:id])\n\n respond_to do |format|\n if @nano.update_attributes(params[:nano])\n flash[:notice] = 'Nano was successfully updated.'\n format.html { redirect_to nano_url(@nano) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nano.errors.to_xml }\n end\n end\n end",
"def update\n @nfer = Nfer.find(params[:id])\n\n respond_to do |format|\n if @nfer.update_attributes(params[:nfer])\n format.html { redirect_to @nfer, notice: 'Nfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to(@bottle, :notice => 'Bottle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @telfornecedor.update(telfornecedor_params)\n format.html { redirect_to @telfornecedor, notice: 'Telfornecedor was successfully updated.' }\n format.json { render :show, status: :ok, location: @telfornecedor }\n else\n format.html { render :edit }\n format.json { render json: @telfornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@partner = Partner.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @partner.update_attributes(params[:partner]) and @partner.contact.update_attributes(params[:contact])\n\t\t\t\tformat.html { redirect_to(@partner, :notice => 'Partner was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @partner.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @tipomensaje = Tipomensaje.find(params[:id])\n\n respond_to do |format|\n if @tipomensaje.update_attributes(params[:tipomensaje])\n flash[:notice] = 'Tipomensaje was successfully updated.'\n format.html { redirect_to(@tipomensaje) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipomensaje.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tel.update(tel_params)\n format.html { redirect_to @tel, notice: 'Tel was successfully updated.' }\n format.json { render :show, status: :ok, location: @tel }\n else\n format.html { render :edit }\n format.json { render json: @tel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prospecto_telefono.update(prospecto_telefono_params)\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_telefono }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todofuken = Todofuken.find(params[:id])\n\n respond_to do |format|\n if @todofuken.update_attributes(params[:todofuken])\n format.html { redirect_to @todofuken, notice: 'Todofuken was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todofuken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n if @tipo_nota.update_attributes(params[:tipo_nota])\n format.html { redirect_to(@tipo_nota, :notice => 'TipoNota was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_nota.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to(@estudiante, :notice => 'Estudiante was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @partenaire = Partenaire.find(params[:id])\n\n respond_to do |format|\n if @partenaire.update_attributes(params[:partenaire])\n flash[:notice] = I18n.t(:successfully_modified_partner)\n format.html { redirect_to(partenaires_path()) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @partenaire.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n if @estatu.update_attributes(params[:estatu])\n format.html { redirect_to(@estatu, :notice => 'Registro actualizado correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estatu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @t1 = T1.find(params[:id])\n\n respond_to do |format|\n if @t1.update_attributes(params[:t1])\n flash[:notice] = 'T1 was successfully updated.'\n format.html { redirect_to(@t1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @t1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @staffer = Staffer.find(params[:id])\n\n respond_to do |format|\n if @staffer.update_attributes(params[:staffer])\n format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n format.html { redirect_to @atom, notice: 'Atom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_telecredito\n @telecredito = Telecredito.find(params[:id])\n end",
"def update\n @via = Via.find(params[:id])\n\n respond_to do |format|\n if @via.update_attributes(params[:via])\n flash[:notice] = 'Via was successfully updated.'\n format.html { redirect_to(@via) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @via.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @telefone = Telefone.new(params[:telefone])\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { render :json => @telefone, :status => :created, :location => @telefone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fondo.update(fondo_params)\n format.html { redirect_to @fondo, notice: 'Fondo was successfully updated.' }\n format.json { render :show, status: :ok, location: @fondo }\n else\n format.html { render :edit }\n format.json { render json: @fondo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n\n respond_to do |format|\n if @coordenador_estagio.update_attributes(params[:coordenador_estagio])\n format.html { redirect_success(\"Coordenador alterado com sucesso!\",:coordenador_estagio, :index)}\n format.json { head :no_content }\n else\n format.html { redirect_error(\"Erro ao alterar coordenador!\",:coordenador_estagio, :index)}\n format.json { render json: @coordenador_estagio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n if @abonne.update_attributes(params[:abonne])\n flash[:notice] = 'Abonne was successfully updated.'\n format.html { redirect_to(@abonne) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @abonne.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patrimonio = Patrimonio.find(params[:id])\n\n respond_to do |format|\n if @patrimonio.update_attributes(params[:patrimonio])\n flash[:notice] = 'Patrimonio salvo com sucesso.'\n format.html { redirect_to(@patrimonio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patrimonio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put_update(options = {})\n options[:id] ||= @phone.id\n options[:phone] ||= @attributes\n\n # options[:email][@email.id.to_s] = @attributes\n put :update,options\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n flash[:notice] = 'Actualizado.'\n format.html { redirect_to(@estudiante) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estudiante.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.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 create\n @tipo_telefone = TipoTelefone.new(params[:tipo_telefone])\n\n respond_to do |format|\n if @tipo_telefone.save\n flash[:notice] = 'TipoTelefone was successfully created.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { render :xml => @tipo_telefone, :status => :created, :location => @tipo_telefone }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @modele_telephone.update(modele_telephone_params)\n format.html { redirect_to @modele_telephone, notice: 'Modele telephone was successfully updated.' }\n format.json { render :show, status: :ok, location: @modele_telephone }\n else\n format.html { render :edit }\n format.json { render json: @modele_telephone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n if @phone.update_attributes(params[:phone])\n format.html { redirect_to(@phone, :notice => 'Phone was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @phone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @leilao = Leilao.find(params[:id])\n\n respond_to do |format|\n if @leilao.update_attributes(params[:leilao])\n flash[:notice] = 'Leilao was successfully updated.'\n format.html { redirect_to(@leilao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @leilao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.66841274",
"0.65371025",
"0.6384179",
"0.6306385",
"0.6227374",
"0.6210042",
"0.61810344",
"0.58926636",
"0.5862392",
"0.5760047",
"0.56905603",
"0.5678629",
"0.5643345",
"0.5629788",
"0.5595618",
"0.558561",
"0.55845004",
"0.5583074",
"0.5550877",
"0.5541985",
"0.55403036",
"0.55391973",
"0.55335623",
"0.5500428",
"0.545303",
"0.5409137",
"0.54061323",
"0.54034406",
"0.5390898",
"0.5376929",
"0.5364801",
"0.5364801",
"0.53493667",
"0.53473026",
"0.53419715",
"0.53379804",
"0.53299934",
"0.53247595",
"0.5321059",
"0.5317394",
"0.53093183",
"0.53085536",
"0.5308149",
"0.5304175",
"0.528657",
"0.5280637",
"0.5280496",
"0.5278441",
"0.5274973",
"0.52729416",
"0.52711755",
"0.5270819",
"0.5268988",
"0.52655786",
"0.5260077",
"0.525784",
"0.5255413",
"0.52543306",
"0.5250462",
"0.525022",
"0.52405196",
"0.52379155",
"0.52331537",
"0.5221531",
"0.5221139",
"0.52209884",
"0.5218035",
"0.52157456",
"0.52134687",
"0.52061886",
"0.52009827",
"0.519983",
"0.5199372",
"0.51990235",
"0.5190143",
"0.5184088",
"0.5183015",
"0.5179875",
"0.51708084",
"0.516125",
"0.51604223",
"0.5159963",
"0.51595974",
"0.5159315",
"0.5157411",
"0.5155826",
"0.51537406",
"0.5152463",
"0.51480854",
"0.51401424",
"0.51367944",
"0.5133078",
"0.5133002",
"0.5130639",
"0.5129299",
"0.51238966",
"0.5119416",
"0.51179224",
"0.51171255",
"0.5116332"
] |
0.6554062
|
1
|
DELETE /telefons/1 DELETE /telefons/1.xml
|
def destroy
@telefon = Telefon.find(params[:id])
@telefon.destroy
respond_with(@telefon)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @tipo_telefone = TipoTelefone.find(params[:id])\n @tipo_telefone.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_telefones_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 @telefono = @persona.telefonos.find(params[:id])\n @telefono.destroy\n\n respond_to do |format|\n format.html { redirect_to(persona_telefonos_url(@persona)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @telefone = Telefone.find(params[:id])\n @telefone.destroy\n\n respond_to do |format|\n format.html { redirect_to telefones_url }\n format.json { head :no_content }\n end\n end",
"def excluir(telefone)\n @client.delete(Route.new([ROTA_BINA, telefone]))\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @telefononegocio = Telefononegocio.find(params[:id])\n @telefononegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to telefononegocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @telefone.destroy\n respond_to do |format|\n format.html { redirect_to telefones_url, notice: 'Telefone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])\n @telefono_empresa_cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(telefono_empresa_clientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @telefone_fornecedor.destroy\n respond_to do |format|\n format.html { redirect_to telefone_fornecedors_url, notice: 'Telefone fornecedor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @telecom_room = TelecomRoom.find(params[:id])\n @telecom_room.destroy\n\n respond_to do |format|\n format.html { redirect_to(telecom_rooms_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @teleoperation = Teleoperation.find(params[:id])\n @teleoperation.destroy\n\n respond_to do |format|\n format.html { redirect_to teleoperations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @telefone_cliente.destroy\n respond_to do |format|\n format.html { redirect_to telefone_clientes_url, notice: 'Telefone cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fax_document = FaxDocument.find(params[:id])\n @fax_document.destroy\n \n respond_to do |format|\n format.html { redirect_to(fax_documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n Recliner.delete(uri)\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(contactname)\n\n end",
"def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tcliente = Tcliente.find(params[:id])\n @tcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tclientes_url) }\n format.xml { head :ok }\n end\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 @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @phone = Phone.find(params[:id])\n @phone.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 string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n @leilao = Leilao.find(params[:id])\n @leilao.destroy\n\n respond_to do |format|\n format.html { redirect_to(leilaos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @abonne = Abonne.find(params[:id])\n @abonne.destroy\n\n respond_to do |format|\n format.html { redirect_to(abonnes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @phonecall = Phonecall.find(params[:id])\n @phonecall.destroy\n\n respond_to do |format|\n format.html { redirect_to(phonecalls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patrimonio = Patrimonio.find(params[:id])\n @patrimonio.destroy\n\n respond_to do |format|\n format.html { redirect_to(patrimonios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nomina.destroy\n\n respond_to do |format|\n format.html { redirect_to(nominas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fax_typ = FaxTyp.find(params[:id])\n @fax_typ.destroy\n\n respond_to do |format|\n format.html { redirect_to fax_typs_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contactos = Contactos.find(params[:id])\n @contactos.destroy\n\n respond_to do |format|\n format.html { redirect_to(contactos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n @tipo_restaurante.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_restaurantes_url) }\n format.xml { head :ok }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\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 @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def delete_note id\n @nimble.delete \"contact/notes/#{id}\"\n end",
"def destroy\n @detour = Detour.find(params[:id])\n @detour.notifications.each do |n|\n logger.info(\"Deleteing notification \" + n.id.to_s + \" for detour \" + @detour.id.to_s + \"\\n\")\n n.destroy\n end\n @detour.destroy\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n format.xml { head :ok }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contacto = Contacto.find(params[:id])\n @contacto.destroy\n\n respond_to do |format|\n format.html { redirect_to(contactos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_tel = TipoTel.find(params[:id])\n @tipo_tel.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_tels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patron = Patron.find(params[:id])\n @patron.destroy\n\n respond_to do |format|\n format.html { redirect_to(patrons_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @technocal_client_address = TechnocalClientAddress.find(params[:id])\n @technocal_client_address.destroy\n\n respond_to do |format|\n format.html { redirect_to(technocal_client_addresses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @telecredito.destroy\n respond_to do |format|\n format.html { redirect_to telecreditos_url, notice: 'Telecredito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @ponto = Ponto.find(params[:id])\n @ponto.destroy\n\n respond_to do |format|\n format.html { redirect_to(pontos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @services_charger = ServicesCharger.find(params[:id])\n @services_charger.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_chargers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @it_device = ItDevice.find(params[:id])\n @it_device.destroy\n\n respond_to do |format|\n format.html { redirect_to(it_devices_url) }\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 @tm_dev1 = TmDev1.find(params[:id])\n @tm_dev1.destroy\n\n respond_to do |format|\n format.html { redirect_to(tm_dev1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entrada = @mini_blog.entradas.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mini_blog_path(@mini_blog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @finger = Finger.find(params[:id])\n @finger.destroy\n\n respond_to do |format|\n format.html { redirect_to(fingers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @noticium = Noticium.find(params[:id])\n @noticium.destroy\n\n respond_to do |format|\n format.html { redirect_to(noticia_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @phone_use = PhoneUse.find(params[:id])\n @phone_use.destroy\n\n respond_to do |format|\n format.html { redirect_to(phone_uses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipomensaje = Tipomensaje.find(params[:id])\n @tipomensaje.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipomensajes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_fuente = TipoFuente.find(params[:id])\n @tipo_fuente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_fuentes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @modele_telephone.destroy\n respond_to do |format|\n format.html { redirect_to modele_telephones_url, notice: 'Modele telephone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @plantilla = Plantilla.find(params[:id])\n @plantilla.destroy\n\n respond_to do |format|\n format.html { redirect_to(plantillas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @antenne = Antenne.find(params[:id])\r\n @antenne.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to antennes_url }\r\n format.json { head :no_content }\r\n end\r\n end"
] |
[
"0.6996788",
"0.6774562",
"0.67523956",
"0.6710246",
"0.65410715",
"0.64671904",
"0.64516807",
"0.64513385",
"0.6411109",
"0.63485086",
"0.62724715",
"0.62665015",
"0.62202954",
"0.62144095",
"0.61913216",
"0.6165254",
"0.6153367",
"0.6115998",
"0.6065057",
"0.60490805",
"0.60471886",
"0.6046671",
"0.6046479",
"0.60390216",
"0.6038394",
"0.6037192",
"0.602955",
"0.60292464",
"0.6026571",
"0.60233134",
"0.6020009",
"0.601881",
"0.6011609",
"0.6011562",
"0.60072404",
"0.60050267",
"0.598004",
"0.5978433",
"0.5978238",
"0.5973255",
"0.5958181",
"0.5944684",
"0.59434795",
"0.59409773",
"0.59391594",
"0.59320176",
"0.5929532",
"0.59279525",
"0.5925261",
"0.5925261",
"0.5925261",
"0.5918217",
"0.5918086",
"0.5917272",
"0.59147775",
"0.59129906",
"0.59129906",
"0.5911641",
"0.59016895",
"0.59015805",
"0.5901008",
"0.59002435",
"0.5898733",
"0.5898733",
"0.58965564",
"0.58964497",
"0.58896947",
"0.5887286",
"0.58858323",
"0.58797693",
"0.58793515",
"0.5876378",
"0.5876378",
"0.5876378",
"0.5876378",
"0.58722335",
"0.5870148",
"0.5860272",
"0.58595806",
"0.58593994",
"0.5851457",
"0.58510196",
"0.58444947",
"0.5842492",
"0.5839509",
"0.5839509",
"0.5834677",
"0.5830394",
"0.5828919",
"0.5826183",
"0.5823174",
"0.5822901",
"0.5821171",
"0.581956",
"0.5813189",
"0.581094",
"0.58104867",
"0.58095556",
"0.5805549",
"0.5805487"
] |
0.6356967
|
9
|
array of words array of integers output array of words sorted from a to z array of integers from lowest number to highest i need to sort from lowest to highest number starting with the most left 2 numbers when I need to perform an exchange then my loop does not break but when no exchanges happen then I break and have my solution.
|
def bubble_sort!(array)
loop do
done = true
idx = 0
loop do
if array[idx] > array[idx + 1]
array[idx], array[idx + 1] = array[idx + 1], array[idx]
idx += 1
done = false
else
idx += 1
end
break if idx == array.size - 1
end
break if done == true
end
array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bubble_sort_by(array)\n while (array != array.sort_by { |word| word.length}) do\n for x in (0..array.length-2) do\n if (yield(array[x],array[x+1]) > 0)\n array[x], array[x+1] = array[x+1], array[x]\n end\n end\n end\n array\nend",
"def bubble_sort(array)\n sorting = true\n\n while sorting\n sorting = false\n\n (array.length - 1).times do |idx|\n word1 = array[idx]\n word2 = array[idx + 1]\n if word1.length > word2.length\n array[idx], array[idx + 1] = array[idx + 1], array[idx]\n sorting = true\n end\n end\n end\n\n array.last\nend",
"def order(words)\n # your code...\n warr = words.split(' ')\n length = (warr.length) - 1\n nums = (0..9).to_a\n ans = (0..length).to_a\n warr.each do |x|\n x.each_char do |y|\n ans[(y.to_i) - 1] = x if nums.include?(y.to_i)\n end\n end\n ans = ans.join(' ')\n return ans\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 bubble_sort_by_explanation array\n puts \"The beginning order of the array: #{array}\"\n puts \"\"\n unsorted = true\n while unsorted do\n i = 0\n unsorted = false\n while i < (array.length - 1)\n puts \"Yield to calculate the difference of #{array[i]}.length - #{array[i + 1]}.length\"\n difference = (yield array[i], array[i + 1]).to_i\n puts \"The difference is #{difference}.\"\n puts \"If is < 0 the order second word is longer and nothing changes\"\n if (difference >= 0)\n puts \"BUT IF THE DIFFERENCE >= 0 the order second word is shorter & needs to be switched!\"\n puts \"This next line switches the words #{array[i]} and #{array[i + 1]}\"\n array[i], array[i + 1] = array[i + 1], array[i]\n unsorted = true\n end\n i += 1\n puts \"#{array} is the current array in while loop\"\n puts \"\"\n end\n end\n puts \"The ending order of the array: #{array}\"\nend",
"def sort(array)\n array.each_index do |i|\n (array.length - i - 1).times do |job|\n if array[cownt] > list[cownt + 1]\n array[cownt], array[cownt + 1] = array[cownt + 1], array[cownt]\n end\n end\n end\nend",
"def sort(num_array)\n array = num_array.to_s.split(\"\").map(&:to_i)\n array.length.times do |t|\n i=0\n array.length.times do |b|\n if b > array[i+1]\n array[i],array[i+1] = array[i+1], array[i]\n (i += 1) if (i < array.length - 2)\n end\n end\n return array\n end\n end",
"def sort words\n # Arrays for sorting\n sorted_array = []\n unsorted_array = []\n\n # Attempting a method which helps sort only unsorted_array, instead of words and unsorted_array\n # if unsorted_array.empty? == true && sorted_array.empty? == true\n # unsorted_array.replace([words])\n # end\n\n # Array for holding the current lowest word\n low_word = []\n # Array for holding the current word\n current_word = []\n\n words.each { |word| current_word.replace([word])\n\n if low_word.empty? == true\n low_word.push(word)\n # Display the low_word being passed in when low_word.empty? = true\n # puts 'low_word == empty: ' + low_word.to_s\n end\n \n if current_word.to_s > low_word.to_s && unsorted_array.include?(word) == false\n unsorted_array.push(word)\n # Display the word if it's greater than the low_word\n # puts current_word.to_s + ' > ' + low_word.to_s\n\n elsif current_word.to_s < low_word.to_s && unsorted_array.include?(low_word) == false\n # puts 'The low_word being replaced: ' + low_word.to_s + ' - is being replaced with - ' + current_word.to_s\n # Why does this push cause the word to display as an array? Example: [\"treason\"] vs treason. A: Pushing low_word.to_s brought in a string of an\n # array: \"[\\\"treason\\\"]\" - not great. Using the .at method I am able to select and push just the string at low_word.at(0) without the array.\n unsorted_array.push(low_word.at(0))\n low_word.replace([word])\n\n end\n \n }\n\n sorted_array.push(low_word.at(0))\n \n unsorted_array.delete_if { |word| word == low_word.at(0) }\n \n # Looping through the unsorted_array until it's empty\n while unsorted_array.empty? == false\n\n # Array for holding the current lowest word\n low_word = []\n # Array for holding the current word\n current_word = []\n \n unsorted_array.each { |word| current_word.replace([word])\n\n if low_word.empty? == true\n low_word.push(word)\n # Display the low_word being passed in when low_word.empty? = true\n # puts 'low_word == empty: ' + low_word.to_s\n end\n \n if current_word.to_s > low_word.to_s && unsorted_array.include?(word) == false\n unsorted_array.push(word)\n # Display the word if it's greater than the low_word\n # puts current_word.to_s + ' > ' + low_word.to_s\n\n elsif current_word.to_s < low_word.to_s && unsorted_array.include?(low_word) == false\n # puts 'The low_word being replaced: ' + low_word.to_s + ' - is being replaced with - ' + current_word.to_s\n # Why does this push cause the word to display as an array? Example: [\"treason\"] vs treason. A: Pushing low_word.to_s brought in a string of an\n # array: \"[\\\"treason\\\"]\" - not great. Using the .at method I am able to select and push just the string at low_word.at(0) without the array.\n unsorted_array.push(low_word.at(0))\n low_word.replace([word])\n\n end\n \n }\n\n sorted_array.push(low_word.at(0))\n \n unsorted_array.delete_if { |word| word == low_word.at(0) }\n\n end\n\n puts ' '\n puts ':: sorted_array ::'\n puts sorted_array.to_s\n puts ' '\n puts ':: unsorted_array ::'\n puts unsorted_array.to_s\n puts ' '\n\nend",
"def bubble_sorter(given_array)\n \n given_array.length.times do\n counter = 1\n while counter < given_array.length do\n \n holder = 0\n \n if given_array[counter - 1] > given_array[counter] \n #puts counter\n holder = given_array[counter]\n given_array[counter] = given_array[counter - 1] \n given_array[counter - 1] = holder\n end\n counter += 1\n end\n end\n\n\n\n\n puts given_array\nend",
"def alphabet_sort(array)\n alphabet = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \n \t\"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n counter = 1\n until counter == 100\n\n \tnew_array = array.each do |letter|\n \t\n \t\ti = 1\n \t index_of_letter_in_array = array.index(letter)\n \t index_of_next_letter_in_array = index_of_letter_in_array + i \n \t value_of_next_item_in_array = array[index_of_next_letter_in_array]\n \t \n \t until i == array[index_of_letter_in_array..-1].length\n \t \t\t if \talphabet.index(letter) > alphabet.index(value_of_next_item_in_array)\n\t\n \t \t\t\t\tarray[index_of_letter_in_array], array[index_of_next_letter_in_array] =\n \t \t\t\t\t array[index_of_next_letter_in_array], array[index_of_letter_in_array]\n \t \t\t\tend #if\n \t \t\t\t\n \t \t\t\ti += 1 \n \t \tindex_of_next_letter_in_array = index_of_letter_in_array + i \n \t \tvalue_of_next_item_in_array = array[index_of_next_letter_in_array]\n \t \tend #until\n \t \t\n \tend #do\n\n counter += 1\n\tend #until\n\tp new_array\n\nend",
"def supply_sort(arr)\n num = arr.length\n loop do\n swapped = false\n\n (num-1).times do |i|\n if arr[i].downcase > arr[i+1].downcase\n arr[i], arr[i+1] = arr[i+1], arr[i]\n swapped = true\n end\n end\n\n break if not swapped\n end\n\n arr\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 bubble_sort_by(greetings)\n len = greetings.length\n flag = 1\n while flag == 1\n flag = 0\n (0..len - 2).each do |i|\n next unless yield(greetings[i + 1], greetings[i]).negative?\n\n temp = greetings[i]\n greetings[i] = greetings[i + 1]\n greetings[i + 1] = temp\n flag = 1\n end\n end\n greetings\nend",
"def sorting(array)\n\t#start with an empty array where newly sorted elements from the input will go\n\tsorted_array = []\n\n\t#while there is at least one element in the passed in array execute the loop\n\twhile array.length > 0\n\t\t#start with these initial values\n\t\tcount = 1\n\t\tminIndex = 0\n\t\t#this ensures that count will never exceed the number of elements in the inputted array\n\t\twhile count < array.length\n\t\t\t#compare using index values of the array elements starting with array[0] and array[1]\n\t\t\t#compares words in their lowercase form, otherwise capitalized letters would come before lowercase ones, despite alphabetical order\n\t\t\t#the downcase method just temporarily changes the value of the element during comparison, then they retain their capitalized form in the output\n\t\t\tif array[minIndex].downcase > array[count].downcase\n\t\t\t\t#if the preceding element of the inputted array is a word that comes after the following element\n\t\t\t\t#set minIndex (the smallest index value of the array) equal to the count value\n\t\t\t\tminIndex = count\n\t\t\tend\n\t\t\t#add 1 to count so that the while loop will eventually finish\n\t\t\tcount += 1\n\t\tend\n\t\t#now, the array element with minIndex is the smallest value so it is safe to push it to our sorted_array\n\t\tsorted_array.push(array[minIndex])\n\t\t#then delete the smallest element from the inputted array so that the next iteration will be the next smallest element\n\t\tarray.delete_at(minIndex)\n\tend\n\tputs sorted_array\nend",
"def sort3(num_array)\n for i in 0..num_array.length - 1\n key = num_array[i]\n j = i - 1\n\n # move elements of num_array[0..i-1] that are greater than key,\n # to one position ahead of their current position\n while j >= 0 && num_array[j] > key\n num_array[j + 1] = num_array[j]\n j -= 1\n end\n num_array[j + 1] = key\n end\n return num_array\nend",
"def bubble_sort_by(array)\n arr = array.length - 1\n loop do\n swap = false\n (0...arr).each do |i|\n n_one = array[i]\n n_two = array[i + 1]\n if yield(n_one, n_two).positive?\n array[i], array[i + 1] = array[i + 1], array[i]\n swap = true\n end\n end\n break if swap == false\n end\n array\nend",
"def sort_by_length(my_sentence)\n array = my_sentence.split(\" \")\n array_size = array.length\n \n temp = nil\n swaps_made = nil\n \n j = 0\n stop_here = array_size - 1\n \n while 0 < stop_here\n # puts \"\\nOUTER LOOP stop @ index #{stop_here}\"\n j = 0\n swaps_made = false\n \n while j < stop_here\n # puts \" INNER LOOP #{j} stop @ index #{stop_here}\"\n curr_word = array[j]\n next_word = array[j+1]\n \n if curr_word.length > next_word.length\n temp = curr_word\n array[j] = next_word\n array[j+1] = temp\n swaps_made = true\n end\n \n j += 1\n end\n \n if swaps_made == false\n # puts \"HUZZAH! WE CAN STOP NOW!\"\n return array\n end\n \n stop_here -= 1\n end\n \n return array\nend",
"def bubble_sort_by_concept_one(array)\n n = array.length\n\n while n.positive?\n\n j = 0\n\n (1..n - 1).each do |k|\n compare_result = yield array[j], array[k]\n\n # if array[j] > array[k], swap these two values\n if compare_result.positive?\n store = array[j]\n array[j] = array[k]\n array[k] = store\n end\n j += 1\n end\n n -= 1; # last element is now sorted\n end\n\n array\nend",
"def wiggle_sort(nums)\n nums = nums.sort!\n\n greater_num_idx = nums.length / 2\n lesser_num_idx = 1\n\n until lesser_num_idx >= greater_num_idx\n nums[lesser_num_idx], nums[greater_num_idx] = nums[greater_num_idx], nums[lesser_num_idx]\n lesser_num_idx += 2\n greater_num_idx += 1\n end\n nums\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_sorting array\r\n#assign length of the array = variable(z)\r\n z = array.length\r\n# like a while loop\r\n loop do\r\n#boolean variable called \"sorted\" = false is when algorithm should exit\r\n# if true keeps looping\r\n sorted = false\r\n#Inside loop check the value of each element and compare it w/ the next one\r\n# how many times it runs = z-1\r\n (z-1).times do |i|\r\n if array[i] > array[i+1]\r\n array[i], array[i+1]=array[i+1], array[i]\r\n#ends loop once sorting = true \r\n sorted = true\r\n end\r\n end\r\n\r\n break if not sorted\r\n end\r\n\r\n array\r\nend",
"def bubble_sort_by_concept_two(array)\n no_swaps = false # initiate flag to indicate when there are no more swaps being done\n\n until no_swaps\n no_swaps = true\n (0..array.length - 2).each do |i|\n # check if these two elements are out of order\n compare_result = yield array[i], array[i + 1]\n\n next unless compare_result.positive?\n\n # do a swap\n store = array[i]\n array[i] = array[i + 1]\n array[i + 1] = store\n no_swaps = false\n end\n end\n\n array\nend",
"def bubble_sort_by ary\n (ary.length-2).downto(0) do |k|\n swapped = false\n for i in 0..k\n if (yield ary[i], ary[i+1]) > 0\n ary[i], ary[i+1] = ary[i+1], ary[i]\n swapped = true\n end\n end\n break if !swapped\n end\n ary\nend",
"def sort(array)\nfor j in 1..(array.length-1) #Sets loop parameter to count between 1 and length instead of starting at zero\n compare = array[j]\n i = j - 1\n while i >= 0 and array[i] > compare\n array[i+1] = array[i]\n i = i - 1\n end\n array[i+1] = compare\nend \nputs array\nend",
"def sorter(array)\n loop do\n switched = false\n for i in 0...array.length - 1\n if array[i].downcase > array[i + 1].downcase\n array[i], array[i + 1] = array[i + 1], array[i]\n switched = true\n end\n end\n break if !switched\n end\n array\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 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 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 insertionsort! arr\n (1..arr.size - 1).each do |i|\n j = i\n while j > 0 && arr[j] < arr[j - 1] do\n arr[j], arr[j - 1] = arr[j - 1], arr[j]\n j -= 1\n end\n end\n arr\nend",
"def sorting(arr)\n#display orig array\n p arr \n p \"**************************************************\"\n # do something to the array\n # compare each value of an array to the value on its left\n # if the value is less than the value on its left, switch places\n # do this by placing the lesser value in a holder and then moving the greater\n # value to the lesser value's former position in the array, then rewrite the\n # greater value's former position, with the holder value.\n # do this until the value is greater than the value on its left for \n # the entire array \n#Here is our brute force attempt at making our own .sort! method\n#we used the .sort! method from the Array class.\narr.length.times do\n |x|\n holder = \"\"\n if arr[x] > arr[x-1]\n holder = arr[x-1]\n arr[x-1] = arr[x]\n arr[x] = holder\n end \n end\nputs \"this is the one we made #{arr} \"\n # if arr[1] > arr[0]\n p arr.sort!\n p \"above is the sorting method\"\n#rerturn the changed array\nend",
"def bubble_sort_by(array)\n\tfinal_list = array.clone\n\titerations = (array.length - 1) ** 2\n\ti = 0\n\n\titerations.times do |x|\n\n swap = yield(final_list[i], final_list[i+1])\n \tif swap == -1\n \t\tif i >= array.length - 2\n \t\t i = 0\n \t\telse\n \t\t\ti += 1\n \t end\n \telsif swap == 1\n \t\tfinal_list[i], final_list[i+1] = final_list[i+1], final_list[i]\n \t\t\tif i >= array.length - 2\n \t\t \ti = 0\n \t\t\telse\n \t\t\t\ti += 1\n \t\t\tend\n \telse\n \t if i >= array.length - 2\n \t\t i = 0\n \t\telse\n \t\t\ti += 1\n \t\tend\n \tend\n end\n puts final_list\nend",
"def the_sort array, sorted_array, unsorted_array\n\n # Array for holding the current lowest word\n low_word = []\n # Array for holding the current word\n current_word = []\n\n array.each { |word| current_word.replace([word])\n\n if low_word.empty? == true\n low_word.push(word)\n # Display the low_word being passed in when low_word.empty? = true\n # puts 'low_word == empty: ' + low_word.to_s\n end\n \n if current_word.to_s > low_word.to_s && unsorted_array.include?(word) == false\n unsorted_array.push(word)\n # Display the word if it's greater than the low_word\n # puts current_word.to_s + ' > ' + low_word.to_s\n\n elsif current_word.to_s < low_word.to_s && unsorted_array.include?(low_word) == false\n # puts 'The low_word being replaced: ' + low_word.to_s + ' - is being replaced with - ' + current_word.to_s\n # Why does this push cause the word to display as an array? Example: [\"treason\"] vs treason. A: Pushing low_word.to_s brought in a string of an\n # array: \"[\\\"treason\\\"]\" - not great. Using the .at method I am able to select and push just the string at low_word.at(0) without the array.\n unsorted_array.push(low_word.at(0))\n low_word.replace([word])\n\n end\n \n }\n\n sorted_array.push(low_word.at(0))\n\n unsorted_array.delete_if { |word| word == low_word.at(0) }\n\nend",
"def strand_sort(array)\n temp = array.dup\n result = []\n until temp.empty?\n value = temp.first\n sublist, temp = temp.partition { |val| value = val if value <= val }\n result += sublist.shift(sublist.length) if result.empty?\n result = binary_sort(result, sublist)\n end\n result\nend",
"def sort(num_array)\n # Your code goes here\n (num_array.length).times do |i|\n while i > 0\n if num_array[i-1] > num_array[i] \n num_array[i-1], num_array[i] = num_array[i], num_array[i-1]\n else\n break\n end\n i-=1\n end\n \n end\n return num_array\n \nend",
"def sort_supplies(supplies)\n moved = true\n while moved == true\n moved = false\n \n counter = 0\n while counter < supplies.length\n if counter == 0\n counter += 1\n next\n elsif supplies[counter].downcase < supplies[counter - 1].downcase\n supplies[counter], supplies[counter - 1] = supplies[counter - 1], supplies[counter]\n moved = true\n end\n counter += 1\n end\n end\n supplies\nend",
"def bubble_sort_by(array)\n\t#counter\n\titeration = 1\n\t#Loop through all values (array.length-1) times\n\twhile iteration <= array.length-1\n\t\t#Compare 2 adjacent values in array. Values are swapped based on block comparison.\n\t\tarray.each_with_index do |n, i|\n\t\t\tunless array[i+1] == nil #stops comparison of last array value.\n\t\t\t\tif yield(n, array[i+1]) > 0\n\t\t\t\t\tarray[i], array[i+1] = array[i+1], n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\titeration += 1 # Counter increases after every iteration\n\tend\n\tputs array.inspect\nend",
"def sort2(num_array)\n n = num_array.length - 1\n for i in 0..n\n for j in 0..(n-i-1)\n if num_array[j] >= num_array[j+1]\n num_array[j], num_array[j+1] = num_array[j+1], num_array[j]\n end\n end\n end\n return num_array\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 non_recursive_sort unsorted_array\n\nsorted_array = []\n\nsmallest = unsorted_array[0]\n\n while unsorted_array != []\n \n unsorted_array.each {|word|\n if smallest >= word\n smallest = word\n end\n }\n sorted_array.push smallest\n unsorted_array.delete_at(unsorted_array.find_index(smallest))\n smallest = unsorted_array[0]\n end\n puts sorted_array.join(\", \")\nend",
"def bubble_sort(array)\r\n #Create a do loop to iterate through the loop\r\n loop do\r\n \t#Make a variable called switch that will switch the numbers as you sort\r\n \t#Set it to false, it will become true if the numbers are not in the right place\r\n switch = false\r\n #MAke a loop inside the other loop\r\n #The length of the array - 1 (To catch last two values as you go through), iterate this many times \r\n (array.length-1).times do |i|\r\n #If the array at the first index is greater value than the one on front of it\r\n if array[i] > array[i+1]\r\n \t#Then it equals one placeholder/index in front/next index spot\r\n \t#It's a larger number and needs to swap\r\n array[i], array[i+1] = array[i+1], array[i]\r\n #Set switch to true\r\n switch = true\r\n #End if statement\r\n end\r\n end\r\n #Break this iteration and go back in line, iterating through if not - switch is false\r\n break if not switch\r\n end\r\n #Return the sorted array\r\n array\r\n #End method\r\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 bubble_sort array\n\t(0...array.length-1).each do |i|\n\t\t(i+1...array.length).each do |j|\n\t\t\tif array[i]>array[j]\n\t\t\t\tarray[i]=array[i]+array[j]\n\t\t\t\tarray[j]=array[i]-array[j]\n\t\t\t\tarray[i]=array[i]-array[j]\n\t\t\tend\n\t\tend\n\tend\n\tarray\nend",
"def bubble_sort_by(array)\r\n array.length.times do |n|\r\n (0...array.length - n - 1).each do |index|\r\n if yield(array[index], array[index + 1]) < 0\r\n lower = array[index + 1]\r\n array[index + 1] = array[index]\r\n array[index] = lower\r\n end\r\n end\r\n end\r\n puts array\r\nend",
"def sort(array)\n final = [array[0]]\n array.delete_at(0)\n # main code\n for i in array\n final_index = 0\n while final_index < final.length\n if i <= final[final_index]\n final.insert(final_index,i)\n break\n elsif final_index == final.length-1\n final.insert(final_index+1,i)\n break\n end\n final_index+=1\n end\n end\n # output\n final\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 bubble_sort_major(array)\n n = array.length\n swapped = true\n while swapped do\n swapped = false\n (n - 1).times do |i|\n # here, the string at each index are compared to the next, and they are swapped if the current is greater than the next\n if (array[i][:major1] <=> array[i + 1][:major1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n end\n array \n end",
"def buuble_sort(arr)\n\tloop do\n\t\tloop_break = true\n\t\t(arr.length-1).times do |i|\n\t\tif arr[i]>arr[i+1]\n\t\t\tarr[i], arr[i+1] = arr[i+1], arr[i]\n\t\t\tloop_break = false\n\t\tend\n\t\tend\n\tbreak if loop_break\n\tend\n\tputs arr\nend",
"def array_sort_by_last_letter_of_word(array)\n new_array = Array.new\n array.each {|element|\n new_array << element.reverse\n } \n new_array.sort!\n new_array2 = Array.new\n new_array.each {|element|\n new_array2 << element.reverse\n } \n new_array2\nend",
"def poorly_written_ruby(*arrays)\n\n combined_array = arrays.flatten # use built in ruby method\n\n index_count = combined_array.size - 1 # assign a variable so that array does not need to be accessed in while loop check\n sorted_array = [combined_array.delete_at(combined_array.length-1)]\n\n for val in combined_array\n i = 0\n while i <= index_count # use variable to avoid array access\n\n if val <= sorted_array[i]\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array << val\n break\n end\n i+=1\n end\n end\n\n # Return the sorted array\n sorted_array\nend",
"def gnome_sort(array)\n count = 0\n\n while count < array.length - 1\n if array[count] > array[count + 1]\n array[count + 1], array[count] = array[count], array[count + 1]\n count -= 2 if count.positive?\n end\n count += 1\n end\n\n array\nend",
"def insertion_sort(arr)\n\t# step 1 - set variables. Placeholder_index starts at index 1 rather than index 0 because you\n\t# are always comparing the placeholder to what is to the left of the placeholder\n\tplaceholder_index = 1\n\t# until the placeholder_index is at the index value as the length of the array...\n\t\tuntil placeholder_index > (arr.length - 1)\n\t\t\tcurrent_index = placeholder_index\n\t\t\t# the compare_index is the value to the right of the placeholder/compare_index\n\t\t\tcompare_index = current_index - 1\n\t\t\t# until the current_index is greater than or equal to the compare_index\n\t\t\tuntil arr[current_index] >= arr[compare_index]\n\t\t\t\t# swap the two numbers\n\t\t\t\tarr[current_index], arr[compare_index] = arr[compare_index], arr[current_index]\n\t\t\t\t# compare left number and right\n\t\t\t\tcurrent_index -= 1\n\t\t\t\tcompare_index -= 1 unless compare_index == 0\n\t\t\tend\n\t\t\tplaceholder_index += 1\n\t\tend\nreturn arr\nend",
"def sort_array(array)\n n = array.size\n return array if n < 2\n (0..n - 2).each do |i|\n (i + 1..n - 1).each do |j|\n next if array[i].even? || array[j].even?\n interchange(array, i, j) if array[i] > array[j]\n end\n end\n array\nend",
"def bubblesort(count, store)\n #using bubble sort to sort word usage from high to low\n #chose bubble sort for ease of impliminatation and because\n #we are using very small file sizes in regards to computers\n swapped = true\n while swapped == true\n swapped = false\n\n for i in 1..count.size-1\n #if position i-1 is less than position i in the count array then swap\n if count[i-1] < count[i]\n #swapping count array positions\n num = count[i-1]\n count[i-1] = count[i]\n count[i] = num\n #swapping store array position to correspond to count array\n word = store[i-1]\n store[i-1] = store[i]\n store[i] = word\n #swap flag true because swap found\n swapped = true\n end #end if\n end #end for\n end #end while\nend",
"def bubble_sort_by(array)\n (array.length - 1).times do |i|\n \tif yield(array[i], array[i + 1]) < 0\n \t array[i], array[i + 1] = array[i + 1], array[i]\n \tend\n end\n print array\nend",
"def bubble_sort(num_array)\n num_array.length.times do\n num_array.each_with_index do |num, i|\n unless num_array[i+1] == nil\n if num > num_array[i+1]\n num_array[i], num_array[i+1] = num_array[i+1], num_array[i]\n end\n end\n end\n end\n num_array\nend",
"def bubble_sort(array)\n\t#outer loop keeps track if something was swapped or not\n\tloop do \n\t\tswapped = false\n\t\t#inner loop swaps numbers that aren't in order\n\t\t(array.length-1).times do |i|\n\t\t\t#take each pair of numbers and compare them. Swap if a > b. If so, swapped = true.\n \t\t\tif array[i] > array[i+1]\n \t\t\tarray[i], array[i+1] = array[i+1], array[i]\n\t\t\t\tswapped = true\n\t\t\tend\n\t\tend\n\t\tbreak if not swapped\n\tend\n\tarray\nend",
"def bub_sort(array)\n l = 1\n pairs = 0\n while l != array.length\n pairs += (array.length-l)\n l += 1\n end\n count = 0\n while count < pairs\n index = 0\n n = 0\n while index < array.length - n\n if array[index] > array[index+1]\n low = array[index+1]\n high = array[index]\n array[index] = low\n array[index+1] = high\n index += 1\n count += 1\n else\n index += 1\n count += 1\n end\n end\n n += 1\n puts array\n\n end\nend",
"def shell_sort(array)\n # p array\n gap = array.length/2\n while gap > 0\n idx = 0\n while idx < array.length - gap\n # while loop to move multiple steps\n while array[idx + gap] < array[idx]\n array[idx+gap],array[idx] = array[idx],array[idx+gap]\n if idx >= gap\n idx -= gap \n else\n break\n end\n end\n idx += 1\n end\n gap = gap/2\n # puts \"new gap is #{gap}\"\n p \"-\" * 10\n # p array verify properly sorting\n end\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 bubble_sort(array)\r\n\t\tnum = array.length\r\n\t\tloop do \r\n\t\t\tswapp = false\r\n\t\t\t(num-1).times do |i|\r\n\t\t\t\t\t\t\tif array[i] > array[i+1]\r\n\t\t\t\t\t\t\t\tarray[i], array[i+1] = array[i+1], array[i]\r\n\t\t\t\t\t\t\t\tswapp = true\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tbreak if not swapp\r\n\t\tend\r\n\t\tarray\r\n\tend",
"def alphabetic_number_sort2 num_arr\n num_arr.sort {|a, b| WORDS_ARR[a] <=> WORDS_ARR[b]}\nend",
"def stock_picker(stock_array)\n buy_sell_output = []\n real_output = []\n largest_difference = 0\n \n for i in 0...stock_array.length() \n for j in 0...stock_array.length()\n if j > i and stock_array[j] - stock_array[i] > largest_difference\n largest_difference = stock_array[j] - stock_array[i]\n buy_sell_output.push(stock_array[i])\n buy_sell_output.push(stock_array[j])\n end\n \n end\n end\n buy_sell_output.sort!()\n #print buy_sell_output[0]\n # = 3\n #print buy_sell_output.last\n # = 15\n\n real_output.push(stock_array.index(buy_sell_output[0]))\n real_output.push(stock_array.index(buy_sell_output.last))\n print real_output\nend",
"def selection_sort3(array)\n n = array.length\n n.times do |i|\n # assume the min number is the leftmost one, until proven otherwise\n minimum_index = i\n # checking all the digits to the right of i\n ((i + 1)..n - 1).each do |j|\n # if one of those digits is smaller than the one at i, we have a new min\n minimum_index = j if array[j] < array[minimum_index]\n end\n # once the min has been found, we swap it with the leftmost one.\n array[i], array[minimum_index] = array[minimum_index], array[i]\n p array\n end\n array\nend",
"def bubble_sort_by(arry)\n\t\tn = arry.length\n\n\t\tuntil n == 0\n\t\t\tnew_n = 0\n\t\t\tfor i in 1..(n-1)\n\t\t\t\tif yield(arry[i-1], arry[i])\n\t\t\t\t\tarry[i-1], arry[i] = arry[i], arry[i-1]\n\t\t\t\t\tnew_n = i\n\t\t\t\tend\n\t\t\tend\n\t\t\tn = new_n\n\t\tend\n\t\treturn arry\n\tend",
"def bubble_sort_by(array)\n \n i = 0 \n while i < array.length - 1 \n left = array[i]\n right = array[i+1]\n if yield(left,right) > 0\n array[i], array[i+1] = array[i+1], array[i]\n i = -1\n end\n i += 1 \n end\n return array\nend",
"def shell_sort(array)\n p array\n gap = array.length/2\n while gap > 0\n puts \"gap is currently #{gap}\"\n idx = 0\n while idx < array.length - gap\n # while loop to move multiple steps\n while array[idx + gap] < array[idx]\n array[idx+gap],array[idx] = array[idx],array[idx+gap]\n if idx > 0\n idx -= 1\n else\n break\n end\n end\n idx += 1\n end\n gap = gap/2\n p \"-\" * 10\n p array\n end\nend",
"def bubble_sort(array)\n # iterate through the array\n array.each do\n first = 0\n second = 1\n array.map do |value|\n \n # compare two adjacent values\n if array[second] && value > array[second]\n # move the greater value to the right and the lesser left\n save = array[first]\n array[first] = array[second]\n array[second] = save\n end\n first += 1\n second += 1\n end\n end\nprint array\nend",
"def cocktailsort\n begin\n swapped = false\n # forwards - same as bubblesort\n 0.upto(array.length - 2) do |i|\n # compare each two adjacent elements\n compare(i, i + 1)\n if array[i] > array[i + 1]\n # if the left one is greater, swap them\n swap(i, i + 1)\n #log\n swapped = true\n end\n end\n\n break unless swapped\n\n swapped = false\n # backwards - the reverse of bubblesort\n (array.length - 2).downto(0) do |i|\n compare(i, i + 1)\n if array[i] > array[i + 1]\n swap(i, i + 1)\n #log\n swapped = true\n end\n end\n end while swapped\nend",
"def bubble_sort_by(array)\n array.length.times do\n \ti = 0\n \tswap = 0\n \twhile i < array.length - 1 do\n \t\tif block_given?\n \t\t\tswap_case = yield(array[i], array[i + 1])\n \t\telse\n \t\t\tswap_case = array[i] > array[i + 1]\n \t\tend\n \t\tif swap_case > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n \t\t\tswap += 1\n \t\tend\n \t\ti += 1\n \tend\n \tbreak if swap == 0\n end\n\treturn array\nend",
"def bubble_sort!(array)\n loop do\n tally = 0\n first = 0\n second = 1\n until second == array.size\n if (array[first] <=> array[second]) == 1\n array[first], array[second] = array[second], array[first]\n tally += 1\n end\n first += 1\n second += 1\n end\n\n break if tally == 0\n end\nend",
"def alphabetic_number_sort(arr)\n words = %w[zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen]\n arr.sort_by do |number|\n words[number]\n end\nend",
"def bubble_sort(array=@base)\n array.each_index do |index1|\n index1.upto(array.size-2) do |index2|\n if array[index1] > array[index2+1]\n array[index1], array[index2+1] = array[index2+1], array[index1]\n end\n end\n end\n array\n end",
"def shell_sort(a)\n i = 0\n j = 0\n size = a.length\n increment = size / 2\n temp = 0\n \n while increment > 0\n i = increment\n while i<size\n j = i\n temp = a[i]\n while j>=increment and a[j-increment]>temp\n a[j] = a[j-increment]\n j = j-increment\n end\n a[j] = temp\n i+=1\n end\n if increment == 2\n increment = 1\n else\n increment = (increment/2).to_i\n end\n end\n return a\nend",
"def sorter(arr)\n\nreturn arr if arr.length <= 1\n\nnot_sorted = true\n\n while not_sorted\n not_sorted = false\n (arr.length-1).times do |i|\n if arr[i] > arr[i+1]\n arr[i], arr[i+1] = arr[i+1], arr[i]\n not_sorted = true\n p arr\n p \"swap occurred\"\n end\n end\n end\n arr\nend",
"def sorter(arr)\n\nreturn arr if arr.length <= 1\n\nnot_sorted = true\n\n while not_sorted\n not_sorted = false\n (arr.length-1).times do |i|\n if arr[i] > arr[i+1]\n arr[i], arr[i+1] = arr[i+1], arr[i]\n not_sorted = true\n p arr\n p \"swap occurred\"\n end\n end\n end\n arr\nend",
"def shell_sort(a)\n array = a\n \n m = 1\n while (gap = array.length / (2 ** m)) >= 1\n puts \"gap: #{gap}\"\n 0.step(array.length-1, gap) do |i|\n #puts \"#{i}\"\n # insertion sort\n #puts \" ###{i+gap}\"\n (i+1).upto(i+gap-1) do |j|\n #puts \" #{j}\"\n if array[j] < array[j-1]\n # need to shift everything over until it isn't\n j.downto(i+1) do |k|\n if array[k] < array[k-1]\n array[k], array[k-1] = array[k-1], array[k]\n end\n end\n end\n end\n p a\n end\n \n m += 1\n end\nend",
"def sortarray (sort_me)\n counter = sort_me.length\n a = 0\n b = 1\n while a < (counter-1)\n b = a+1\n while b < (counter)\n if sort_me[a] > sort_me[b]\n temp = sort_me[a]\n sort_me[a] = sort_me[b]\n sort_me[b] = temp\n end\n b += 1\n end\n a += 1\n end\n return sort_me\nend",
"def bubble_sort(array)\n\tn = array.length + 1\n\tloop do \n\t\tswapping = false \n\t\t(n-1).times do |i|\n\t\t\tif i > 0 && array[i] < array[i - 1]\n\t\t\t\tarray[i - 1], array[i] = array[i], array[i - 1]\n\t\t\t\tswapping = true\n\t\t\tend\n\t\tend \n\t\tbreak if not swapping\n\tend\n\tarray \nend",
"def bubble_sort(input_array)\n \n nb_swaps = 1000\n \n # the loop will be exited when number of swaps = 0 \n until (nb_swaps == 0) do \n res = bubble_sort_pass(input_array)\n nb_swaps = res[\"nb_swaps\"]\n end \n \n return(res[\"result_array\"])\n \nend",
"def highest_score_from (words)\n highest_scores = []\n scores = []\n\n words.each do |word|\n # calling method above (called score_hash) to create a hash with the particular word and score of each word in the array\n score_hash = {\n words: word,\n scores: score_word(word)\n }\n # shovelling the hashes above into the highest_scores array\n highest_scores << score_hash\n # shoveeling the return of the score_word method above (which is the score) for each of the words in the array\n scores << score_word(word)\n end\n\n # sorts the scores from the scores array above and then makes the changes \"permanent\" with the ! so we can use it in the below iterations.\n sorted_scores = scores.sort!\n winners_room = []\n winner_hash = {}\n # Iterating our way through the above array of hashes\n highest_scores.each do |hash|\n # Iterating through each of those hashes. if the value of the score is equal to the highest member of the sorted_scores array (the largest), the word will then be shovelled into the winner array.\n\n if hash[:scores] == sorted_scores.last\n # putting all the winners with highest score to wait\n winners_room << hash[:words]\n\n end\n shortest_word = 11\n # going thru each player in the winners room to meet top winner\n actual_winner = []\n # actual_actual_winner = \"\"\n\n\n\n actual_actual_winner = []\n winners_room.each do |winner|\n if winner.length == 10\n actual_winner << winner\n\n\n elsif winner.length <= shortest_word\n shortest_word = winner.length\n actual_winner << winner\n\n end\n # actual_actual_winner = []\n actual_actual_winner << actual_winner[0]\n end\n # actual_actual_winner = ''\n # actual_actual_winner = actual_winner.first\n #itterate thru the winner array to account for tie stuff\n # binding.pry\n winner_hash = {\n word: actual_actual_winner[0],\n score: sorted_scores.last\n }\n end\n return winner_hash\nend",
"def sort array\n\tcount = -2\n\t\t# count number of words in first list\n\t\tarray.each do |word|\n\t\tcount = count + 1\n\t\tend\n\trecursive_sort(array, [ ], [ ], count)\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 lcs_phase_two(arr)\n return arr.max if arr.max < 0 #edge case\n\n current = 0\n largest = 0\n\n arr.each do |ele|\n current += ele\n current = 0 if current < 0 #bookmark\n largest = current if largest < current\n end\n\n largest\nend",
"def sort_zombies\n index = 0\n while index < @zombie_apocalypse_supplies.length\n index2 = index + 1\n while index2 < @zombie_apocalypse_supplies.length\n if @zombie_apocalypse_supplies[index2] < @zombie_apocalypse_supplies[index]\n @zombie_apocalypse_supplies[index], @zombie_apocalypse_supplies[index2] = @zombie_apocalypse_supplies[index2], @zombie_apocalypse_supplies[index]\n end\n index2 += 1\nend\nindex += 1\nend\nputs\nputs @zombie_apocalypse_supplies\nputs\nend",
"def shell_sort(arr)\n gap = arr.size / 2\n until gap >= 1\n (0...gap).each do |i|\n j = i\n while j < arr.size\n arr[j], arr[j+gap] = arr[j+gap], arr[j] if arr[j] > arr[j+gap]\n j = j + gap\n end\n end\n gap, mod = gap.divmod(2)\n gap = mod == 0 ? gap + 1 : gap\n end\n arr\nend",
"def bubble_sort_by(input)\r\n sorted = false\r\n last_index = input.length-2\r\n until sorted\r\n swaps = 0\r\n 0.upto(last_index) do |i|\r\n if yield(input[i], input[i+1]) < 0\r\n input[i],input[i+1] = input[i+1],input[i]\r\n swaps += 1\r\n end\r\n end\r\n sorted = true if swaps == 0\r\n last_index -= 1\r\n end\r\n input\r\nend",
"def insertion_sort(array)\r\n final = [array[0]] # Final grabs the first value in array.\r\n array.delete_at(0) # Then it deletes that value, to compare others\r\n # main code\r\n for i in array # for every integer in array:\r\n final_index = 0\r\n while final_index < final.length # Both index and length will increase, till length stops increasing, stopping loop.\r\n if i <= final[final_index] #IF the integer is less than the final_index integer:\r\n final.insert(final_index,i) # Insert the integer into the current index.\r\n break\r\n elsif final_index == final.length-1 #IF the index reaches the end of final's array, that means the integer is greater than all:\r\n final.insert(final_index+1,i) # Insert the value to the end of array cause it's the greatest value #COULD USE .PUSH HERE\r\n break \r\n end\r\n final_index+=1 # We will go to the next index of final, if no conditions are matched\r\n end # END WHILE LOOP\r\n end # END FOR LOOP\r\n # output\r\n final #returns final array\r\nend",
"def non_comparison_sort(arr)\n result = []\n i = 1 \n while i <= arr.length \n result << i \n i+=1\n end \n p result \nend",
"def sort(array)\n loop do\n flag = false\n array.each_index do |index|\n break if array[index] == array.last\n if array[index] > array[index + 1]\n array[index], array[index + 1] = array[index + 1], array[index]\n flag = true\n end\n end\n break if flag == false\n end\n return array\n end",
"def bubble_sort_by(array)\n\nsorted = false\ncheck_it = array.length - 1 \n\tuntil sorted\n\t\tinorder = true \n\t\tcheck_it.times do |i|\n\t\t\ty = yield(array[i], array[i+1])\n\t\t\tif y == 1 #<=> returns that a > b\n\t\t\t\tarray[i], array[i+1] = array[i+1], array[i] \n\t\t\t\n\t\t\t\tinorder = false \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\t\t\t\n\t\t\n\t\t\tend\n\t\t\n\t\t\tputs array.inspect\t\n\t\t\tend \n\t \t\t\n\t \t\tcheck_it -= 1 \n\t\t\tputs \"end of yield runthrough\" #just to check\n\n\t\t\tif check_it == 0\t\t\t\n\t\t\t\tsorted = true \n\t\t\telsif inorder == true \n\t\t\t\tsorted = true\t\t\n\t\t\n\t\t\tend\n\t\t\n \tend\nend",
"def bubble_sort1!(array)\n return nil unless array.all?(array[0].class)\n \n to_be_sorted = array.size - 1\n\n loop do\n new_ending = 0\n \n 0.upto(to_be_sorted - 1) do |i|\n if array[i] > array[i + 1]\n array[i], array[i + 1] = array[i + 1], array[i]\n new_ending = i\n end\n end\n to_be_sorted = new_ending - 1\n break if to_be_sorted < 0\n new_ending == nil ? (to_be_sorted -= 1) : to_be_sorted = new_ending\n end\nend",
"def bubble_sort(array)\n n = array.length\n swapped = true\n while swapped\n swapped = false\n (n-1).times do |i|\n if array[i].downcase > array[i+1].downcase\n array[i], array[i+1] = array[i+1], array[i]\n swapped = true\n end\n end\n end\n p array\nend",
"def bubble_sort(arr)\n n = arr.length\n #ln 7, array length is my set of four numbers\n\n loop do\n #[2, 42, 22, 02]\n #[42, 2, 22, 02]\n #[42, 22, 2, 02]\n #[42, 22, 02, 2]\n\n swapped = false\n\n (n-1).times do |i|\n if arr[i] > arr [i + 1]\n arr [i], arr[i +1] = arr [i +1], arr[i]\n swapped = true\n end\n end\n\n #ln18 iterator variable is i, i +1 is the next number beside it \n #ln 19 is the rule to swap, we do this by equalling the values to the opposite one, that is how we swap \n #when accessing something within an element it needs an index\n\n break if not swapped \n #break will break us out of the loop but only if swapped is not true\n end\n\n arr\n\nend",
"def method(x)\r\n swapped = true\r\n while swapped == true\r\n swapped = false\r\n (x.length-1).times do |i|\r\n if x[i] > x[i+1]\r\n x[i], x[i+1] = x [i+1], x[i]\r\n swapped = true\r\n end\r\n end \r\n end \r\n x \r\nend",
"def sort array\n\tcount = -2\n\t\t# count number of words in first list\n\t\tarray.each do |word|\n\t\tcount = count + 1\n\tend\n\trecursive_sort(array, [ ], [ ], count)\nend",
"def sorting(array)\n #set a variable equal to the length of the array\n n = array.length\n\n #create main loop and set a variable equal to false. This variable will break the loop once all the swaps have been made\n loop do\n swapped = false\n\n #create a times loop\n (n-1).times do |i|\n if array[i] > array[i+1]\n switch = array[i+1] #store element to be swapped in a temporary variable\n array[i+1] = array[i]\n array[i] = switch\n swapped = true #if a swap happens then break variable becomes true. Either way, the .times loop will happen again until i reaches n-1\n end\n end\n\n #once .times loop ends\n break if !swapped\n end\n\n array\nend",
"def checksorted(array)\n i = 0\n until i > array.length-2 do\n # print array[i]\n if array[i] > array[i+1] then\n array[i], array[i+1] = array[i+1], array[i]\n print array\n next\n end\n print array\n i +=1\n end\n\n end",
"def selection_sort(arr)\n# set a variable called mark to 0\nmark = 0\n# make sure that we check every number\nwhile mark <= arr.length\n\t# set an index marker to 0\n\ti = 0\n\t# go through every item in the array\n\tarr.each do |num|\n\t# set the variable var to the value of the array at index position i\n\tvar = arr[i]\n\t\t# when the value of var is greater than the value of num\n\t\tif var > num\n\t\t\t# set the variable low to the value of num\n\t\t\tlow = num\n\t\t\t# set the variable var to the value of num\n\t\t\tvar = num\n\t\tend\n\t\t# increment the value of the variable i by 1\n\t\ti += 1\n\tend\n\tswap = arr[i]\n\tarr[i] = low\nend\n\treturn arr\nend",
"def sort(a)\n\t\n\tfor i in 1...a.length\n\n\ttemp=a[i]\n\tj=i-1\n\tx=bsearch(a,temp,0,j)\n\n\twhile j>=x do\n\ta[j+1]=a[j]\n\tj-=1\n\tend #This is for the while loop\n\ta[j+1]=temp\n\tend\n\n\tend",
"def sort(array)\n for index in (1...array.size)\n stored = array[index]\n position = index\n while position > 0 && array[position - 1] > stored\n array[position] = array[position - 1]\n position -= 1\n end\n array[position] = stored\n end\n array\nend"
] |
[
"0.7030257",
"0.68429494",
"0.66791314",
"0.66459066",
"0.6633959",
"0.66083676",
"0.6595324",
"0.65758055",
"0.6519745",
"0.6516699",
"0.65130115",
"0.6500154",
"0.6489104",
"0.648644",
"0.64823484",
"0.6468318",
"0.6461134",
"0.6443252",
"0.64390737",
"0.6438569",
"0.64366406",
"0.64283574",
"0.64255524",
"0.6422898",
"0.64171016",
"0.6415203",
"0.6407541",
"0.6405674",
"0.6403864",
"0.6401056",
"0.63950074",
"0.6393483",
"0.638518",
"0.6358349",
"0.6355509",
"0.6353014",
"0.63439673",
"0.63234764",
"0.6322929",
"0.63071364",
"0.6300411",
"0.6295114",
"0.6293385",
"0.6293283",
"0.6292661",
"0.6288411",
"0.62750036",
"0.6273733",
"0.6267076",
"0.62666243",
"0.62661535",
"0.62610996",
"0.6260793",
"0.6260691",
"0.62583643",
"0.625203",
"0.6244008",
"0.62340856",
"0.62238216",
"0.622147",
"0.62101936",
"0.62084603",
"0.6202395",
"0.61983603",
"0.61868864",
"0.61790276",
"0.61786187",
"0.6176487",
"0.6175427",
"0.6173384",
"0.6172472",
"0.61630476",
"0.61625963",
"0.61600715",
"0.61591375",
"0.61591375",
"0.6158238",
"0.61578196",
"0.61542624",
"0.6150548",
"0.61470115",
"0.61371845",
"0.6137181",
"0.61369026",
"0.6135505",
"0.613359",
"0.6128741",
"0.6121878",
"0.6121036",
"0.61155576",
"0.61119527",
"0.61118925",
"0.6108013",
"0.61076874",
"0.6106162",
"0.61031455",
"0.6103009",
"0.6102667",
"0.6100888",
"0.60932755",
"0.60899866"
] |
0.0
|
-1
|
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement.
|
def selects_the_titles_of_all_projects_and_their_pledge_amounts
"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY title"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'music';\n\"\nend",
"def current_categories(db)\r\n\tretrieve_categories = '\r\n\tSELECT name FROM categories'\r\n\tcategories = db.execute(retrieve_categories)\r\nend",
"def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT projects.category, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects\nON pledges.project_id = projects.id \nWHERE projects.category = 'books';\"\nend",
"def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT Projects.category, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id WHERE Projects.category = 'books';\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\nend",
"def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end",
"def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end",
"def get_category_name(category_id)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category = db.get_first_value(\"select name from category where id = ?\", [category_id])\n\n return categor\nend",
"def projects\n where(:_type => ProjectCategory.name)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title ORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(amount) FROM projects\n INNER JOIN pledges ON project_id = projects.id\n GROUP BY title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title\"\n\n# FROM owners\n# INNER JOIN cats_owners\n# ON owners.id = cats_owners.owner_id\n# JOIN cats ON cats_owners.cat_id = cats.id\n# WHERE cats_owners.owner_id = 2;\n\nend",
"def current_categorized_expenses(db, user_name)\r\n\tretrieve_categorized_expenses = '\r\n\tSELECT categories.name, amount FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE users.name = ?'\r\n\tcategorized_expenses = db.execute(retrieve_categorized_expenses, [user_name])\r\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY(projects.title) ;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n sql = <<-SQL\n SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title;\n SQL\n\nend",
"def getCategories(_, _, _)\n @db.categories\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n <<-SQL\n SELECT projects.title , sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\n \n\"SELECT projects.title, SUM(amount) \nFROM pledges \nINNER JOIN projects \nON pledges.project_id = projects.id GROUP BY projects.title;\"\nend",
"def category(id)\n db = connect()\n return db.execute('SELECT Id,Title FROM discussions WHERE CatId=?', id), db.execute('SELECT * FROM categories WHERE Id=?', id)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title ORDER BY title\"\nend",
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def get_category_id(category)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category_id = db.get_first_value(\"select id from category where name = ?\", [category])\n\n return category_id\nend",
"def select(db); end",
"def select(db); end",
"def get_records_for_category categ\n if categ.nil? or categ == \"\"\n #return @records\n get_data \"select * from todo\"\n else\n #return @records.select { |row| row[0] == categ }\n get_data \"select * from todo where categ = '#{categ}' \"\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL \n SELECT projects.title, SUM(pledges.amount)\n FROM projects \n INNER JOIN pledges on projects.id = pledges.project_id \n GROUP BY projects.title\n ORDER BY projects.title\n SQL\nend",
"def project_statement\n project_clauses = []\n active_subprojects_ids = []\n\n active_subprojects_ids = project.descendants.active.map(&:id) if project\n if active_subprojects_ids.any?\n if has_filter?(\"subproject_id\")\n case operator_for(\"subproject_id\")\n when '='\n # include the selected subprojects\n ################\n # Smile specific : [project.id] + removed\n ids = values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!'\n # exclude the selected subprojects\n\n ################\n # Smile specific : [project.id] + removed\n ids = active_subprojects_ids - values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!*'\n # main project only\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n else\n # all subprojects\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n end\n elsif Setting.display_subprojects_issues?\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n else\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n elsif project\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n project_clauses.any? ? project_clauses.join(' AND ') : nil\n end",
"def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\nSQL\nend",
"def index\n\n # @sql = \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n @sql = params[:name].present? ? \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" : \"Projects.name ILIKE '%' \"\n @sql += \"OR Projects.description ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n\n @sql += \"and Projects.category ILIKE '#{'%'+params[:categorysdigital]+'%'}' \" if params[:categorysdigital].present?\n if params[:categorysdigital].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n end\n\n if params[:categorysdigital].present? || params[:categorysmarketing].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n end\n\n @sql += \"and Projects.progress = #{params[:progresspropose].to_i} \" if params[:progresspropose].present?\n if params[:progresspropose].present?\n @sql += \"or Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n else\n @sql += \"and Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n end\n\n if params[:progressselected].present?\n @sql += \"or Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n else\n @sql += \"and Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n end\n\n # @sql += \"ORDER progress\"\n @projects = Project.where(@sql).order(:progress)\n @count = @projects.count\n @count_tt = Project.count\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present?\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now())\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects \nON pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n# Select projects title column and the sum of the pledges amount column\n# from the projects database,\n# join the pledges (Join table)\n# with projects.id and the pledges project id. Match these numbers\n# Group the tables together by Projects title and then\n# sort by projects.title\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM Projects\n JOIN Pledges\n ON Projects.id = Pledges.project_id\n GROUP BY Projects.title\n ORDER BY Projects.title;\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT DISTINCT title ,SUM(amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title\n SQL\nend",
"def get_project_name(id)\n con = PG::Connection.connect(\"localhost\",5432,nil,nil,\"aaa\",\"admin\")\n sql = \"SELECT name \"\n sql += \"FROM projects \"\n sql += \"WHERE id='#{id}' \"\n res = con.exec(sql)\n con.close\n name = \"NA\"\n name = res[0]['name'] if res.num_tuples > 0\nend",
"def sql\n <<-SQL\n -- Search learning paths\n SELECT DISTINCT\n c.id,\n c.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_path' AS content_type,\n c.id AS learning_path_id,\n 0 AS learning_objective_id\n FROM courses c\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = c.id AND ts.taggable_type = 'LearningPath'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = c.id AND cc.contentable_type = 'LearningPath'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_course_worklow_clause}\n #{construct_name_sql}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning objectives\n SELECT DISTINCT\n cm.id,\n cm.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_objective' AS content_type,\n cm.context_id::bigint AS learning_path_id,\n cm.id::bigint AS learning_objective_id\n FROM context_modules cm\n INNER JOIN courses c\n ON c.id = cm.context_id\n AND cm.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = cm.id AND ts.taggable_type = 'LearningObjective'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = cm.id AND cc.contentable_type = 'LearningObjective'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('cm')}\n #{construct_name_sql('cm')}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning learning_event\n SELECT DISTINCT\n ct.id,\n ct.title AS name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_event' AS content_type,\n ct.context_id::bigint AS learning_path_id,\n ct.context_module_id::bigint AS learning_objective_id\n FROM content_tags ct\n INNER JOIN courses c\n ON c.id = ct.context_id\n AND ct.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = ct.id AND ts.taggable_type = 'LearningEvent'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = ct.id AND cc.contentable_type = 'LearningEvent'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('ct')}\n #{construct_name_sql('ct', 'title')}\n #{construct_all_tags_search('t', 'name')}\n SQL\n end",
"def get_category_name\n Category.find(:first, :select => ['name'],:conditions=>['has_complexity=?',false]).name rescue ''\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"\nSELECT \nProjects.title,\nSUM(Pledges.amount)\nFROM Pledges\nINNER JOIN Projects\nON Pledges.project_id = Projects.id\nGROUP BY Projects.title\nORDER BY Projects.title\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(pledges.amount) \nFROM projects \nJOIN pledges \nON Projects.id = pledges.project_id \nGROUP BY title\"; \nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges \nON projects.id=pledges.project_id\nGROUP BY projects.id\nORDER BY projects.title;\"\nend",
"def makeQueryTableAll(tableName)\n #sql = \"SELECT * FROM [\" << tableName << \"]\"\n sql = \"SELECT * FROM [\" << tableName << \"]\" << \" WHERE id < 3\"\n #puts(sql) #debug\n return sql\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"SELECT projects.title, sum_pledges FROM (SELECT pledges.project_id, SUM(pledges.amount) AS sum_pledges FROM pledges GROUP BY pledges.project_id) INNER JOIN projects ON projects.id = project_id ORDER BY projects.title\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\nSELECT projects.title, SUM(pledges.amount) \nFROM projects \nINNER JOIN pledges on projects.id = pledges.project_id\nGROUP BY (pledges.project_id)\nORDER BY projects.title;\nSQL\nend",
"def category_totals(db, user_name, number)\r\n\tretrieve_totals = '\r\n\tSELECT categories.name, SUM(amount) FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE categories.id = ?\r\n\tAND users.name = ?'\r\n\ttotals = db.execute(retrieve_totals, [number, user_name])[0]\r\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\r\n\"SELECT title, SUM(pledges.amount) FROM projects\r\nJOIN pledges ON projects.id = pledges.project_id\r\nGROUP BY projects.id\r\nORDER BY title ASC\"\r\nend",
"def add_category(db, category)\r\n\tnew_category = '\r\n\tINSERT INTO categories (name)\r\n\tVALUES (?)'\r\n\tdb.execute(new_category, [category])\r\nend",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Select title, amount from projects, pledges where projects.id = pledges.id order by title ASC;\"\nend",
"def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id=pledges.project_id GROUP BY projects.title;\"\n## FROM - where are they talking to each other - where is the scotch tape\nend",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title,\n SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\n\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, \nSUM(pledges.amount) \nFROM projects\nJOIN pledges ON pledges.project_id = projects.id\nGROUP BY projects.title\nORDER BY projects.title ASC;\"\nend",
"def select_all(sql, name = nil) end",
"def select\n @pds_projects = PdsProject.includes(:company).where('ProjectID in (?)', PROJECT_LIST)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(amount) AS pledge_amount\nFROM pledges\nJOIN projects\nWHERE pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL\n SELECT\n title, sum(amount)\n FROM\n projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY\n title\n ORDER BY\n title\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount )\nFROM projects \nJOIN pledges\nON projects.id = pledges.project_id \nGROUP BY projects.title \nORDER BY projects.title \";\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title,(SELECT SUM(pledges.amount))\n FROM projects\n INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title ASC;\n \"\nend",
"def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"def get_category(cate, limitl, limitr)\n return Product.find_by_sql(\"select * from products where tag like '%#{cate}%' order by id limit #{limitl}, #{limitr}\")\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title \"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def select_project\n @projects = Project.find(:all)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"def sql_statement_find\n @sql_statement_find ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :project_plan AS project_plan,\n application_data -> :why_selected_project AS why_selected_project,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice,\n hstore_to_json_loose(slice(application_data, ARRAY[:student0_attrs])) AS student0,\n hstore_to_json_loose(slice(application_data, ARRAY[:student1_attrs])) AS student1\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id\n AND applications.id = :id;\n SQL\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM projects\n JOIN pledges\n ON Projects.id = Pledges.project_id\n GROUP BY project_id\n ORDER BY Projects.title\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON pledges.project_id = projects.id\n GROUP BY projects.title\n ORDER BY projects.title\n\"\nend",
"def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nJOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title;\"\nend",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\t@page.css('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\t@db.execute 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM (pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title ASC;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id GROUP BY Projects.title;\"\nend",
"def add_project_name_to_jql jql_string\n unless jql_string.empty?\n jql_string.insert(0, \"project=#{@project} AND \")\n else\n \"project=#{@project}\"\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.id ORDER BY title;\"\nend",
"def search(category, query_term)\nresult = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\");\n puts student\n result.each do |student|\n puts \"#{k}: #{v}\"\n end\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY(projects.title);\"\nend",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(pledges.amount) FROM projects INNER JOIN pledges on pledges.project_id=projects.id group by pledges.project_id ORDER BY projects.title ASC\"\nend",
"def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id=projects.id GROUP BY projects.title ORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n # SELECT titles, amounts FROM projects, pledges ORDER BY titles ASC\n #SELECT titles.projects, pledges.amounts ORDER BY titles ASC\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges \n ON pledges.project_id = projects.id \n GROUP BY(pledges.project_id)\n ORDER BY projects.title ASC\n \";\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges ON pledges.project_id = projects.id\n GROUP BY title\n ORDER BY title ASC;\"\nend",
"def sql_statement_all\n @sql_statement_all ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id;\n SQL\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title ASC;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"select\nprojects.title,\nsum(pledges.amount) as sum_all_pledges\nfrom projects\ninner join pledges\non projects.id = pledges.project_id\ngroup by projects.title\norder by projects.title;\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) \n FROM projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY projects.title;\"\nend",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nLEFT JOIN pledges\nON projects.id=pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n #SELECT title, SUM(quantity) FROM groceries GROUP BY aisle ORDER BY SUM(quantity);\n\n \"SELECT projects.title, sum( pledges.amount)\nFROM projects\nJOIN pledges\nwhere projects.id=pledges.project_id\ngroup by projects.title order by projects.title\n;\"\n\nend",
"def frey_example\n # Find all the cats that are the same color as the cat named 'Freyja'.\n # Including 'Freyja' in the results.\n # DO NOT USE A SUBQUERY\n\n execute(<<-SQL)\n SELECT\n color_cats.name\n FROM\n cats AS freyja_cats\n JOIN\n cats AS color_cats ON freyja_cats.color = color_cats.color\n WHERE\n freyja_cats.name = 'Freyja';\n SQL\nend",
"def select &blck\n @projects.select(&blck)\n end",
"def select &blck\n @projects.select(&blck)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT p.title, SUM(pl.amount) FROM pledges pl INNER JOIN projects p ON pl.project_id = p.id GROUP BY pl.project_id ORDER BY p.title\"\nend"
] |
[
"0.91978997",
"0.7068997",
"0.6991828",
"0.6652033",
"0.66230565",
"0.6514643",
"0.648783",
"0.63246053",
"0.6061025",
"0.59403455",
"0.59393066",
"0.5937369",
"0.59020996",
"0.58835524",
"0.58716",
"0.58550864",
"0.58536905",
"0.58415705",
"0.5820357",
"0.5785234",
"0.5783229",
"0.56992614",
"0.56970924",
"0.56928146",
"0.56928146",
"0.56912357",
"0.5683692",
"0.567896",
"0.56351626",
"0.56293553",
"0.5620267",
"0.56186193",
"0.5614905",
"0.5590296",
"0.5583118",
"0.55744904",
"0.5574043",
"0.5573383",
"0.5567892",
"0.55452454",
"0.55418557",
"0.55286545",
"0.5488443",
"0.5481405",
"0.5480465",
"0.54794765",
"0.54767334",
"0.54658157",
"0.5462176",
"0.54601943",
"0.5450423",
"0.54489326",
"0.5433244",
"0.5431719",
"0.5430979",
"0.5430075",
"0.5424739",
"0.54242975",
"0.54235417",
"0.5416847",
"0.54086775",
"0.5394201",
"0.53872555",
"0.5384959",
"0.5383212",
"0.5382189",
"0.53818476",
"0.5374088",
"0.53625935",
"0.53529316",
"0.5352482",
"0.5349052",
"0.53488636",
"0.53486246",
"0.534243",
"0.53416926",
"0.53334725",
"0.533061",
"0.5322868",
"0.53219444",
"0.5320728",
"0.531241",
"0.531241",
"0.53078246",
"0.5300529",
"0.5297473",
"0.5291857",
"0.52877223",
"0.5285923",
"0.52852035",
"0.5284938",
"0.5284349",
"0.5277347",
"0.52745944",
"0.52733094",
"0.5269485",
"0.52654827",
"0.5260228",
"0.5257398",
"0.5257398",
"0.5256091"
] |
0.0
|
-1
|
Return the instance as a hash of simple (typeconverted) values suitable for Savon.
|
def to_savon
hash = Hash.new()
type_mappings.keys.each do |ivar_name|
value = map_to_savon(ivar_name, instance_variable_get("@#{ivar_name}"))
hash[ivar_name.to_sym] = value unless value.nil?
end
hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash\n [self.class, to_s].hash\n end",
"def hash\n [self.class, to_s].hash\n end",
"def to_hash\n { type: type, value: value }\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_h\n data = super\n data[:convert] = data.delete(:converter)\n data.stringify_keys\n end",
"def hash\n return to_s.hash\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_hash() end",
"def to_hash\n self.class.fields.each_with_object({}) do |key, hash|\n val = send(key)\n hash[key] = val if !val.nil?\n end\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash\n to_a.hash\n end",
"def to_h\n hash = {}\n [:bri, :hue, :sat].each do |attr|\n value = send(attr)\n hash[attr] = value if value\n end\n hash\n end",
"def to_hash\n @_hash_\n end",
"def to_h\n self.symbolize_keys.to_h\n end",
"def to_hash\n object\n end",
"def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end",
"def to_h\n encode_with({})\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def to_output_hash\n Types::Coercible::Hash.schema(\n map { |attr| [attr.key, attr.to_read_type] }.to_h\n )\n end",
"def as_hash\n @hash\n end",
"def hash\n to_a.hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n {\n name: @name,\n type: @type,\n catalog_id: @catalog_id,\n settings: @settings\n }\n end",
"def to_h\n FieldsToHash.call(self)\n end",
"def hash\n @type.hash\n end",
"def to_hash *args\n hsh = super(*args)\n hsh.each do |attr, val|\n hsh[attr] = val.to_hash if val.respond_to?(:to_hash)\n end\n hsh\n end",
"def to_dict\n @hash\n end",
"def to_h\n to_hash\n end",
"def to_hash\n hash = {}; self.attributes.each { |k,v| hash[k] = v }\n end",
"def hash\n [_name, _type, _klass].hash\n end",
"def to_hash\n fields.inject({type: type}) do |table, name|\n table.tap do\n if val = send(name)\n val = val.iso8601(3) if name == :timestamp\n table[name] = val\n end\n end\n end\n end",
"def to_h; end",
"def to_h; end",
"def to_h; end",
"def to_h; end",
"def to_h\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s.gsub( /@/, '' )] = self.instance_variable_get( var )\n end\n hash.merge( 'type' => type )\n end",
"def hash\n [created, value, change_mode, invoicing_type, no_charge].hash\n end",
"def hash\n [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, returned, uniqueness, reference_types].hash\n end",
"def to_h()\n #This is a stub, used for indexing\n end",
"def export\n to_h.merge('&class' => self.class.to_s).stringify_keys\n end",
"def serialize\n hash = {}\n self.class::ATTRIBUTES.keys.each do |attr|\n spec = self.class::ATTRIBUTES[attr].to_h\n type = spec[:type]\n value = send(attr)\n\n if value.nil?\n hash[attr] = nil\n elsif type == TYPE_OBJECT\n hash[attr] = value.serialize\n elsif type == TYPE_OBJECT_ARRAY\n hash[attr] = value.map{ |e| e.serialize }\n else\n hash[attr] = value\n end\n end\n\n return hash\n end",
"def to_hash\n\t\t\trhash = {}\n\t\t\t@hash.each {|k,v|\n\t\t\t\tcase v\n\t\t\t\twhen ConfigStruct\n\t\t\t\t\trhash[k] = v.to_h\n\t\t\t\twhen NilClass, FalseClass, TrueClass, Numeric\n\t\t\t\t\t# No-op (can't dup)\n\t\t\t\t\trhash[k] = v\n\t\t\t\twhen Symbol\n\t\t\t\t\trhash[k] = v.to_s\n\t\t\t\telse\n\t\t\t\t\trhash[k] = v.dup\n\t\t\t\tend\n\t\t\t}\n\t\t\treturn rhash\n\t\tend",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def to_hash\n hash = {}\n self.instance_variables.each do |var|\n symbol = var.to_s.gsub(\"@\",\"\").to_sym\n hash[symbol] = send symbol\n end\n return hash\n end",
"def hash\n [self.class, self.val, self.attribute].hash\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def to_h\n self.class.list_of_attributes.each_with_object({}) do |key, hash|\n val = instance_variable_get :\"@#{key}\"\n hash[key] = Utils.hashify(val) unless val == Dry::Initializer::UNDEFINED\n end\n end",
"def to_hash\n return self\n end",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def hash\n self.to_f.hash\n end",
"def to_hash\n converter_map.dup\n end",
"def to_input_hash\n Types::Coercible::Hash.schema(\n map { |attr| [attr.name, attr] }.to_h\n )\n end",
"def hash\n [ data, type ].hash\n end",
"def hash\n [from_ts, group_by, groups, monitors, overall, series, thresholds, to_ts, type, type_id].hash\n end",
"def to_hash\n @value\n end",
"def to_hash\n @value\n end",
"def to_hash\n hash = {}\n self.attributes.each {|attr| hash[attr.to_sym] = self.send(attr)}\n hash\n end",
"def to_hash\n {}\n end",
"def to_h\n private_to_h\n end",
"def to_h\n private_to_h\n end",
"def to_hash\n h = {}\n self.all_redis_objects.each do |o|\n field = o[0]\n redis_type = o[1][:type] \n case redis_type\n when :value\n h[field] = try_a_number(self.method(field).call.value)\n when :set\n h[field] = self.method(field).call.members.map{ |x| try_a_number(x) }\n end\n end\n h\n end",
"def to_h\n self.dictionary\n end",
"def to_hash\n Hash[self]\n end",
"def to_hash\n {}.tap do |v|\n v[:type] = @type.name\n v[:name] = @name\n v[:pos] = @pos\n v[:cell] = @cell\n v[:units] = @units\n end\n end",
"def to_hash\n attributes\n end",
"def to_hash\n validate!\n @hash ||= json\n end",
"def to_hash\n attribute_hash = {}\n simple_attributes.each do |att|\n attribute_hash[att] = self.send(att) unless self.send(att).nil?\n end\n \n attribute_hash\n end",
"def to_hash\n\t\tpure_hash = {}\n\t\t@hash.each do |info|\n\t\t\tpure_hash[info.key] = info.value\n\t\tend\n\t\tpure_hash\n\tend",
"def to_h\n @to_h ||= {\n # era: era, # todo\n year: year,\n quarter: quarter,\n month: month,\n cweek: week,\n day: day,\n day_of_year: day_of_year,\n week_day: week_day,\n cycle: cycle,\n year_of_week: year_of_week,\n }.freeze\n end",
"def to_hash\n { @name => @value }\n end",
"def convert_to_hash\n\n tmp_hash= {}\n self.class_variables.each do|var|\n tmp_hash[var.to_s.delete(\"@@\")] = self.class_variable_get(var)\n end\n\n return tmp_hash\n\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def to_h\n Hash[ self ]\n end",
"def to_hash\n raise NotImplementedError\n end",
"def hash\n [to_d.hash, currency.hash].hash\n end",
"def to_hash\n attributes.dup\n end",
"def to_hash\n @data.inject({}) do |ac,(k,v)|\n ac.merge! k => ((v.kind_of? self.class) ? v.to_hash : v)\n end\n end",
"def to_hash(*)\n mapper.new(self).to_hash\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end",
"def hash\n self.class.name.hash\n end",
"def to_hash\n instance_variables_hash.inject({}) do |acc, data|\n k,v = data\n v = v.to_hash if v.respond_to?(:to_hash)\n acc[k] = v\n acc\n end\n end",
"def to_hash\n result = {}\n [[:tn, :tn], [:epg, :epg], [:cnam, :cnam], [:refId, :ref_id]].each do |garbage, pretty|\n # Make sure that this thing ain't nil\n if self.send(pretty)\n result[garbage] = self.send(pretty)\n end\n end\n result\n end",
"def to_hash\n {\n \"name\" => name,\n \"type\" => type\n }.reject { |k, v| v.nil? }\n end",
"def to_hash()\n @data\n end"
] |
[
"0.75584674",
"0.74956375",
"0.7347888",
"0.72963244",
"0.72963244",
"0.72963244",
"0.71461827",
"0.7145675",
"0.7145675",
"0.7145675",
"0.7145675",
"0.7145675",
"0.7145675",
"0.7104434",
"0.7080353",
"0.7060343",
"0.70341825",
"0.7027626",
"0.70230806",
"0.6978581",
"0.6978581",
"0.69153905",
"0.6913318",
"0.68711674",
"0.68705165",
"0.68668586",
"0.68575007",
"0.6855763",
"0.68550456",
"0.68550456",
"0.68306845",
"0.67921704",
"0.67895204",
"0.6759202",
"0.6759139",
"0.6750454",
"0.6749701",
"0.6744117",
"0.67361706",
"0.67304057",
"0.67251533",
"0.6717369",
"0.67145795",
"0.6710138",
"0.6710138",
"0.6710138",
"0.6710138",
"0.6708262",
"0.6705121",
"0.6694454",
"0.669331",
"0.668443",
"0.66690886",
"0.66481715",
"0.663446",
"0.6614851",
"0.6612135",
"0.66109645",
"0.65976036",
"0.6594252",
"0.6590128",
"0.6590128",
"0.658703",
"0.6586692",
"0.65771186",
"0.6576857",
"0.6567972",
"0.6562014",
"0.6562014",
"0.6545639",
"0.6533612",
"0.65312666",
"0.65312666",
"0.65273434",
"0.65273273",
"0.6513437",
"0.65115863",
"0.65106714",
"0.65053636",
"0.65027356",
"0.6498069",
"0.6483612",
"0.6481998",
"0.6478604",
"0.64767736",
"0.64767736",
"0.64767736",
"0.6474017",
"0.64684796",
"0.64682126",
"0.6466339",
"0.64658344",
"0.6461863",
"0.64543825",
"0.64388967",
"0.6438379",
"0.64356345",
"0.6433474",
"0.64300895",
"0.64293426"
] |
0.69498456
|
21
|
Convert the instance to a JSON representation
|
def to_json(*a)
result = {}
self.type_mappings.keys.each { |key| result[key] = self.send(key).to_json }
{
'json_class' => self.class.name,
'data' => result
}.to_json(*a)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_json\n self.to_h.to_json\n end",
"def serialize\n self.to_hash.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"def to_json\n to_h.to_json\n end",
"def to_json\n to_h.to_json\n end",
"def to_json\n return self.to_hash.to_json\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def to_json\n to_json_object.to_json\n end",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n return self.class.to_json\n end",
"def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"def instance_to_json\n { \n id: self.id,\n title: self.title,\n description: self.description,\n creator: self.creator.name\n \n }\n end",
"def to_json!\n self.to_hash.to_json\n end",
"def to_json\n JSON(as_json)\n end",
"def to_json\n Formatter::JSON.render(self)\n end",
"def to_json\n object.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def to_json\n {\n :json_class => self.class.name,\n :name => self.name,\n :uuid => self.uuid\n }.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n {\n :json_class => self.class.name,\n :display_name => self.display_name,\n :name => self.name,\n :uuid => self.uuid\n }.to_json\n end",
"def instance_to_json\n { \n id: self.id,\n title: self.title,\n content: self.content,\n likes: self.likes,\n author: {\n id: self.author.id,\n name: self.author.name\n }\n }\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n JSON.generate(to_h)\n end",
"def to_json\n attributes =\n if respond_to?(:to_hash)\n to_hash.as_json\n else\n instance_values.as_json\n end\n\n attributes.to_json\n end",
"def to_json\n {\n :json_class => self.class.name,\n :display_name => self.display_name,\n :name => self.name,\n :types => self.types,\n :uuid => self.uuid\n }.to_json\n end",
"def to_json\n JSON.generate to_hash\n end",
"def to_json\n return Json.dump(to_hash)\n end",
"def to_json\n\n end",
"def tojson\n\t\tend",
"def to_json\r\n to_hash.to_json\r\n end",
"def to_json\n to_raw.to_json\n end",
"def instance_to_json\n \n { id: self.id,\n name: self.name,\n publisher: self.publisher,\n weapons:self.weapons.arrg_to_json\n }\n end",
"def to_json\n to_parsed.to_json\n end",
"def to_json\n to_a.to_json\n end",
"def to_json\n Oj.dump(to_hash)\n end",
"def as_json\n to_s.as_json\n end",
"def to_json(_context = nil)\n to_h.to_json\n end",
"def to_s\n self.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json\n @object.marshal_dump.to_json\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def to_json\n JSON.dump _attributes\n end",
"def serialize_to_json\n @data.to_json\n end",
"def to_json\n to_s.to_json\n end",
"def to_json\n return to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n @json.to_json\n end",
"def toJson()\n json = { 'class' => self.class.to_s }\n json['id'] = @id ;\n json['index'] = @index ;\n json['allow'] = @allow ;\n json['disallow'] = @disallow ;\n json['speed'] = @speed ;\n json['length'] = @length ;\n json['originalId'] = @originalId ;\n\n json['shape'] = genShapeJson() ;\n\n return json ;\n end",
"def to_json\n JSON.pretty_generate(to_h)\n end",
"def as_json\n JSON.parse self.to_json\n end",
"def as_json\n record\n end",
"def as_json(*args)\n {}.update(self)\n end",
"def to_s\n to_json\n end",
"def as_json(_opts={})\n raise NotImplementedError\n end",
"def to_json\n Yajl::Encoder.encode(to_hash, :pretty => true)\n end",
"def to_json\n @json ||= get_json\n end",
"def json_serialize\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def to_json\n JSON.pretty_generate(to_hash)\n end",
"def as_json(options={})\n { :id => self.id, :name => self.name }\n end",
"def as_json(_options = nil)\n to_s\n end",
"def as_json(options=nil)\n instance_values.except \"model\", \"adapter\"\n end",
"def as_json(options = {})\n\t\t\t\t\tresult = {\n\t\t\t\t\t\t\"name\" => self.name.to_s,\n\t\t\t\t\t\t\"description\" => self.description.to_s,\n\t\t\t\t\t\t\"quantity\" => self.quantity.to_i,\n\t\t\t\t\t\t\"price\" => self.price_without_decimal\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\tend",
"def to_json(*)\n to_hash.to_json\n end",
"def as_json(_options = nil)\n to_h\n end",
"def to_nice_json\n JSON.pretty_generate to_hash\n end",
"def to_nice_json\n JSON.pretty_generate to_hash\n end",
"def to_json(options = {})\n super(self.class.serialize_options_update(options))\n end",
"def to_s()\n hash = {}\n self.instance_variables.each do |var|\n hash[var] = self.instance_variable_get var\n end\n hash.to_json\n end",
"def to_json(opts={})\n self.to_hash.to_json(opts)\n end",
"def to_json\n JSON.dump ({\n :name => @name,\n :age => @age,\n :gender => @gender\n })\n end",
"def to_json\n @data.to_json\n end",
"def stringify\n json_hash = {}\n\n begin\n json_hash = Serializer.serialize(self, class: self.class.name)\n rescue JSON::JSONError => e\n warn \"#{__FILE__}.#{__LINE__}: #{e.message}\"\n end\n\n json_hash.to_json\n end",
"def to_json\n data.to_json\n end",
"def as_json(*)\n to_h\n end",
"def as_json\n\t\t{\n\t\t\t:id => self.id,\n\t\t\t:nombre => self.nombre,\n\t\t\t:abreviacion => self.abreviacion,\n\t\t}\t\t\n\tend",
"def to_json(*)\n #This is a stub, used for indexing\n end",
"def serialize\n end",
"def as_json\n attributes\n end",
"def as_json\n attributes\n end",
"def to_json(*_args)\n JSON.dump as_json\n end",
"def json\n @data.to_json\n end",
"def to_json\n raise StandardError, \"Not implemented!\"\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def to_json\n #JSON.fast_generate(to_hash)\n JSON.pretty_generate(to_hash)\n end",
"def to_json\n #JSON.fast_generate(to_hash)\n JSON.pretty_generate(to_hash)\n end"
] |
[
"0.8448921",
"0.83716893",
"0.82706946",
"0.826712",
"0.8240175",
"0.8240175",
"0.82194114",
"0.8210146",
"0.81833684",
"0.8115767",
"0.8115767",
"0.81033736",
"0.80731463",
"0.8025077",
"0.80181783",
"0.7999389",
"0.79935306",
"0.79813087",
"0.79698694",
"0.79698694",
"0.79543847",
"0.79506177",
"0.79506177",
"0.7919994",
"0.791941",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7909475",
"0.7899131",
"0.78710437",
"0.78619486",
"0.7803235",
"0.7798144",
"0.7793531",
"0.7768385",
"0.7753496",
"0.7743513",
"0.77280873",
"0.77259046",
"0.7718974",
"0.76988196",
"0.7667492",
"0.76640713",
"0.7617328",
"0.75878483",
"0.75878483",
"0.7571567",
"0.755556",
"0.754683",
"0.7528119",
"0.75280064",
"0.7525265",
"0.7516289",
"0.75080097",
"0.7484375",
"0.74753594",
"0.74731916",
"0.74724126",
"0.74663466",
"0.7444216",
"0.742166",
"0.7415745",
"0.7406472",
"0.7400561",
"0.7386659",
"0.7341188",
"0.73256487",
"0.73231584",
"0.7307675",
"0.7305096",
"0.73006445",
"0.72916126",
"0.72885585",
"0.72885585",
"0.7287097",
"0.7286241",
"0.72850907",
"0.7268703",
"0.7265488",
"0.72442394",
"0.7240502",
"0.7229729",
"0.7211809",
"0.7203943",
"0.7201258",
"0.71721613",
"0.71721613",
"0.7167928",
"0.7166312",
"0.7164478",
"0.71621734",
"0.71460694",
"0.71460694"
] |
0.0
|
-1
|
Convert Ruby value to Savon data.
|
def map_to_savon(mapping_name, value)
mapping = all_type_mappings[mapping_name]
mapping = SavonHelper.define_missing_type_mapping(self.class, mapping_name, value, type_mappings, interface) if mapping.nil?
return nil if value.nil?
mapping.to_savon(value)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_data value\n if @to_data.nil?\n raise NoMethodError, \"#to_data not defined\"\n end\n \n @to_data.call value\n end",
"def cast(value)\n value\n end",
"def convert(value) value end",
"def serialize(value)\n value\n end",
"def cast_value(value)\n value\n end",
"def convert_value(value)\n value\n end",
"def deserialize(value)\n cast(value)\n end",
"def serialize(value)\n value\n end",
"def serialize(value)\n value\n end",
"def serialize(value)\n Serializer.parse(value)\n end",
"def serialize_value(value)\r\n value\r\n end",
"def serialize_value(value)\n value\n end",
"def cast_value(value) # :doc:\n value\n end",
"def serialize_value(value)\n value\n 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 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 cast_value(value) # :api: public\n value\n end",
"def deserialize(value)\n value\n end",
"def deserialize_value(value)\r\n value\r\n end",
"def convert_to_ruby(val)\n @to_ruby.call(val)\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 typecast(value)\n value\n end",
"def value_from_s(value)\n @value_proc.call(value)\n end",
"def convert_from_ruby(val)\n @from_ruby.call(val)\n end",
"def serialize(val)\n val.to_s\n end",
"def serialize(val)\n val.to_s\n end",
"def serialize(value)\n value.to_s\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 data_string\n Data.serialize(data)\n end",
"def string\n Util.from_bytes :string, value\n end",
"def to_data\n to_s\n end",
"def unserialize_value(value)\n value\n end",
"def serialize_value(value)\n [value.to_i].pack('N')\n end",
"def datavalue(value)\n merge(datavalue: value.to_s)\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 serialize(value)\n Marshal.dump(value)\n end",
"def serialize(value)\n Marshal.dump(value)\n end",
"def typecast(value)\n value\n end",
"def cast_value\n value.mongoize\n end",
"def serialize(value)\n begin\n [::Marshal.dump(value)].pack('m')\n rescue\n if options[:display_warnings] === true\n Ramaze::Log::warn(\"Failed to serialize #{value.inspect}\")\n end\n\n return nil\n end\n end",
"def serialize(value)\n begin\n [::Marshal.dump(value)].pack('m')\n rescue\n if options[:display_warnings] === true\n Ramaze::Log::warn(\"Failed to serialize #{value.inspect}\")\n end\n\n return nil\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 convert_data(v, opts = {})\n v.is_a?(BSON::Binary) ? v : BSON::Binary.new(to_hex(v['$hex'], opts), :generic)\n end",
"def as(value)\n @value = 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 typecast_value_blob(value)\n value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)\n end",
"def to_primitive\n data\n end",
"def value\n @casted_value ||= type_cast_value(@value)\n end",
"def value\n Native(val)\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 value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\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 convert_value(value)\n value.to_s\n end",
"def json_value\n [Base64.strict_encode64(value)]\n end",
"def getvalue\n dt = @datatype || String\n case dt.to_s\n when \"String\"\n return @buffer\n when \"Integer\"\n return @buffer.to_i\n when \"Float\"\n return @buffer.to_f\n else\n return @buffer.to_s\n end\n end",
"def getvalue\n dt = @datatype || String\n case dt.to_s\n when \"String\"\n return @buffer\n when \"Integer\"\n return @buffer.to_i\n when \"Float\"\n return @buffer.to_f\n else\n return @buffer.to_s\n end\n end",
"def value\n to_type(@value)\n end",
"def serialize_val(value)\n case value\n when ARRAY_RXP\n value.split(/\\s*,\\s*/).map(&method(:serialize_val))\n when /\\A(true|t|yes|y)\\z/i\n true\n when /\\A(false|f|no|n)\\z/i\n false\n when /\\A(nil|null)\\z/i\n nil\n when /\\A\\d+\\z/\n value.to_i\n when /\\A\\d*\\.\\d+\\z/\n value.to_f\n when /\\A['\"].*['\"]\\z/\n value.gsub(/(\\A['\"]|['\"]\\z)/, '')\n else\n value\n end\n end",
"def to_vapi(value)\n #VAPI::Data::OpaqueValue.new(value)\n end",
"def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n 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 coerce(value)\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n value\n end",
"def to_soap_value\n return to_s unless respond_to? :to_datetime\n to_datetime.to_soap_value\n end",
"def serialize(value)\n return if value.nil?\n undashed_uuid = strip_dashes(value)\n\n # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord\n # does not explicity escape the Binary data type. escaping is implicit as\n # the Binary data type always converts its value to a hex string.\n unless valid_undashed_uuid?(undashed_uuid)\n raise MySQLBinUUID::InvalidUUID, \"#{value} is not a valid UUID\"\n end\n\n Data.new(undashed_uuid)\n end",
"def encode_value(value)\n case value\n when Time\n value.to_i\n else\n value\n end\n end",
"def convert_to_object_value(dynamo_value); dynamo_value; end",
"def serialize_value(value)\n case value\n when RDF::Literal\n {'value' => value.to_s}.\n merge(value.has_datatype? ? {'type' => value.datatype.to_s} : {}).\n merge(value.has_language? ? {'language' => value.language.to_s} : {})\n when RDF::Resource\n value.to_s\n when String\n {'value' => value}\n else value.to_h\n end\n end",
"def data=(data)\n @data = data.to_s\n end",
"def byte\n Util.from_bytes :byte, value\n end",
"def value_coercion(value); end",
"def serialize(type, value)\n if type.respond_to?(:serialize)\n type.serialize(value)\n else\n type.type_cast_for_database(value)\n end\n end",
"def to_s\n @value.dup.force_encoding(Encoding.default_external)\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 serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end",
"def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end",
"def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end",
"def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end",
"def write(value)\n record.send(\"#{name}_data=\", value)\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 typecast_value_string(value)\n value.to_s\n end",
"def to_text\n Vpim.decode_text(value)\n end",
"def raw_value\n to_s\n end",
"def cast(value, type)\n case type\n when :string\n value\n when :integer\n value.to_i\n when :float\n value.to_f\n when :percent\n value.to_f\n when :currency\n BigDecimal(value)\n when :time\n value.to_i\n when :date\n parse_date(value)\n end\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 serialized\n @value\n end",
"def value\n return @value unless @value.nil?\n @value = string.data\n @value\n end",
"def value\n data.value\n end",
"def to_soap_value!\n self\n end",
"def to_ruby\n \"#{ruby_name} = #{converted_value}\"\n end",
"def deserialize_value(column, value)\n value\n end",
"def __convert_data(data, mode = nil)\n if mode != :converted\n JsonRpcObjects::Utils::Hash.keys_to_sym(data)\n else\n data\n end\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 type_cast(value)\n case type\n when 'N' # number\n unpack_number(value)\n when 'I' # integer\n unpack_unsigned_long(value)\n when 'F' # float\n unpack_float(value)\n when 'D' # date\n decode_date(value)\n when 'T' # datetime\n decode_datetime(value)\n when 'L' # logical\n boolean(value)\n else\n value.to_s.strip\n end\n end",
"def format_value_to_string(value)\n value.dump\n end",
"def cast(value)\n cast_value(value) unless value.nil?\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 binary_value=( data )\n\t\t# self.log.debug \"Setting cookie value to base64ed %p\" % [ data ]\n\t\tself.value = [ data ].pack( 'm' ).strip\n\tend",
"def to_s\n data\n end",
"def encode(value)\n raise_on_circular_reference(value) do\n value.send(:to_json)\n end\n end",
"def value=(value)\n @value = Data.coerce_value(value, String, :to_s)\n end"
] |
[
"0.6590039",
"0.6489713",
"0.6469867",
"0.640474",
"0.63925123",
"0.63593477",
"0.6341933",
"0.63269156",
"0.6316254",
"0.6297326",
"0.6297224",
"0.6290264",
"0.62819254",
"0.62817353",
"0.627693",
"0.6225975",
"0.6225975",
"0.6169046",
"0.61522967",
"0.61186796",
"0.6052665",
"0.6027229",
"0.5996457",
"0.59912264",
"0.5979245",
"0.59751546",
"0.59751546",
"0.5972344",
"0.5937521",
"0.5927619",
"0.5924341",
"0.59210217",
"0.59163785",
"0.5914219",
"0.59127504",
"0.5863586",
"0.5837536",
"0.5837536",
"0.5824535",
"0.5775653",
"0.5758267",
"0.5758267",
"0.57501423",
"0.5734259",
"0.57119673",
"0.5710669",
"0.56666875",
"0.56456476",
"0.5642106",
"0.56392366",
"0.5621894",
"0.5611552",
"0.5608617",
"0.5607736",
"0.56026137",
"0.55961895",
"0.55961895",
"0.5592507",
"0.5590499",
"0.55869514",
"0.5529578",
"0.55283237",
"0.5512782",
"0.55017555",
"0.55011684",
"0.5492368",
"0.54803103",
"0.547814",
"0.5475762",
"0.5463175",
"0.5453082",
"0.54505384",
"0.54458356",
"0.544515",
"0.54385006",
"0.54385006",
"0.54385006",
"0.54385006",
"0.5433361",
"0.5425586",
"0.54225934",
"0.54158765",
"0.541474",
"0.54130846",
"0.53980875",
"0.5394771",
"0.538697",
"0.5384655",
"0.5384226",
"0.5374443",
"0.5363178",
"0.53548336",
"0.5350025",
"0.5339051",
"0.53385156",
"0.5330302",
"0.53187996",
"0.531527",
"0.5315239",
"0.5309939",
"0.5309384"
] |
0.0
|
-1
|
GET /client_profiles GET /client_profiles.json
|
def index
@client_profiles = ClientProfile.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end",
"def set_client_profile\n @client_profile = ClientProfile.find(params[:id])\n end",
"def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end",
"def create\n @client_profile = ClientProfile.new(client_profile_params)\n\n respond_to do |format|\n if @client_profile.save\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profiles\n collection(\"profiles\", paged: true)\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def show\n @stripe_client_id = ENV['CLIENT_ID']\n respond_with(@profile)\n end",
"def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def profiles(fields: nil)\n params = build_fields_params fields\n res = @connection.get profile_path, params\n map_as_collection res, Profile\n end",
"def create\n @client_profile = current_client.build_client_profile(client_profile_params)\n\n authorize @client_profile\n\n respond_to do |format|\n if @client_profile.save\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully created.' }\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.html { render :new, layout: 'public'}\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end",
"def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end",
"def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end",
"def show_cidprofile_full\n puts 'got signed request from an OAuth consumer:'\n pp current_token\n pp current_client_application\n \n @profile = Profile.find_by_cid(params[:cid])\n puts 'found profile by cid=' + params[:cid]\n \n puts 'Showing all profile info:'\n pp @profile\n respond_to do |format|\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end \n \n end",
"def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def client_profile_params\n params.require(:client_profile).permit(:client_id, :name, :bio)\n end",
"def pull_profiles\n \tprofiles_from_api = self.client.profiles\n\t\tprofiles_array = []\n\t\tprofiles_from_api.each do |p|\n\t\t\tif p.service == \"twitter\"\n\t\t\t\tprofiles_array << p\n\t\t\tend\n\t\tend\n\t\tprofiles_array\n end",
"def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end",
"def show\n @profiles = @grab.profiles\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end",
"def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end",
"def show\n authorize @client_profile\n end",
"def get_profile_ids()\n @type = Type::CIM_GET_PROFILE_IDS\n make_request\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def index\n @profiles = current_user\n end",
"def get_profile(session, user_id)\n $client.authorization.update_token!(session[:token].to_hash)\n plus = $client.discovered_api('plus')\n\n Rails.logger.debug \"TokenPair: #{$client.authorization.to_yaml}\"\n result = $client.execute(\n :api_method => plus.people.get,\n :parameters => {'userId' => user_id})\n\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n Rails.logger.debug \"GoogleClient: NM #{result.data['displayName']}\"\n Rails.logger.debug \"GoogleClient: IM #{result.data['image']['url']}\"\n Rails.logger.debug \"GoogleClient: PR #{result.data['url']}\"\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n\n @profile = Hash.new\n @profile[:name] = result.data['displayName']\n @profile[:profile_url] = result.data['url']\n\n # Avatar sizes\n @profile[:img_url] = result.data['image']['url']\n @profile[:img_url].gsub!(/sz=\\d+$/, \"\")\n\n @profile[:img_thumb_url] = @profile[:img_url] + 'sz=100'\n @profile[:img_tiny_url] = @profile[:img_url] + 'sz=32'\n @profile[:img_badge_url] = @profile[:img_url] + 'sz=15'\n\n return @profile\n end",
"def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def profiles; end",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def profile; Profile.get(self.profile_id); end",
"def profile_url\n \"#{Steam::API::COMMUNITY_URL}/profiles/#{steam_id}\"\n end",
"def cap_ids\n CAP_CLIENT.profile_ids\nend",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def profile\n p @user.as_json\n render json: @user.as_json\n end",
"def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end",
"def profile\n _uuid = uuid.gsub(/-/, '')\n url = \"https://sessionserver.mojang.com/session/minecraft/profile/#{_uuid}\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier])\n\n #Take the provisioning profile name into account\n #if Sigh.config[:provisioning_name].to_s.length > 0\n #filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }\n #if Sigh.config[:ignore_profiles_with_different_name]\n #results = filtered\n #else\n #results = filtered if (filtered || []).count > 0\n #end\n #end\n\n if results \n return [results]\n else\n return []\n end\n \n\n\n #return results if Sigh.config[:skip_certificate_verification]\n\n #return results.find_all do |a|\n ## Also make sure we have the certificate installed on the local machine\n #installed = false\n #a.certificates.each do |cert|\n #file = Tempfile.new('cert')\n #file.write(cert.download_raw)\n #file.close\n #installed = true if FastlaneCore::CertChecker.installed?(file.path)\n #end\n #installed\n #end\n end",
"def list_arrays_assigned_to_profile(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/arrays\", args)\nend",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def load_profiles()\n # read profiles\n puts \"Loading configs from #{@server_host}:#{@server_port}\" # Rails.logger.info\n\n res = Net::HTTP.start(@server_host, @server_port) {|http|\n http.open_timeout = 5\n http.read_timeout = 10\n http.get('/api/profiles')\n }\n raise \"HTTP status is not succeeded\" if res.code != '200'\n\n profiles_arr = JSON.parse(res.body)\n @table = ProfileTable.new(profiles_arr)\n end",
"def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def all_profiles(property_hash)\n profiles = []\n\n client = property_hash[:protocol_profile_client] || property_hash[:protocol_profile_server]\n server = property_hash[:protocol_profile_server] || property_hash[:protocol_profile_client]\n if !client.nil?\n if client == server\n profiles << { :profile_name => client,\n :profile_type => nil,\n :profile_context => \"PROFILE_CONTEXT_TYPE_ALL\" }\n else\n profiles << { :profile_name => client,\n :profile_type => nil,\n :profile_context => \"PROFILE_CONTEXT_TYPE_CLIENT\" }\n profiles << { :profile_name => server,\n :profile_type => nil,\n :profile_context => \"PROFILE_CONTEXT_TYPE_SERVER\" }\n end\n end\n\n (profile_properties - [:protocol_profile_client,\n :protocol_profile_server]).each do |propertyname|\n property_hash[propertyname].nil? && next\n type, context = /^([^_]+)_PROFILES?_?([^_]+)?$/.match(\n propertyname.upcase).captures\n context = context || \"ALL\"\n\n typemap = {\n 'SIP' => 'SIPP',\n 'ONECONNECT' => 'CONNECTION_POOL'\n }\n type = typemap[type] || type\n\n profile_type = context == \"ALL\" ?\n \"PROFILE_TYPE_#{type}\" :\n \"PROFILE_TYPE_#{context}_#{type}\"\n profile_context = \"PROFILE_CONTEXT_TYPE_#{context}\"\n arraywrap(property_hash[propertyname]).each do |profile_name|\n profiles << { profile_name: profile_name,\n profile_type: profile_type,\n profile_context: profile_context }\n end\n end\n profiles\n end",
"def profile(profile_id, fields: nil)\n check_not_empty profile_id, 'profile_id'\n params = build_fields_params fields\n res = @connection.get profile_path(profile_id), params\n Profile.new res.body, self\n end",
"def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end",
"def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end",
"def profile(id, region, name)\r\n BnetApi.make_request(\"/sc2/profile/#{id}/#{region}/#{name}/\")\r\n end",
"def profile_url\n @json['profile']['url'] rescue nil\n end",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end",
"def show\n @profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n @comments = Comment.where( :user_id => @user.id).take(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { respond_with_bip(@profile) }\n end\n end",
"def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_v2_profiles_get_profiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomizationApi.api_v2_profiles_get_profiles_get ...'\n end\n # resource path\n local_var_path = '/api/v2/profiles/GetProfiles'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'RequestedClientId'] = opts[:'requested_client_id'] if !opts[:'requested_client_id'].nil?\n query_params[:'RequestedProfileId'] = opts[:'requested_profile_id'] if !opts[:'requested_profile_id'].nil?\n query_params[:'ItemType'] = opts[:'item_type'] if !opts[:'item_type'].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(['text/plain', 'application/json', 'text/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] || 'TaxCalculationSettingsResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic']\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: CustomizationApi#api_v2_profiles_get_profiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def show\n\t\t# begin\n\t\t\tprofile = Profile.find(params[:id])\n\t @conversation = current_profile.find_conversation(profile)\n\t respond_to do |format|\n\t format.html {render \"profiles/#{profile._type.underscore}_show\"}\n\t format.json { render :json => @profile }\n\t end\n\t\t# rescue => error\n\t\t# \trender \"profiles/not_found\"\n\t\t# \tputs error.message\n\t\t# end\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end",
"def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def profile(token, secret)\n self.access_token = self.get_access_token(token, secret)\n req = self.access_token.request(:get, PAL_EPNTS['profile_url']+PAL_EPNTS['profile_fields'],{'x-li-format' => 'json','Content-Type'=>'application/json'})\n req.body\n end",
"def index\n @seeker_profiles = SeekerProfile.all\n end",
"def my_profile\n render json: { user: current_user}\n end",
"def get_profile\n self.class.get '/members/private', @options\n end",
"def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end"
] |
[
"0.7066529",
"0.7010263",
"0.6964071",
"0.6911514",
"0.6817861",
"0.6725345",
"0.6717022",
"0.6716054",
"0.6711716",
"0.6673309",
"0.66695815",
"0.6627569",
"0.6627569",
"0.6571033",
"0.6540882",
"0.6501271",
"0.6496163",
"0.6483836",
"0.6454368",
"0.64317626",
"0.6431076",
"0.64093435",
"0.63927627",
"0.6344406",
"0.6342277",
"0.6342132",
"0.63005966",
"0.62914723",
"0.62902397",
"0.62782866",
"0.6261715",
"0.6261626",
"0.62579185",
"0.62521344",
"0.6249925",
"0.62424845",
"0.6230937",
"0.62184405",
"0.6180846",
"0.616797",
"0.6165076",
"0.6157517",
"0.6155093",
"0.61367166",
"0.6136614",
"0.6106152",
"0.610421",
"0.60995793",
"0.60995793",
"0.60920036",
"0.60678536",
"0.60534394",
"0.60400623",
"0.60373646",
"0.60227334",
"0.60216683",
"0.6019126",
"0.60186887",
"0.5989357",
"0.5989357",
"0.5989357",
"0.5987437",
"0.59860355",
"0.5984444",
"0.59820074",
"0.5980447",
"0.5972613",
"0.59610754",
"0.59522086",
"0.59513247",
"0.5946377",
"0.5931839",
"0.5931037",
"0.592347",
"0.5917676",
"0.5910783",
"0.5906371",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.59029335",
"0.5896814",
"0.5887457",
"0.58753943",
"0.58740985",
"0.5872366",
"0.58675945",
"0.5865717"
] |
0.7600032
|
0
|
GET /client_profiles/1 GET /client_profiles/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @client_profiles = ClientProfile.all\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end",
"def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end",
"def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end",
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def set_client_profile\n @client_profile = ClientProfile.find(params[:id])\n end",
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def show\n @stripe_client_id = ENV['CLIENT_ID']\n respond_with(@profile)\n end",
"def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end",
"def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end",
"def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end",
"def create\n @client_profile = ClientProfile.new(client_profile_params)\n\n respond_to do |format|\n if @client_profile.save\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end",
"def profile; Profile.get(self.profile_id); end",
"def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def show_cidprofile_full\n puts 'got signed request from an OAuth consumer:'\n pp current_token\n pp current_client_application\n \n @profile = Profile.find_by_cid(params[:cid])\n puts 'found profile by cid=' + params[:cid]\n \n puts 'Showing all profile info:'\n pp @profile\n respond_to do |format|\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end \n \n end",
"def create\n @client_profile = current_client.build_client_profile(client_profile_params)\n\n authorize @client_profile\n\n respond_to do |format|\n if @client_profile.save\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully created.' }\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.html { render :new, layout: 'public'}\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end",
"def profiles\n collection(\"profiles\", paged: true)\n end",
"def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def get_profile(session, user_id)\n $client.authorization.update_token!(session[:token].to_hash)\n plus = $client.discovered_api('plus')\n\n Rails.logger.debug \"TokenPair: #{$client.authorization.to_yaml}\"\n result = $client.execute(\n :api_method => plus.people.get,\n :parameters => {'userId' => user_id})\n\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n Rails.logger.debug \"GoogleClient: NM #{result.data['displayName']}\"\n Rails.logger.debug \"GoogleClient: IM #{result.data['image']['url']}\"\n Rails.logger.debug \"GoogleClient: PR #{result.data['url']}\"\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n\n @profile = Hash.new\n @profile[:name] = result.data['displayName']\n @profile[:profile_url] = result.data['url']\n\n # Avatar sizes\n @profile[:img_url] = result.data['image']['url']\n @profile[:img_url].gsub!(/sz=\\d+$/, \"\")\n\n @profile[:img_thumb_url] = @profile[:img_url] + 'sz=100'\n @profile[:img_tiny_url] = @profile[:img_url] + 'sz=32'\n @profile[:img_badge_url] = @profile[:img_url] + 'sz=15'\n\n return @profile\n end",
"def profile\n _uuid = uuid.gsub(/-/, '')\n url = \"https://sessionserver.mojang.com/session/minecraft/profile/#{_uuid}\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end",
"def show\n @profiles = @grab.profiles\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end",
"def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end",
"def profile\n p @user.as_json\n render json: @user.as_json\n end",
"def pull_profiles\n \tprofiles_from_api = self.client.profiles\n\t\tprofiles_array = []\n\t\tprofiles_from_api.each do |p|\n\t\t\tif p.service == \"twitter\"\n\t\t\t\tprofiles_array << p\n\t\t\tend\n\t\tend\n\t\tprofiles_array\n end",
"def show\n\t\t# begin\n\t\t\tprofile = Profile.find(params[:id])\n\t @conversation = current_profile.find_conversation(profile)\n\t respond_to do |format|\n\t format.html {render \"profiles/#{profile._type.underscore}_show\"}\n\t format.json { render :json => @profile }\n\t end\n\t\t# rescue => error\n\t\t# \trender \"profiles/not_found\"\n\t\t# \tputs error.message\n\t\t# end\n end",
"def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def index\n @profiles = current_user\n end",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def profile_url\n \"#{Steam::API::COMMUNITY_URL}/profiles/#{steam_id}\"\n end",
"def profile(profile_id, fields: nil)\n check_not_empty profile_id, 'profile_id'\n params = build_fields_params fields\n res = @connection.get profile_path(profile_id), params\n Profile.new res.body, self\n end",
"def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end",
"def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end",
"def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def profile_url\n @json['profile']['url'] rescue nil\n end",
"def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def profile(id, region, name)\r\n BnetApi.make_request(\"/sc2/profile/#{id}/#{region}/#{name}/\")\r\n end",
"def current_profile\n @profile ||= JSON.parse($redis.get(\"profile\"))\n end",
"def show\n authorize @client_profile\n end",
"def profiles(fields: nil)\n params = build_fields_params fields\n res = @connection.get profile_path, params\n map_as_collection res, Profile\n end",
"def api_v2_profiles_get_profiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomizationApi.api_v2_profiles_get_profiles_get ...'\n end\n # resource path\n local_var_path = '/api/v2/profiles/GetProfiles'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'RequestedClientId'] = opts[:'requested_client_id'] if !opts[:'requested_client_id'].nil?\n query_params[:'RequestedProfileId'] = opts[:'requested_profile_id'] if !opts[:'requested_profile_id'].nil?\n query_params[:'ItemType'] = opts[:'item_type'] if !opts[:'item_type'].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(['text/plain', 'application/json', 'text/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] || 'TaxCalculationSettingsResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic']\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: CustomizationApi#api_v2_profiles_get_profiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def client_profile_params\n params.require(:client_profile).permit(:client_id, :name, :bio)\n end",
"def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end",
"def get_profile_ids()\n @type = Type::CIM_GET_PROFILE_IDS\n make_request\n end",
"def show\n @profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n @comments = Comment.where( :user_id => @user.id).take(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { respond_with_bip(@profile) }\n end\n end",
"def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end",
"def get_profile(profile_id)\n @type = Type::CIM_GET_PROFILE\n handle_profile_id(profile_id)\n make_request\n end",
"def show_current\n user = current_user\n profile = Profile.find_by user_id: user.id\n\n render json: profile\n end",
"def profiles; end",
"def my_profile\n render json: { user: current_user}\n end",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def get_profile\n self.class.get '/members/private', @options\n end",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier])\n\n #Take the provisioning profile name into account\n #if Sigh.config[:provisioning_name].to_s.length > 0\n #filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }\n #if Sigh.config[:ignore_profiles_with_different_name]\n #results = filtered\n #else\n #results = filtered if (filtered || []).count > 0\n #end\n #end\n\n if results \n return [results]\n else\n return []\n end\n \n\n\n #return results if Sigh.config[:skip_certificate_verification]\n\n #return results.find_all do |a|\n ## Also make sure we have the certificate installed on the local machine\n #installed = false\n #a.certificates.each do |cert|\n #file = Tempfile.new('cert')\n #file.write(cert.download_raw)\n #file.close\n #installed = true if FastlaneCore::CertChecker.installed?(file.path)\n #end\n #installed\n #end\n end",
"def profile(username)\n Person.profile(username, @api_key, @https)\n end",
"def getProfile\n account = current_user.account\n if account.nil?\n render status: 400, json: {error: \"Invalid User\"}\n else\n if current_user.registered && (account.referral_code.nil? || account.referral_code.blank?)\n account.generate_referral_code\n end\n render status: 200, json: {username: current_user.username,\n email: current_user.email,\n firstName: current_user.first_name,\n lastName: current_user.last_name,\n company: current_user.company,\n balance: account.balance,\n registered: current_user.registered,\n referralCode: account.referral_code}\n end\n end",
"def profile\n if object = send(:\"current_#{resource_name}\")\n self.resource = resource_class.to_adapter.get!(object.to_key)\n respond_with self.resource\n else\n render json: '', status: 404\n end\n end",
"def load_profiles()\n # read profiles\n puts \"Loading configs from #{@server_host}:#{@server_port}\" # Rails.logger.info\n\n res = Net::HTTP.start(@server_host, @server_port) {|http|\n http.open_timeout = 5\n http.read_timeout = 10\n http.get('/api/profiles')\n }\n raise \"HTTP status is not succeeded\" if res.code != '200'\n\n profiles_arr = JSON.parse(res.body)\n @table = ProfileTable.new(profiles_arr)\n end",
"def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end",
"def cap_ids\n CAP_CLIENT.profile_ids\nend",
"def all_profiles(property_hash)\n profiles = []\n\n client = property_hash[:protocol_profile_client] || property_hash[:protocol_profile_server]\n server = property_hash[:protocol_profile_server] || property_hash[:protocol_profile_client]\n if !client.nil?\n if client == server\n profiles << { :profile_name => client,\n :profile_type => nil,\n :profile_context => \"PROFILE_CONTEXT_TYPE_ALL\" }\n else\n profiles << { :profile_name => client,\n :profile_type => nil,\n :profile_context => \"PROFILE_CONTEXT_TYPE_CLIENT\" }\n profiles << { :profile_name => server,\n :profile_type => nil,\n :profile_context => \"PROFILE_CONTEXT_TYPE_SERVER\" }\n end\n end\n\n (profile_properties - [:protocol_profile_client,\n :protocol_profile_server]).each do |propertyname|\n property_hash[propertyname].nil? && next\n type, context = /^([^_]+)_PROFILES?_?([^_]+)?$/.match(\n propertyname.upcase).captures\n context = context || \"ALL\"\n\n typemap = {\n 'SIP' => 'SIPP',\n 'ONECONNECT' => 'CONNECTION_POOL'\n }\n type = typemap[type] || type\n\n profile_type = context == \"ALL\" ?\n \"PROFILE_TYPE_#{type}\" :\n \"PROFILE_TYPE_#{context}_#{type}\"\n profile_context = \"PROFILE_CONTEXT_TYPE_#{context}\"\n arraywrap(property_hash[propertyname]).each do |profile_name|\n profiles << { profile_name: profile_name,\n profile_type: profile_type,\n profile_context: profile_context }\n end\n end\n profiles\n end",
"def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end",
"def get_profile(connector, id, options={})\n brief = options.delete :brief || false\n json = connector.prepare_and_invoke_api_call(\n \"profiles/v1/providers/#{id}\" + (brief ? \"/brief\" : \"\"), :method=>:get)\n return self.new(json['profile'])\n end",
"def profile(token, secret)\n self.access_token = self.get_access_token(token, secret)\n req = self.access_token.request(:get, PAL_EPNTS['profile_url']+PAL_EPNTS['profile_fields'],{'x-li-format' => 'json','Content-Type'=>'application/json'})\n req.body\n end",
"def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_profile }\n end\n end",
"def list_arrays_assigned_to_profile(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/arrays\", args)\nend",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def get_network_sm_profiles(network_id)\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => network_id\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/profiles'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => network_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end"
] |
[
"0.7329758",
"0.725613",
"0.6942355",
"0.69291705",
"0.69083637",
"0.6888077",
"0.6789355",
"0.6789012",
"0.67808217",
"0.6777584",
"0.6694707",
"0.6658725",
"0.6655892",
"0.66370904",
"0.6620087",
"0.6604809",
"0.66047746",
"0.66033864",
"0.66033864",
"0.65950316",
"0.657737",
"0.6565152",
"0.65544087",
"0.6522968",
"0.6487446",
"0.647592",
"0.6453453",
"0.6448595",
"0.64084035",
"0.640025",
"0.6381282",
"0.6381282",
"0.63653374",
"0.6352339",
"0.635052",
"0.6312634",
"0.6303088",
"0.62810946",
"0.6273102",
"0.6265595",
"0.6263191",
"0.62453437",
"0.62453437",
"0.62453437",
"0.62445354",
"0.6234844",
"0.6228999",
"0.62258387",
"0.6219627",
"0.62084484",
"0.6195408",
"0.6194206",
"0.6190957",
"0.6171135",
"0.6169012",
"0.6153774",
"0.61423385",
"0.6137364",
"0.6137364",
"0.6135658",
"0.61252326",
"0.6113235",
"0.6111407",
"0.6109456",
"0.6099401",
"0.6089241",
"0.608406",
"0.6082872",
"0.6078742",
"0.6069415",
"0.6063148",
"0.6057459",
"0.6055142",
"0.6047103",
"0.6031959",
"0.6028542",
"0.6027282",
"0.601521",
"0.6013322",
"0.6008743",
"0.60058033",
"0.60000855",
"0.59895766",
"0.59891474",
"0.59739155",
"0.5970255",
"0.5964109",
"0.5961778",
"0.5950272",
"0.5932279",
"0.5930055",
"0.59280014",
"0.59240603",
"0.5922889",
"0.5921574",
"0.5916159",
"0.5916159",
"0.5916159",
"0.5916159",
"0.5916159",
"0.5916159"
] |
0.0
|
-1
|
POST /client_profiles POST /client_profiles.json
|
def create
@client_profile = ClientProfile.new(client_profile_params)
respond_to do |format|
if @client_profile.save
format.json { render :show, status: :created, location: @client_profile }
else
format.json { render json: @client_profile.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @client_profile = current_client.build_client_profile(client_profile_params)\n\n authorize @client_profile\n\n respond_to do |format|\n if @client_profile.save\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully created.' }\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.html { render :new, layout: 'public'}\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def client_profile_params\n params.require(:client_profile).permit(:client_id, :name, :bio)\n end",
"def set_client_profile\n @client_profile = ClientProfile.find(params[:id])\n end",
"def index\n @client_profiles = ClientProfile.all\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end",
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def client_profile_params\n params.require(:client_profile).permit(:image, :sex, :birth_date, :address, :city, :zip_code, :civil_status, :mobile, :telephone, :company, :department, :employee_category, :job_title, :manager, :enabled)\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n if @profile.save\n begin\n response_bank = Pagarme::CreateBankAccountService.new(profile: @profile).call\n rescue\n return redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n if response_bank.id.present?\n @profile.update(bank_id: response_bank.id)\n response_recipient = Pagarme::CreateRecipientService.new(profile: @profile).call\n if response_recipient.id.present?\n @profile.update(recipient_id: response_recipient.id)\n return redirect_to edit_client_profile_path(@profile), notice: 'Perfil salvo com sucesso.'\n end\n end\n redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.' \n else\n redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def create\n # TO DO: make this for just generic creation.\n @profile = Profile.find_by_email(params[:profile][:email])\n @profile.user_id = current_user.id\n\n if @profile.nil?\n @profile = Profile.new(params[:profile])\n add_to_list_niche(params[:profile][:fname], params[:profile][:email], params[:profile][:niche], list_id=ENV[\"MAILCHIMP_LISTID\"])\n @profile.save\n else\n @profile.update_attributes(params[:profile])\n end\n\n redirect_to profiles_path, notice: 'Profile was successfully created.' \n # format.json { render json: @profile, status: :created, location: @profile }\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.my_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end",
"def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend",
"def create\n @prof_inspection = ProfInspection.new(params[:prof_inspection])\n @prof_inspection.client=@client\n\n respond_to do |format|\n if @prof_inspection.save\n format.html { redirect_to client_prof_inspections_path(@client), notice: I18n.t(:record_created)}\n format.json { render json: @prof_inspection, status: :created, location: @prof_inspection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prof_inspection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n \n respond_to do |format|\n if @profile.save\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create!(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cleaners_profile = Cleaners::Profile.new(cleaners_profile_params)\n\n respond_to do |format|\n if @cleaners_profile.save\n format.html { redirect_to after_signup_path(:preference) }\n format.json { render action: 'show', status: :created, location: @cleaners_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_profile_with_http_info(sbp_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#create_profile ...\"\n end\n \n # verify the required parameter 'sbp_profile' is set\n fail \"Missing the required parameter 'sbp_profile' when calling create_profile\" if sbp_profile.nil?\n \n # resource path\n path = \"/v1/profile/create\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\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(sbp_profile)\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 => 'SbpProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#create_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @representative_profile = RepresentativeProfile.new(representative_profile_params)\n\n respond_to do |format|\n if @representative_profile.save\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully created.' }\n format.json { render :show, status: :created, location: @representative_profile }\n else\n format.html { render :new }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.site_identifier = params[:profile][:site_identifier]\n\n respond_to do |format|\n if @profile.save\n# current_user.default_profile = @profile\n set_banner\n format.html do\n redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: profile_home_path(@profile.site_identifier) }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n if params['internal_setting_ids'].present?\n params['internal_setting_ids'].each do |internal_setting_id|\n @profile_internal_setting = @profile.profile_internal_settings.build(:internal_setting_id => internal_setting_id)\n @profile_internal_setting.save\n end \n end\n\n if params['email_access_ids'].present?\n params['email_access_ids'].each do |email_access_id|\n @profile_email_access = @profile.profile_email_accesses.build(:email_access_id => email_access_id)\n @profile_email_access.save\n end \n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_profile = Admin::Profile.new(admin_profile_params)\n\n respond_to do |format|\n if @admin_profile.save\n unless params[:admin_profile][:avatar].blank?\n preloaded = Cloudinary::Uploader.upload(params[:admin_profile][:avatar], :use_filename => true, :public_id => \"profiles/#{@admin_profile.id}\")\n end\n\n unless params[:admin_profile][:profile_skills_attributes].blank?\n params[:admin_profile][:profile_skills_attributes].each do |skill|\n admin_skill = Admin::ProfileSkill.create({profile_id: @admin_profile.id, name: skill[1][:name], skill: skill[1][:skill]})\n admin_skill.save\n end\n end\n\n unless params[:admin_profile][:profile_hobbies_attributes].blank?\n params[:admin_profile][:profile_hobbies_attributes].each do |hobby|\n admin_hobby = Admin::ProfileHobby.create({profile_id: @admin_profile.id, name: hobby[1][:name]})\n admin_hobby.save\n end\n end\n\n format.html { redirect_to admin_root_path, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_profile }\n else\n format.html { render action: 'new'}\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@equalizer_profile = current_user.equalizer_profiles.new(params[:equalizer_profile])\n\n\t\trespond_to do |format|\n\t\t\tif @equalizer_profile.save\n\t\t\t\tformat.html { redirect_to(@equalizer_profile, :notice => 'Equalizer profile was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @equalizer_profile, :status => :created, :location => @equalizer_profile }\n\t\t\t\tformat.json { render :json => @equalizer_profile, :status => :created, :location => @equalizer_profile }\n\t\t\t\tformat.yaml { render :text => @equalizer_profile.to_yaml, :content_type => 'text/yaml', :status => :created, :location => @equalizer_profile }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @equalizer_profile.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @equalizer_profile.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.yaml { render :text => @equalizer_profile.errors.to_yaml, :content_type => 'text/yaml', :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @userprofile = Userprofile.new(userprofile_params)\n\n respond_to do |format|\n if @userprofile.save\n format.html { redirect_to @userprofile, notice: 'Userprofile was successfully created.' }\n format.json { render :show, status: :created, location: @userprofile }\n else\n format.html { render :new }\n format.json { render json: @userprofile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n profile = Payments::Profile.new(profile_params)\n profile.user = current_user\n\n respond_to do |format|\n if profile.save\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end",
"def generate_profile(user)\n if user.profile.nil?\n profile_params = { user_id: user.id, name: \"Subscribed User\", bio: \"Coinmitted investor\", language: \"en\", currency: \"USD\", deleted: false, membership: 0 }\n Profile.create(profile_params) if user.profile.nil?\n end\n end",
"def create_profile(profile, options = {})\n options = @@create_profile_option_defaults.merge(options)\n @type = Type::CIM_CREATE_PROFILE\n @fields.merge!(profile.to_hash)\n set_fields(:validation_mode => options[:validation_mode])\n make_request\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n build_identity\n save_identity || render(template: 'profiles/show')\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user=current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner_profile = PartnerProfile.new(partner_profile_params)\n\n respond_to do |format|\n if @partner_profile.save\n format.html { redirect_to @partner_profile, notice: 'Partner profile was successfully created.' }\n format.json { render :show, status: :created, location: @partner_profile }\n else\n format.html { render :new }\n format.json { render json: @partner_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_profile!\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name]\n if !name\n name = Sigh.config[:app_identifier].gsub '.' ,''\n end\n\n UI.important \"Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'\"\n profile = profile_type.create!(name: name,\n bundle_id: bundle_id)\n profile\n end",
"def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend",
"def create\n profile_params=params[:profile]\n avatar_params=params[:profile][:avatar]\n if current_user.chef?\n location_params=params[:profile][:location]\n cover_params=params[:profile][:cover_image_url]\n profile_params.delete(\"location\")\n profile_params.delete(\"cover_image_url\")\n end\n profile_params.delete(\"avatar\")\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n @profile.create_avatar(:image=>avatar_params)\n if current_user.chef?\n @profile.save!\n @profile.covers.create(:image=>cover_params)\n @location = Location.new(location_params)\n @location.save!\n @profile.location_id=@location.id\n end\n @profile.save!\n #render json: @profile.to_json(include_hash)\n if current_user.chef?\n redirect_to new_event_path\n else\n redirect_to events_path\n end\n end",
"def show\n @stripe_client_id = ENV['CLIENT_ID']\n respond_with(@profile)\n end",
"def create_profile\n Profile.create(user_id: self.id)\n end",
"def newprofile\n if params[\"auth_key\"] == nil or params[\"device_id\"] == nil or params[\"profile_url\"] == nil\n render :json => '{\"status\": \"failed\", \"reason\": \"incorrect parameters\"}'\n else\n device = Device.find(params[\"device_id\"])\n if device.auth_key == params[\"auth_key\"]\n device.profile_url = params[\"profile_url\"]\n if device.save\n render :json => '{\"status\": \"success\"}'\n else\n render :json => '{\"status\": \"failed\", \"reason\": \"save error\"}'\n end\n else\n render :json => '{\"status\": \"failed\", \"reason\": \"not authorized\"}'\n end\n end\n end",
"def create\n \t@profile = Profile.new(profile_params)\n\n \trespond_to do |format|\n if @profile.save\n UserMailer.delay.registration_confirmation(@profile)\n format.json { render action: 'show', status: :create, location: @profile }\n else\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @driver_profile = DriverProfile.new(driver_profile_params)\n\n respond_to do |format|\n if @driver_profile.save\n format.html { redirect_to @driver_profile, notice: 'Driver profile was successfully created.' }\n format.json { render :show, status: :created, location: @driver_profile }\n post_request\n else\n flash[:error] = \"#{@driver_profile.errors.full_messages.to_sentence}\"\n format.html { render :new }\n format.json { render json: @driver_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n @profile = current_user.create_profile(params[:profile])\n if @profile \n format.html { redirect_to(profile_url(@profile.user_id), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7382159",
"0.6989375",
"0.6530571",
"0.63997746",
"0.6383759",
"0.6372186",
"0.63159794",
"0.6270599",
"0.622642",
"0.620696",
"0.6149313",
"0.60813195",
"0.6047061",
"0.6032439",
"0.6006447",
"0.6002127",
"0.59745467",
"0.5973002",
"0.596753",
"0.5955531",
"0.59200394",
"0.59190214",
"0.59149307",
"0.586881",
"0.58655196",
"0.58638865",
"0.58638865",
"0.58616346",
"0.58610225",
"0.5858466",
"0.5852778",
"0.5852039",
"0.58425653",
"0.5819609",
"0.58131456",
"0.57801807",
"0.57787085",
"0.577451",
"0.57743",
"0.57719505",
"0.5771845",
"0.5771641",
"0.57656056",
"0.57650936",
"0.57650936",
"0.57650936",
"0.5761554",
"0.5760205",
"0.5760205",
"0.5760205",
"0.5760205",
"0.5760205",
"0.5760205",
"0.5760205",
"0.5759865",
"0.5754386",
"0.5754386",
"0.5754386",
"0.5754386",
"0.5754386",
"0.5754386",
"0.5754386",
"0.5754386",
"0.5752067",
"0.5747581",
"0.57373554",
"0.5734658",
"0.5719693",
"0.57176393",
"0.5715555",
"0.5714007",
"0.57082653",
"0.57076395",
"0.5703967",
"0.5700617",
"0.56858456",
"0.56844586",
"0.56839454",
"0.5680525",
"0.5674123",
"0.56727207",
"0.5671967",
"0.5671967",
"0.5659575",
"0.56572175",
"0.56544256",
"0.56469417",
"0.5623867",
"0.5621076",
"0.5612827",
"0.56112707",
"0.5606158",
"0.5602067",
"0.56001234",
"0.55907005",
"0.55868036",
"0.5578242",
"0.55780363",
"0.55735135",
"0.5566537"
] |
0.75950766
|
0
|
PATCH/PUT /client_profiles/1 PATCH/PUT /client_profiles/1.json
|
def update
respond_to do |format|
if @client_profile.update(client_profile_params)
format.json { render :show, status: :ok, location: @client_profile }
else
format.json { render json: @client_profile.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend",
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile.update(profile_params)\n respond_with(@profile)\n end",
"def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend",
"def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end",
"def set_client_profile\n @client_profile = ClientProfile.find(params[:id])\n end",
"def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend",
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end",
"def update_profile!(caller_id, access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/#{caller_id}/user/{{client_id}}/profile\"\n request[:request_body] = to_hash\n end.execute!\n\n json[:user_guid]\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend",
"def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_profile(params)\n post('/account/update_profile.json', params)\n end",
"def client_profile_params\n params.require(:client_profile).permit(:client_id, :name, :bio)\n end",
"def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end",
"def update\r\n params = profile_params\r\n params.delete(\"id\")\r\n params.delete(\"user\")\r\n respond_to do |format|\r\n if @profile.update(params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile(params)\n post 'account/update_profile', :post => params\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_url, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html do\n redirect_to @profile,\n notice: \"Profile was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n good_change(format, :ok)\n else\n bad_change(format, :edit)\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # byebug\n if @profile.update(profile_params)\n format.html { redirect_to vendor_path(current_user.username), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_customer_profile\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to '/', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @profile.update(profile_params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server_profile = ServerProfile.find(params[:id])\n \n respond_to do |format|\n if @server_profile.update_attributes(params[:server_profile])\n flash[:notice] = 'Server Profile was successfully updated.'\n format.html { redirect_to(@server_profile) }\n format.xml { head :ok }\n format.js { render :partial => 'server_profiles/server_profile', :layout => false }\n\t\t\t\tformat.json { render :json => @server_profile }\n else\n flash[:error] = 'There was a problem updating this Server Profile.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server_profile.errors, :status => :unprocessable_entity }\n format.js { render :partial => 'server_profiles/server_profile', :layout => false }\n\t\t\t\tformat.json { render :json => @server_profile }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climber_profile.update(climber_profile_params)\n format.html { redirect_to @climber_profile, notice: 'Climber profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @climber_profile }\n else\n format.html { render :edit }\n format.json { render json: @climber_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end",
"def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to user_url(@client.id), notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_user_url(@client.id)}\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find_by_user_id(current_user.id)\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n params[:client][:version] = ENV[\"VERSION\"]\r\n params[:client][:username] = current_user.username\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @client.update_attributes(client_params)\r\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @client.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(profile_attributes)\n format.html { redirect_to root_path, notice: 'Анкета успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_profile(profile)\n @type = Type::CIM_UPDATE_PROFILE\n @fields.merge!(profile.to_hash)\n make_request\n end",
"def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @profile.update_attributes(profile_params)\n begin\n response_bank = Pagarme::CreateBankAccountService.new(profile: @profile).call\n rescue\n return redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n if response_bank.id.present?\n @profile.reload.update(bank_id: response_bank.id)\n if @profile.recipient_id.blank?\n response_recipient = Pagarme::CreateRecipientService.new(profile: @profile).call\n else\n response_recipient = Pagarme::UpdateRecipientService.new(profile: @profile).call\n end\n if response_recipient.id.present?\n @profile.reload.update(recipient_id: response_recipient.id)\n return redirect_to edit_client_profile_path(@profile), notice: 'Perfil atualizado com sucesso.'\n end\n end\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n else\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n end\n end",
"def set_client_profile\n\n @client_profile = ClientProfile.find(params[:id])\n\n # if current_admin\n # @client_profile = ClientProfile.find(params[:id])\n\n # else\n # # Client can only edit their own\n # @client_profile = ClientProfile.where(id: params[:id], client: current_client).first\n # # Redirect if @client_profile is nil\n # redirect_to new_client_profile_path, notice: \"Not allowed...\" unless @client_profile\n # end \n end",
"def update\n respond_to do |format|\n if @profile.update_attributes profile_params\n format.html { redirect_to(@profile, notice: 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n @original_profile = Profile.find(@profile.id)\n format.html { render action: \"edit\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client_profile = ClientProfile.new(client_profile_params)\n\n respond_to do |format|\n if @client_profile.save\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n\tif signed_in?\n\t\tif params[:client][:encrypted_password_confirmation].blank?\n\t\t\tparams[:client].delete(\"encrypted_password\")\n\t\t\tparams[:client].delete(\"encrypted_password_confirmation\")\n\t\tend\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@client = Client.find(params[:id])\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile_pick.update(profile_pick_params)\n format.html { redirect_to @profile_pick, notice: 'Profile pick was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_pick }\n else\n format.html { render :edit }\n format.json { render json: @profile_pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_profile\n # login_as(:patrick)\n # put :update, :id => profiles(:profile_00006).id, :profile => { }\n # assert_redirected_to profile_path(assigns(:profile))\n end",
"def update\n if params[:profile][:remove_profile_photo] == \"1\" \n @profile.remove_profile_photo = nil\n @profile.save\n end\n if params[:profile][:remove_cover_photo] == \"1\"\n @profile.remove_cover_photo = nil\n @profile.save\n end\n \n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, :notice => t('alerts.profiles.update') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_client\n\t\t@client = Client.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @client.update_attributes(client_update_params)\n\t\t format.html { redirect_to(@client, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@client) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@client) }\n\t\t end\n\n \t end\n\tend",
"def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end",
"def update\n @client = Client.find(params[:id])\n authorize! :update, @client\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to @client, :notice => 'Client was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n succeess_redirect_path = URI(request.referer).path.gsub 'edit', ''\n if @client.update(client_params)\n format.html { redirect_to succeess_redirect_path, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { redirect_to URI(request.referer).path }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: params[:fname],\r\n\t\t\tlname: params[:lname],\r\n\t\t\tgender: params[:gender],\r\n\t\t\tbio: params[:bio],\r\n\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\tbdate: params[:bdate]\r\n\t\t}\r\n\t\terrors = Api::Init.MembersControl.checkProfileParams(dataHash)\r\n\t\tif errors.count != 0 \r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['profile_errors'],I18n.t(\"errors.messages.users.profile_errors\"), errors).to_json\r\n else\r\n \tuserProfileObject = UsersProfile.byUser(params[:user].id).first\r\n userProfileObject.updateProfile(dataHash)\t\r\n self.default_response\r\n end\r\n\tend",
"def update\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 :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, 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"
] |
[
"0.72260207",
"0.6723318",
"0.657502",
"0.64624083",
"0.64601666",
"0.64480466",
"0.64459664",
"0.63586",
"0.6346588",
"0.6324564",
"0.6291774",
"0.62917554",
"0.6271877",
"0.6262125",
"0.6254571",
"0.6247829",
"0.6238143",
"0.62135655",
"0.6201705",
"0.6189819",
"0.6189684",
"0.618487",
"0.6180944",
"0.6177635",
"0.6176654",
"0.61697096",
"0.6161542",
"0.61583287",
"0.6138954",
"0.6138954",
"0.6138954",
"0.6138954",
"0.6118145",
"0.6118145",
"0.6118145",
"0.6113918",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.60983014",
"0.6098015",
"0.6096283",
"0.6096232",
"0.6094674",
"0.6092724",
"0.6092724",
"0.6092659",
"0.6091189",
"0.6089389",
"0.6084051",
"0.607056",
"0.6070035",
"0.6059764",
"0.6054881",
"0.60540074",
"0.6051077",
"0.60463727",
"0.604207",
"0.6037348",
"0.60265553",
"0.6024828",
"0.60082537",
"0.600804",
"0.6002047",
"0.59977853",
"0.59951925",
"0.5994264",
"0.5994234",
"0.59766823",
"0.5971005",
"0.595302",
"0.5952883",
"0.5949842",
"0.5948856",
"0.5932055",
"0.59265924",
"0.59211224",
"0.59211224",
"0.59178495",
"0.5914609",
"0.59066224",
"0.59047735",
"0.5898993",
"0.5898234",
"0.5892224",
"0.58824474",
"0.5879657",
"0.5878505"
] |
0.739365
|
0
|
DELETE /client_profiles/1 DELETE /client_profiles/1.json
|
def destroy
@client_profile.destroy
respond_to do |format|
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@profile.destroy\n\n \trespond_to do |format|\n \t\tprofiles = Profile.all\n \t\tformat.json { render json: profiles}\n \tend\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend",
"def destroy\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @profile = Profile.find(params[:id])\n # authorize! :destroy, @profile\n\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_with(@profile)\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_profile.destroy\n respond_to do |format|\n format.html { redirect_to admin_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pay_profile = PayProfile.find(params[:id])\n @pay_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to pay_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Profile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_profile = Users::Profile.find(params[:id])\n @users_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = @user.profile\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(@user) }\n format.json { head :no_content }\n end\n #redirect_to user_path(@user)\n end",
"def destroy\n @user.profile.destroy\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @profile\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: \"Profile: #{I18n.t('helpers.deleted')}\" }\n format.json { head :no_content }\n end\n end",
"def delete_profile( profile_name )\n delete_all_accessors(profile_name)\n\n profile_id = find_profile_id( profile_name )\n response = Faraday.get do |req|\n req.url \"#{@base_url}/services/conf/brokerConfigurations/#{profile_id}\", { :opts => 'delete', :random => generate_random_number }\n req.headers = @authorization_headers.merge({'enctype'=>'multipart/form-data'})\n end\n\n profile_id = response.body\n return profile_id\n end",
"def destroy\r\n @profile.destroy\r\n respond_to do |format|\r\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_profile.destroy\n respond_to do |format|\n format.html { redirect_to project_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html do\n redirect_to profiles_url, notice:\n \"Profile was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @climber_profile.destroy\n respond_to do |format|\n format.html { redirect_to climber_profiles_url, notice: 'Climber profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n redirect_to '/'\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @retailer_profile.destroy\n respond_to do |format|\n format.html { redirect_to retailer_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n @profile.requests.destroy_all\n @profile.member.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'El perfil fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @android_profile = @user.android_profile\n @android_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_android_profile_url, :flash => { success: 'Successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @userprofile.destroy\n respond_to do |format|\n format.html { redirect_to userprofiles_url, notice: 'Userprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_profiles_url, notice: 'User profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_profile.destroy\n respond_to do |format|\n format.html { redirect_to contract_profiles_url, notice: 'Contract profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_profile.destroy\n respond_to do |format|\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n session[:profile_id] = nil\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n redirect_to profiles_url\n end"
] |
[
"0.7570437",
"0.6955545",
"0.6902419",
"0.68988854",
"0.6881676",
"0.6881446",
"0.6881446",
"0.68612945",
"0.68560594",
"0.68560594",
"0.68560594",
"0.68541515",
"0.6840027",
"0.6840027",
"0.68260026",
"0.68188083",
"0.68188083",
"0.68188083",
"0.68188083",
"0.68188083",
"0.68188083",
"0.68188083",
"0.68188083",
"0.68093693",
"0.68005717",
"0.67903066",
"0.6768086",
"0.6740267",
"0.6711156",
"0.66994876",
"0.6686681",
"0.66866076",
"0.66866076",
"0.66860473",
"0.66735435",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.6666397",
"0.66659445",
"0.66614044",
"0.66535515",
"0.66523206",
"0.66498876",
"0.6645541",
"0.66413414",
"0.66280174",
"0.6617472",
"0.6612273",
"0.66081023",
"0.6605099",
"0.65947986",
"0.65806717",
"0.6575273",
"0.6568189",
"0.65646553",
"0.65611404",
"0.65611404",
"0.65611404",
"0.65611404",
"0.65611404",
"0.65562177",
"0.65526223",
"0.6538397",
"0.65276504",
"0.6525356",
"0.6524189",
"0.65231025",
"0.65229124",
"0.6512142",
"0.65109664",
"0.65032995",
"0.6502654",
"0.650018",
"0.6463531",
"0.64498997"
] |
0.7805865
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_client_profile
@client_profile = ClientProfile.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 client_profile_params
params.require(:client_profile).permit(:client_id, :name, :bio)
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
|
Metodo para verificar si el empleado que va registar el medico es externo o interno.
|
def verificar_empleado_externo?(user)
unless user.nil?
@employee = Employee.find_by(user_id: user)
unless @employee.nil?
puts user
puts @employee.provider_provider_id.nil?
@employee.provider_provider_id.nil?
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_primo_as_external_system?\n @record.external_system.eql?(\"primo\")\n end",
"def registrable?\n # Almost all Names in MO are potentially registrable, so use a blacklist\n # instead of a whitelist\n !unregistrable?\n end",
"def external?\n crate.canonical_id.host != canonical_id.host\n end",
"def has_local_doi? ids=nil\n ids||=identifier\n not not ( ids.index full_mock_doi )\n end",
"def has_related_patient?\n if registrations.count > 0\n return true\n end\n under_supervision_clinics.each do |clinic|\n clinic.registrations.each do |reg|\n return true\n end\n end\n return false\n end",
"def aleph_cr_record?\n if @record.eds_accession_number.present? &&\n @record.eds_accession_number.start_with?('mitcr.')\n true\n else\n false\n end\n end",
"def mon_owned?\n @mon_data.mon_owned?\n end",
"def in_us1?\n self.nro_remision.to_s == \"\"\n end",
"def other_entry?\n principle == \"EVERYONE\"\n end",
"def es_medidor_de_energia_reactiva\n \tmedidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n medidor = Medidor.find(medidor_id)\n return medidor.tipo_medidor.codigo == 2\n end",
"def extern?(record)\n record.header.externs.include?(@name)\n end",
"def does_resolve_to_host?\n mx_records.include? Socket.gethostname\n end",
"def external?\n !external_id.blank?\n end",
"def entertained?\n return (gladiators.map { |g| g.name }).include? \"Maximus\"\n end",
"def nas?\n @domain.include?(:NAS)\n end",
"def external?\n !internal?\n end",
"def external?\n !internal?\n end",
"def es_matrimonio_asignado?(matrimonio)\n asignaciones_seguimiento.where(persona_id: matrimonio.esposo_id)\n .or(asignaciones_seguimiento.where(persona_id: matrimonio.esposa_id))\n .any?\n end",
"def does_global_level_crosswalk_exist(reason_code_object)\n crosswalk_records = reason_code_object.reason_codes_clients_facilities_set_names.\n select{|rcsn| rcsn.facility_id == nil && rcsn.client_id == nil}\n rcc_log.debug \"Does global level crosswalk exist: #{crosswalk_records.present? && crosswalk_records.length > 0}\"\n crosswalk_records.present? && crosswalk_records.length > 0\n end",
"def mon_owned?\n (defined?(@mon_data) ? @mon_data : use_monitor_core).owned?\n end",
"def unregistrable?\n rank == \"Group\" ||\n rank == \"Domain\" ||\n unpublished? ||\n # name includes quote marks, but limit this to below Order in order to\n # account for things like \"Discomycetes\", which is registered & quoted\n /\"/ =~ text_name && rank >= \"Class\" ||\n # Use kingdom: Protozoa as a rough proxy for slime molds\n # Slime molds, which are Protozoa, are in fungal nomenclature registries.\n # But most Protozoa are not slime molds and there's no efficient way\n # for MO to tell the difference. So err on the side of registrability.\n kingdom.present? && /(Fungi|Protozoa)/ !~ kingdom\n end",
"def regular?\n !administrative? && !stub?\n end",
"def internal_or_core?(pin); end",
"def valid_dns?\n @host.exchanger.has_dns_a_record?\n end",
"def filled_by_internal_user?\n seat_reservation && time_sheet_entries.first.internal_user_start\n end",
"def manage_datacite?\n has_local_doi?\n end",
"def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend",
"def require_employee_number?\n !!(self.registered_download.require_employee_number?)\n end",
"def aleph_record?\n if @record.eds_accession_number.present? &&\n @record.eds_accession_number.start_with?('mit.')\n true\n else\n false\n end\n end",
"def local?\n daycare_id.nil? ? false : true\n end",
"def local?\n daycare_id.nil? ? false : true\n end",
"def internal?\n self.internal\n end",
"def require_manager_name?\n !!(self.registered_download.require_manager_name?)\n end",
"def orden_mantenimiento_exists\n\n if self.id_orden_mantenimiento.blank?\n true\n else\n begin\n OrdenMantenimiento.find(self.id_orden_mantenimiento)\n rescue ActiveRecord::RecordNotFound\n errors.add(:id_orden_mantenimiento, \"No existe la orden especificada\")\n false\n end\n end\n\n end",
"def common_event_reserved?\r\n @common_event_id > 0\r\n end",
"def internal?\n internal\n end",
"def owner?(mem)\n return false if not mem\n mem.lifes._ids.include?(data.owner_id)\n end",
"def is_externally_visible\n return @is_externally_visible\n end",
"def belongs_to_me? file\n #The only difference between shared files that have been added to your Drive\n #and those that haven't is that those that have have a file path (parents)\n return true if @config['sync_shared_in_drive'] and file.parents != nil and file.parents != []\n file.shared_with_me_time.nil? and file.owners != nil and file.owners.select{|owner| owner.me}.count > 0\n end",
"def femme?\n identified? && sexe == 'F'\n end",
"def priv?\n !org?\n end",
"def error_for?(dom_namer)\n k = dom_namer.id.split(':')[1..-1].join('.')\n errors[k].any?\n end",
"def valid?\n not @local_id.nil?\n end",
"def candownload?(issue = nil)\n if self.isregistered?\n #durante il periodo di prova l'utente NON accede ai attachment degli contenuti rossi che hanno una sezione protetta\n if issue && issue.section && issue.section.protetto\n #tranne quelli che hanno una sezione protetta\n return false\n end\n end\n return true\n end",
"def common_event_reserved?\n @common_event_id > 0\n end",
"def registered? c, verbose = false\n if @clients[c][:nick].empty?\n if verbose then\n\tsend_errnr_to_client c, NR::ERR_NOTREGISTERED\n end\n \n return false\n elsif @clients[c][:user] != 1\n if verbose then\n\tsend_errnr_to_client c, NR::ERR_NOTREGISTERED\n end\n \n return false\n else\n return true\n end\n end",
"def global?\n daycare_id.nil? ? true : false\n end",
"def global?\n daycare_id.nil? ? true : false\n end",
"def can_be_officer?\n self.degree.to_sym == :master_mason\n end",
"def occupied?\n !patient.nil?\n end",
"def valid_mx?\n @host.exchanger.mxers.size > 0\n end",
"def consider_local? # :nodoc:\n @domain == :both or @domain == :local\n end",
"def searchable_in_registry?\n # Use blacklist instead of whitelist; almost all MO names are searchable\n !unsearchable_in_registry?\n end",
"def imperfect_return_resubmission?\n return false unless previously_transmitted_submission.present?\n \n previously_transmitted_submission.efile_submission_transitions.collect(&:efile_errors).flatten.any? { |error| [\"SEIC-F1040-501-02\", \"R0000-504-02\"].include? error.code }\n end",
"def has_local?\n local.exist?\n end",
"def retired?\n RETIRED_SSNS.map { |ssn_string| SSN.new(ssn_string) }.any? { |ssn| ssn == self }\n end",
"def minting_service_defined?\n Rails.configuration.x.madmp.enable_dmp_id_registration && minter.present? &&\n minter.api_base_url.present?\n end",
"def using_internal_mapping?\n\t\t\t\taccount_mapping_mode_used == :internal\n\t\t\tend",
"def is_internal_nfs_datastore?(name)\n name.start_with?(\"_nfs_asm\")\n end",
"def is_ok ( addr )\n\tindex = addr - @base\n\treturn true if @map[index] == \"X\"\n\treturn true if @map[index] == \"I\"\n\treturn false\n end",
"def local?\r\nLOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip\r\nend",
"def cross_check_mac_address_with_ouis\n\t\toui_str = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )[0,6]\n\t\toui_obj = Oui.where( :value => oui_str ).first\n\t\tif oui_obj == nil \\\n\t\t|| (self.phone_model && self.phone_model.try(:manufacturer) != oui_obj.manufacturer)\n\t\t\terrors.add( :mac_address, I18n.t(:mac_address_not_matching_oui, :manufacturer => self.phone_model.try(:manufacturer).try(:name) ))\n\t\tend\n\tend",
"def external?\n @external\n end",
"def new_patient?(patient)\n return Patient.find_by_mrn(patient.mrn).nil?\n end",
"def registered?\n registrations = ring_server.read_all [:name, @service, nil, @identifier]\n registrations.any? { |registration| registration[2] == @object }\n rescue DRb::DRbConnError\n @ring_server = nil\n return false\n end",
"def isRegistado?\n if session[:perm] == 0\n return true;\n else\n return false;\n end\n end",
"def imported_population?\n return self.patient_population.nil?\n end",
"def emergency_contact_for?(host)\n self.is_emergency_contact_for? host\n end",
"def comprobacionmedidor\n\nif @privilegio == 'Administrador'\n\np \"Tienes todos los permisos\"\n\nelse\n\n@medidor = Medidore.find_by(token: @token)\nif @medidor[:asociado] == Usuario.find_by(mail: @mailvalidacion).nombre\nelse\n\np \"No tienes asociada esta phinet\"\njsonerror_response(\"No tienes asociada este Medidor #{@medidor[:nombre]}\")\n\nend\n\n\nend\n\n\n\n\nend",
"def system_notificaton?\n @system_notificaton\n end",
"def icn_id_registrable\n return if icn_id.blank? || registrable?\n\n errors.add(:base, :name_error_unregistrable.t(\n rank: rank.to_s, name: real_search_name\n ))\n end",
"def orden_repuesto_exists\n\n if self.id_orden_respuesto.blank?\n true\n else\n begin\n OrdenRepuesto.find(self.id_orden_respuesto)\n rescue ActiveRecord::RecordNotFound\n errors.add(:id_orden_respuesto, \"No existe la orden especificada\")\n false\n end\n end\n\n end",
"def wmid_exist?(wmid)\n request(:find_wm, :wmid => Wmid.new(wmid))[:retval] == 1\n end",
"def legible?\n @local.to_s =~ LEGIBLE_LOCAL_REGEX\n end",
"def unknow\r\n return false unless unknow?\r\n @unknow.shift\r\n end",
"def valid?\n (internal_ip.nil? || name.nil?) ? false : true\n end",
"def instrumentalists?\n true\n end",
"def is_impersonating?\n @impers ||= !self.impersonation_id.blank?\n end",
"def can_use_ill?\n !virginia_borrower?\n end",
"def name_is_misapplied?\n !TaxonNameRelationship.where_subject_is_taxon_name(self).with_type_string('TaxonNameRelationship::Iczn::Invalidating::Misapplication').empty?\n end",
"def unknown?\n\t\treturn ( major.text.include?('InsufficientInformation') )\n\tend",
"def synced?\n contabilium_id.present? && ucrm_id.present?\n end",
"def check_fields_nas_domain?\n return false if @fields[:share] == \"Google\" # File Listing\n return false if @fields[:src_sharename] == \"Google\" || @fields[:dst_sharename] == \"Google\" # File Copy/Move\n return false if @fields[:sharename] == \"Google\" # File Deletion\n return true\n end",
"def valid_ein_prefix?(record)\n # Data from https://www.irs.gov/Businesses/Small-Businesses-&-Self-Employed/How-EINs-are-Assigned-and-Valid-EIN-Prefixes\n # Note - these acceptable_prefixes include prefixes that the IRS doesn't include on their database of valid prefixes\n # but actually assigns in practice (according to IRS data dumps)\n acceptable_prefixes = [\n \"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", 10, 12, 60, 67, 50, 53, 11, 13, 14, 16, 21, 22, 23,\n 25, 34, 51, 52, 54, 55, 56, 57, 58, 59, 65, 30, 32, 35, 36, 37, 38, 61, 15,\n 24, 40, 44, 94, 95, 80, 90, 33, 39, 41, 42, 43, 48, 62, 63, 64, 66, 68, 71,\n 72, 73, 74, 75, 76, 77, 81, 82, 83, 84, 85, 86, 87, 88, 91, 92, 93, 98, 99,\n 20, 26, 27, 45, 46, 47, 31\n ]\n\n acceptable_prefixes.map! { |p| p.to_s }\n\n @response = true\n if !acceptable_prefixes.include?(record.ein[0,2])\n @response = false\n end\n @response\n end",
"def relaxed_locate?\n @relaxed_locate\n end",
"def cross_check_mac_address_with_ouis\n oui = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')[0,6]\n if Oui.where(:value => oui).first == nil or Oui.where(:value => oui).first.manufacturer != self.phone_model.manufacturer\n errors.add( :mac_address, \"The given mac address doesn't match to the OUIs of the manufacturer #{self.phone_model.manufacturer.name}.\" )\n end\n end",
"def unmatched?\r\n @partner.nil?\r\n end",
"def staff_initiated?\n self.from_phone == self.ride_zone.phone_number_normalized\n end",
"def extern?\n extern_package_name && !extern_package_name.empty?\n end",
"def external_reference_check(record,row)\n #riferimenti al plot\n plot = Plot.find(:first, :conditions => [\"numero_plot = ? AND deleted = false\", record.cod_plot])\n #se il plot non esiste\n if plot.blank?\n save_error(record,\"Riferimento al Plot\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end",
"def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend",
"def common_event_reserved?\n !@reserved_common_events.empty?\n end",
"def registered?\n registrations = self.ring_server.read_all([:name,\n @service,\n nil,\n @identifier])\n registrations.any? { |registration| registration[2] == self }\n rescue DRb::DRbConnError\n @ring_server = nil\n false\n end",
"def public?\n !foreign? && !facility_code.nil? && facility_code[0] == \"1\"\n end",
"def is_work_address_previously_collected_and_valid?(question)\n answer_for(question, valid_response_exists?(\"PREG_VISIT_1_3.WORK_ADDRESS_1\", :last))\n end",
"def local_request?\n LOCAL_REQUEST_ERROR\n end",
"def correspondence?\n correspondence_indicator && !ojt? && !offer_degree?\n end",
"def is_cross_company?\n super && !is_anniversary?\n end",
"def avid?\n namespace.__avid_instances__.any? &method( :equal? )\n end",
"def has_reported_renters\r\n if self.get_reported_renters.size > 0\r\n return true\r\n else\r\n return false\r\n end\r\n end"
] |
[
"0.6074028",
"0.59400356",
"0.5760218",
"0.5754254",
"0.56107455",
"0.55920964",
"0.5579983",
"0.55697554",
"0.55665636",
"0.55474734",
"0.5535004",
"0.5509006",
"0.5478742",
"0.54525506",
"0.54492146",
"0.5436241",
"0.54345965",
"0.5431724",
"0.540444",
"0.5402924",
"0.53946877",
"0.53824013",
"0.53755397",
"0.5368887",
"0.53634447",
"0.53379697",
"0.5332326",
"0.53295326",
"0.53106236",
"0.53084713",
"0.53084713",
"0.5299453",
"0.5292792",
"0.52800703",
"0.52745026",
"0.5271411",
"0.524693",
"0.52399576",
"0.5223483",
"0.5219358",
"0.52059245",
"0.52056795",
"0.5200732",
"0.5188036",
"0.51716095",
"0.51619154",
"0.5161762",
"0.5161762",
"0.5156384",
"0.51466155",
"0.51445717",
"0.5143696",
"0.5134925",
"0.51327586",
"0.51314306",
"0.5130674",
"0.51257306",
"0.51155776",
"0.5113717",
"0.51078975",
"0.510697",
"0.510553",
"0.5104492",
"0.5098218",
"0.50972414",
"0.50880533",
"0.5086971",
"0.5082317",
"0.50758165",
"0.507202",
"0.50696015",
"0.5059185",
"0.50588465",
"0.50572336",
"0.5056759",
"0.50550044",
"0.5048237",
"0.5043409",
"0.5040029",
"0.5034188",
"0.5033972",
"0.50327075",
"0.50257385",
"0.5024327",
"0.5021562",
"0.5020223",
"0.5012912",
"0.50094116",
"0.5008508",
"0.50052476",
"0.5003545",
"0.49916995",
"0.4989611",
"0.49889725",
"0.4988193",
"0.49873373",
"0.49858227",
"0.49846148",
"0.49824652",
"0.4981583"
] |
0.5514408
|
11
|
A presenter for selecting a work type to create this is needed here because the selector is in the header on every page
|
def create_work_presenter
@create_work_presenter ||= create_work_presenter_class.new(current_ability.current_user)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def header_markup(type)\n if type == :selectable\n content = \"All Available #{attribute_name.to_s.sub('_id', '').titleize}\"\n specific_class = 'selectable'\n elsif type == :selection\n content = 'Current Selections'\n specific_class = 'selection'\n end\n\n content_tag(:div, content, class: \"pure-admin-multiselect-header #{specific_class}\",\n style: 'display: none;')\n end",
"def select_question_type(qtype)\n frm.select(:id=>\"_id1:selType\").select(qtype)\n frm.button(:value=>\"Save\").click\n\n page = case(qtype)\n when \"Multiple Choice\" then MultipleChoice.new(@browser)\n when \"True False\" then TrueFalse.new(@browser)\n when \"Survey\" then Survey.new(@browser)\n when \"Short Answer/Essay\" then ShortAnswer.new(@browser)\n when \"Fill in the Blank\" then FillInBlank.new(@browser)\n when \"Numeric Response\" then NumericResponse.new(@browser)\n when \"Matching\" then Matching.new(@browser)\n when \"Audio Recording\" then AudioRecording.new(@browser)\n when \"File Upload\" then FileUpload.new(@browser)\n else puts \"nothing selected\"\n end\n\n return page\n\n end",
"def set_work_type\n @work_type = WorkType.find_by_id(params[:id])\n end",
"def get_work_types\n @task_index = params[:task_index].blank? ? '' : params[:task_index]\n if params[:note_id].blank?\n @note = Communication.new(:assigned_by_employee_user_id=> params[:lawyer_id])\n else\n @note = Communication.find(params[:note_id])\n end\n get_work_types_subtypes_complexities(params)\n render :update do |page|\n page.replace_html 'task_'+@task_index+'_work_types', :partial=>'work_type_select'\n if @has_complexity\n page.show 'task_'+@task_index+'_complexity'\n else\n page.hide 'task_'+@task_index+'_complexity'\n end\n end\n end",
"def select_task_type245(task_type_option)\n ui_manager.select_radio_btn(task_type_locator)\n end",
"def query_type=(query_option)\n @browser.select_list(:id => \"smartSearchSubtype_0\").select(query_option)\n end",
"def set_worktype\n @worktype = Worktype.find(params[:id])\n end",
"def acts_as_selector\n define_method(\"is_selector?\") { true }\n end",
"def selected_page\n end",
"def get_work_subtypes\n get_note_work_subtypes_complexities(params)\n render :update do |page|\n page.replace_html 'task_'+params[:task_index]+'_work_subtypes', :partial=>'work_subtype_select'\n end\n end",
"def define_selectors_(type, name, selector)\n define_method(\"#{name}_#{type}_selector\") do |text = nil|\n text ? extend_selector(selector, :text, text) : selector\n end\n\n define_method(\"#{name}_selector\") do |text = nil|\n text ? extend_selector(selector, :text, text) : selector\n end\n end",
"def settings_selection(settings_type)\n settings_icon.click\n setting_select.each do |setting|\n setting.click if setting.text == settings_type\n end\n end",
"def paperwork_type\n if invoice?\n \"sales invoice\"\n elsif quote? || pay_by_phone?\n \"quotation\"\n elsif pro_forma?\n \"pro forma invoice\"\n else\n \"order details\"\n end\n end",
"def create_selector(input); end",
"def get_page_presenter(action, type=nil)\n\n\n\n\n\n\n\n if action.to_s == \"index\" && type && page_presenters[:index].kind_of?(Hash)\n\n\n\n page_presenters[:index][type.to_sym]\n\n\n\n elsif action.to_s == \"index\" && page_presenters[:index].kind_of?(Hash)\n\n\n\n page_presenters[:index].default\n\n\n\n else\n\n\n\n page_presenters[action.to_sym]\n\n\n\n end\n\n\n\n\n\n\n\n end",
"def page_selector(element, content_name, options = {}, select_options = {})\n default_options = {\n :page_attribute => :id,\n :global => false,\n :prompt => _t('Choose page'),\n :order_by => :name\n }\n options = default_options.merge(options)\n content = element.content_by_name(content_name)\n if options[:global] || options[:only].present?\n pages = Page.where({\n :language_id => session[:language_id],\n :layoutpage => options[:global] == true,\n :public => options[:global] == false\n })\n if options[:only].present?\n pages = pages.where({:page_layout => options[:only]})\n end\n pages_options_tags = pages_for_select(pages.order(options[:order_by]), content ? content.ingredient : nil, options[:prompt], options[:page_attribute])\n else\n pages_options_tags = pages_for_select(nil, content ? content.ingredient : nil, options[:prompt], options[:page_attribute])\n end\n options.update(:select_values => pages_options_tags)\n if content.nil?\n render_missing_content(element, content_name, options)\n else\n render_essence_editor(content, options)\n end\n end",
"def work_type\n self[Solrizer.solr_name('work_type')]\n end",
"def work_type_name(work)\n case work.person.gender\n when \"female\" then work.type.name_feminine\n when \"male\" then work.type.name_masculine\n end\n end",
"def select_trip_type(type)\n trip_type_button = @driver.find_element(:xpath, \"//input[@value='#{type}']\")\n #trip_type_button = @driver.find_element(:css, \"input[value='oneway']\")\n trip_type_button.click\n end",
"def work_presenter\n @work_presenter||= CurationConcerns::GenericWorkShowPresenter.new(\n SolrDocument.find(work_id),\n Ability.new(nil)\n )\n end",
"def set_work_item_type\n @work_item_type = WorkItemType.find(params[:id])\n end",
"def select_question_type(qtype)\n frm.select(:id=>\"assesssmentForm:changeQType\").select(qtype)\n\n page = case(qtype)\n when \"Multiple Choice\" then MultipleChoice.new(@browser)\n when \"True False\" then TrueFalse.new(@browser)\n when \"Survey\" then Survey.new(@browser)\n when \"Short Answer/Essay\" then ShortAnswer.new(@browser)\n when \"Fill in the Blank\" then FillInBlank.new(@browser)\n when \"Numeric Response\" then NumericResponse.new(@browser)\n when \"Matching\" then Matching.new(@browser)\n when \"Audio Recording\" then AudioRecording.new(@browser)\n when \"File Upload\" then FileUpload.new(@browser)\n else puts \"#{qtype} is not a valid question type\"\n end\n\n return page\n\n end",
"def selectCategory(data = {})\n self.has_expected_element?\n data = data_for('homepage',data)\n case data['category'].downcase.gsub(/\\s+/, '')\n when 'news&politics'\n news_and_politics_element.click\n when 'style'\n style_element.click\n end\n end",
"def work_presenter\n @work_presenter||= CurationConcerns::GenericWorkShowPresenter.new(\n SolrDocument.find(work_id),\n Ability.new(nil)\n )\n end",
"def polymorphic_selector(f, selected, polymorphic_name, polymorphic_hash, disabled = false)\n render partial: 'shared/resource_form/polymorphic_selector', locals: {\n f: f,\n selected: selected,\n polymorphic_name: polymorphic_name,\n polymorphic_hash: polymorphic_hash,\n disabled: disabled\n }\n end",
"def piece_selector\n if self.page_layout.id && self.section_id\n \"s_#{self.to_key}\"\n end\n end",
"def selected; end",
"def wiki_menu_select\n wiki_menu\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Search by Character\",\n \" [2] Search by House\",\n \" [3] Main Menu\",\n \" [4] Exit App\"\n ]\n prompt.select(\" \", menu_choices)\nend",
"def choose_new_type\n @types = Poll.all_types_for_select\n end",
"def index\n authorize WorkType\n @filterrific = initialize_filterrific(\n WorkType,\n params[:filterrific]\n ) or return\n @selected_per_page = get_session_per_page(WorkType.per_page)\n @work_types = @filterrific.find.page(params[:page]).per_page(@selected_per_page)\n end",
"def polymorphic_selector(f, selected, polymorphic_name, polymorphic_hash, disabled = false)\n render partial: 'common/form/polymorphic_selector', locals: {\n f: f,\n selected: selected,\n polymorphic_name: polymorphic_name,\n polymorphic_hash: polymorphic_hash,\n disabled: disabled\n }\n end",
"def select_task_type4(task_type_option)\n task_type_locator = Locator.new(NewRequestWhatLocators::TASK_TYPE).replace_value('<task_type>', task_type_option)\n sp_helper.select_radio_btn(task_type_locator)\n end",
"def klass\n wtype=ENV.fetch('WORK_TYPE')\n if wtype==\"GraduateThesisOrDissertation\" then\n model=GraduateThesisOrDissertation\n elsif wtype==\"UndergraduateHonorsThesis\" then\n model=UndergraduateHonorsThesis \n elsif wtype==\"Article\" then\n model=Article\n elsif wtype==\"Book\" then\n model=Book\n elsif wtype==\"BookChapter\" then\n model=BookChapter\n elsif wtype == \"ConferenceProceeding\" then\n model=ConferenceProceeding\n elsif wtype == \"Presentation\" then\n model= Presentation\n elsif wtype == \"Report\"\n model= Report\n elsif wtype == \"Dataset\"\n model = Dataset\n elsif wtype == \"Default\"\n model= Default\n end\n model\n end",
"def selection(choice)\n case choice\n when 1\n view_entries\n when 2\n manual_add_entry\n when 3\n puts 'Awaiting Build...'\n hold_screen\n # search_menu\n when 4\n puts 'Awaiting Build...'\n hold_screen\n # file_selection\n end\n end",
"def load_selector(value_type)\n selectors.active.where(value_type: value_type).limit(1).first\n end",
"def select_item(what)\n item = find_item(what)\n item.click if item\n end",
"def main_selector\n print \"What would you like to do? Create, List, Update, or Vote: \"\n main_decision = gets.chomp.downcase\n main_decision = main_decision[0]\n case main_decision\n when \"c\"\n create_person_or_politician\n when \"l\"\n list_characters_created\n when \"u\"\n update_character\n when \"v\"\n vote\n else\n puts \"That is not a valid entry please try again!\"\n main_selector\n end\n end",
"def select\n self[:select]\n end",
"def page_select(id, params={})\n type = params[:type]\n p_class = params[:p_class]\n description = params[:description] || id.to_s.titleize\n model = params[:model]\n default_id = params[:default_id]\n skip_id = params[:skip_id]\n\n f = \"<p #{p_class.nil? ? '' : 'class=\"' + attr_h(p_class) + '\"'}>\"\n f << \"<label for=\\\"#{id}\\\">#{description}</label>\"\n f << \"<select name=\\\"#{id}\\\" id=\\\"#{id}\\\">\"\n f << \"<option value=\"\">/</option>\"\n CortexReaver::Page.top.order(:title).all.each do |page|\n f << page_select_helper(page, default_id, skip_id)\n end\n f << \"</select></p>\"\n end",
"def define_selectors(type, name, selector)\n define_method(\"#{name}_#{type}_selector\") { selector }\n define_method(\"#{name}_selector\") { selector }\n end",
"def work_type_name\n model.work_type&.name\n end",
"def find(type, name, opts={})\n \n defaults = {\n :nav_homepage => true,\n :course_description => '',\n :course_number => ''\n }\n \n opts = defaults.merge(opts)\n \n # Navigate to Curriculum Mgmt\n self.homepage() unless(!opts[:nav_homepage])\n \n \n # Search Criteria\n if(type == \"proposal\")\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|13|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|648421FAE6C751B6B3D6A2EC5262F586|org.kuali.student.common.ui.client.service.SearchRpcService|search|org.kuali.student.core.search.dto.SearchRequest|org.kuali.student.core.search.dto.SearchRequest/3917446114|java.lang.Boolean/476441737|java.util.ArrayList/3821976829|org.kuali.student.core.search.dto.SearchParam/3876231949|proposal.queryParam.proposalOptionalName|#{name}|proposal.search.generic|proposal.resultColumn.proposalOptionalName|1|2|3|4|1|5|6|0|7|0|8|1|9|10|0|11|12|13|0|0|\"\n }\n )\n elsif(type == \"course\")\n # Only searching by title/name\n contents = (name == '' ? \"5|0|13|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|648421FAE6C751B6B3D6A2EC5262F586|org.kuali.student.common.ui.client.service.SearchRpcService|search|org.kuali.student.core.search.dto.SearchRequest/3917446114|java.lang.Integer/3438268394|java.lang.Boolean/476441737|java.util.ArrayList/3821976829|org.kuali.student.core.search.dto.SearchParam/3876231949|lu.queryParam.luOptionalType|kuali.lu.type.CreditCourse|lu.search.generic|org.resultColumn.orgShortName|1|2|3|4|1|5|5|6|10|7|0|8|1|9|10|0|11|12|13|0|6|0|\" : \n \"5|0|15|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|648421FAE6C751B6B3D6A2EC5262F586|org.kuali.student.common.ui.client.service.SearchRpcService|search|org.kuali.student.core.search.dto.SearchRequest/3917446114|java.lang.Integer/3438268394|java.lang.Boolean/476441737|java.util.ArrayList/3821976829|org.kuali.student.core.search.dto.SearchParam/3876231949|lu.queryParam.luOptionalLongName|#{name}|lu.queryParam.luOptionalType|kuali.lu.type.CreditCourse|lu.search.generic|org.resultColumn.orgShortName|1|2|3|4|1|5|5|6|10|7|0|8|2|9|10|0|11|9|12|0|13|14|15|0|6|0|\")\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => contents\n }\n )\n\n end\n \n end",
"def selected?; end",
"def selected?; end",
"def list_page(type, opts={})\n page do\n form_attr = form_attributes(opts[:form] || {:action=>url_for(type)})\n Forme.form(form_attr, form_opts) do |f|\n input_opts = {:name=>'id', :id=>'id', :label=>model.class_name}\n if model.autocomplete_options_for(type, request)\n input_type = :text\n input_opts.merge!(:class=>'autoforme_autocomplete', :attr=>{'data-type'=>type})\n else\n input_type = :select\n input_opts.merge!(:options=>model.select_options(type, request), :add_blank=>true)\n end\n f.input(input_type, input_opts)\n f.button(:value=>type.to_s.capitalize, :class=>\"btn btn-#{type == :delete ? 'danger' : 'primary'}\")\n end\n end\n end",
"def select\n @type = params[:type]\n @hosts = Host.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"host\"\n @apps = App.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"app\"\n @sites = Site.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"site\"\n @devices = Device.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"device\"\n end",
"def select\n self[:select]\n end",
"def klass\n #byebug\n wtype=ENV.fetch('WORK_TYPE')\n #byebug\n puts \"HELLLLLLLOOOOOOOOOOOOOOOO\"\n if wtype==\"GraduateThesisOrDissertation\" then\n model=GraduateThesisOrDissertation\n elsif wtype==\"UndergraduateHonorsThesis\" then\n model=UndergraduateHonorsThesis \n elsif wtype==\"Article\" then\n model=Article\n end\n model\n end",
"def type\n \"mymenu\"\n end",
"def pick_someone\n\n end",
"def select_render action=nil\n # defaults to current action, though another may be specified, even a full path\n \"#{action || @action}_\"+\n case\n when injector?\n \"injector\"\n when dialog?\n \"modal\"\n else\n \"page\"\n end\n end",
"def select_template template\n\t\tpage_div = $browser.div(:xpath => \"//div[@class='template-categories_category-name'][contains(text(), '\"+template+\"')]\")\n\t\tpage_div.click\n\tend",
"def switch_to_tab_for_type \n\t\t\ttab = 0 if @search_type == :recent\n\t\t\ttab = 1 if @search_type == :nearby\n\t\t\ttab = 2 if @search_type == :location\n\t\t\t# This is in the documentation, but I could not find it in the framework?\n\t\t\t# Rho::NativeTabbar.switch_tab(tab)\n\t\tend",
"def sub_view\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).sub_handler\n page(SubmissionPage).verify_page_elements\n page(SubmissionPage).select_action(\"Submissions\")\n page(SubmissionPage).select_action(\"Comments\")\n page(MorePage).backpage\n end",
"def select_puppy(name = 'Hanna')\n index = index_for(name)\n view_detail_elements[index].click\n end",
"def donable_selected\n @donable = donable_class_constant(params[:donable_type]).new\n render_donable_partial\n end",
"def pick\n\n wid = get_wid or return\n\n pick_workitem wid\n\n redirect_to :controller => \"stores\"\n end",
"def fav_saved_selection(return_selection)\n case return_selection\n when 1\n today_menu \n when 2\n weekend_menu\n when 3\n display_favorites\n else\n welcome_header\n main_menu\n end \n \n end",
"def selector_name\n 'summary/move_selector'\n end",
"def xml_work_type\n @xml[:work].type @type\n end",
"def new_creatable_selection\n select_tag :model_type,options_for_select(creatable_classes.collect{|c| [c.underscore.humanize,c.underscore] })\n end",
"def get_selector(name)\n doc = Hpricot(response.body)\n Hpricot(doc.search(\"[@id='#{name}']\").to_html)\nend",
"def show\n authorize @work_type\n end",
"def select_puppy(name = 'Brook')\n\t\tindex = index_for(name)\n\t\tbutton_element(value: 'View Details', index: index).click\n\t\t# view_detail_elements[index].click\n\tend",
"def select_question_type\n set_user_input\n if @user_input == 0\n @response = Registration.question_type_selection(@screen_id)\n @session.update_attributes(question_type_id: nil, req_no: @req_no - 1)\n else\n @question_type = QuestionType.find_by_ussd_id(@user_input)\n if @question_type\n @session.update_attributes(question_type_id: @question_type.id, req_no: @req_no)\n if URI.escape(@question_type.name) == URI.escape(\"Révision scolaire\")\n @response = Registration.select_academic_level(@screen_id)\n else\n @response = Registration.confirm_registration(@session, @screen_id)\n end\n else\n @response = Error.invalid_question_type(@screen_id)\n end\n end\n end",
"def type_name\n \"page\"\n end",
"def select(scope) # abstract\n end",
"def select_list\n @browser.div(:class => \"select-list\")\n end",
"def sort_result_by(type = SortOption::ALPHABETICAL_CONST)\r\n find('div.resultList')\r\n page.execute_script(\"$('div.resultList div div select:first').css('display','block')\")\r\n element = find(:xpath, \".//select[@class='input-medium-sort-by requester chzn-done']\")\r\n id = element[:id]\r\n select type, from: id\r\n end",
"def select\r\n assert_exists\r\n if(@how == :text)\r\n @select_list.select(@what)\r\n elsif(@how == :value)\r\n @select_list.select_value(@what)\r\n end \r\n end",
"def assessment_type_title\n frm.div(:class=>\"tier2\").table(:index=>0)[0][1].text\n end",
"def select_room\n\n # These two lines create an array for the menu to display the room names\n menu = []\n @rooms.each { |room| menu.push(room.type)} \n\n # this displays the menu using the TTY-Prompt gem. It returns the selected room\n selection = TTY::Prompt.new.select(\"Choose a room type:\", menu, cycle: true, marker: '>', echo: false)\n @rooms.each { |room| return room if room.type == selection }\n end",
"def select_room\n\n # These two lines create an array for the menu to display the room names\n menu = []\n @rooms.each { |room| menu.push(room.type)} \n\n # this displays the menu using the TTY-Prompt gem. It returns the selected room\n selection = TTY::Prompt.new.select(\"Choose a room type:\", menu, cycle: true, marker: '>', echo: false)\n @rooms.each { |room| return room if room.type == selection }\n end",
"def search_results_page_type\n action = controller.action_name\n if [\"browse_for_sale\", \"new_developments\"].include? action\n :sales\n elsif [\"browse_for_rent\", \"quick_search\"].include? action\n :rentals\n end\n end",
"def spec_type(desc, *additional); end",
"def select_puppy(name = 'Brook')\n index = index_for(name)\n button_element(value: 'View Details', index: index).click\n end",
"def main_menu\n main_menu_options = {'Interact with Existing Kits' => :list_and_select_kit,\n 'Create a new Kit' => :prompt_kit_params, \n 'Quit' => :quit}\n \n op = @io.select_from_options(\"What would you like to do?\", main_menu_options)\n @operation_stack.unshift op\n \n # return nil, because there's nothing to pass onto the next method\n return\n end",
"def choose\n \n end",
"def choose\n raise NotImplementedError.new('Must override')\n end",
"def init_function(browser, type, name_or_id=nil, text=nil, execution=false)\n puts type\n if type == 'table'\n p 'gototable'\n return find_element_table(browser, name_or_id, execution)\n elsif type == 'button'\n p 'gotobutton'\n return find_element_button(browser, name_or_id, execution)\n elsif type == 'text_input'\n p 'gotoinput'\n return find_element_text_input(browser, name_or_id, text, execution)\n elsif type == 'text'\n p 'gototext'\n return find_element_text(browser, name_or_id, execution)\n end\n puts type\nend",
"def orcid_work_type(internal_work_type, internal_work_subtype)\n type = case internal_work_type\n when 'Text'\n case internal_work_subtype\n when /^(Article|Articles|Journal Article|JournalArticle)$/i\n 'journal-article'\n when /^(Book|ebook|Monografie|Monograph\\w*|)$/i\n 'book'\n when /^(chapter|chapters)$/i\n 'book-chapter'\n when /^(Project report|Report|Research report|Technical Report|TechnicalReport|Text\\/Report|XFEL.EU Annual Report|XFEL.EU Technical Report)$/i\n 'report'\n when /^(Dissertation|thesis|Doctoral thesis|Academic thesis|Master thesis|Masterthesis|Postdoctoral thesis)$/i\n 'dissertation'\n when /^(Conference Abstract|Conference extended abstract)$/i\n 'conference-abstract'\n when /^(Conference full text|Conference paper|ConferencePaper)$/i\n 'conference-paper'\n when /^(poster|Conference poster)$/i\n 'conference-poster'\n when /^(working paper|workingpaper|preprint)$/i\n 'working-paper'\n when /^(dataset$)/i\n 'data-set'\n end\n\n when 'Collection'\n case internal_work_subtype\n when /^(Collection of Datasets|Data Files|Dataset|Supplementary Collection of Datasets)$/i\n 'data-set'\n when 'Report'\n 'report'\n end\n end # double CASE statement ends\n\n type || TYPE_OF_WORK[internal_work_type] || 'other'\n end",
"def set_type\n end",
"def selector(f, name, collection, selected, required = true)\n\n prompt_text_label = totally_humanize(name)\n\n f.input name,\n collection: collection,\n prompt: 'Select ' + prompt_text_label,\n selected: selected,\n required: required\n\n end",
"def selector(f, name, collection, selected, required = true)\n\n prompt_text_label = totally_humanize(name)\n\n f.input name,\n collection: collection,\n prompt: 'Select ' + prompt_text_label,\n selected: selected,\n required: required\n\n end",
"def part_of_title_by_type(resource_type)\n if self.type == resource_type\n self.title\n elsif self.is_part_of && self.is_part_of.type == resource_type\n self.is_part_of.title\n else\n nil\n end\n end",
"def fill_out_work(work)\n work.title = self.title\n\n if self.bib_number.present?\n work.build_external_id(category: \"bib\", value: self.bib_number)\n end\n if self.accession_number.present?\n work.build_external_id(category: \"accn\", value: self.accession_number)\n end\n if self.museum_object_id.present?\n work.build_external_id(category: \"object\", value: self.museum_object_id)\n end\n if self.box.present? || self.folder.present?\n work.physical_container = {box: self.box.presence, folder: self.folder.presence}\n end\n if self.dimensions.present?\n work.extent = self.dimensions\n end\n\n if self.collecting_area == \"archives\"\n work.department = \"Archives\"\n elsif self.collecting_area == \"rare_books\" || self.collecting_area == \"modern_library\"\n work.department = \"Library\"\n elsif self.collecting_area == \"museum\"\n work.department = \"Museum\"\n end\n\n end",
"def select_by_id(type, id)\n result = nil\n\n case type \n when \"channel\"\n result = @channels.index { |channel| channel.id == id }\n raise ArgumentError, \"no channel with id: #{id}\" if result.nil?\n @selected = @channels[result]\n when \"user\"\n result = @users.index { |user| user.id == id }\n raise ArgumentError, \"no user with id: #{id}\" if result.nil?\n @selected = @users[result]\n end\n end",
"def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end",
"def connect\n klass = Ultimaker::TYPES[type.split(\".\").first]\n klass.new()\n end",
"def first_opt\n prompt = TTY::Prompt.new\n\n puts \"\\n\"\n\n selector = prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"Study\"\n menu.choice \"Start quiz\"\n menu.choice \"Add a new Q&A\"\n menu.choice \"Exit\"\n end\n\n case selector\n when \"Study\"\n show_categories\n study(@category_input_push)\n when \"Start quiz\"\n\n show_categories\n quiz(@category_input_push)\n\n when \"Add a new Q&A\"\n another_qa_opt\n when \"Exit\"\n exit\n end\nend",
"def add_work_type_filter\n return if options[:work_types].blank?\n body.filter(:terms, work_types: options[:work_types])\n end",
"def view_component_class_for(model)\n if model.kind_of?(Work)\n SearchResult::WorkComponent\n elsif model.kind_of?(Collection)\n SearchResult::CollectionComponent\n else\n raise ArgumentError.new(\"Don't know proper search results ViewModel class for #{model}\")\n end\n end",
"def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend",
"def select_output_type\n @plan = Plan.find_by(id: params[:plan_id])\n @research_output = ResearchOutput.new(\n plan: @plan, research_output_type: output_params[:research_output_type]\n )\n authorize @research_output\n end",
"def part_title_by_type(resource_type)\n if self.type == resource_type\n self.title\n elsif self.has_part && self.has_part.type == resource_type\n self.has_part.title\n else\n nil\n end\n end",
"def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n if(self.class::INPUT_TYPES.include?(\"select-one\"))\r\n @element_name = locate_tagged_element(\"select\", @how, @what, self.class::INPUT_TYPES)\r\n else \r\n @element_name = locate_tagged_element(\"input\", @how, @what, self.class::INPUT_TYPES)\r\n end \r\n end\r\n @o = self\r\n end",
"def select_publicly_viewable\n frm.radio(:id=>\"pubview\").set\n end",
"def create_selected_on(template, &block)\n returning PageSelector.new(template) do\n |s| s.on(&block)\n end\n end"
] |
[
"0.5845424",
"0.55968153",
"0.55542445",
"0.5524932",
"0.55233353",
"0.55151033",
"0.55022043",
"0.5495173",
"0.546521",
"0.5424807",
"0.53730696",
"0.53561443",
"0.53497624",
"0.53457004",
"0.5338135",
"0.53283846",
"0.5289929",
"0.5268983",
"0.52685225",
"0.5262414",
"0.52493006",
"0.5248166",
"0.52102333",
"0.5208754",
"0.5188833",
"0.51853544",
"0.5184157",
"0.51699036",
"0.5162717",
"0.51600784",
"0.5153757",
"0.51471746",
"0.51327103",
"0.5126275",
"0.51030934",
"0.5094431",
"0.50889015",
"0.508378",
"0.5083004",
"0.5075935",
"0.5074681",
"0.50619495",
"0.5052756",
"0.5052756",
"0.5052296",
"0.5043308",
"0.50407034",
"0.50396824",
"0.50175345",
"0.50140244",
"0.5007214",
"0.50025696",
"0.49891582",
"0.49812558",
"0.49790078",
"0.49762693",
"0.49706218",
"0.4966655",
"0.49655005",
"0.49622092",
"0.49518317",
"0.49500182",
"0.49357885",
"0.49350965",
"0.49249586",
"0.49228024",
"0.4920029",
"0.4913675",
"0.49135235",
"0.491343",
"0.49127707",
"0.49067158",
"0.49067158",
"0.49064052",
"0.48999393",
"0.4896988",
"0.48934355",
"0.4888743",
"0.48853078",
"0.48762417",
"0.4875854",
"0.4872101",
"0.4864808",
"0.4864808",
"0.48625898",
"0.48623767",
"0.4856567",
"0.48449108",
"0.48442563",
"0.48435795",
"0.48395982",
"0.48352972",
"0.48247018",
"0.48237294",
"0.4823651",
"0.4822286",
"0.48185468",
"0.48178434"
] |
0.504682
|
47
|
changed to add feature flag for featured researcher
|
def display_featured_researcher?
Flipflop.show_featured_researcher?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def feature_flags\n 0\n end",
"def get_required_features(features)\n end",
"def set_featuring\n @featuring = Featuring.find(params[:id])\n end",
"def has_feat ( f )\n return false\n end",
"def append_features(mod) end",
"def legit_feature?\n Flipflop.feature_set.features.map(&:name).include?(params[:feature])\n end",
"def update_feature_flag\n featured = !params[:featured].nil?\n Array(params[:item_ids]).map do |uid|\n item = item_from_uid(uid)\n next unless item.scope == Scopes::SCOPE_PUBLIC && item.featured ^ featured\n\n item.update(featured: featured)\n item.current_user = @context.user\n item\n end.compact\n end",
"def loaded_features; end",
"def legit_feature\n return unless legit_feature?\n\n params[:feature]\n end",
"def feature=(value)\n @feature = value\n end",
"def add_feature(feature)\n return unless feature\n\n @features ||= []\n @features << feature\n end",
"def add_feature(feature)\n @features ||= []\n @features << feature\n end",
"def feature(document)\n #log.debug \"FEATURE\"\n feature = document[:feature]\n return unless document[:feature]\n return if has_exclude_tags?(feature[:tags].map { |t| t[:name].gsub(/^@/, '') })\n\n @feature = YARD::CodeObjects::Lucid::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|\n f.comments = feature[:comments] ? feature[:comments].map{|comment| comment[:text]}.join(\"\\n\") : ''\n f.description = feature[:description] || ''\n f.add_file(@file,feature[:location][:line])\n f.keyword = feature[:keyword]\n f.value = feature[:name]\n f.tags = []\n\n feature[:tags].each {|feature_tag| find_or_create_tag(feature_tag[:name],f) }\n end\n feature[:children].each { |s|\n case s[:type]\n when :Background\n background(s)\n when :ScenarioOutline\n scenario_outline(s)\n when :Scenario\n scenario(s)\n end\n }\n end",
"def add_loaded_features(loaded_features); end",
"def add(feature)\n @set[feature] = true\n end",
"def feature_enable?(feature)\n @features ||= config.features_enable\n @features[feature] == true\nend",
"def feature?(feature)\n definition[:features]&.include?(feature)\n end",
"def feature(name)\n features[name]\n end",
"def enable_features(feature_names)\n self.enabled_features = feature_names\n end",
"def has_feature?(*)\n end",
"def update_features\n self.feature_descriptions = BasketItem.describe_feature_selections(feature_selections)\n end",
"def feature\n @job = Job.find(params[:id])\n @job.featured = true\n @job.save\n\n\t\t@job.update_job_featured_points(\"Featured\")\n\t\tflash[:notice] = 'Job successfully featured.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end",
"def set_feature_flag\n @feature_flag = FeatureFlag.find(params[:id])\n end",
"def feature_setup\n raise NotImplementedError\n end",
"def add_active_feature(feature)\n add_feature(feature, true)\n end",
"def type\n \"Feature\"\n end",
"def type\n \"Feature\"\n end",
"def feature_version(feature); end",
"def feature\n return @feature\n end",
"def features_requested\n if !defined?(@_requested_features)\n @_requested_features = ENV[\"VAGRANT_EXPERIMENTAL\"].to_s.downcase.split(',')\n end\n @_requested_features\n end",
"def supports?(feature_name)\n features.key? feature_name\n end",
"def check_features\n # case params[:action]\n # when \"index\"\n # current_features.include?('feature_key') ? true : invalid_features \n # end\n return true\n end",
"def is_featured=(value)\n @is_featured = value\n end",
"def is_featured=(value)\n @is_featured = value\n end",
"def add_feature\n $LOADED_FEATURES << @feature\n end",
"def set_featured_researcher\n @featured_researcher = FeaturedResearcher.find(params[:id])\n end",
"def use(*features); end",
"def feature(name, &block); begin; yield; features << name; rescue Exception; end; end",
"def features_field\n product_descriptions.where(content_name: \"features\").first_or_initialize\n end",
"def is_feature(test)\n test.metadata[:type].to_s == 'feature'\nend",
"def features\n @features ||= {}\n @features.keys\n end",
"def extract_feature(doc)\n raise \"extract_feature was passed an empty doc!\" if doc.nil?\n pid = (doc/'/feature')[0].attributes['id']\n puts \"extract_feature() -> pid = #{pid}\"\n description = (doc/'/feature/fdesc').inner_html\n feature = Feature.find_or_create_by_pid(pid)\n\n #if(description)\n feature.description = description.strip\n #end\n\n raise \"Feature not saved!\" unless feature.save\n return feature\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_features()#:nodoc:\n # These features are more or less accurate. Many values couldn't be verified because\n # they are used in context of Java programming language a sometimes Nokogiri just\n # dont't provide any information on the feature\n\n features = {\n \"external-general-entities\" => false,\n \"external-parameter-entities\" => false,\n \"is-standalone\" => false, #Zjistit jak ziskat z dokumentu standalone\n \"lexical-handler/parameter-entities\" => false,\n \"namespaces\" => true,\n \"namespace-prefixes\" => true,\n \"resolve-dtd-uris\" => false,\n \"string-interning\" => false,\n \"unicode-normalization-checking\" => true, #Nokogiri probably supports this, needs to be verified\n \"use-attributes2\" => false,\n \"use-locator2\" => false,\n \"use-entity-resolver2\" => false,\n \"validation\" => true, #Nokogiri is probably reporting erros\n \"xmlns-uris\" => true, #Nokogiri is probably treating xmlns declarations as part of xmlns namespace\n \"xml-1.1\" => false #Don't know\n }\n\n return features\n end",
"def feature\n child_node.feature\n end",
"def feature\n child_node.feature\n end",
"def feature(name)\n @feature_name = name\n end",
"def feature(name)\n @feature_name = name\n end",
"def feature(name, docs, hash = {})\n # Not needed to describe the type\n nil\n end",
"def set_feature\n @feature = @project.features.find(params[:featureId])\n end",
"def feature_flag_model\n ::FeatureFlag\n end",
"def is_flagged?(feature)\n flags.include?feature\n end",
"def feature_module\n unless defined?(@feature_module)\n @features ||= {}\n @feature_module = ::Module.new\n const_set(\"FeatureModule\", @feature_module)\n features = @features\n # Create a feature? method that can be passed a feature name and\n # determine if the feature is present.\n @feature_module.send(:define_method, :feature?) do |name|\n method = name.to_s + \"?\"\n return !!(respond_to?(method) and send(method))\n end\n\n # Create a method that will list all functional features.\n @feature_module.send(:define_method, :features) do\n return false unless defined?(features)\n features.keys.find_all { |n| feature?(n) }.sort { |a,b|\n a.to_s <=> b.to_s\n }\n end\n\n # Create a method that will determine if a provided list of\n # features are satisfied by the curred provider.\n @feature_module.send(:define_method, :satisfies?) do |*needed|\n ret = true\n needed.flatten.each do |feature|\n unless feature?(feature)\n ret = false\n break\n end\n end\n ret\n end\n\n # Create a boolean method for each feature so you can test them\n # individually as you might need.\n @features.each do |name, feature|\n method = name.to_s + \"?\"\n @feature_module.send(:define_method, method) do\n (is_a?(Class) ? declared_feature?(name) : self.class.declared_feature?(name)) or feature.available?(self)\n end\n end\n\n # Allow the provider to declare that it has a given feature.\n @feature_module.send(:define_method, :has_features) do |*names|\n @declared_features ||= []\n names.each do |name|\n @declared_features << name.intern\n end\n end\n # Aaah, grammatical correctness\n @feature_module.send(:alias_method, :has_feature, :has_features)\n end\n @feature_module\n end",
"def push_frontend_feature_flag(name, *args)\n var_name = name.to_s.camelize(:lower)\n enabled = Feature.enabled?(name, *args)\n\n # Here the `true` argument signals gon that the value should be merged\n # into any existing ones, instead of overwriting them. This allows you to\n # use this method to push multiple feature flags.\n gon.push({ features: { var_name => enabled } }, true)\n end",
"def featured\n request('featured')\n end",
"def before_feature(feature)\n @current_category = get_current_category(:path => feature.file, :root_category => @results)\n @current_feature = {}\n end",
"def is_featured\n return @is_featured\n end",
"def is_featured\n return @is_featured\n end",
"def get_sax_feature(feature)\n \n end",
"def feature\n @property[:feature]\n end",
"def provider_feature(name)\n return nil unless defined?(@features)\n\n @features[name]\n end",
"def _init_global_features()\n @_global_features = {}\n end",
"def set_featured\n @featured = Featured.friendly.find(params[:id])\n end",
"def get_featured\n\t\t{:recent => \"Recently Started\", :ending => \"Ending Soon\", :small => \"Small Projects\"}\n\tend",
"def create\n @feature = Feature.new(params[:feature])\n @feature.user = current_user\n @feature.progress = Feature::PROGRESS[0]\n @feature.status = Feature::STATUSES[0]\n @feature.description = replace_for_update(@feature.description)\n\n respond_to do |format|\n if @feature.save\n flash[:notice] = 'Feature was successfully created.'\n format.html { update_user_edit_stats; redirect_to(@feature) }\n format.xml { render :xml => @feature, :status => :created, :location => @feature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def append_features(base)\n puts \"#{base} is appended with new features\"\n end",
"def append_features( hooked_instance )\n \n original_append_features( hooked_instance )\n super if defined?( super )\n \n end",
"def start_features(_features)\n raise NotImplementedError.new \\\n \"#{self.class.name}#before_features must be implemented in subclass.\"\n end",
"def single_features\r\n\tcase self.feature_groups.where(singles: true).first\r\n\twhen nil\r\n\t\tself.feature_groups.create(singles: true)\r\n\telse \r\n\t\tself.feature_groups.where(singles: true).first\r\n\tend\r\n end",
"def list_features *args\r\n puts \"not implemented yet\"\r\n end",
"def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n puts \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by_old_pid(old_pid)\n if feature.nil?\n puts \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n puts \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end",
"def features\n features = {}\n sexp_newtype_block.each do |s|\n if s[0] == :command and\n s[1][0..1] == [:@ident, \"feature\"] and\n s[2][0] == :args_add_block\n\n name = s[2][1][0][1][1][1]\n desc = s[2][1][1][1][1][1]\n\n features[name] = desc\n end\n end\n\n features\n end",
"def toggle_featured!\n self.update_attribute(:featured, !self.featured?)\n self.featured?\n end",
"def add_features(doc, features)\n fm = REXML::Element.new('featureManager', doc)\n features.each do |feature|\n f = REXML::Element.new('feature', fm)\n f.add_text(feature)\n end\n end",
"def initialize\n self.features = {}\n end",
"def set_feature\n @feature = Feature.find( params[ :id ])\n end",
"def draw_feature( image, feature, x, y )\n if feature.feature_type == \"exon\" and not feature.feature_name.match(/En2/)\n if feature.feature_name.match(/fragment/)\n draw_exon_fragment( image, x, y )\n else\n draw_exon( image, x, y )\n end\n elsif feature.feature_type == \"promoter\"\n draw_promoter( image, feature, [x, y] )\n else\n case feature.feature_name\n when \"FRT\"\n draw_frt( image, feature, x, y )\n when \"loxP\"\n draw_loxp( image, feature, x, y )\n when \"Rox\"\n draw_rox( image, feature, x, y )\n when \"AttP\"\n draw_attp( image, feature, x, y )\n when \"intervening sequence\"\n draw_intervening_sequence( image, x, y )\n when \"F3\"\n draw_f3( image, feature, x, y )\n when \"AsiSI\"\n draw_asisi( image, feature, [x, y] )\n when \"ori\"\n draw_ori( image, x, y )\n when \"En2 SA (ATG)\"\n draw_en2_k_frame( image, feature, [x, y] )\n when \"PGK_DTA_pA\"\n draw_pgk_dta_pa( image, feature, [x, y] )\n when \"pA_DTA_PGK\"\n draw_pa_dta_pgk( image, feature, [x, y] )\n # Any non-speciall feature is probably a cassette feature\n # and can be rendered with the feature.render_options()\n else\n draw_cassette_feature( image, feature, x, y )\n end\n end\n end",
"def define_features\n @fvs.each do |vector, label|\n vector.each do |term, value|\n @features.add(term)\n end\n end\n end",
"def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n self.say \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by(old_pid: old_pid)\n if feature.nil?\n self.say \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n self.say \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end",
"def processor_features\n data[:processor_features]\n end",
"def update!(**args)\n @features = args[:features] if args.key?(:features)\n end",
"def add_feature(feature_object, opts = {})\n # Calculate the ultimate start and stop of the feature: the start\n # of the first subfeature (e.g. exon) and the stop of the last one.\n # The only reason we want to know these positions, is because we want\n # to determine if the feature falls within the view of the image or\n # not (see below).\n start = feature_object.locations.collect{|l| l.from}.min.to_i\n stop = feature_object.locations.collect{|l| l.to}.max.to_i\n\n # If the feature wouldn't show because it's not in the region we're\n # looking at, don't bother storing the stuff. I think this makes huge\n # speed and memory differences if you've got a chromosome with\n # thousands of features.\n if stop <= self.panel.display_start or start >= self.panel.display_stop\n return nil\n else #elsif start >= panel.display_start and stop <= panel.display_stop\n @features.push(Bio::Graphics::Feature.new(self, feature_object, opts))\n return @features[-1]\n end\n\n return self\n end",
"def get_features(frag, model)\n w1 = (frag.cleaned.last or '')\n w2 = (frag.next or '')\n\n frag.features = [\"w1_#{w1}\", \"w2_#{w2}\", \"both_#{w1}_#{w2}\"]\n\n if not w2.empty?\n if w1.chop.is_alphabetic? \n frag.features.push \"w1length_#{[10, w1.length].min}\", \"w1abbr_#{model.non_abbrs[w1.chop]}\"\n end\n\n if w2.chop.is_alphabetic?\n frag.features.push \"w2cap_#{w2[0,1].is_upper_case?}\", \"w2lower_#{model.lower_words[w2.downcase]}\"\n end\n end\n end",
"def featured_representatives\n FeaturedRepresentative.where(work_id: 'mono')\n end",
"def feature_params\n params.require(:feature).permit(:is_public, :fid, :is_blank, :ancestor_ids, :skip_update, names: [:name, :feature_name_type_id, :language_id, :writing_system_id, :etymology, :feature_name, :is_primary_for_romanization, :ancestor_ids, :skip_update, :feature_id, :position], all_parent_relations: [:perspective_id, :parent_node_id, :child_node_id, :feature_relation_type_id, :ancestor_ids, :skip_update])\n end",
"def features_path\n @features_path || 'features'\n end",
"def added_skill_types\r\n features_set(FEATURE_STYPE_ADD)\r\n end",
"def feature_type\n raise 'feature_type not implemented for Feature, override in your class'\n end",
"def feature_type\n raise 'feature_type not implemented for Feature, override in your class'\n end",
"def feature(name, docs, hash = {})\n @features ||= {}\n raise(Puppet::DevError, \"Feature #{name} is already defined\") if @features.include?(name)\n begin\n obj = ProviderFeature.new(name, docs, hash)\n @features[obj.name] = obj\n rescue ArgumentError => detail\n error = ArgumentError.new(\n \"Could not create feature #{name}: #{detail}\"\n )\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end",
"def add_features(doc, features)\n fm = REXML::Element.new('featureManager', doc)\n features.each do |feature|\n f = REXML::Element.new('feature', fm)\n f.add_text(feature)\n end\n end",
"def feature\n @item_attributes.feature.collect {|f| f.to_s}\n end",
"def configured_feature_flags\n feature_flag_options.sort_by(&:name).map(&:to_h).reduce({}, :merge).with_indifferent_access\n end",
"def use_technology_preview; end",
"def index\n @featuring = Featuring.all\n end",
"def set_featured\n @featured = Featured.find(params[:id])\n end",
"def get_features(frag, model)\n w1 = (frag.cleaned.last or '')\n w2 = (frag.next or '')\n\n frag.features = [\"w1_#{w1}\", \"w2_#{w2}\", \"both_#{w1}_#{w2}\"]\n\n if not w2.empty?\n if w1.chop.is_alphabetic? \n frag.features.push \"w1length_#{[10, w1.length].min}\"\n frag.features.push \"w1abbr_#{model.non_abbrs[w1.chop]}\"\n end\n\n if w2.chop.is_alphabetic?\n frag.features.push \"w2cap_#{w2[0].is_upper_case?}\"\n frag.features.push \"w2lower_#{model.lower_words[w2.downcase]}\"\n end\n end\n end",
"def technical_features\n @tech_feat = {\n pros: @pros,\n cons: @cons,\n used_by: @used_by,\n consensus_type: @consensus_type,\n explanation: @explanation,\n further_reading: @further_reading\n }\n\n puts \"\"\n return @tech_feat\n end",
"def find_feature\n @feature = Feature.get_by_fid(params[:feature_id]) # Feature.find(params[:feature_id])\n end"
] |
[
"0.68857735",
"0.6830483",
"0.67920166",
"0.67553765",
"0.6669886",
"0.6636096",
"0.66227627",
"0.66180146",
"0.65925425",
"0.65370494",
"0.65064836",
"0.6467436",
"0.6467381",
"0.6466313",
"0.64478",
"0.64109653",
"0.6382161",
"0.6380248",
"0.6368259",
"0.6356401",
"0.6338464",
"0.6327794",
"0.6322464",
"0.6303575",
"0.6293685",
"0.6292521",
"0.6292521",
"0.62676567",
"0.62414277",
"0.62352914",
"0.62157166",
"0.61895293",
"0.6174846",
"0.6174846",
"0.6161844",
"0.6156256",
"0.61478674",
"0.6134882",
"0.61282367",
"0.61220306",
"0.611857",
"0.61031204",
"0.60976726",
"0.60976726",
"0.60857195",
"0.60821706",
"0.60821706",
"0.60677874",
"0.60677874",
"0.6054879",
"0.6029755",
"0.6024102",
"0.60188687",
"0.60176605",
"0.6014163",
"0.5999083",
"0.5998798",
"0.5994082",
"0.5994082",
"0.5993529",
"0.5992639",
"0.5991595",
"0.5972398",
"0.59423107",
"0.5938134",
"0.59359276",
"0.59301937",
"0.59277886",
"0.59121346",
"0.5902999",
"0.5895834",
"0.58938754",
"0.58936274",
"0.5893385",
"0.58859557",
"0.58820957",
"0.5876854",
"0.5869094",
"0.58672583",
"0.5867247",
"0.5866275",
"0.58651775",
"0.58647615",
"0.5854808",
"0.58502126",
"0.58381176",
"0.58351356",
"0.5821165",
"0.5812547",
"0.5812547",
"0.581181",
"0.5811804",
"0.5808569",
"0.58070475",
"0.5804662",
"0.58030367",
"0.57988435",
"0.57982236",
"0.57975984",
"0.5787997"
] |
0.6318939
|
23
|
changed to add feature flag for featured work
|
def display_featured_works?
Flipflop.show_featured_works?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def feature\n @job = Job.find(params[:id])\n @job.featured = true\n @job.save\n\n\t\t@job.update_job_featured_points(\"Featured\")\n\t\tflash[:notice] = 'Job successfully featured.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end",
"def update_feature_flag\n featured = !params[:featured].nil?\n Array(params[:item_ids]).map do |uid|\n item = item_from_uid(uid)\n next unless item.scope == Scopes::SCOPE_PUBLIC && item.featured ^ featured\n\n item.update(featured: featured)\n item.current_user = @context.user\n item\n end.compact\n end",
"def legit_feature?\n Flipflop.feature_set.features.map(&:name).include?(params[:feature])\n end",
"def get_featured\n\t\t{:recent => \"Recently Started\", :ending => \"Ending Soon\", :small => \"Small Projects\"}\n\tend",
"def is_featured\n return @is_featured\n end",
"def is_featured\n return @is_featured\n end",
"def add_active_feature(feature)\n add_feature(feature, true)\n end",
"def feature_enable?(feature)\n @features ||= config.features_enable\n @features[feature] == true\nend",
"def get_required_features(features)\n end",
"def has_feature?(*)\n end",
"def has_feat ( f )\n return false\n end",
"def is_featured=(value)\n @is_featured = value\n end",
"def is_featured=(value)\n @is_featured = value\n end",
"def feature_flags\n 0\n end",
"def toggle_featured!\n self.update_attribute(:featured, !self.featured?)\n self.featured?\n end",
"def legit_feature\n return unless legit_feature?\n\n params[:feature]\n end",
"def set_feature_paid_for \n @features = ProjectMilestone.where(project_id: @project.id).limit(2)\n end",
"def update_features\n self.feature_descriptions = BasketItem.describe_feature_selections(feature_selections)\n end",
"def featured\n request('featured')\n end",
"def add_feature(feature)\n return unless feature\n\n @features ||= []\n @features << feature\n end",
"def feature?(feature)\n definition[:features]&.include?(feature)\n end",
"def feature_version(feature); end",
"def feature\n return @feature\n end",
"def add_feature(feature)\n @features ||= []\n @features << feature\n end",
"def type\n \"Feature\"\n end",
"def type\n \"Feature\"\n end",
"def loaded_features; end",
"def featured_representatives\n FeaturedRepresentative.where(work_id: 'mono')\n end",
"def feature_setup\n raise NotImplementedError\n end",
"def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n self.say \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by(old_pid: old_pid)\n if feature.nil?\n self.say \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n self.say \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end",
"def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n puts \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by_old_pid(old_pid)\n if feature.nil?\n puts \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n puts \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end",
"def check_features\n # case params[:action]\n # when \"index\"\n # current_features.include?('feature_key') ? true : invalid_features \n # end\n return true\n end",
"def set_feature_flag\n @feature_flag = FeatureFlag.find(params[:id])\n end",
"def supports?(feature_name)\n features.key? feature_name\n end",
"def create\n @feature = Feature.new(params[:feature])\n @feature.user = current_user\n @feature.progress = Feature::PROGRESS[0]\n @feature.status = Feature::STATUSES[0]\n @feature.description = replace_for_update(@feature.description)\n\n respond_to do |format|\n if @feature.save\n flash[:notice] = 'Feature was successfully created.'\n format.html { update_user_edit_stats; redirect_to(@feature) }\n format.xml { render :xml => @feature, :status => :created, :location => @feature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_featuring\n @featuring = Featuring.find(params[:id])\n end",
"def is_feature(test)\n test.metadata[:type].to_s == 'feature'\nend",
"def toggle!\n self.featured = !self.featured\n save\n end",
"def append_features(mod) end",
"def start_features(_features)\n raise NotImplementedError.new \\\n \"#{self.class.name}#before_features must be implemented in subclass.\"\n end",
"def extract_feature(doc)\n raise \"extract_feature was passed an empty doc!\" if doc.nil?\n pid = (doc/'/feature')[0].attributes['id']\n puts \"extract_feature() -> pid = #{pid}\"\n description = (doc/'/feature/fdesc').inner_html\n feature = Feature.find_or_create_by_pid(pid)\n\n #if(description)\n feature.description = description.strip\n #end\n\n raise \"Feature not saved!\" unless feature.save\n return feature\n end",
"def before_feature(feature)\n @current_category = get_current_category(:path => feature.file, :root_category => @results)\n @current_feature = {}\n end",
"def estimable?\n story_type == 'feature' && !estimated?\n end",
"def is_flagged?(feature)\n flags.include?feature\n end",
"def features_field\n product_descriptions.where(content_name: \"features\").first_or_initialize\n end",
"def feature\n @property[:feature]\n end",
"def add(feature)\n @set[feature] = true\n end",
"def set_featured\n @featured = Featured.friendly.find(params[:id])\n end",
"def set_feature\n @feature = @project.features.find(params[:featureId])\n end",
"def check_if_featured_changed\n if \"featured\".in?(self.changed) && featured\n unless remaining_articles(:featured).blank?\n\n remaining_articles(:featured).each do |article|\n article.featured = false\n article.save\n end\n\n end\n end\n end",
"def unfeature\n @job = Job.find(params[:id])\n @job.featured = false\n @job.save\n\n\t\t@job.update_job_featured_points(\"Unfeatured\")\n\t\tflash[:notice] = 'Job successfully unfeatured.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end",
"def set_featured\n @featured = Featured.find(params[:id])\n end",
"def feature\n child_node.feature\n end",
"def feature\n child_node.feature\n end",
"def feature(document)\n #log.debug \"FEATURE\"\n feature = document[:feature]\n return unless document[:feature]\n return if has_exclude_tags?(feature[:tags].map { |t| t[:name].gsub(/^@/, '') })\n\n @feature = YARD::CodeObjects::Lucid::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|\n f.comments = feature[:comments] ? feature[:comments].map{|comment| comment[:text]}.join(\"\\n\") : ''\n f.description = feature[:description] || ''\n f.add_file(@file,feature[:location][:line])\n f.keyword = feature[:keyword]\n f.value = feature[:name]\n f.tags = []\n\n feature[:tags].each {|feature_tag| find_or_create_tag(feature_tag[:name],f) }\n end\n feature[:children].each { |s|\n case s[:type]\n when :Background\n background(s)\n when :ScenarioOutline\n scenario_outline(s)\n when :Scenario\n scenario(s)\n end\n }\n end",
"def push_frontend_feature_flag(name, *args)\n var_name = name.to_s.camelize(:lower)\n enabled = Feature.enabled?(name, *args)\n\n # Here the `true` argument signals gon that the value should be merged\n # into any existing ones, instead of overwriting them. This allows you to\n # use this method to push multiple feature flags.\n gon.push({ features: { var_name => enabled } }, true)\n end",
"def enable_features(feature_names)\n self.enabled_features = feature_names\n end",
"def feature_without_category?\n if @feature_without_category.nil?\n @feature_without_category = %w(all both).include?(featured)\n end\n @feature_without_category\n end",
"def feature=(value)\n @feature = value\n end",
"def add_feature\n $LOADED_FEATURES << @feature\n end",
"def display_featured_researcher?\n Flipflop.show_featured_researcher?\n end",
"def features\n features = {}\n sexp_newtype_block.each do |s|\n if s[0] == :command and\n s[1][0..1] == [:@ident, \"feature\"] and\n s[2][0] == :args_add_block\n\n name = s[2][1][0][1][1][1]\n desc = s[2][1][1][1][1][1]\n\n features[name] = desc\n end\n end\n\n features\n end",
"def featured?\n featured_at?\n end",
"def features\n features = Hash[api.get_features(app).body.map{|feature| [feature['name'], feature['enabled']]}]\n actual_features = Hash[api.get_features(target_app).body.map{|feature| [feature['name'], feature['enabled']]}]\n\n features_to_enable = features.select{|feature, enabled| enabled && !actual_features[feature]}\n features_to_disable = actual_features.select{|feature, enabled| enabled && !features[feature]}\n\n action(\"Copying labs features from #{app} and restarting #{target_app}\") do\n features_to_enable.each do |feature|\n puts \"Adding #{feature} to #{target_app}\"\n api.post_feature(feature, target_app)\n end\n\n features_to_disable.each do |feature|\n puts \"Deleting #{feature} from #{target_app}\"\n api.delete_feature(feature, target_app)\n end\n end\n end",
"def feature(name)\n features[name]\n end",
"def before_feature(_feature)\n raise NotImplementedError.new \\\n \"#{self.class.name}#start_feature must be implemented in subclass.\"\n end",
"def use(*features); end",
"def show\n @feature = Feature.find(params[:id])\n # @homepage_features = Feature.homepage_list.published\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feature }\n end\n end",
"def show_subfeature\n ::Actions::Features::YourFeature1::YourSubfeature1.new(bot: bot, user: user, some_attr: 'attr').show\n end",
"def feature_flag_model\n ::FeatureFlag\n end",
"def feature(name, &block); begin; yield; features << name; rescue Exception; end; end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def features_requested\n if !defined?(@_requested_features)\n @_requested_features = ENV[\"VAGRANT_EXPERIMENTAL\"].to_s.downcase.split(',')\n end\n @_requested_features\n end",
"def start_feature(_feature)\n raise NotImplementedError.new \\\n \"#{self.class.name}#start_feature must be implemented in subclass.\"\n end",
"def current_theme_supports( feature, *args )\n return current_theme_supports('custom-header', 'uploads') if feature == 'custom-header-uploads'\n\n return false if !isset( Railspress.GLOBAL._wp_theme_features[ feature ] )\n\n # If no args passed then no extra checks need be performed\n return true if args.blank?\n\n case feature\n when 'post-thumbnails'\n # post-thumbnails can be registered for only certain content/post types by passing\n # an array of types to add_theme_support(). If no array was passed, then\n # any type is accepted\n return true if Railspress.GLOBAL._wp_theme_features[ feature ] == true # Registered for all types\n\n content_type = args[0]\n return Railspress.GLOBAL._wp_theme_features[ feature ][0].include?(content_type)\n\n when 'html5', 'post-formats'\n # specific post formats can be registered by passing an array of types to\n # add_theme_support()\n\n # Specific areas of HTML5 support *must* be passed via an array to add_theme_support()\n type = args[0]\n return Railspress.GLOBAL._wp_theme_features[ feature ][0].include?(type)\n\n when 'custom-logo', 'custom-header', 'custom-background'\n # Specific capabilities can be registered by passing an array to add_theme_support().\n return ( !Railspress.GLOBAL._wp_theme_features[feature][0][args[0]].blank? && Railspress.GLOBAL._wp_theme_features[feature][0][args[0]] )\n end\n\n # Filters whether the current theme supports a specific feature.\n #\n # The dynamic portion of the hook name, `$feature`, refers to the specific theme\n # feature. Possible values include 'post-formats', 'post-thumbnails', 'custom-background',\n # 'custom-header', 'menus', 'automatic-feed-links', 'html5',\n # 'starter-content', and 'customize-selective-refresh-widgets'.\n #\n # @param bool true Whether the current theme supports the given feature. Default true.\n # @param array $args Array of arguments for the feature.\n # @param string $feature The theme feature.\n apply_filters( \"current_theme_supports-#{feature}\", true, args, _wp_theme_features[ feature ] )\n end",
"def invert_feature\n raise ApiError, \"Only Site Admin can perform this action\" unless @context.can_administer_site?\n\n items = update_feature_flag\n\n messages =\n if items.count.positive?\n message_key =\n if items.first.featured?\n \"api.feature.messages.featured\"\n else\n \"api.feature.messages.un_featured\"\n end\n [{ type: \"success\", message: I18n.t(message_key) }]\n else\n [{ type: \"error\", message: I18n.t(\"api.feature.messages.failed\") }]\n end\n\n render json: items, root: \"items\", adapter: :json, meta: messages\n end",
"def supports?(feature)\n features.include?(feature)\n end",
"def add_loaded_features(loaded_features); end",
"def support\n end",
"def estimated?\n (self.story_type == 'feature') && self.story_points\n end",
"def feature?(feature=RC.current_feature)\n return true if self.feature.nil?\n self.feature == feature.to_s\n end",
"def feature(name, docs, hash = {})\n # Not needed to describe the type\n nil\n end",
"def toggle_featured\n authorize! @cookbook\n\n @cookbook.update(featured: !@cookbook.featured)\n\n redirect_to(\n cookbook_path(@cookbook),\n notice: t(\n \"cookbook.featured\",\n cookbook: @cookbook.name,\n state: @cookbook.featured? ? \"featured\" : \"unfeatured\"\n )\n )\n end",
"def feature_type\n raise 'feature_type not implemented for Feature, override in your class'\n end",
"def feature_type\n raise 'feature_type not implemented for Feature, override in your class'\n end",
"def feature_with_category?\n if @feature_with_category.nil?\n @feature_with_category = %w(category both).include?(featured)\n end\n @feature_with_category\n end",
"def add_inactive_feature(feature)\n add_feature(feature, false)\n end",
"def influences_these_works\n find_related_frbr_objects( :is_an_influence_on, :which_works?) \n end",
"def list_features *args\r\n puts \"not implemented yet\"\r\n end",
"def post_type_supports(post_type, feature)\n !Railspress.GLOBAL._wp_post_type_features[post_type][feature].nil?\n end",
"def needs_fix?\n active? && flagged?\n end",
"def featured(number)\n \nend",
"def single_features\r\n\tcase self.feature_groups.where(singles: true).first\r\n\twhen nil\r\n\t\tself.feature_groups.create(singles: true)\r\n\telse \r\n\t\tself.feature_groups.where(singles: true).first\r\n\tend\r\n end",
"def featured_olympiad\n @featured_olympiad ||= Olympiad.featured_olympiad()\n end",
"def use_technology_preview; end",
"def get_features(frag, model)\n w1 = (frag.cleaned.last or '')\n w2 = (frag.next or '')\n\n frag.features = [\"w1_#{w1}\", \"w2_#{w2}\", \"both_#{w1}_#{w2}\"]\n\n if not w2.empty?\n if w1.chop.is_alphabetic? \n frag.features.push \"w1length_#{[10, w1.length].min}\", \"w1abbr_#{model.non_abbrs[w1.chop]}\"\n end\n\n if w2.chop.is_alphabetic?\n frag.features.push \"w2cap_#{w2[0,1].is_upper_case?}\", \"w2lower_#{model.lower_words[w2.downcase]}\"\n end\n end\n end",
"def set_feature\n @feature = Feature.find(params[:id])\n end",
"def create\n @feature = Feature.new(feature_params)\n\n respond_to do |format|\n if @feature.save\n if @feature.is_active\n deactivate_all_features(@feature.id)\n end\n format.html { redirect_to(@feature, :notice => 'Feature was successfully created.') }\n format.xml { render :xml => @feature, :status => :created, :location => @feature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('present_index') ? true : invalid_features\n when \"employee_present\"\n current_features.include?('present_employee') ? true : invalid_features\n when \"my_absence\"\n current_features.include?('present_detail') ? true : invalid_features\n when \"presence_report\"\n current_features.include?('present_report') ? true : invalid_features\n\n # Terlambat tab\n when \"late\"\n current_features.include?('late_index') ? true : invalid_features\n when \"override_late\"\n current_features.include?('override') ? true : invalid_features\n when \"show\"\n current_features.include?('late_detail') ? true : invalid_features\n\n # Jam Kerja Lebih tab\n when \"more_hour\"\n current_features.include?('working_hours_more_index') ? true : invalid_features\n\n # Jam Kerja Kurang tab\n when \"less_hour\"\n current_features.include?('working_hours_less_index') ? true : invalid_features\n\n # Istirahat Lebih tab\n when \"more_rest\"\n current_features.include?('less_rest_index') ? true : invalid_features\n\n # Istirahat Kurang tab\n when \"less_rest\"\n current_features.include?('more_rest_index') ? true : invalid_features\n\n # Tidak Masuk tab\n when \"absent\"\n current_features.include?('absence_index') ? true : invalid_features\n\n # Tidak Lengkap tab\n when \"no_logout\"\n current_features.include?('employee_no_end_work_time_index') ? true : invalid_features\n end\n # return true\n end"
] |
[
"0.67613715",
"0.6695411",
"0.6439379",
"0.64391464",
"0.64128065",
"0.64128065",
"0.639853",
"0.6334965",
"0.63262063",
"0.63166547",
"0.62993044",
"0.62879825",
"0.62879825",
"0.62837744",
"0.62624097",
"0.6249091",
"0.62483096",
"0.61840636",
"0.6171695",
"0.6168008",
"0.6157622",
"0.61526597",
"0.6137335",
"0.61239684",
"0.6101214",
"0.6101214",
"0.60826236",
"0.6071758",
"0.6071334",
"0.604889",
"0.6045376",
"0.6036776",
"0.60299253",
"0.60115874",
"0.60006857",
"0.5983817",
"0.59803975",
"0.5977956",
"0.5972143",
"0.5945144",
"0.59437466",
"0.5935685",
"0.5922235",
"0.5912161",
"0.59067863",
"0.58998203",
"0.58940274",
"0.58916366",
"0.5881696",
"0.5874287",
"0.5871568",
"0.5866274",
"0.586233",
"0.586233",
"0.5859468",
"0.5844184",
"0.5835398",
"0.58310866",
"0.58308834",
"0.58289695",
"0.5815242",
"0.5814106",
"0.5813179",
"0.5810427",
"0.5805677",
"0.58018565",
"0.5795287",
"0.57947636",
"0.5792804",
"0.5790482",
"0.57889766",
"0.5778782",
"0.5778782",
"0.5767705",
"0.5751123",
"0.5750588",
"0.5750564",
"0.57407594",
"0.57376313",
"0.57043004",
"0.57027364",
"0.5702384",
"0.56986076",
"0.56909233",
"0.5690267",
"0.5690267",
"0.56671774",
"0.5666809",
"0.5663049",
"0.5662461",
"0.56567013",
"0.56444347",
"0.56412494",
"0.5632098",
"0.56201464",
"0.561817",
"0.5615124",
"0.56137174",
"0.56135374",
"0.5611641"
] |
0.6514683
|
2
|
changed to add feature flag for recently uploaded
|
def display_recently_uploaded?
Flipflop.show_recently_uploaded?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_feature_flag\n featured = !params[:featured].nil?\n Array(params[:item_ids]).map do |uid|\n item = item_from_uid(uid)\n next unless item.scope == Scopes::SCOPE_PUBLIC && item.featured ^ featured\n\n item.update(featured: featured)\n item.current_user = @context.user\n item\n end.compact\n end",
"def add_active_feature(feature)\n add_feature(feature, true)\n end",
"def create\n @feature = Feature.new(params[:feature])\n @feature.user = current_user\n @feature.progress = Feature::PROGRESS[0]\n @feature.status = Feature::STATUSES[0]\n @feature.description = replace_for_update(@feature.description)\n\n respond_to do |format|\n if @feature.save\n flash[:notice] = 'Feature was successfully created.'\n format.html { update_user_edit_stats; redirect_to(@feature) }\n format.xml { render :xml => @feature, :status => :created, :location => @feature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_feature(feature)\n @features ||= []\n @features << feature\n end",
"def add_loaded_features(loaded_features); end",
"def feature_flags\n 0\n end",
"def add_feature(feature)\n return unless feature\n\n @features ||= []\n @features << feature\n end",
"def set_feature_flag\n @feature_flag = FeatureFlag.find(params[:id])\n end",
"def update_feature_flag\n raise ApiExceptionHandler, Message.not_allowed unless @context.user.site_admin?\n\n FileService::ToggleFeaturePublicFolderService.new(params, @context).call\n end",
"def feature_version(feature); end",
"def is_feature_update=(value)\n @is_feature_update = value\n end",
"def feature\n @job = Job.find(params[:id])\n @job.featured = true\n @job.save\n\n\t\t@job.update_job_featured_points(\"Featured\")\n\t\tflash[:notice] = 'Job successfully featured.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end",
"def add_feature\n $LOADED_FEATURES << @feature\n end",
"def add(feature)\n @set[feature] = true\n end",
"def append_features(mod) end",
"def push_frontend_feature_flag(name, *args)\n var_name = name.to_s.camelize(:lower)\n enabled = Feature.enabled?(name, *args)\n\n # Here the `true` argument signals gon that the value should be merged\n # into any existing ones, instead of overwriting them. This allows you to\n # use this method to push multiple feature flags.\n gon.push({ features: { var_name => enabled } }, true)\n end",
"def is_feature_update\n return @is_feature_update\n end",
"def has_feat ( f )\n return false\n end",
"def loaded_features; end",
"def add_inactive_feature(feature)\n add_feature(feature, false)\n end",
"def feature_upload(id, file)\r\n dir = \"home_features\"\r\n file.original_filename = id.to_s + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end",
"def before_feature(feature)\n @current_category = get_current_category(:path => feature.file, :root_category => @results)\n @current_feature = {}\n end",
"def is_flagged?(feature)\n flags.include?feature\n end",
"def legit_feature\n return unless legit_feature?\n\n params[:feature]\n end",
"def create\n respond_to do |format|\n if @feature.save\n flash[:notice] = 'Feature was successfully created.'\n @changed << @feature.id\n \n format.html { redirect_to features_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @feature, status: :created, location: @feature }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'feature' }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flag; end",
"def feature_flag_model\n ::FeatureFlag\n end",
"def update_features\n self.feature_descriptions = BasketItem.describe_feature_selections(feature_selections)\n end",
"def type\n \"Feature\"\n end",
"def type\n \"Feature\"\n end",
"def legit_feature?\n Flipflop.feature_set.features.map(&:name).include?(params[:feature])\n end",
"def save_feature( args )\n app_name = args.delete( :app_name )\n route_info = args.delete( :route_info )\n environment = args.delete( :environment )\n \n row = { min_field(:app_name) => app_name, min_field(:env) => environment.to_s }\n if route_info\n row[min_field(:controller)] = route_info[:controller]\n row[min_field(:action)] = route_info[:action]\n else\n row[min_field(:context)] = args.delete( :path )\n end\n \n feature = features.find_one( row, :fields => ['_id'] )\n return feature['_id'] if feature\n\n now = args[:created_at]\n row[min_field(:date_id)] = \"%4d%02d%02d\" %[now.year, now.month, now.day]\n \n features.save( row )\n end",
"def flags; end",
"def index\n @features = Feature.all.added_by(current_user.id)\n end",
"def added_skill_types\r\n features_set(FEATURE_STYPE_ADD)\r\n end",
"def create\n @feature = Feature.new(params[:feature])\n @feature.user = current_user\n\n respond_to do |format|\n if @feature.save\n if @feature.is_published\n @feature.create_activity :create, owner: current_user\n end\n format.html { redirect_to( \"/admin\", {notice: 'Feature was successfully created.'}) }\n format.json { render json: @feature, status: :created, location: @feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def before_feature_element(feature_element)\n @in_feature_element = true\n @current_feature[:elements] = [] if @current_feature[:elements].nil?\n @current_feature_element = {}\n @current_feature[:elements] << @current_feature_element\n end",
"def add(feature)\n @client.sadd(FeaturesKey.to_s, feature.name.to_s)\n true\n end",
"def create\n @feature = Feature.new(feature_params)\n ##Le asigno el id del usuario que esta logueado en ese momento\n @feature.publicationDate = Time.now\n @feature.publicationState = 'Pendiente' \n @feature.user = User.find(session[:user_id])\n @feature.totalLikes = 0\n respond_to do |format|\n if @feature.save\n ##Despues de salvado el articulo, le asigno por defecto unos valores\n format.html { redirect_to user_path(current_user)}\n format.json { render :show, status: :created, location: @feature }\n else\n format.html { render :new }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def append_features( hooked_instance )\n \n original_append_features( hooked_instance )\n super if defined?( super )\n \n end",
"def feature=(value)\n @feature = value\n end",
"def feature(document)\n #log.debug \"FEATURE\"\n feature = document[:feature]\n return unless document[:feature]\n return if has_exclude_tags?(feature[:tags].map { |t| t[:name].gsub(/^@/, '') })\n\n @feature = YARD::CodeObjects::Lucid::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|\n f.comments = feature[:comments] ? feature[:comments].map{|comment| comment[:text]}.join(\"\\n\") : ''\n f.description = feature[:description] || ''\n f.add_file(@file,feature[:location][:line])\n f.keyword = feature[:keyword]\n f.value = feature[:name]\n f.tags = []\n\n feature[:tags].each {|feature_tag| find_or_create_tag(feature_tag[:name],f) }\n end\n feature[:children].each { |s|\n case s[:type]\n when :Background\n background(s)\n when :ScenarioOutline\n scenario_outline(s)\n when :Scenario\n scenario(s)\n end\n }\n end",
"def add_feature\n name = @feature.suffix?(\".rbc\") ? @feature[0..-2] : @feature\n $LOADED_FEATURES << name\n end",
"def feature_files\n features = Redcukes::Issue.cucumber_features\n features.each do |feature|\n @tags = get_tags feature\n write_feature_file(build_feature_filename(feature), build_source(feature)) if is_valid?(feature)\n end\n # proceed as usual\n original_feature_files\n end",
"def new_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/create_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n $created_count = $created_count + 1\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n puts \"Feature '#{get_name_feature_from_file(feature_content)}' created.\"\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend",
"def set_featuring\n @featuring = Featuring.find(params[:id])\n end",
"def create\n prev_trip = Trip.where(featured: true)\n @trip = Trip.find(params[:trip_id])\n @trip.featured = true\n\n if @trip.save\n prev_trip.update_column(:featured, false)\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scan_ff_for_tag feature\n if feature[:gherkin][\"tags\"]\n feature[:gherkin][\"tags\"].each do |tag|\n if tag[\"name\"] == Observer.tag\n f = feature.clone\n @@tag_features << f\n @num = false\n puts \"\"\n end\n end\n end\n end",
"def version_added; end",
"def feature_flag_params\n params.require(:feature_flag).permit(:name, :value, :description)\n end",
"def append_features(base)\n puts \"#{base} is appended with new features\"\n end",
"def update\n respond_to do |format|\n if @feature.update(feature_params)\n @feature.update(publicationState: 'Pendiente')\n format.html { redirect_to user_path(current_user) }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_features\n # case params[:action]\n # when \"index\"\n # current_features.include?('feature_key') ? true : invalid_features \n # end\n return true\n end",
"def hook_add_files\n @flavor.class.after_add_files do |files, resource_action, type|\n files.each do |file|\n actions_taken << \"#{resource_action} #{type} #{file}\"\n end\n end\n end",
"def check_if_featured_changed\n if \"featured\".in?(self.changed) && featured\n unless remaining_articles(:featured).blank?\n\n remaining_articles(:featured).each do |article|\n article.featured = false\n article.save\n end\n\n end\n end\n end",
"def feature_flags_with_defaults\n flag_names = FeatureFlag.pluck(:name).sort\n FeatureFlag.default_flag_hash.merge(feature_flags_for(*flag_names)).with_indifferent_access\n end",
"def update_feature_header\n feature = Feature.find(params[:feature_id])\n is_a_new_label = (params[:label] != feature.label)\n feature.update_attributes({:label => params[:label], :automatic_rating_mode => params[:automatic_rating_mode], :extract => params[:extract]})\n if is_a_new_label\n Feature.rebuild!\n feature.update_path_and_sort\n end \n redirect_to(features_category_path(feature.category_id)) \n end",
"def modified_files; end",
"def tracked_files; end",
"def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n puts \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by_old_pid(old_pid)\n if feature.nil?\n puts \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n puts \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end",
"def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n self.say \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by(old_pid: old_pid)\n if feature.nil?\n self.say \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n self.say \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end",
"def add_feature(feature, state)\n check_feature_is_not_symbol(feature)\n check_feature_already_in_list(feature)\n Redis.current.hset(@redis_key, feature, state)\n end",
"def upload_shipped\n end",
"def get_required_features(features)\n end",
"def create\n @feature = Feature.new(feature_params)\n\n respond_to do |format|\n if @feature.save\n if @feature.is_active\n deactivate_all_features(@feature.id)\n end\n format.html { redirect_to(@feature, :notice => 'Feature was successfully created.') }\n format.xml { render :xml => @feature, :status => :created, :location => @feature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @feature = current_user.features.new(params[:feature])\n\n respond_to do |format|\n if @feature.save\n format.html { redirect_to @feature, notice: 'Feature was successfully created.' }\n format.json { render json: @feature, status: :created, location: @feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def features\n @features ||= {}\n @features.keys\n end",
"def added; status[:added]; end",
"def feature_add(name)\n set_add(FeaturesKey, name.to_s)\n end",
"def features_field\n product_descriptions.where(content_name: \"features\").first_or_initialize\n end",
"def feature_enable?(feature)\n @features ||= config.features_enable\n @features[feature] == true\nend",
"def invert_feature\n raise ApiError, \"Only Site Admin can perform this action\" unless @context.can_administer_site?\n\n items = update_feature_flag\n\n messages =\n if items.count.positive?\n message_key =\n if items.first.featured?\n \"api.feature.messages.featured\"\n else\n \"api.feature.messages.un_featured\"\n end\n [{ type: \"success\", message: I18n.t(message_key) }]\n else\n [{ type: \"error\", message: I18n.t(\"api.feature.messages.failed\") }]\n end\n\n render json: items, root: \"items\", adapter: :json, meta: messages\n end",
"def add(feature)\n verbose_info \"adding #{feature.inspect}\"\n aixm.add_feature feature\n feature\n end",
"def feature_flag_for(flag_name)\n opt = get_flag_option(flag_name)\n opt.present? ? opt.value : FeatureFlag.find_by(name: flag_name)&.default_value\n end",
"def update!(**args)\n @features = args[:features] if args.key?(:features)\n end",
"def <<(feature)\n @features << feature\n end",
"def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n if @feature.is_published\n @feature.create_activity :update, owner: current_user\n end \n format.html { redirect_to(\"/admin\", {notice: 'Feature was successfully updated.'}) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_feature\n if request.xhr?\n existed_feature = Feature.find_by_id(params[\"hidden_feature_id\"])\n return render :json =>{\"success\" =>false} if existed_feature.blank?\n updated = existed_feature.update_attributes(:description => params[\"description\"], :status =>params[\"status\"])\n return render :js =>\"success_update(true)\" if updated ==true\n return render :js =>\"success_update(false)\"\n else\n return render :js =>\"success_update(false)\"\n end\n end",
"def configured_feature_flags\n feature_flag_options.sort_by(&:name).map(&:to_h).reduce({}, :merge).with_indifferent_access\n end",
"def feature(name, &block); begin; yield; features << name; rescue Exception; end; end",
"def set_feature_paid_for \n @features = ProjectMilestone.where(project_id: @project.id).limit(2)\n end",
"def flagging\n @title = 'Flags and their meaning'\n @css = 'flags.css'\n end",
"def set_feature\n @feature = @project.features.find(params[:featureId])\n end",
"def update_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend",
"def features\n features = Hash[api.get_features(app).body.map{|feature| [feature['name'], feature['enabled']]}]\n actual_features = Hash[api.get_features(target_app).body.map{|feature| [feature['name'], feature['enabled']]}]\n\n features_to_enable = features.select{|feature, enabled| enabled && !actual_features[feature]}\n features_to_disable = actual_features.select{|feature, enabled| enabled && !features[feature]}\n\n action(\"Copying labs features from #{app} and restarting #{target_app}\") do\n features_to_enable.each do |feature|\n puts \"Adding #{feature} to #{target_app}\"\n api.post_feature(feature, target_app)\n end\n\n features_to_disable.each do |feature|\n puts \"Deleting #{feature} from #{target_app}\"\n api.delete_feature(feature, target_app)\n end\n end\n end",
"def updated_file_only=(flag)\r\n @conf[:update] = flag\r\n end",
"def is_featured=(value)\n @is_featured = value\n end",
"def is_featured=(value)\n @is_featured = value\n end",
"def enable_features(feature_names)\n self.enabled_features = feature_names\n end",
"def create\n @feature = Feature.find_or_create_by(name: params[:feature][:name])\n @feature.update(deleted_at: nil)\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle.features << @feature unless @feature.in? @vehicle.features\n end\n respond_to do |format|\n if @feature.save\n format.html\n format.json { render json: @feature, status: :created, location: @feature }\n format.js { render 'features/create' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def set_flag\n path = path_to_flag\n return nil unless path\n begin\n img = File.open(path, 'rb'){|f| f.readlines}.join\n File.open(File.join([Rails.root, 'public', \"flag_for_campaign_#{self.id}.png\"]), 'wb'){|f| f.write(img)}\n \"/flag_for_campaign_#{self.id}.png\"\n rescue\n nil\n end\n end",
"def mark_for_hot_list\n if self.is_available_for_hot_list\n return self.update_attribute(:added_to_hot_list, Time.now)\n end\n return false\n end",
"def time_added?\n self.impact == 'Added'\n end",
"def update\n\t\t#find the feature header\n\t\tfeature = FeatureHeader.where(:licserver_id => params[:licserver_id], :name => params[:id]).first\n\n\t\tif feature.nil? then\n\t\t\trender :nothign => true, :status => :not_found\n\t\t\treturn\n\t\telse\n\t\t\t#update the feature\n\t\t\tif params.has_key? :'enforce-uniq' then\n\t\t\t\tfeature.update_attribute(:uniq_users, true)\n\t\t\telse\n\t\t\t\tfeature.update_attribute(:uniq_users, false)\n\t\t\tend\n\t\t\trender :nothing => true, :status => :ok\n\t\tend\n\tend",
"def feature_params\n params.require(:feature).permit(:is_public, :fid, :is_blank, :ancestor_ids, :skip_update, names: [:name, :feature_name_type_id, :language_id, :writing_system_id, :etymology, :feature_name, :is_primary_for_romanization, :ancestor_ids, :skip_update, :feature_id, :position], all_parent_relations: [:perspective_id, :parent_node_id, :child_node_id, :feature_relation_type_id, :ancestor_ids, :skip_update])\n end",
"def save_features\n self.features.each { |c| if c.destroy_association? then c.destroy else c.save end }\n self.added_features.each { |c| c.save unless c.nil? } unless self.added_features.nil?\n end",
"def feature_accessed\n self.all_features.each do |feature|\n return feature.identifier if feature.includes_action?(params[:controller], params[:action])\n end\n\n return nil\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('shift_index') ? true : invalid_features\n when \"new\"\n current_features.include?('shift_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('shift_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('shift_delete') ? true : invalid_features\n end\n # return true\n end",
"def flag!(f=[], user=nil, record_history=false)\n f = [f.to_s] if f.class != Array\n f = f.map{|flag| flag.to_s}\n # puts \"#---------------#{self.flags}\"\n if self.flags.nil?\n self.set(_fgs: f)\n else\n f.each do |flag|\n self.push(_fgs: flag) if !self.flags.include?(flag)\n end \n end\n # logger.debug \"Flagged with '#{f.join(', ')}'\"\n if record_history\n #update the flag history\n history = f.map{|flag| {f: flag, w: Time.now, un: (user.nil? ? nil : user.name), user_id: (user.nil? ? nil : user.id)}}\n if self.flag_history.nil?\n self.set(:_fgh => history)\n else\n history.each do |h|\n self.push(:_fgh => h)\n end\n end\n end\n end",
"def feature_params\n params.require(:feature).permit(:tittle, :price, :publicationDate, :publicationState, :description, :user_id, :category_id, :image)\n end"
] |
[
"0.64233935",
"0.6312423",
"0.6273116",
"0.6238249",
"0.62089956",
"0.61934453",
"0.6186336",
"0.61829937",
"0.6148449",
"0.61480486",
"0.6054983",
"0.60345685",
"0.5990625",
"0.59495986",
"0.5935935",
"0.5893084",
"0.58618206",
"0.58581835",
"0.5828518",
"0.5825956",
"0.58256733",
"0.57856977",
"0.57786006",
"0.5739178",
"0.5731721",
"0.5730847",
"0.57221633",
"0.5684751",
"0.5682515",
"0.5682515",
"0.5665797",
"0.56641585",
"0.56600636",
"0.5646022",
"0.5605266",
"0.5593351",
"0.5592563",
"0.55889434",
"0.5578206",
"0.5575573",
"0.5572181",
"0.55636567",
"0.5555025",
"0.55532086",
"0.5543953",
"0.55225",
"0.55224913",
"0.55222785",
"0.5517715",
"0.5505656",
"0.55008787",
"0.5487987",
"0.5482691",
"0.5481238",
"0.54705536",
"0.5458203",
"0.5457689",
"0.545465",
"0.54467714",
"0.5445929",
"0.5430005",
"0.5428377",
"0.5427032",
"0.5423886",
"0.54131186",
"0.54066414",
"0.5392334",
"0.539181",
"0.53885144",
"0.5382634",
"0.5374475",
"0.5369327",
"0.53650415",
"0.5359169",
"0.5356395",
"0.53539056",
"0.5351092",
"0.5349189",
"0.534433",
"0.5341513",
"0.5340126",
"0.53281945",
"0.53219914",
"0.5318786",
"0.5317853",
"0.5315714",
"0.53072363",
"0.53072363",
"0.5305504",
"0.5302512",
"0.529894",
"0.52979153",
"0.5296",
"0.5294181",
"0.52815133",
"0.5278841",
"0.52776015",
"0.52716255",
"0.5271253",
"0.52708113"
] |
0.55019933
|
50
|
Given a DDI metadata file, parse it and return study information Returns a Nesstar::Study object
|
def parse ddi_file
@logger.info 'Parsing DDI file ' + ddi_file
catalog = DDI::Catalog.new
study = DDI::Study.new
study_info_hash = Hash.new
#TODO This will not work on windows since it depends on the unix tool file need to use a different way. Possibly use rchardet instead
begin
encode_type = `file --mime -br #{ddi_file}`.gsub(/\n/,"").split(';')[1].split('=')[1]
rescue Exception => e
end
#have to convert to UTF-8 for libxml
contents = File.open(ddi_file).read
output = Iconv.conv("UTF-8", encode_type, contents)
converted_file = File.join(File.dirname(ddi_file), "converted_file.xml")
file = File.open(converted_file, 'w')
file.write(output)
file.close
parser = LibXML::XML::Parser.file(converted_file)
doc = parser.parse
studynodes = doc.find('//stdyDscr')
abstracts = studynodes[0].find('//abstract')
abstract = ""
abstracts.each {|ab| abstract << ab.content.strip}
abstract.strip!
study.abstract = abstract
study.title = studynodes[0].find('//stdyDscr/citation/titlStmt/titl')[0].first.content.strip unless studynodes[0].find('//stdyDscr/citation/titlStmt/titl')[0] == nil
study.id = studynodes[0].find('//IDNo')[0].first.content.strip unless studynodes[0].find('//IDNo')[0] == nil
#start and finish dates for study
dates = []
date = studynodes[0].find('//sumDscr/collDate')
date.each do |d|
a = d.attributes
unless a.length == 0
study_date = DDI::StudyDate.new
study_date.type = a.get_attribute('event').value.strip
study_date.date = a.get_attribute('date').value.strip
dates.push(study_date)
end
end
study.dates = dates
studynodes[0].find('//sampProc')[0] ? samp_node = studynodes[0].find('//sampProc')[0] : samp_node = nil
unless samp_node == nil
study.sampling_procedure = samp_node.first.content.strip unless samp_node.first == nil
end
# study.weight = studynodes[0].find('//sampProc')[0].first.content
study.ddi_variables = get_variable_information doc
return study
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_ddi_metadata\n dataset = Dataset.find(dataset_id)\n ddi_parser = DDI::Parser.new\n all_variables = Variable.all(:conditions=> {:dataset_id => dataset_id})\n all_variable_ids = all_variables.collect{|var| var.id}\n parsed_variable_ids = []\n new_variables = []\n study = ddi_parser.parse filename\n #create variables for the dataset\n study.ddi_variables.each do |variable|\n #TODO find the variable from the dataset and if nil then add new var since this is from nesstar and we don't use the dataset to find the vars\n existing_variable = Variable.all(:conditions=>{:name=>variable.name, :dataset_id => dataset_id}).first\n #if the variable does not exist then go on to the next one, only load metadata for vars in the db\n if existing_variable != nil\n\t existing_variable.update_attributes(:value=>variable.label) if variable.label != nil\n if variable.group == nil\n variable_category = 'N/A'\n end\n parsed_variable_ids << existing_variable.id \n variable.categories.each do |category|\n valDom = ValueDomain.all(:conditions=>{:variable_id => existing_variable.id, :value => category.value, :label => category.label}).first \n if valDom == nil \n valDom = ValueDomain.new(:variable_id => existing_variable.id, :value => category.value, :label => category.label)\n valDom.save\n end \n category.category_statistics.each do |statistic|\n #the frequency statistics for the value domain\n #guessing that 'freq' is consistent, however......\n if statistic.type == 'freq'\n val_dom_stat = ValueDomainStatistic.all(:conditions=>{:frequency => statistic.value, :value_domain_id => valDom.id}).first\n if val_dom_stat == nil\n val_dom_stat = ValueDomainStatistic.new(:frequency => statistic.value, :value_domain_id => valDom.id)\n val_dom_stat.save\n else\n val_dom_stat.update_attributes(:frequency => statistic.value) if val_dom_stat.frequency != statistic.value\n end\n break\n end\n end\n end\n variable.summary_stats.each do |summary_stat|\n begin\n if summary_stat.type == 'mean'\n existing_variable.update_attributes(:mean => summary_stat.value) if var.mean != summary_stat.value\n elsif summary_stat.type == 'stdev'\n existing_variable.update_attributes(:standard_deviation => summary_stat.value) if existing_variable.standard_deviation != summary_stat.value\n elsif summary_stat.type == 'invd'\n existing_variable.update_attributes(:invalid_entries => summary_stat.value) if existing_variable.invalid_entries != summary_stat.value\n elsif summary_stat.type == 'vald'\n existing_variable.update_attributes(:valid_entries => summary_stat.value) if existing_variable.valid_entries != summary_stat.value\n end\n rescue\n logger.warn Time.now.to_s + 'One of the summary stats failed for variable ' + existing_variable.id.to_s\n end\n end\n question = variable.question != nil ? variable.question : \"\"\n interview = variable.interview_instruction != nil ? variable.interview_instruction : \"\"\n derivation = question + interview\n if variable.question != nil && variable.interview_instruction != nil\n existing_variable.update_attributes(:dermethod => derivation) if existing_variable.dermethod != derivation\n end\n end\n end\n end",
"def metadata_file\n study_files.any_of(\n { file_type: 'Metadata' },\n { file_type: 'AnnData', 'ann_data_file_info.has_metadata' => true }\n ).first\n end",
"def load_sis_data_file( filename )\n\n sisdata = {}\n\n begin\n File.open( filename, 'r').each do |line|\n\n # handle blank and commented lines\n next if line.blank?\n next if line[ 0 ] == '#'\n tokens = line.strip.split( \"|\" )\n sisdata[ tokens[ 0 ] ] = tokens[ 1 ]\n end\n rescue Errno::ENOENT\n # do nothing, no file...\n end\n\n return sisdata\n\n end",
"def read_metadata; end",
"def read\n @metadata = {}\n @content = File.read(path)\n\n if @content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n @content = $POSTMATCH\n\n begin\n @metadata = YAML.load($1)\n raise unless @metadata.is_a? Hash\n rescue => ex\n $stderr.puts \"#{File.basename($PROGRAM_NAME)}: #{ex.to_s}\"\n $stderr.puts \"WARNING: Couldn't load metadata.\"\n @metadata = {}\n end\n\n @metadata.symbolize_keys!\n import_metadata\n end\n end",
"def set_study\n @study = Study.find(params[:id])\n @inf = @study.inform_id\n end",
"def set_study\n @study = Study.find_by_nct_id(params[:id])\n end",
"def parseDcMetadata(metadata, getSeriesMetadata=false, useSharedNotesForDescriptionFallback=false, passIdentifierAsDcSource=false, **args)\n # Cast keys to lowercase\n metadata = OcUtil::keysLowerCase(metadata)\n\n # Get an array of hashes for with key names and fallback values\n dc_metadata_definition = getDcMetadataDefinition(metadata, useSharedNotesForDescriptionFallback,\n passIdentifierAsDcSource, args[:startTime], args[:stopTime])\n\n # Get values for the given keys, or use fallback values of the key does not exist\n dc_data = {}\n dc_metadata_definition.each do |definition|\n dc_data[definition[:symbol]] = OcUtil::parseMetadataFieldOrFallback(metadata, definition[:fullName], definition[:fallback])\n end\n\n # A non-empty title is required for a successful ingest\n if dc_data[:title].to_s.empty?\n dc_data[:title] = \"Default Title\"\n end\n\n # Avoid using invalid or existing ids (to avoid ingest errors and accidental overwrites)\n dc_data[:identifier] = checkEventIdentifier(dc_data[:identifier], args[:server], args[:user], args[:password])\n\n return dc_data\n end",
"def setup_file\n raise FsException::Action, 'No file path for Dicom to extract metadata from' unless file_path\n raise FsException::Action, 'File does not exist for Dicom to extract metadata from' unless File.exist? file_path\n\n Rails.logger.info \"Retrieving file for DICOM metadata processing: #{file_path}\"\n\n self.dicom_object = DICOM::DObject.read(file_path)\n end",
"def parse_metadata(file)\n file_name = File.basename(file)\n puts \"\\n#{Time.now.strftime('%T')} Parsing #{file_name}\" unless Rails.env.test?\n attrs = parser.new(file).attributes\n\n if attrs.blank?\n errors << \"Failed to parse file: #{file_name}\"\n elsif record_exists?(attrs)\n # Don't re-import the record if this record already\n # exists in fedora.\n skipped_imports << file_name\n else\n create_record(attrs.merge(metadata_file: file, visibility: visibility, admin_set: admin_set))\n successful_imports << file_name\n end\n rescue => e\n errors << \"#{file_name}: #{e}\"\n end",
"def read_metadata\n @metadata =\n if !disabled? && File.file?(metadata_file)\n content = File.binread(metadata_file)\n\n begin\n Marshal.load(content)\n rescue TypeError\n SafeYAML.load(content)\n rescue ArgumentError => e\n Jekyll.logger.warn(\"Failed to load #{metadata_file}: #{e}\")\n {}\n end\n else\n {}\n end\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def set_study\n @study = Study.find(params[:id])\n end",
"def extract_meta_data(file_path)\n m = /(\\d{4})-(\\d{2})-(\\d{2})-(.+)\\.md/.match(file_path)\n {\n published_at: Date.new(m[1].to_i, m[2].to_i, m[3].to_i),\n slug: m[4]\n }\n end",
"def doi_metadata\n # This must be mock_doi rather than any identifier defined in the object.\n # Otherwise users could manually specify a different identifier and\n # change records they're not supposed to.\n data = {:identifier => mock_doi}\n \n data[:alternate_identifier] = identifier.map do |identifier|\n next if identifier == full_mock_doi\n guess_identifier_type(identifier)\n end .compact\n\n if respond_to? :doi_published and doi_published\n data[:publication_year] = \"#{doi_published.year}\"\n else\n data[:publication_year] = \"#{Time.new.year}\"\n end\n\n data[:subject] =\n (subject.to_a.map do |e|\n { scheme:'FAST', schemeURI: 'http://fast.oclc.org/', label: e }\n end) +\n (tag.to_a.map do |e|\n { scheme: nil, schemeURI: nil, label: e}\n end)\n\n creator_role=Sufia.config.contributor_roles['Creator']\n data[:creator] = ((contributors_sorted.select do |c|\n c.role.include? creator_role\n end).select do |c|\n !c.marked_for_destruction?\n end).map do |c|\n { name: c.contributor_name.first,\n affiliation: c.affiliation\n }\n end\n\n data[:abstract] = abstract.to_a\n data[:research_methods] = research_methods.to_a\n data[:description] = description.to_a\n data[:funder] = funder.to_a\n data[:contributor] = contributors_sorted.reduce([]) do |a,c|\n # Creator role is converted to nil in contributor_role_to_datacite and then removed with compact\n next a if c.marked_for_destruction?\n roles=c.role.map do |r| contributor_role_to_datacite r end\n roles.compact!\n next a if roles.empty?\n roles.sort! # Roles must be sorted, otherwise authors might change arbitrarily\n roles.each do |r|\n a << {\n name: c.contributor_name.first,\n affiliation: c.affiliation,\n contributor_type: r\n }\n end\n a\n end\n\n\n data[:relatedIdentifier] = related_url.map do |url|\n # related field is now titled cited by, so use that as the relation type\n (guess_identifier_type url).tap do |ident| ident[:relation_type]='IsCitedBy' end\n end\n\n if self.class == GenericFile\n data[:title] = title\n data[:resource_type] = Sufia.config.resource_types_to_datacite[resource_type.first] # Only maping first choice from the list\n data[:size] = [content.size]\n data[:format] = [content.mime_type]\n data[:date_uploaded] = date_uploaded.strftime('%Y-%m-%d')\n data[:rights] = rights.map do |frights|\n {rights: Sufia.config.cc_licenses_reverse[frights], rightsURI: frights}\n end\n else #Add Collection metadata\n data[:title] = [title] # Collection returns string, XML builder expects array\n # FixMe: construct << {contributor, email}\n if not date_created.empty?\n data[:date_created] = Date.parse(date_created.first.to_s).strftime('%Y-%m-%d') unless date_created.empty?\n end\n data[:resource_type] = Sufia.config.resource_types_to_datacite['Collection']\n\n #Add members metadata\n# \t\t\tdata[:rights] = rights.map do |crights|\n# \t\t\t\t{rights: \"Collection rights - \" + Sufia.config.cc_licenses_reverse[crights], rightsURI: crights }\n# \t\t\tend\n# members.reduce(data[:rights]) do |a,mobj|\n data[:rights] = members.reduce([]) do |a,mobj|\n if member_visible? mobj\n if mobj.content.original_name.nil? then filename = mobj.id else filename = mobj.content.original_name end\n if mobj.rights.any?\n a << { # Do we allow for multiple licensing?\n rights: filename + \" - \" + Sufia.config.cc_licenses_reverse[mobj.rights[0]],\n rightsURI: mobj.rights[0]\n }\n else\n a\n end\n else\n a\n end\n end\n\n data[:format] = members.reduce([]) do |a,mobj|\n if member_visible? mobj\n if mobj.content.original_name.nil? then filename = mobj.id else filename = mobj.content.original_name end\n if mobj.content.mime_type.nil? then a end\n a << (filename + \" - \" + mobj.content.mime_type)\n else\n a\n end\n end\n\n data[:size] = members.reduce([]) do |a,mobj|\n if member_visible? mobj\n if mobj.content.original_name.nil? then filename = mobj.id else filename = mobj.content.original_name end\n if mobj.content.size then a end\n a << \"#{filename} - #{mobj.content.size}\"# Should we preatyfier file size in bytes?\n else\n a\n end\n end\n\n\n members.reduce(data[:relatedIdentifier]) do |a,mobj|\n if member_visible? mobj and mobj.respond_to? :doi_landing_page #FixMe: only public objects\n a << { id: mobj.doi_landing_page, id_type: 'URL', relation_type: 'HasPart' }\n else\n a\n end\n end\n end\n return data\n end",
"def set_study_file\n @study_file = StudyFile.find(params[:id])\n end",
"def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end",
"def metadata(filepath)\n metadata = {}\n metadata.merge!(author(filepath))\n metadata.merge!(title(filepath))\n metadata.merge!(serie(filepath))\n metadata\n end",
"def create_from_xml\n unless params[:metadata_file].present?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n xml_ds = XmlDatastream.new\n begin\n xml_ds.load_xml(params[:metadata_file])\n rescue DRI::Exceptions::InvalidXML\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n rescue DRI::Exceptions::ValidationErrors => e\n flash[:notice] = e.message\n @error = e.message\n return false\n end\n\n if xml_ds.metadata_standard.nil?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n @object = DRI::DigitalObject.with_standard xml_ds.metadata_standard\n @object.update_metadata xml_ds.xml\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n if @object.descMetadata.is_a?(DRI::Metadata::EncodedArchivalDescriptionComponent)\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n unless @object.collection?\n flash[:notice] = t('dri.flash.notice.specify_collection')\n @error = t('dri.flash.notice.specify_collection')\n return false\n end\n\n @object.apply_depositor_metadata(current_user.to_s)\n @object.manager_users_string = current_user.to_s\n @object.discover_groups_string = 'public'\n @object.read_groups_string = 'public'\n @object.master_file_access = 'private'\n\n @object.ingest_files_from_metadata = params[:ingest_files] if params[:ingest_files].present?\n\n true\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def set_study\n @study = Study.find(params[:id])\n @datasets = @study.datasets\n end",
"def extract_metadata(file)\n document = parse_kramdown(file)\n toc = ::Kramdown::Converter::Toc.convert(document.root)\n toc_items = toc[0].children.select { |el| el.value.options[:level] == 2 }.map do |t| \n {:id => t.attr[:id], :text => t.value.children.first.value}\n end\n\n metadata = document.root.options[:metadata]\n metadata[:toc] = toc_items\n metadata[:converted] = document.to_html\n metadata[:technologies] = metadata[:technologies].split(\",\").collect {|tech| tech.strip}\n metadata[:images] = find_images(document.root)\n metadata[:author] = metadata[:author].split(',').first if metadata[:author]\n metadata[:commits] = commit_info @repo, Pathname.new(file)\n metadata[:current_tag] = current_tag @repo, Pathname.new(file)\n metadata[:current_branch] = current_branch @repo, Pathname.new(file)\n metadata[:github_repo_url] = repository_url @repo\n metadata[:contributors] = metadata[:commits].collect { |c| c[:author] }.uniq\n metadata[:contributors_email] = metadata[:commits].collect { |c| c[:author_email] }.uniq\n metadata[:contributors].delete(metadata[:author])\n metadata[:product] = @product if @product\n metadata[:experimental] = @experimental\n metadata\n end",
"def method_missing(*args)\n if @studies.has_key? args.first\n @studies[args.first]\n else\n Portfolio.log.error \"Study #{args.first} not found. Available studies are:\\n #{@studies.inspect}\"\n super\n end\n end",
"def read_metadata\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def show\n @study = Study.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @study }\n end\n end",
"def read_denreifile\n set_default\n return unless File.exist? './Denreifile'\n execute_denrei_dsl read_denreifile_source\n end",
"def from_file(filename, opts)\n @resident_dir = File.dirname(File.expand_path(filename))\n opts = { :filter_by_precursor_mass_tolerance => true, :read_pephits => true}.merge(opts)\n\n (@params, after_params_io_pos) = Mspire::Sequest::Srf.get_sequest_params_and_finish_pos(filename)\n return unless @params\n\n dup_references = 0\n dup_refs_gt_0 = false\n\n dup_references = @params.print_duplicate_references.to_i\n if dup_references == 0\n # warn %Q{\n #*****************************************************************************\n #WARNING: This srf file lists only 1 protein per peptide! (based on the\n #print_duplicate_references parameter in the sequest.params file used in its\n #creation) So, downstream output will likewise only contain a single protein\n #for each peptide hit. In many instances this is OK since downstream programs\n #will recalculate protein-to-peptide linkages from the database file anyway.\n #For complete protein lists per peptide hit, .srf files must be created with\n #print_duplicate_references > 0. HINT: to capture all duplicate references, \n #set the sequest parameter 'print_duplicate_references' to 100 or greater.\n #*****************************************************************************\n # }\n else\n dup_refs_gt_0 = true\n end\n\n File.open(filename, 'rb') do |fh|\n @header = Mspire::Sequest::Srf::Header.from_io(fh)\n @version = @header.version\n\n unpack_35 = case @version\n when '3.2'\n false\n when '3.3'\n false\n when '3.5'\n true\n end\n\n if @header.combined\n @base_name = File.basename(filename, '.*')\n # I'm not sure why this is the case, but the reported number is too\n # big by one on the 2 files I've seen so far, so we will correct it here!\n @header.dta_gen.num_dta_files = @header.dta_gen.num_dta_files - 1\n if opts[:read_pephits] == false\n raise NotImplementedError, \"on combined files must read everything right now!\"\n end\n (@dta_files, @out_files) = read_dta_and_out_interleaved(fh, @header.num_dta_files, unpack_35, dup_refs_gt_0)\n else\n @base_name = @header.raw_filename.scan(/[\\\\\\/]([^\\\\\\/]+)\\.RAW$/).first.first\n\n @dta_files = read_dta_files(fh, @header.num_dta_files, unpack_35)\n if opts[:read_pephits]\n # need the params file to know if the duplicate_references is set > 0\n raise NoSequestParamsError, \"no sequest params info in srf file!\\npass in path to sequest.params file\" if @params.nil?\n @out_files = read_out_files(fh,@header.num_dta_files, unpack_35, dup_refs_gt_0)\n\n # FOR DISPLAY ONLY!\n #@out_files.each do |f|\n # if f.num_hits == 10\n # p f.hits.last\n # end\n #end\n\n if fh.eof?\n #warn \"FILE: '#{filename}' appears to be an abortive run (no params in srf file)\\nstill continuing...\"\n @params = nil\n @index = []\n end\n end\n end\n\n fh.pos = after_params_io_pos\n\n # This is very sensitive to the grab_params method in sequest params\n fh.read(12) ## gap between last params entry and index \n\n @index = read_scan_index(fh,@header.num_dta_files)\n end\n\n\n ### UPDATE SOME THINGS:\n # give each hit a base_name, first_scan, last_scan\n if opts[:read_pephits] && !@header.combined\n @index.each_with_index do |ind,i|\n mass_measured = @dta_files[i][0]\n outfile = @out_files[i]\n outfile.first_scan = ind[0]\n outfile.last_scan = ind[1]\n outfile.charge = ind[2]\n\n pep_hits = @out_files[i].hits\n @peptide_hits.push( *pep_hits )\n pep_hits.each do |pep_hit|\n pep_hit[15] = @base_name\n pep_hit[16] = ind[0]\n pep_hit[17] = ind[1]\n pep_hit[18] = ind[2]\n # add the deltamass\n pep_hit[12] = pep_hit[0] - mass_measured # real - measured (deltamass)\n pep_hit[13] = 1.0e6 * pep_hit[12].abs / mass_measured ## ppm\n pep_hit[19] = self ## link with the srf object\n end\n end\n\n filter_by_precursor_mass_tolerance! if params\n end\n\n self\n end",
"def describe_synthetics(path, compact)\n struct = Depix.from_file(path, compact)\n describe_synthetics_of_struct(struct)\n end",
"def get_metadata\n doc = download_ais(@program_id)\n streamUri = (doc/\"//streamuri\").text\n @metadata[:fileType] = streamUri[-3..-1]\n @metadata[:programName] = (doc/\"//brandtitle\").text\n @metadata[:episodeId] = (doc/\"//programmenumber\").text\n\n assetInfo = download_asset(@program_id)\n @metadata[:episodeNumber] = (assetInfo/\"//episodenumber\").text\n @metadata[:seriesNumber] = (assetInfo/\"//seriesnumber\").text\n @metadata[:episodeInfo] = (assetInfo/\"//episodeinfo\").text\n @metadata[:episodeTitle] = (assetInfo/\"//episodetitle\").text\n @metadata[:brandTitle] = (assetInfo/\"//brandtitle\").text\n @metadata[:epId] = (assetInfo/\"//programmeid\").text\n @metadata[:imagePath] = (assetInfo/\"//imagepath\").text\n\n @metadata[:title1] = (assetInfo/\"//title1\").text\n @metadata[:title2] = (assetInfo/\"//title2\").text\n\n #progGuideUrl is used to pull out metadata from the CH4 website\n progGuideUrl = (assetInfo/\"//episodeguideurl\").text\n\n begin\n #read program guide to get additional metadata\n seriesInfo = download_progguide(progGuideUrl)\n\n synopsisElem = seriesInfo.at(\"//meta[@name='synopsis']\")\n @metadata[:description] = synopsisElem.nil? ? \"\" : synopsisElem['content']\n rescue\n @log.error \"Unable to read program guide data - the video file will not be fully tagged\"\n @log.debug \"Program Guide URL: #{progGuideUrl}\"\n end\n end",
"def import_to\n begin\n study = Study.find(params[:study_id])\n \n unless study.user_id != session[:user_id] || study.active == true\n sparql = SPARQL::Client.new(\"http://dbpedia.org/sparql\")\n \n category = params[:category_name].gsub ' ', '_'\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n ?name <http://xmlns.com/foaf/0.1/depiction> ?image .\n FILTER (LANG(?description) = 'en')\n }\")\n \n unless items.size < 1\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n image = item[:image].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.image = image\n i.save\n end\n end\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n FILTER (LANG(?description) = 'en')\n }\")\n \n if items.size > 0\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n unless Item.where(name: name).size > 0\n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.save\n end\n end\n else\n flash[:error] = \"Please enter a valid Wikipedia category.\"\n end\n end\n rescue\n \n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end",
"def read_ccsr_metadata\n\n parser = XML::Parser.io(File.open(filename, \"r\"), :encoding => XML::Encoding::ISO_8859_1)\n doc = parser.parse\n\n nodes = doc.find('//ccsrmetadata/variables')\n if nodes.size == 1\n nodes[0].each_element do |node|\n if (/^id_/.match(node.name)) \n name = node[\"variable_name\"]\n label = node[\"variable_label\"]\n v = Variable.find(:all,:conditions=> {:dataset_id => dataset_id, :is_archived=>false, :name=>name})\n if (v[0]!= nil)\n v[0].value_domains.each do |valdom|\n valdom.delete\n end\n value_map = String.new\n node.each_element do |child_node| \n if (!child_node.empty?) \n valDom = ValueDomain.new\n valDom.variable = v[0]\n valDom.label = child_node[\"value_name\"]\n valDom.value = child_node[\"value\"]\n value_map << \"value \" + child_node[\"value\"] + \" label \" + child_node[\"value_name\"] + \"\\r\\n\"\n valDom.save\n end\n end\n v[0].update_attributes(:value=>label, :info=>value_map,:updated_by=>user_id, :update_reason=>update_reason)\n\n # don't care about 'false positives' in the metadata, all we care about is the columns from the original dataset\n end\n end \n end\n else\n nodes.each do |node|\n name = node[\"variable_name\"]\n label = node[\"variable_label\"]\n v = Variable.find(:all,:conditions=> {:dataset_id => dataset_id, :is_archived=>false, :name=>name})\n if (v[0]!= nil)\n v[0].value_domains.each do |valdom|\n valdom.delete\n end\n value_map = String.new\n node.each_element do |child_node| \n if (!child_node.empty?) \n valDom = ValueDomain.new\n valDom.variable = v[0]\n valDom.label = child_node[\"value_name\"]\n valDom.value = child_node[\"value\"]\n value_map << \"value \" + child_node[\"value\"] + \" label \" + child_node[\"value_name\"] + \"\\r\\n\"\n valDom.save\n end\n end\n\n v[0].update_attributes(:value=>label, :info=>value_map,:updated_by=>user_id, :update_reason=>update_reason)\n\n # don't care about 'false positives' in the metadata, all we care about is the columns from the original dataset\n end \n end\n end\n end",
"def metadataget( doi )\n #puts \"=====> metadataget #{doi}\"\n url = \"#{self.url}/dois/#{doi}\"\n status, response = rest_get( url )\n return status, response if ok?( status )\n return status, ''\n end",
"def metadataget( doi )\n #puts \"=====> metadataget #{doi}\"\n url = \"#{self.url}/dois/#{doi}\"\n status, response = rest_get( url )\n return status, response if ok?( status )\n return status, ''\n end",
"def parse_ddm(ddm);end",
"def esri_opendata_metadata\n File.read(File.join(File.dirname(__FILE__), './docs/esri_open_data.json'))\n end",
"def esri_opendata_metadata\n File.read(File.join(File.dirname(__FILE__), './docs/esri_open_data.json'))\n end",
"def show\n @id = params[:id]\n @resource = ActiveFedora::Base.find(@id)\n\n raise ActiveFedora::ObjectNotFoundError if not @resource\n\n authorize! :edit, @resource\n\n raise \"Resource doesn't support DOI functionality\" if not @resource.respond_to? :doi\n\n @metadata_errors = @resource.validate_doi_metadata\n\n if @resource.is_a? Collection\n @presenter = Sufia::CollectionPresenter.new @resource\n @model_class = \"collection\"\n else\n @presenter = Sufia::GenericFilePresenter.new @resource\n @model_class = \"generic_file\"\n end\n end",
"def files\n @study = Study.find(params[:study_id])\n @documents = @study.documents \n \n end",
"def read\n x = nil\n File.open(@filename, 'r') {|f| x = f.readlines }\n x.each do |line|\n\n line = self.class.remove_comments(line)\n\n if line.present?\n @data << self.class.extract_data_from_line(line)\n # puts self.class.extract_data_from_line(line).to_yaml\n end\n end\n end",
"def new\n @study = Study.new()\n end",
"def parse_sifttter_file(filepath, date)\n title = File.basename(filepath).gsub(/^.*?\\/([^\\/]+)$/, \"\\\\1\") + \"\\n\"\n\n date_regex = /(?:#{ date.strftime(\"%B\") } 0?#{ date.strftime(\"%-d\") }, #{ date.strftime(\"%Y\") })/\n time_regex = /(?:\\d{1,2}:\\d{1,2}\\s?[AaPpMm]{2})/\n entry_regex = /@begin\\n@date\\s#{ date_regex }(?: at (#{ time_regex }?)\\n)?(.*?)\\n@end/m\n\n contents = File.read(filepath)\n cur_entries = contents.scan(entry_regex)\n unless cur_entries.empty?\n @entries.merge!(title => []) unless @entries.key?(title)\n cur_entries.each { |e| @entries[title] << [e[0], e[1].strip] }\n end\n end",
"def extract_metadata; end",
"def load_workset( filename )\n\n md_filename = ''\n asset_files = []\n File.open( filename, 'r').each do |line|\n if /^metadata : /.match( line )\n md_filename = /^metadata : (.*)$/.match( line ).captures[ 0 ]\n end\n\n if /^asset : /.match( line )\n asset_files << /^asset : (.*)$/.match( line ).captures[ 0 ]\n end\n end\n\n return md_filename, asset_files\n end",
"def initialize(file_path)\n\n @title, @abstract = \"\", \"\"\n @metadata = {}\n\n if file_path\n\n @file_path = File.expand_path(file_path)\n\n # Read the YAML front matter.\n convertible = OpenStruct.new.extend(Jekyll::Convertible)\n @metadata = convertible.read_yaml(File.dirname(@file_path), File.basename(@file_path))\n\n # Scrub the YAML out of the markdown.\n markdown = File.read(@file_path).sub(/---(.|\\n)*---/, '')\n\n # Parse the cleaned markdown.\n renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n document = Nokogiri::HTML::fragment(renderer.render(markdown))\n\n # Set the title.\n header = document.at_css('h1')\n @title = header.text\n header.remove\n\n # Set the abstract.\n @abstract = document.to_s.strip\n\n end\n\n end",
"def read_metadata\n metadata = { :variable_set => read_variable_set }\n set_key_map metadata[:variable_set]\n\n metadata\n end",
"def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def content_info(id)\n filename = settings.root + '/contents/' + id + '.yml'\n content = YAML.load(File.read(filename))\n\n raise 'Content has not key' unless content[:key]\n\n # Complete HMS information with default values.\n content[:id] ||= \"urn:marlin:organization:example:#{id}\"\n content[:title] ||= id\n content[:synopsis] ||= content[:title]\n content[:url] ||= url(\"/contents/#{id}.dcf\")\n\n # Other useful URLs.\n content[:rights_url] = url('/license/' + id)\n content[:download_url] = url('/download/' + id)\n content[:stream_url] = url('/stream/' + id)\n content[:cad_url] = url('/cad/' + id)\n\n content\n rescue Errno::ENOENT\n # .yml file does not exist. Show a 404 Not Found.\n not_found\n end",
"def show_study\n @study = Study.find(params[:study_id])\n @study_member = @study.study_members.build\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def read_synthesisview_file(synthfile, chromlist, glisthash, highlighted_group=\"\",\n\t\t\tsnpTags=nil)\n defaultkey = GroupList.get_default_name\n firstline = true\t\t\n begin\n File.open(synthfile, \"r\") do |file|\n # read in all lines\n lines = Array.new\n #file.each_line(\"\\r\") do |line|\n file.each_line(\"\\n\") do |line|\n line.each_line(\"\\r\") do |splitline|\n lines << splitline unless splitline =~ /^\\n$/\n end\n end\n group_column, subgroup_column = check_subgroup(lines[0]) \n unless subgroup_column || group_column\n set_groups(glisthash, lines[0], defaultkey, highlighted_group, snpTags)\n else\n set_groups_subgroup(glisthash, lines, defaultkey, group_column, subgroup_column, \n\t\t\t\t\thighlighted_group,snpTags)\n end\n\n # if there is built-in MySQL support for looking up position\n # information\n snp_positions = get_locations(lines, synthfile, :has_positions=>@location)\n\n lines.each do |line|\n # skip blank lines\n next if line !~ /\\w/\n\n # read column headers to create groups\n if firstline\n firstline = false\n next\n end\n\n # split line and check whether need to create new chromosome\n data = strip_and_split(line)\n\n # if no location information present skip\n\t\t\t\t@snpid ? snpid = data[@snpid] : snpid = data[@snp1] + '_' + data[@snp2]\n\t\t\t\t# if no SNP name in file set SNP name to be same as SNPID\n\t\t\t\t@snpname == -1 ? snpname = snpid : snpname = data[@snpname]\n next if !snp_positions.has_key?(snpid)\n chrnum = snp_positions[snpid]['chr']\n chrname = chrnum.to_s\n if chrnum =~ /mt/i\n chrnum = \"26\"\n elsif chrnum =~ /y/i\n chrnum = \"24\"\n elsif chrnum =~ /x/i\n chrnum = \"23\"\n end\n \n if (chromosome = chromlist.get_chrom(chrnum.to_i)) == nil\n # create a new SNP\n newchrom = Chromosome.new(chrnum.to_i, chrname)\n chromlist.add_chrom(newchrom)\n chromosome = chromlist.get_chrom(chrnum.to_i)\n end\n\n # location will be first num listed\n location = snp_positions[snpid]['pos']\n location = location.to_i\n snp = chromosome.snp_list.get_snp(snpid) \n unless snp\n\t\t\t\t\tunless @anccol.empty?\n\t\t\t\t\t\tanc_array = Array.new\n\t\t\t\t\t\tanc_array << data[@anccol[0]].to_f\n\t\t\t\t\t\tanc_array << data[@anccol[1]].to_f\n\t\t\t\t\t\tanc_array << data[@anccol[2]].to_f\n\t\t\t\t\tend\n snp = SNP.new(snpname, location, anc_array)\n chromosome.snp_list.add_snp(snp)\n snp = chromosome.snp_list.get_snp(snpname)\n end\n\t\t\t\tsnp.text_color = data[@snpcolorcol] if @snpcolorcol and data[@snpcolorcol] =~ /\\w/\n # add results to SNP\n if !subgroup_column and !group_column\n glisthash.each_value do |glist|\n glist.groups.each do |group|\n read_group_data(snp, group, data)\n end\n end\n elsif subgroup_column and group_column\n glisthash.each do |name, glist|\n if name == data[subgroup_column]\n glist.groups.each do |group|\n if group.name == data[group_column] + \":\" + data[subgroup_column]\n read_group_data(snp, group, data)\n end\n end\n end\n end \n elsif group_column\n glisthash.each_value do |glist|\n glist.groups.each do |group|\n if group.name == data[group_column]\n read_group_data(snp, group, data)\n end\n end\n end\n end\n end\n end\n rescue StandardError => e\n puts e\n exit(1)\n end\n end",
"def read_metadata(path)\n unless path\n abort \"Must exist a markdown filename which have Yaml Front Matter.\"\n end\n yml, _ = Maliq::FileUtils.retrieveYFM(File.read path)\n return nil if yml.empty?\n YAML.load(yml).to_symkey\n end",
"def create_from_xml\n unless params[:metadata_file].present?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n xml_ds = XmlDatastream.new\n begin\n xml_ds.load_xml(params[:metadata_file])\n rescue DRI::Exceptions::InvalidXML\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n rescue DRI::Exceptions::ValidationErrors => e\n flash[:notice] = e.message\n @error = e.message\n return false\n end\n\n if xml_ds.metadata_standard.nil?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n @object = DRI::Batch.with_standard xml_ds.metadata_standard\n @object.update_metadata xml_ds.xml\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n if @object.descMetadata.is_a?(DRI::Metadata::EncodedArchivalDescriptionComponent)\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n unless @object.collection?\n flash[:notice] = t('dri.flash.notice.specify_collection')\n @error = t('dri.flash.notice.specify_collection')\n return false\n end\n\n @object.apply_depositor_metadata(current_user.to_s)\n @object.manager_users_string = current_user.to_s\n @object.discover_groups_string = 'public'\n @object.read_groups_string = 'public'\n @object.master_file_access = 'private'\n\n @object.ingest_files_from_metadata = params[:ingest_files] if params[:ingest_files].present?\n\n true\n end",
"def read\n $t1 = Time.now # Init procedure timestamp\n person = []\n IO.foreach(\"data_500.txt\") do |line| # Get all patients from file iterate each line\n line.chomp! # Remove trailing whitespace.\n person.push(line.split(\":\")) # Saving data split :\n end\n group(person) # Get blood type\n end",
"def load_file(file_name)\n\tpatients_info = {}\n\tFile.open(file_name).each do |line|\n\t\tline.chomp!\n\t\tfields = line.split(\"\\t\")\n\t\tchrom_number = fields.delete_at(1)\n\t\tfields = fields[0..2]\n\t\tfields.map!{|a| a.to_i}\n\t\tquery = patients_info[chrom_number]\n\t\tif query.nil?\n\t\t\tpatients_info[chrom_number] = [fields]\n\t\telse\n\t\t\tquery << fields\n\t\tend\n\tend\n\treturn patients_info\nend",
"def query_study_source(irb_number)\n query_list = [\n :find_basics,\n :find_description,\n :find_inc_excl,\n :find_funding_sources\n ]\n do_import_queries(Eirb, irb_number, query_list)\n end",
"def seed_parser(db)\n warn \"Parsing data files in #{@options[:datadir]}/#{db}\" if @options[:verbose]\n\n @data[db] = { }\n\n # There are three files we need: SEED.md52id2ont, SEED.md52id2func and\n # SEED.id2subsystems, each will be read and placed in the @data structure\n # under the keys 'SEED' and the respective file endings. The first two will\n # be a hash indexed by md5sum, the third a hash indexed by subsystem id\n # (which can be found in the md52id2ont file).\n #\n # 1. SEED.md52id2ont\n begin\n warn \"\\tSEED.md52id2ont\" if @options[:verbose]\n data = {}\n @data['SEED']['md52id2ont'] = data\n File.new(\"#{@options[:datadir]}/#{db}/SEED.md52id2ont\").each_with_index do |line, linenum|\n begin\n\tline.chomp!\n\tfields = line.split(/\\s*\\t\\s*/)\n\n\t# We have entries with multiple annotations\n\tdata[fields[0]] ||= []\n\tdata[fields[0]] << fields[1]\n rescue ArgumentError\n\twarn \"\\t\\tSEED.md52id2ont error at #{linenum}\" if @options[:verbose]\n end\n end\n rescue\n warn \"Failed to parse #{@options[:datadir]}/#{db}/SEED.md52id2ont: #{$!}, backtrace:\\n\\t#{$!.backtrace.join(\"\\n\\t\")}\"\n exit\n end\n\n # 2. SEED.md52id2func\n begin\n warn \"\\tSEED.md52id2func\" if @options[:verbose]\n data = {}\n @data['SEED']['md52id2func'] = data\n File.new(\"#{@options[:datadir]}/#{db}/SEED.md52id2func\").each_with_index do |line, linenum|\n line.chomp!\n begin\n\tfields = line.split(/\\s*\\t\\s*/)\n\n\t# We may have multiple rows. We only care about picking up the complete list of organisms\n\tif data[fields[0]]\n\t data[fields[0]][:organisms] << fields[3]\n\telse\n\t data[fields[0]] = { \n\t desc: fields[2],\n\t organisms: [ fields[3] ]\n\t }\n\tend\n rescue ArgumentError\n\twarn \"\\t\\tSEED.md52id2func error at #{linenum}\" if @options[:verbose]\n end\n end\n rescue\n warn \"Failed to parse #{@options[:datadir]}/#{db}/SEED.md52id2func: #{$!}, backtrace:\\n\\t#{$!.backtrace.join(\"\\n\\t\")}\"\n exit\n end\n\n # 3. SEED.id2subsystems\n begin\n warn \"\\tSEED.id2subsystems\" if @options[:verbose]\n data = {}\n @data['SEED']['id2subsystems'] = data\n File.new(\"#{@options[:datadir]}/#{db}/SEED.id2subsystems\").each_with_index do |line, linenum|\n begin\n\tline.chomp!\n\tfields = line.split(/\\s*\\t\\s*/)\n\tdata[fields[-1]] = fields[0..-2]\n rescue ArgumentError\n\twarn \"\\t\\tSEED.id2subsystems error at #{linenum}\" if @options[:verbose]\n end\n end\n rescue\n warn \"Failed to parse #{@options[:datadir]}/#{db}/SEED.id2subsystems: #{$!}, backtrace:\\n\\t#{$!.backtrace.join(\"\\n\\t\")}\"\n exit\n end\n\n # Open an output file\n fname = \"#{@options[:basename]}.seed\"\n begin\n warn \"Opening #{fname} for SEED output\" if @options[:verbose]\n @data[db][:outfile] = File.new(fname, \"w\")\n rescue\n warn \"Failed to open file for SEED output #{fname}: #{$!}, backtrace: #{$!.backtrace.join(\"\\n\\t\")}\"\n end\nend",
"def read_meta post_file\n separate_yfm_and_content(post_file)\n\n @title = @yfm[\"title\"] \n @layout = @yfm[\"layout\"] || @yfm[\"template\"] || \"default\"\n @permalink = @yfm[\"permalink\"]\n @datetime = Time.parse(@yfm[\"date\"]) || File.mtime(post_file) \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 thesis\n 'Thesis/Dissertation' if record.find { |a| a.tag == '502' }\n end",
"def parse_meta\n if self.asset?\n newAsset = File.basename(self.asset.to_s)\n leftover, filename, extension = newAsset.split(/^(.*)\\.(.*)$/)\n elements = filename.split('_')\n\n if filename.match(/[0-9]{3}_[0-9]{3}[a-zA-Z]?/)\n leftover, season, episode, scene, part = filename.split(/([0-9]{1})([0-9]{2})_([0-9]{3})([a-zA-Z]?)/)\n episode = Episode.find_by_season_and_number(season, episode)\n scene = Scene.find_or_create_by_number_and_part_and_episode_id(scene, part, episode.id)\n self.episode_id = episode.id\n self.scene << scene\n else\n if elements.length > 0 && animation = elements[0].downcase.match(/(stk|ep)([0-9]+)?/)\n case animation[1]\n when 'stk'\n self.stock = true \n when 'ep'\n self.stock = false\n if episode = Episode.find_by_number(animation[2])\n self.episode_id = episode.id\n end\n end\n elements.shift # Strip off stock or episode\n end\n\n self.id = elements.pop if elements[-1].match(/^[0-9]+$/)\n self.asset_type = elements.shift.downcase if Asset::TYPES.map {|type| type[1] }.include?(elements[0].downcase)\n self.name_list.add(elements.shift) if elements.length > 0\n self.keyword_list.add(elements) if elements.length > 0\n end\n end\n end",
"def parse_klass_info(line)\n #(dept_abbr, klass_section, instructor, title) = line[0].gsub(/^\"(.*)\"$/,'\\1').split\n (dept_abbr, klass_section, instructor, title) = line[0].scan(\n /^\"*(\\w*)\\s+([^\\s]*)\\s+(.*[^\\s])\\s*\\((\\w*)\\)\"*$/ ).first\n (full_course_number, section) = klass_section.split(\"-\")\n if instructor.index(\",\").nil?\n puts \"Could not parse instructor name #{instructor} correctly. Please check source file.\"\n exit\n end\n (last_name, first_name) = instructor.split(\",\")\n\n # Handles cases where an instructor has multiple parts to their name\n # i.e. El Ghaoui, Laurent\n # i.e. Chang-Hasnain, C.\n first_name = first_name.scan(/(\\W+|\\w+)/).map{|x| x.first.capitalize}.join\n last_name = last_name.scan(/(\\W+|\\w+)/).map{|x| x.first.capitalize}.join\n\n respondents = line[1]\n semester = line[11]\n full_course_number.upcase!\n\n # Check and find department\n department = Department.find_by_nice_abbr(dept_abbr)\n if department.nil?\n puts \"Could not find department #{dept_abbr}. Please check the formatting of the input file.\"\n exit\n end\n\n # Check whether course exists\n (course_number, suffix) = full_course_number.match(/^([0-9]*)([A-Z]*)$/)[1..-1]\n course = Course.find(:first, :conditions => {:department_id => department.id, :course_number => course_number, :suffix => suffix})\n if course.nil?\n puts \"Could not find course #{dept_abbr} #{full_course_number}. Please enter it into the database before rerunning this script\" \n exit\n end\n\n # Check whether instructor exists\n # I have no idea what we should do about duplicates. I'll probably want to see what the old script did\n # So many bad things can happen here if the survey does not format the instructor name properly\n instructor = Instructor.find(:first, :conditions => { :first_name => first_name, :last_name => last_name })\n \n if instructor.nil?\n puts \"No instructor named #{first_name} #{last_name} found. Creating now.\"\n puts \"If this is in error, please merge the instructor entries in the database.\"\n if title == \"prof\"\n privacy = false\n else\n privacy = true\n end\n instructor = Instructor.create( :first_name => first_name, :last_name => last_name, :private => privacy )\n end\n\n # Check whether klass exists, note that the EE survey results for TAs may not not follow the same section number convention as the other results\n formatted_semester = semester[-4..-1] + case semester[0..-6] when \"SPRING\" then \"1\" when \"SUMMER\" then \"2\" when \"FALL\" then \"3\" else \"UNKNOWN\" end\n klass = Klass.find( :first, :conditions => { :course_id => course.id, :semester => formatted_semester, :section => section } )\n if klass.nil?\n if title == 'ta'\n raise \"Error: TA #{first_name} #{last_name} belongs to unknown section of #{course_number}\"\n elsif title == 'prof'\n puts \"No klass for #{semester} #{course.course_abbr} found. Creating new one.\"\n klass = Klass.create( :course_id => course.id, :semester => formatted_semester, :section => section )\n else\n raise \"Error\"\n end\n end\n\n # Check whether instructor is an instructor or a TA for the klass\n case title\n when \"prof\"\n klass.instructors << instructor unless klass.instructors.include? instructor\n klass.save\n when \"ta\"\n klass.tas << instructor unless klass.tas.include? instructor\n klass.save\n else\n raise \"Error: Title #{title} not recognized. Should be either 'prof' or 'ta'\"\n end\n\n return [1, instructor, klass]\nend",
"def interpret(d)\n article = Article.new\n\n if d['headline'] != []\n if !d['headline']['main'].nil?\n article.title = d['headline']['main']\n elsif !d['headline']['name'].nil?\n article.title = d['headline']['name']\n end\n end\n if article.title.nil?\n article.title = 'n/a'\n end\n\n article.source = @source\n article.pub_date = !(d['pub_date'].eql? '') ? (DateTime.parse d['pub_date']) : nil\n\n byline = (d['byline'] != []) ? d['byline']['original'] : 'n/a'\n article.author = (byline[0..2] == 'By ') ? byline[3..byline.size] : byline\n\n article.link = !(d['web_url'].eql? '') ? d['web_url'] : 'n/a'\n article.summary = !(d['snippet'].eql? '') ? d['snippet'] : 'n/a'\n\n # an article may contain several images\n image = []\n if d['multimedia'] != []\n url = 'http://www.nytimes.com/'\n img = d['multimedia']\n img.each { |i| (i['type'] == 'image') ? image << (url + i['url']) : 'n/a' }\n else\n image << 'n/a'\n end\n article.image = image.join(',')\n\n article\n end",
"def metadata_file\n @metadata_file ||= site.in_source_dir(\".jekyll-metadata\")\n end",
"def parse_page_file\n raise \"File not found: #{@pointer['realpath']}\" unless File.exist?(@pointer['realpath'])\n\n page = File.open(@pointer['realpath'], 'r:UTF-8') {|f| f.read }\n\n begin\n front_matter = page.match(FMregex)\n rescue => e\n raise \"Error trying to read meta-data from #{@pointer['realpath']}.\" +\n \" Check your folder configuration. Error details: #{e}\"\n end\n \n data = front_matter ?\n (YAML.load(front_matter[0].gsub(/---\\n/, \"\")) || {}) :\n {}\n\n result = {\n \"data\" => data,\n \"content\" => page.gsub(FMregex, '')\n }\n\n # variable cache\n @data = data\n @content = result['content']\n\n result\n rescue Psych::SyntaxError => e\n Ruhoh.log.error(\"Psych::SyntaxError while parsing top YAML Metadata in #{ @pointer['realpath'] }\\n\" +\n \"#{ e.message }\\n\" +\n \"Try validating the YAML metadata using http://yamllint.com\"\n )\n nil\n end",
"def metadata_file; end",
"def metadata_file; end",
"def parseSeriesDcMetadata(metadata)\n # Get an array of hashes for with key names and fallback values\n dc_metadata_definition = getSeriesDcMetadataDefinition(metadata)\n\n # Get values for the given keys, or use fallback values of the key does not exist\n dc_data = {}\n dc_metadata_definition.each do |definition|\n dc_data[definition[:symbol]] = OcUtil::parseMetadataFieldOrFallback(metadata, definition[:fullName], definition[:fallback])\n end\n\n return dc_data\n end",
"def get_datastream( pid, dsID )\n pid.include?(\"druid\") ? pid = pid : pid = \"druid:#{pid}\"\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID + '/content') \n RestClient.get(uri.to_s)\n rescue => e\n e.response \n end",
"def clinical_dose drug_id\n result = ClinicalDose.where( drug_id: drug_id, species_id: [self.species, nil])\n result.any? ? result.first : nil\n end",
"def getSeriesDcMetadataDefinition(metadata)\n dc_metadata_definition = []\n dc_metadata_definition.push( { :symbol => :title,\n :fullName => \"opencast-series-dc-title\",\n :fallback => metadata['meetingname']})\n dc_metadata_definition.push( { :symbol => :identifier,\n :fullName => \"opencast-dc-isPartOf\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :creator,\n :fullName => \"opencast-series-dc-creator\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :contributor,\n :fullName => \"opencast-series-dc-contributor\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :subject,\n :fullName => \"opencast-series-dc-subject\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :language,\n :fullName => \"opencast-series-dc-language\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :description,\n :fullName => \"opencast-series-dc-description\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :rightsHolder,\n :fullName => \"opencast-series-dc-rightsholder\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :license,\n :fullName => \"opencast-series-dc-license\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :publisher,\n :fullName => \"opencast-series-dc-publisher\",\n :fallback => nil})\n return dc_metadata_definition\n end",
"def read_summary(fname)\n hash={}\n # Read file\n File.open(fname,'r') do |f|\n # Loop over line\n f.each_line do |line|\n line.chomp!\n index,content = line.split(/\\s*==\\s*/)\n hash[index] = content # index:id, content:path\n end\n end\n return hash\nend",
"def read_metadata\n @client.get(metadata_path)\n end",
"def parse_spec(file)\n file = File.open(file, 'r', :encoding => \"UTF-8\")\n lines = file.readlines\n line = lines.shift\n groups = {}\n count = 0\n cur = nil\n curgroup = nil\n while line do\n if line =~ /^Gegevensgroep(.*)$/ \n curgroup = $1.strip\n groups[curgroup] = []\n # don't parse explanation and condition yet\n line = lines.shift\n next\n end\n if line =~ /^Gegevensnaam(.*)$/\n cur = Datum.new\n groups[curgroup] << cur\n count += 1\n cur.name = $1.strip\n line = lines.shift\n while line !~ /^[Ii]dentificatie/\n cur.name << line\n line = lines.shift\n end\n next\n end\n if cur && line =~ /^[Ii]dentificatie(.*)$/\n cur.id = $1.strip\n line = lines.shift\n next\n end\n if cur && line =~ /^Omschrijving(.*)$/\n cur.description = $1.strip\n line = lines.shift\n while line !~ /^Condities/\n cur.description << line\n line = lines.shift\n end\n next \n end\n if cur && line =~ /^Condities(.*)$/ \n cur.conditions = $1.strip\n line = lines.shift\n while line !~ /^Toelichting/\n cur.conditions << line\n line = lines.shift\n end\n next\n end\n if cur && line =~ /^Toelichting(.*)$/ \n cur.explanation = $1.strip\n line = lines.shift\n while line !~ /^Formaat/\n cur.explanation << line\n line = lines.shift\n end\n next\n end\n if cur && line =~/^Formaat (.*)$/\n cur.format = $1\n line = lines.shift\n next\n end\n cur = nil\n line = lines.shift\n end\n return groups\nend",
"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 get_demographics(patient, doc)\n patient['first'] = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:name/cda:given').text\n patient['last'] = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:name/cda:family').text\n birthdate_in_hl7ts_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:birthTime')\n birthdate_in_hl7ts = birthdate_in_hl7ts_node['value']\n patient['birthdate'] = HL7Helper.timestamp_to_integer(birthdate_in_hl7ts)\n gender_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:administrativeGenderCode')\n patient['gender'] = gender_node['code']\n race_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:raceCode')\n patient['race'] = race_node['code'] if race_node\n ethnicity_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:ethnicGroupCode')\n patient['ethnicity'] = ethnicity_node['code'] if ethnicity_node\n\n languages = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient').search('languageCommunication').map {|lc| lc.at_xpath('cda:languageCode')['code'] }\n patient['languages'] = languages unless languages.empty?\n \n id_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:id')\n patient['patient_id'] = id_node['extension']\n end",
"def content\n @content ||= repository.datastream_dissemination :pid => pid, :dsid => dsid\n end",
"def load_text_metadata\n str = self.client.getmd({}, @address)\n keymap = self.class.md_key_map # subclasses implement this function\n types = self.class.md_type_coercion_map # subclasses might implement this function\n \n # regular expression: matches lines with:\n # 4 whitespace characters at start of line\n # word containing uppercase characters and/or underscores (captured as var 1)\n # colon character immediately after that word\n # one or more whitespace characters\n # any characters following that whitespace, up to end of line (captured as var 2)\n # So, if the string matches, it gets the key as var 1, value as var 2\n re = /^\\W{4}([A-Z_]+):\\s+(.+)$/\n str.each_line do |line|\n md = re.match(line)\n next if md.nil?\n next if md.size < 3 # skip if we didn't get a value for a key (or didn't match)\n \n # insert the metadata value into the @metadata hash\n insert_metadata md[1], md[2], keymap, types\n end\n \n # note that we don't need to run this again\n @metadata_loaded = true\n end",
"def diphot_metadata_to_h\n File.open(@qualified_filename, 'r') do |fd|\n diff = fd.readline.chomp\n reference = fd.readline.chomp\n @obj_metadata = { 'diff' => diff, 'reference' => reference }\n end\n end",
"def create\n @study = Study.new\n @study.creator_id = current_user.id unless current_user.nil?\n @study.project_id = params[:project_id]\n @study.save\n #StudyAssignment.set_assignment(@study.id, @study.creator_id, 0) unless @study.creator_id.nil?\n\n # if the user selected a key question, then make appropriate database\n # entries for key questions and extraction forms\n unless !defined?(params[:study]) || params[:study].nil?\n @study.assign_kqs_and_efs(params[:study])\n end\n\n # put simple study id and title information in the session object\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n unless @study_extforms.empty?\n @included_sections = Hash.new\n @kqs_per_section = Hash.new()\n @study_extforms.each do |ef|\n included = ExtractionFormSection.get_included_sections(ef.extraction_form_id)\n @included_sections[ef.extraction_form_id] = included\n @kqs_per_section[ef.extraction_form_id] = ExtractionFormSection.get_questions_per_section(ef.extraction_form_id,@study)\n end\n end\n\n # get info on secondary publications\n @project = Project.find(@study.project_id)\n flash[:success] = \"The study was successfully created.\"\n redirect_to \"/projects/#{@project.id}/studies/#{@study.id}/edit\"\n end",
"def set_case_study\n @case_study = CaseStudy.find(params[:id])\n end",
"def set_case_study\n @case_study = CaseStudy.find(params[:id])\n end",
"def set_case_study\n @case_study = CaseStudy.find(params[:id])\n end",
"def set_study_set\n @study_set = StudySet.find(params[:id])\n end",
"def getDcMetadataDefinition(metadata, useSharedNotesForDescriptionFallback, passIdentifierAsDcSource,\n meetingStartTime, meetingEndTime)\n dc_metadata_definition = []\n dc_metadata_definition.push( { :symbol => :title,\n :fullName => \"opencast-dc-title\",\n :fallback => metadata['meetingname']})\n dc_metadata_definition.push( { :symbol => :identifier,\n :fullName => \"opencast-dc-identifier\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :creator,\n :fullName => \"opencast-dc-creator\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :isPartOf,\n :fullName => \"opencast-dc-ispartof\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :contributor,\n :fullName => \"opencast-dc-contributor\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :subject,\n :fullName => \"opencast-dc-subject\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :language,\n :fullName => \"opencast-dc-language\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :description,\n :fullName => \"opencast-dc-description\",\n :fallback => useSharedNotesForDescriptionFallback ?\n sharedNotesToString(SHARED_NOTES_PATH) : nil})\n dc_metadata_definition.push( { :symbol => :spatial,\n :fullName => \"opencast-dc-spatial\",\n :fallback => \"BigBlueButton\"})\n dc_metadata_definition.push( { :symbol => :created,\n :fullName => \"opencast-dc-created\",\n :fallback => meetingStartTime})\n dc_metadata_definition.push( { :symbol => :rightsHolder,\n :fullName => \"opencast-dc-rightsholder\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :license,\n :fullName => \"opencast-dc-license\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :publisher,\n :fullName => \"opencast-dc-publisher\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :temporal,\n :fullName => \"opencast-dc-temporal\",\n :fallback => (meetingStartTime && meetingEndTime) ?\n \"start=#{Time.at(meetingStartTime / 1000).to_datetime};\n end=#{Time.at(meetingEndTime / 1000).to_datetime};\n scheme=W3C-DTF\"\n : nil})\n dc_metadata_definition.push( { :symbol => :source,\n :fullName => \"opencast-dc-source\",\n :fallback => passIdentifierAsDcSource ?\n metadata[\"opencast-dc-identifier\"] : nil })\n return dc_metadata_definition\n end",
"def get_document_metadata(d)\n md = []\n begin\n md = d.stuffing_metadata\n rescue\n log_and_print \"WARN: get_document_metadata threw an unknown exception\"\n md = []\n end\n\n if md == nil\n md = []\n end\n \n return md\n end",
"def read\n\t\t@file_content = File.open(\"/home/calin/football/football.dat\",\"r\")\n\tend",
"def full_description\n self.study_detail.try(:full_description)\n end",
"def getMp3Info(file)\n ret = {}\n tagstrings = `eyeD3 --no-color #{file} | grep -P '(title|artist|album)' | sed 's/\\\\t\\\\+/\\\\n/'`.split(\"\\n\")\n tagstrings.each do |line|\n key_val = line.split(\":\")\n ret[(key_val[0].strip.to_sym)] = key_val[1]\n end\n if ret[:artist].nil? || ret[:album].nil? || ret[:title].nil?\n raise \"Error parsing id3 tags on mp3 file - is it possible that eyeD3 output format has changed?\"\n end\n ret\nend",
"def read_track music_file\n\tname = music_file.gets()\n\tlocation = music_file.gets()\n\ttrack = Track.new(name, location)\n\treturn track\nend",
"def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = meta_info_file_pathname.read.strip.split(':').map(&:to_i)\n {\n inode: inode,\n bytes_read: bytes_read\n }\n else\n {\n inode: nil,\n bytes_read: 0\n }\n end\n end",
"def read_meta(node)\n t = decompress_revision(node)\n return {} unless has_metadata?(t)\n \n mt = t[metadata_start..(metadata_end(t) - 1)]\n mt.split(\"\\n\").inject({}) do |hash, line|\n k, v = line.split(\": \", 2)\n hash[k] = v\n hash\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 mediainfo(filename)\n\n puts(\"Running mediainfo on #{filename}\") if @debug\n metadata = {}\n output = %x[mediainfo --full '#{filename}']\n\n lines = output.split(/$/)\n\n lines.each do |line|\n line.gsub! /^$\\n/, ''\n line.strip!\n\n if (line =~ /duration\\s+:\\s+(\\d+)/i && metadata[:duration] == nil)\n duration = $1.to_i\n metadata[:duration] = duration / 1000\n end\n if (line =~ /scan type\\s+:\\s+interlaced/i)\n metadata[:interlaced] = true\n end\n if (line =~ /width\\s+:\\s+1440/i)\n metadata[:needs_scaling] = true\n end\n end\n\n metadata\nend"
] |
[
"0.6062818",
"0.5943793",
"0.53857136",
"0.5285459",
"0.52500516",
"0.5240419",
"0.5210561",
"0.5209262",
"0.5196281",
"0.5161175",
"0.5157264",
"0.51322967",
"0.51322967",
"0.51322967",
"0.51322967",
"0.51322967",
"0.51322967",
"0.51322967",
"0.50869656",
"0.50776047",
"0.50670004",
"0.5028138",
"0.5022055",
"0.5020003",
"0.5012854",
"0.50054425",
"0.50054425",
"0.49991703",
"0.4989159",
"0.49641302",
"0.4955848",
"0.4931835",
"0.49183422",
"0.49138305",
"0.48808807",
"0.48785076",
"0.4878254",
"0.48633584",
"0.48501664",
"0.48501664",
"0.48486057",
"0.4837613",
"0.4837613",
"0.48367587",
"0.4805876",
"0.47895008",
"0.47887632",
"0.47849193",
"0.47589087",
"0.47324485",
"0.47168192",
"0.47108",
"0.47084162",
"0.47006106",
"0.46994177",
"0.46961537",
"0.46910748",
"0.46879825",
"0.4686964",
"0.4682971",
"0.46821013",
"0.46772623",
"0.46749797",
"0.4667499",
"0.4666727",
"0.4665434",
"0.4631602",
"0.4631035",
"0.46304733",
"0.46286434",
"0.4624319",
"0.46236885",
"0.46236885",
"0.46183065",
"0.4613613",
"0.4608067",
"0.46037877",
"0.4601788",
"0.46014693",
"0.45911756",
"0.4590691",
"0.4581363",
"0.456829",
"0.4561152",
"0.4557634",
"0.45529488",
"0.4551869",
"0.4551869",
"0.4551869",
"0.45511204",
"0.45470387",
"0.4535163",
"0.4528281",
"0.45240504",
"0.451698",
"0.4513247",
"0.45083737",
"0.4505609",
"0.45051193",
"0.45048016"
] |
0.73066497
|
0
|
information about the variables
|
def get_variable_information doc
variables = []
variable_info_hash = Hash.new
docnodes = doc.find('//dataDscr')
vargroups = docnodes[0].find('//dataDscr/varGrp')
vargroups.each do |vargroup|
#hash which holds all the variable groups
a = vargroup.attributes
groups = a.get_attribute('var')
if groups != nil
groups = a.get_attribute('var')
variable_info_hash[vargroup.find('./labl')[0].first.content] = groups.value.split(' ') unless vargroup.find('./labl')[0] == nil
# else
# variable_info_hash[vargroup.find('./labl')[0].first.content] = groups.value.split(' ')
end
end
vars = docnodes[0].find('//dataDscr/var')
vars.each do |var|
variable = DDI::DDIVariable.new
var_attr = var.attributes
variable.id = var_attr.get_attribute('ID').value.strip unless var_attr.get_attribute('ID') == nil
variable.name = var_attr.get_attribute('name').value.strip unless var_attr.get_attribute('name') == nil
#if there is no name then it has no meaning or context
next if variable.name == nil
variable.file = var_attr.get_attribute('files').value.strip unless var_attr.get_attribute('files') == nil
variable.interval = var_attr.get_attribute('intrvl').value.strip unless var_attr.get_attribute('intrvl') == nil
variable.label = var.find('./labl')[0].content.strip unless var.find('./labl')[0] == nil
#these things never seem consistent with the schema, might be an inner element, might be an attribute!
if var.find('./labl')[0] == nil
variable.label = var_attr.get_attribute('labl').value.strip unless var_attr.get_attribute('labl') == nil
end
rng = var.find('./valrng')
if rng != nil
if rng[0] != nil
unless rng[0].first == nil
range_attr = rng[0].first.attributes
max_val = range_attr.get_attribute('max')
variable.max = max_val.value.strip unless max_val == nil
min_val = range_attr.get_attribute('min')
variable.min = min_val.value.strip unless min_val == nil
end
end
end
q = var.find('./qstn')
if q[0] != nil
ql = q[0].find('./qstnLit')
if ql != nil
if ql[0] != nil
variable.question = ql[0].first.content.strip
end
end
iv = q[0].find('./ivuInstr')
if iv != nil
if iv[0] != nil
variable.interview_instruction = iv[0].first.content.strip
end
end
end
stats = var.find('./sumStat')
summary_stats = []
stats.each do |stat|
a = stat.attributes
# summary_stats[a.get_attribute('type').value] = stat.first.content
statistic = DDI::SummaryStat.new
statistic.type = a.get_attribute('type').value.strip
statistic.value = stat.first.content.strip
summary_stats.push(statistic)
end
variable.summary_stats = summary_stats
catgry = var.find('./catgry')
categories = []
#categories in ddi are value domains in mb
catgry.each do |cat|
category = DDI::Category.new
valxml = cat.find('./catValu')
if valxml != nil && valxml[0] != nil
category.value = valxml[0].first.content.strip unless valxml[0].first == nil
else
category.value = 'N/A'
end
labxml = cat.find('./labl')
if labxml != nil && labxml[0] != nil
category.label = labxml[0].first.content.strip unless labxml[0].first == nil
else
category.label = 'N/A'
end
catstats = cat.find('./catStat')
category_statistics = []
catstats.each do |catstat|
category_statistic = DDI::CategoryStatistic.new
a = catstat.attributes
if a != nil && a.get_attribute('type') != nil
category_statistic.type = a.get_attribute('type').value.strip
category_statistic.value = catstat.first.content.strip unless catstat.first == nil
category_statistics.push(category_statistic)
end
end
category.category_statistics = category_statistics
categories.push(category)
end
#what group is the variable in
variable_info_hash.each_key do |key|
if variable_info_hash[key].include?(variable.id)
variable.group = key.strip
break
end
end
variable.categories = categories
variables.push(variable)
end
return variables
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def variables; end",
"def variables; end",
"def vars\n variables.values\n end",
"def vars\n variables.values\n end",
"def local_variables() end",
"def vars\n @vars ||= soln.keys\n @vars\n end",
"def info_variables\n @queue << \"i v\"\n end",
"def variables\n {}\n end",
"def print_variables() #method\n puts \"Variables directory:\"\n @variables.each do |key, variable|\n puts \"------------------------------------------------------\"\n puts(\"|Name: #{variable.name}, Type: #{variable.type}, Size: #{variable.size}, Dir: #{variable.memory_dir}, Dim Obj: #{variable.dim_objs}|\")\n puts \"------------------------------------------------------\"\n end\n end",
"def variables\n return @variables unless @variables.nil?\n vars = []\n dict = @instance.getDictionary\n dict.getVariables.each do |var|\n vars << {\n :name => var.getName,\n :qual => var.getQualification.toString.downcase.to_sym,\n :type => var.getType.toString.downcase.to_sym,\n :formula => var.getFormula.getValue,\n :variable => var,\n }\n end\n @variables = vars\n end",
"def instance_variables() end",
"def print_vars\n p @@z\n p @z # <1>\n end",
"def variable_name; end",
"def variable_name; end",
"def variable; end",
"def variable; end",
"def showvars(x,y)\n \"x = #{x}\\ny = #{y}\"\nend",
"def class_variables() end",
"def variables\n root.variables_value\n end",
"def basic_variables\n {\n 'x_card_num' => number,\n 'x_card_code' => ccv,\n 'x_exp_date' => exp_date,\n 'x_amount' => amount\n }\n end",
"def locals; list_all :local_variables; end",
"def get_variables\n get_siteinfo('variables')['query']['variables']\n end",
"def global_variables() end",
"def variables\n @table.keys\n end",
"def instance_variables; end",
"def output_variables\n string = \"\"\n @variables.each { |name, value| string += \"#{name} = #{value}\\n\" }\n string\n end",
"def print var_name\n v = @var_table[var_name]\n if v.class == Array\n @upstream.info \"Array: #{v.length}: #{@var_table[var_name].inspect}\"\n elsif v.class == Fixnum\n @upstream.info \"Integer: #{v}\"\n elsif v.nil?\n @upstream.info \"nil\"\n end\n end",
"def variables\n EMPTY_ARRAY\n end",
"def variable_names()\n @var_set.keys\n end",
"def locals\n variables - parameters - hidden\n end",
"def variables()\n # The result will be cached/memoized...\n @variables ||= begin\n vars = @representation.each_with_object([]) do |element, subResult|\n case element\n when Placeholder \n subResult << element.name\n \n else\n # Do nothing\n end\n end\n \n vars.flatten.uniq\n end\n \n return @variables\n end",
"def declared_variables\n @variables.select {|k, v| v == :var }.map {|pair| pair[0].to_s }.sort\n end",
"def inspect\n instance_variables.each_with_object([\n \"\\n#<#{self.class}:0x#{object_id.to_s(16)}>\",\n \"\\tInstance variables:\"\n ]) do |item, result|\n result << \"\\t\\t#{item} = #{instance_variable_get(item)}\"\n result\n end.join(\"\\n\")\n end",
"def summary\n\t\tresult = {}\n\t\tinstance_variables().each do |name|\n\t\t\tif name.to_s =~ /^@(.*)_chance$/\n\t\t\t\tresult[$1.to_sym] = self.instance_variable_get(name)\n\t\t\tend\n\t\tend\n\t\tresult.inspect\n\tend",
"def instance_variable_names; end",
"def info; end",
"def info; end",
"def instance_variables\n get_instance_variables.to_a.collect{ |n| \"#{n}\".to_sym }\n end",
"def class_variables; end",
"def variables\n\n @root_expression && @root_expression.variables\n end",
"def locals; end",
"def locals; end",
"def locals; end",
"def variables\n {\n 'customId' => @custom_id,\n 'environmentName' => @app_env,\n 'programmingLanguage' => 'RUBY',\n 'workflowName' => @workflow_name\n }\n end",
"def info(value); end",
"def prep_variables\n end",
"def instance_variables\n get_instance_variables.to_a.collect{ |n| \"@#{n}\".to_sym }\n end",
"def show\n setup_variables(params)\n\n end",
"def vars\n operands.vars.flatten.compact\n end",
"def variable_count\n variables.size\n end",
"def print_values\n print \"\\nRegister A: #{@register_a}\\tRegister B: #{@register_b}\\n\"\n print \"Zero Bit: #{@zero_bit}\\tOverflow Bit: #{@overflow}\\n\"\n print \"Program Counter: #{@pc}\\n\"\n print \"Memory: #{@memory}\\n\"\n end",
"def variables\n format.scan(/(%\\w+)/).flatten.map {|v| v[1..v.length] }\n end",
"def variables\n return @options[:variables]\n end",
"def variables\n context.variables.keys - context.allowed_variables\n end",
"def variables\n @countries = [\"Australia\",\"Canada\",\"France\",\"Mexico\",\"Spain\",\"Norway\",\"Netherlands\",\"United States\"]\n @categories = [\"Art\",\"Music\",\"Film and Video\",\"Tech\",\"Dance\",\"Fashion\",\"Games\",\"Photography\",\"Theather\",\"Food\"]\n end",
"def my_var\n\ta = 10\n\tb = \"10\"\n\tc = \"dix\"\n\td = 10.0\n\tputs \"mes variables :\"\n\tputs \"\\ta contient : #{a} et est de type: #{a.class}\"\n\tputs \"\\tb contient : #{b} et est de type: #{b.class}\"\n\tputs \"\\tc contient : #{c} et est de type: #{c.class}\"\n\tputs \"\\td contient : #{d} et est de type: #{d.class}\"\nend",
"def info\n\tend",
"def get_vars(instruction)\n dictionary = {\n 'definition' => ['os_type_id','iso_file','boot_cmd_sequence','postinstall_files'],\n 'kickstart' => ['reponame','pkgs'],\n 'preseed' => ['suite','pkgs'],\n 'autoinst' => ['pkgs']\n }\n # 'kickstart_file' option in definition.rb is deprecated\n # erb_vars = ['os_type_id','iso_file','boot_cmd_sequence','kickstart_file','postinstall_files']\n return dictionary[instruction]\n end",
"def data\r\n @obj.read_var(@name)\r\n end",
"def all_variables\n\n return nil if @expressions.empty?\n\n @expressions.each_with_object({}) { |exp, h|\n h[exp.fei] = exp.variables if exp.variables\n }\n end",
"def get_info \n \"#{@model}, #{@wheels}, #{@current_speed}\"\n end",
"def all_variables\n @items.map(&:variables).flatten\n end",
"def read_metadata\n { :variable_set => nil }\n end",
"def variables(vars)\n @storage[:variables] = vars\n end",
"def variable_objects()\n @var_set.values\n end",
"def variables()\n all_vars = children.each_with_object([]) do |a_child, subResult|\n case a_child\n when Placeholder\n subResult << a_child.name\n when Section\n subResult.concat(a_child.variables)\n end\n end\n\n return all_vars.flatten.uniq\n end",
"def get_variables\n\t\t@assignment = Assignment.find(params[:assignment_id])\n\t\t@assignment_type = @assignment.assignment_type\n\t\t@course = @assignment_type.course\n\tend",
"def print_var(arr, variables)\n keyword_ops = KeywordOperations.new\n keyword_ops.get_val(arr[1], variables)\n end",
"def class_variables\n end",
"def info()\n #This is a stub, used for indexing\n end",
"def variables\n response = self.class.get_raw \"process-instance/#{id}/variables\"\n deserialize_variables response[:parsed_data][:data]\n end",
"def variables\n @variables ||= Mongo.collection(\"slanger.metrics.variables\")\n end",
"def build_vars\n\n end",
"def INFO_FIELDS\n %w(name created updated type ref user description comments)\n end",
"def info_locals\n @queue << \"i l\"\n end",
"def info\n @info\n end",
"def resolveV\r\n puts 'printing a list of instance variables:'\r\n\r\n puts @@currClass.instance_variables.to_s\r\n @@bLastUsed = false\r\n @@forwardClasses = []\r\n end",
"def my_var()\n hash = { a: 10, b: 10.to_s, c: nil, d: 10.0 }\n puts \"my variables :\"\n hash.each { |key, val| \n puts \"\\t #{key} contains: #{val.nil? ? val.inspect : val.to_s} and is a type : #{val.class}\"\n }\nend",
"def info\n @info ||= {}\n end",
"def procedure_instance_variables\n [:@databases, :@archives, :@encryptors, :@compressors, :@storages, :@notifiers, :@syncers]\n end",
"def inspect\n @info.inspect \n end",
"def getVarMap\n\t\t@var_map\n\tend",
"def vars\n variable? ? [self] : []\n end",
"def get_variables\n result = @assigns.each_value.reduce([]) do |ar,tree|\n ar.concat(tree.get_variables)\n end\n result.uniq!.sort!\n return result\n end",
"def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end",
"def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end",
"def info\n @info\n end",
"def print_basic_info\n \"Name:#{name}, Occupation:#{occupation}, Sex:#{sex}\"\n end",
"def toString\n\t\tself.instance_variables.each do |i|\n\t\t\tputs \"#{i[1..-1]}: #{self.instance_variable_get(i)}\\n\"\n\t\tend\n\tend",
"def toString\n\t\tself.instance_variables.each do |i|\n\t\t\tputs \"#{i[1..-1]}: #{self.instance_variable_get(i)}\\n\"\n\t\tend\n\tend",
"def vars\n select {|o| o.respond_to?(:vars)}.map(&:vars).flatten.compact\n end",
"def my_method\n v3 = 3\n puts local_variables\n log local_variables\n end",
"def var_names\n @var_names ||= eval \"local_variables\", get_binding\n end",
"def ivar_descriptions\n\t\tself.instance_variables.sort.collect do |ivar|\n\t\t\tnext unless ivar.respond_to?( :length )\n\t\t\tlen = self.instance_variable_get( ivar ).length\n\t\t\t\"%d %s\" % [ len, ivar.to_s.gsub(/_/, ' ')[1..-1] ]\n\t\tend\n\tend",
"def print_free_vars_initializer\n @printer << 'def ' << FreeVarInitName << '(_yadpy_values):' << :nl\n @printer << ' global '\n @typechecker.references.each_with_index do |pair, i|\n @printer << ', ' if i > 0\n @printer << pair[1]\n end\n @printer << :nl\n args = []\n i = 0\n @typechecker.references.each do |pair|\n @printer << ' ' << pair[1] << ' = ' << '_yadpy_values[' << i.to_s << ']' << :nl\n args << pair[0]\n i += 1\n end\n @printer << :nl\n return args\n end",
"def cvars; end",
"def info\n @info ||= {}\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n \"#<#{self.class} #{instance_variables.map{|iv| \"#{iv}=>#{instance_variable_get(iv).inspect}\"}.join(', ')}>\"\n end"
] |
[
"0.8170768",
"0.8170768",
"0.7431272",
"0.7431272",
"0.71834475",
"0.7038542",
"0.7016133",
"0.6988799",
"0.6948198",
"0.6921278",
"0.68772167",
"0.6808953",
"0.6788339",
"0.6788339",
"0.67542815",
"0.67542815",
"0.6743187",
"0.67061263",
"0.66260576",
"0.6624385",
"0.6519377",
"0.6513733",
"0.6510434",
"0.650953",
"0.6508661",
"0.6455212",
"0.6449038",
"0.6439983",
"0.64140147",
"0.6383658",
"0.638289",
"0.6381495",
"0.6373647",
"0.63637054",
"0.6360651",
"0.63398135",
"0.63398135",
"0.6335369",
"0.6325276",
"0.6317365",
"0.63034177",
"0.63034177",
"0.63034177",
"0.6279207",
"0.6220634",
"0.62036604",
"0.62013274",
"0.61827445",
"0.6163845",
"0.61536765",
"0.61435807",
"0.6131106",
"0.61310476",
"0.61123985",
"0.6086246",
"0.6080177",
"0.6075672",
"0.60737133",
"0.60723",
"0.6067237",
"0.60653895",
"0.60499",
"0.6048854",
"0.60458046",
"0.60244834",
"0.6023778",
"0.6017858",
"0.60058284",
"0.6002422",
"0.60003895",
"0.59986854",
"0.59594107",
"0.5954441",
"0.5953415",
"0.5953377",
"0.59486544",
"0.5933904",
"0.593194",
"0.5928609",
"0.5921015",
"0.592015",
"0.5912124",
"0.59100384",
"0.5906524",
"0.59053284",
"0.59053284",
"0.590044",
"0.58927",
"0.5889057",
"0.5889057",
"0.5883989",
"0.58677673",
"0.5864427",
"0.58535427",
"0.5847411",
"0.58429253",
"0.58389896",
"0.58309686",
"0.58309686",
"0.5827347"
] |
0.624098
|
44
|
GET /theloaisaches or /theloaisaches.json
|
def index
@theloaisaches = Theloaisach.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@teaches) }\n\t\tend\n\n end",
"def show\n\t\trespond_to do |format|\n format.html { render :show }\n format.json { render json: Oj.dump(@teaches) }\n end\n\n end",
"def index\n @the_loai_saches = TheLoaiSach.all\n end",
"def hearings(options = {})\n get('/hearings', options)\n end",
"def index\n @title = t 'view.teaches.index_title'\n @teaches = @teaches.page(params[:page]).uniq('id')\n @teaches = @teaches.in_institution(current_institution) if current_institution\n @teaches = @teaches.historic if @user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def index\n if params[:tea] && params[:tea][:category]\n @teas = Tea.where(:category => params[:tea][:category])\n else\n @teas = Tea.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teas }\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def show\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goody }\n end\n end",
"def heros\n get('/hero/')\n end",
"def show\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotele }\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def show\n respond_with(@coaches = Coach.find(params[:id]))\n end",
"def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def show\n @title = t 'view.teaches.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end",
"def coach\n fetch('football.coaches')\n end",
"def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def show\n @talent = Talent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @talent }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index.html.erb\n format.json { render json: @dteors } \n else\n format.html { redirect_to new_student_path, notice: t(:vvedit_dani)}\n end\n \n end\n end",
"def index\n @you_owe_mes = YouOweMe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @you_owe_mes }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\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 index\n \n if params.has_key?(:geo_treasure_id)\n @treasure_treasures = Treasure::Treasure.where(geo_treasure_id: params[:geo_treasure_id])\n logger.debug \"treasures #{@treasure_treasures.inspect}\"\n else\n raise ForbiddenError.new \"access forbidden\" unless admin? || staff? || developer?\n @treasure_treasures = Treasure::Treasure.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treasure_treasures }\n end\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def show\n @you_owe_me = YouOweMe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @you_owe_me }\n end\n end",
"def show\n @leye = Leye.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leye }\n end\n end",
"def index\n @passengers = Passenger.all\n respond_to do |format|\n format.html\n format.json { render :json => @passengers}\n end\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def index\n info = ScheduleProcessor.headway_info\n query = params[:text]\n workspace = params[:enterprise_name] || params[:team_domain]\n user_id = params[:user_id]\n\n if query == 'help'\n result = help_response(info[:routes])\n elsif (data = info[:routes].find { |r| r[:id] == query})\n track_event('slash', \"route/#{query}\", user_id, workspace)\n result = route_response(data)\n elsif query == 'delays'\n track_event('slash', 'delays', user_id, workspace)\n result = delays_response(info[:routes])\n else\n track_event('slash', 'default', user_id, workspace)\n result = default_response(info)\n end\n \n render json: result\n end",
"def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end",
"def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def http( *args )\n p http_get( *args )\n end",
"def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end",
"def list\n get('/')\n end",
"def index\n @election = Election.find(params[:election_id])\n @races = @election.races\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @races }\n end\n end",
"def goals(*args)\n @client.get \"#{@path}/goals\", Hash[*args]\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end",
"def index\r\n @chapas = Chapa.all\r\n respond_with(@chapas)\r\n end",
"def index\n @teachers = Teacher.order(:tea_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teachers }\n end\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def show\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @representante_athlete }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def abilities\n get('/ability/')\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end",
"def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def get(path, **args); end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def show\n @harvest_trello = HarvestTrello.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvest_trello }\n end\n end",
"def show\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ways_of_admission }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end",
"def show\n @route = Route.find(params[:id])\n @driver = Hitchhiker.find(@route.hitchhiker_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\n end\n end",
"def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def index\n @tl_saches = TlSach.all\n end",
"def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend",
"def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\n end",
"def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end",
"def get(route='', params = {}, filter = nil)\n url = base_url + route\n unless filter.nil?\n url << '/' + \"(#{ERB::Util.url_encode(filter)})\"\n end\n url << '.json'\n begin\n JSON.parse(RestClient.get(url, params: params))\n rescue RestClient::ResourceNotFound => e\n Object.new\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @bubble_tea = BubbleTea.find(params[:id])\n render json: @bubble_tea\n end",
"def ambassador(params = {})\n self.class.get('/ambassador/get', params)\n end",
"def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end"
] |
[
"0.6470635",
"0.6407504",
"0.6238453",
"0.613327",
"0.60264987",
"0.59744483",
"0.589963",
"0.5894425",
"0.5887093",
"0.5886826",
"0.5879474",
"0.58148515",
"0.5810373",
"0.57945275",
"0.5775904",
"0.5772876",
"0.57721025",
"0.57721025",
"0.574822",
"0.5747134",
"0.5746791",
"0.5733215",
"0.57080555",
"0.570605",
"0.5699829",
"0.56735176",
"0.5665959",
"0.5655248",
"0.56368476",
"0.5634741",
"0.56305504",
"0.5627127",
"0.56258166",
"0.5617195",
"0.5617195",
"0.56055576",
"0.56043214",
"0.5604099",
"0.5600646",
"0.55978495",
"0.5589858",
"0.55881435",
"0.5577693",
"0.55753905",
"0.5566935",
"0.55658734",
"0.5559185",
"0.55580395",
"0.5545454",
"0.55446017",
"0.55438226",
"0.5536059",
"0.553253",
"0.5528996",
"0.5526257",
"0.5523063",
"0.55217224",
"0.55204135",
"0.5519899",
"0.5519644",
"0.55186504",
"0.5511301",
"0.55109006",
"0.5509729",
"0.5505693",
"0.55035806",
"0.54963696",
"0.5495281",
"0.54945934",
"0.5491746",
"0.5487961",
"0.5485845",
"0.5478783",
"0.5474602",
"0.5470879",
"0.5466662",
"0.54625344",
"0.54564106",
"0.5451926",
"0.5451906",
"0.5445327",
"0.5442561",
"0.54352933",
"0.54352933",
"0.5432097",
"0.5430601",
"0.5428146",
"0.5427589",
"0.5425529",
"0.5422405",
"0.54219675",
"0.5420038",
"0.54195774",
"0.5417552",
"0.54170173",
"0.54126126",
"0.54126126",
"0.54107255",
"0.54034156",
"0.5393736"
] |
0.649614
|
0
|
GET /theloaisaches/1 or /theloaisaches/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@teaches) }\n\t\tend\n\n end",
"def index\n @theloaisaches = Theloaisach.all\n end",
"def show\n\t\trespond_to do |format|\n format.html { render :show }\n format.json { render json: Oj.dump(@teaches) }\n end\n\n end",
"def index\n @title = t 'view.teaches.index_title'\n @teaches = @teaches.page(params[:page]).uniq('id')\n @teaches = @teaches.in_institution(current_institution) if current_institution\n @teaches = @teaches.historic if @user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goody }\n end\n end",
"def show\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotele }\n end\n end",
"def show\n @talent = Talent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @talent }\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def show\n @title = t 'view.teaches.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n respond_with(@coaches = Coach.find(params[:id]))\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def index\n @the_loai_saches = TheLoaiSach.all\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def show\n @leye = Leye.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leye }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end",
"def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end",
"def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end",
"def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @route = Route.find(params[:id])\n @driver = Hitchhiker.find(@route.hitchhiker_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\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\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 @trek = Trek.find(params[:id])\n @title = \"#{@trek.title} route\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trek }\n end\n end",
"def index\n if params[:tea] && params[:tea][:category]\n @teas = Tea.where(:category => params[:tea][:category])\n else\n @teas = Tea.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teas }\n end\n end",
"def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end",
"def show\n @path = params[:path] ? params[:path].split(\"/\") : []\n puts @theorem.id\n @display_object = @theorem\n if @path.last\n type = @path.last.split(\":\").first\n id = @path.last.split(\":\").last\n @display_object = type.constantize.find(id)\n end\n puts @theorem.id\n\n respond_to do |f|\n f.html do\n @theorem.viewed! unless (current_user && @theorem.user_id == current_user.id) || @path.count > 0\n render\n end\n f.json {render json: @theorem }\n end\n end",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def show\n @you_owe_me = YouOweMe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @you_owe_me }\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def show\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tetramod }\n end\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def show\n @templete = Templete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @templete }\n end\n end",
"def show\n @beattape = Beattape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beattape }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end",
"def show\n @habit = Habit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @habit }\n end\n end",
"def show\n @harvest_trello = HarvestTrello.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvest_trello }\n end\n end",
"def show\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lector }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end",
"def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end",
"def show\n @orthodb_best_orthologue = OrthodbBestOrthologue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orthodb_best_orthologue }\n end\n end",
"def show\n @bubble_tea = BubbleTea.find(params[:id])\n render json: @bubble_tea\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def show\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thought }\n end\n end",
"def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def show\r\n @antenne = Antenne.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @antenne }\r\n end\r\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 interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end",
"def show \n @route = Route.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @route }\n end\n end",
"def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\n end",
"def coach\n fetch('football.coaches')\n end",
"def show\n\n @anime = Finder.find_anime_by_id params[:id]\n @anime ||= KiWi.show_anime params[:id]\n\n # binding.pry\n\n render json: @anime\n end",
"def show\n @archetype = Archetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @archetype }\n end\n end",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def show\n @amplicon = Amplicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amplicon }\n end\n end",
"def show\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @avert }\n end\n end",
"def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end",
"def show\n @whattelpp = Whattelpp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @whattelpp }\n end\n end",
"def show\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ways_of_admission }\n end\n end",
"def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def show\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monkey }\n end\n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def show\n @betraege = Betraege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @betraege }\n end\n end",
"def index\n @teachers = Teacher.order(:tea_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teachers }\n end\n end",
"def show\n @turno = Turno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turno }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end",
"def show\n @webling = Webling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webling }\n end\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def get(path, **args); end",
"def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end",
"def show\n @eatvent = Eatvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eatvent }\n end\n end",
"def 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 @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end"
] |
[
"0.64893997",
"0.6244425",
"0.624108",
"0.6231589",
"0.6109041",
"0.6044681",
"0.6042624",
"0.60374546",
"0.60374546",
"0.6032156",
"0.59931415",
"0.59858245",
"0.59789467",
"0.59541863",
"0.5933957",
"0.5928734",
"0.59261364",
"0.59057224",
"0.58881956",
"0.58858454",
"0.5875908",
"0.5875908",
"0.58756393",
"0.58585894",
"0.58522755",
"0.5819755",
"0.5818821",
"0.5817051",
"0.58040947",
"0.5796306",
"0.5777043",
"0.5769399",
"0.5753555",
"0.57479084",
"0.5742399",
"0.57380617",
"0.5726888",
"0.57239264",
"0.57227373",
"0.57133734",
"0.57061124",
"0.5704893",
"0.56948245",
"0.5684747",
"0.5681984",
"0.5681382",
"0.5680141",
"0.5679456",
"0.5678468",
"0.5676448",
"0.5672974",
"0.5671813",
"0.5664079",
"0.5653553",
"0.56478167",
"0.56478167",
"0.5641744",
"0.5640495",
"0.5637581",
"0.5636168",
"0.5633784",
"0.5633784",
"0.5632475",
"0.56316763",
"0.5631204",
"0.5630277",
"0.56287587",
"0.5623763",
"0.56199104",
"0.56141543",
"0.56085753",
"0.56072325",
"0.56056184",
"0.5605609",
"0.56025356",
"0.56008255",
"0.56001824",
"0.5598767",
"0.55932915",
"0.55873233",
"0.55870014",
"0.55862457",
"0.5585303",
"0.5583796",
"0.5583412",
"0.55817246",
"0.5581234",
"0.55797434",
"0.5578488",
"0.5577649",
"0.55760413",
"0.55758786",
"0.5573778",
"0.5568497",
"0.55682343",
"0.5567656",
"0.55675304",
"0.5562754",
"0.5557985",
"0.55523676",
"0.55522746"
] |
0.0
|
-1
|
POST /theloaisaches or /theloaisaches.json
|
def create
@theloaisach = Theloaisach.new(theloaisach_params)
respond_to do |format|
if @theloaisach.save
format.html { redirect_to @theloaisach, notice: "Theloaisach was successfully created." }
format.json { render :show, status: :created, location: @theloaisach }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @theloaisach.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @the_loai_sach = TheLoaiSach.new(the_loai_sach_params)\n\n respond_to do |format|\n if @the_loai_sach.save\n format.html { redirect_to @the_loai_sach, notice: \"The loai sach was successfully created.\" }\n format.json { render :show, status: :created, location: @the_loai_sach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @the_loai_sach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t 'view.teaches.new_title'\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: t('view.teaches.correctly_created') }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: 'new' }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tea = Tea.new(params[:tea])\n\n respond_to do |format|\n if @tea.save\n format.html { redirect_to @tea, notice: 'Tea was successfully created.' }\n format.json { render json: @tea, status: :created, location: @tea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @word_praat = WordPraat.new(word_praat_params[:word_praat])\n\n respond_to do |format|\n if @word_praat.save\n format.html { redirect_to @word_praat, notice: 'Word praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @word_praat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render json: @tarefa, status: :created, location: @tarefa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @athlete = Athlete.new(athlete_params)\n @event = @athlete.event\n @routes = @event.routes\n respond_to do |format|\n if @athlete.save\n format.html { redirect_to @athlete, notice: 'Zgłoszenie zostało przyjęteTT' }\n format.json { render :show, status: :created, location: @athlete }\n else\n format.html { render :new }\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @walikela = Walikela.new(walikela_params)\n\n respond_to do |format|\n if @walikela.save\n format.html { redirect_to @walikela, notice: 'Walikela was successfully created.' }\n format.json { render action: 'show', status: :created, location: @walikela }\n else\n format.html { render action: 'new' }\n format.json { render json: @walikela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, **args); end",
"def create\n @tl_sach = TlSach.new(tl_sach_params)\n\n respond_to do |format|\n if @tl_sach.save\n format.html { redirect_to @tl_sach, notice: \"Tl sach was successfully created.\" }\n format.json { render :show, status: :created, location: @tl_sach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tl_sach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hotele = Hotele.new(params[:hotele])\n\n respond_to do |format|\n if @hotele.save\n format.html { redirect_to @hotele, notice: 'Hotele was successfully created.' }\n format.json { render json: @hotele, status: :created, location: @hotele }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hotele.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kela = Kela.new(kela_params)\n\n respond_to do |format|\n if @kela.save\n format.html { redirect_to @kela, notice: 'Kela was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kela }\n else\n format.html { render action: 'new' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hotele = Hotele.new(hotele_params)\n\n respond_to do |format|\n if @hotele.save\n format.html { redirect_to @hotele, notice: 'Hotele was successfully created.' }\n format.json { render :show, status: :created, location: @hotele }\n else\n format.html { render :new }\n format.json { render json: @hotele.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @tale = Tale.new(tale_params)\n\n respond_to do |format|\n if @tale.save\n format.html { redirect_to '/all', notice: 'Tale was successfully created.' }\n format.json { render :show, status: :created, location: @tale }\n else\n format.html { render :new }\n format.json { render json: @tale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apunte = Apunte.new(params[:apunte])\n\n respond_to do |format|\n if @apunte.save\n format.html { redirect_to @apunte, notice: 'Apunte was successfully created.' }\n format.json { render json: @apunte, status: :created, location: @apunte }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goody = Goody.new(params[:goody])\n\n respond_to do |format|\n if @goody.save\n format.html { redirect_to @goody, notice: 'Goody was successfully created.' }\n format.json { render json: @goody, status: :created, location: @goody }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @thre = Thre.new(thre_params)\n\n respond_to do |format|\n if @thre.save\n format.html { redirect_to @thre, notice: 'Thre was successfully created.' }\n format.json { render :show, status: :created, location: @thre }\n else\n format.html { render :new }\n format.json { render json: @thre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @etape = Etape.new(params[:etape])\n\n respond_to do |format|\n if @etape.save\n format.html { redirect_to @etape, notice: 'Etape was successfully created.' }\n format.json { render json: @etape, status: :created, location: @etape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tetramod = Tetramod.new(params[:tetramod])\n\n respond_to do |format|\n if @tetramod.save\n format.html { redirect_to @tetramod, notice: 'Tetramod was successfully created.' }\n format.json { render json: @tetramod, status: :created, location: @tetramod }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tetramod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @sach = Sach.new(sach_params)\n\n respond_to do |format|\n if @sach.save\n format.html { redirect_to @sach, notice: \"Sach was successfully created.\" }\n format.json { render :show, status: :created, location: @sach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @railway = Railway.new(params[:railway])\n\n respond_to do |format|\n if @railway.save\n format.html { redirect_to @railway, notice: 'Railway was successfully created.' }\n format.json { render json: @railway, status: :created, location: @railway }\n else\n format.html { render action: \"new\" }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create\n @talent = Talent.new(params[:talent])\n\n respond_to do |format|\n if @talent.save\n format.html { redirect_to @talent, :notice => 'Talent was successfully created.' }\n format.json { render :json => @talent, :status => :created, :location => @talent }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @talent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end",
"def create\n @thema = Thema.new(thema_params)\n\n respond_to do |format|\n if @thema.save\n format.html { redirect_to @thema, notice: 'Thema was successfully created.' }\n format.json { render action: 'show', status: :created, location: @thema }\n else\n format.html { render action: 'new' }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @athlete = Athlete.new(athlete_params)\n\n respond_to do |format|\n if @athlete.save\n format.html { redirect_to @athlete, notice: 'Athlete was successfully created.' }\n format.json { render :show, status: :created, location: @athlete }\n else\n format.html { render :new }\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @athlete = Athlete.new(athlete_params)\n\n respond_to do |format|\n if @athlete.save\n format.html { redirect_to @athlete, notice: 'Athlete was successfully created.' }\n format.json { render :show, status: :created, location: @athlete }\n else\n format.html { render :new }\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teather = Teather.new(teather_params)\n\n respond_to do |format|\n if @teather.save\n format.html { redirect_to @teather, notice: 'Teather was successfully created.' }\n format.json { render :show, status: :created, location: @teather }\n else\n format.html { render :new }\n format.json { render json: @teather.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teach = Teach.new(params[:teach])\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @way = Way.new(way_params)\n\n respond_to do |format|\n if @way.save\n format.html { redirect_to @way, notice: 'Way was successfully created.' }\n format.json { render :show, status: :created, location: @way }\n else\n format.html { render :new }\n format.json { render json: @way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"def create\n @ahoogah = Ahoogah.new(ahoogah_params)\n\n respond_to do |format|\n if @ahoogah.save\n format.html { redirect_to @ahoogah, notice: 'Ahoogah was successfully created.' }\n format.json { render :show, status: :created, location: @ahoogah }\n else\n format.html { render :new }\n format.json { render json: @ahoogah.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @athletes_team = AthletesTeam.new(athletes_team_params)\n\n respond_to do |format|\n if @athletes_team.save\n format.html { redirect_to @athletes_team, notice: 'Athletes team was successfully created.' }\n format.json { render :show, status: :created, location: @athletes_team }\n else\n format.html { render :new }\n format.json { render json: @athletes_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' }\n format.json { render json: @hoge, status: :created, location: @hoge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to board_url(@etapa.board), notice: 'Etapa was successfully created.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def create\n id, name, image_url = Tee.gather_data_from_url(params[:link])\n who = format_username(params[:who])\n\n @tee = Tee.new(:shirt_id => id, :name => name,\n :image_url => image_url, :who => who,\n :link => params[:link])\n\n if @tee.valid? && @tee.save!\n redirect_to tees_path\n else\n if @tee.link =~ /\\/submission\\//\n @available_tees = Tee.suggested_tees\n render :new\n else\n raise Exception, \"Invalid t-shirt data: #{params[:link]}\"\n end\n end\n end",
"def create\n @neela = Neela.new(neela_params)\n\n respond_to do |format|\n if @neela.save\n format.html { redirect_to @neela, notice: 'Neela was successfully created.' }\n format.json { render :show, status: :created, location: @neela }\n else\n format.html { render :new }\n format.json { render json: @neela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gatha = Gatha.new(gatha_params)\n\n respond_to do |format|\n if @gatha.save\n format.html { redirect_to @gatha, notice: 'Gatha was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gatha }\n else\n format.html { render action: 'new' }\n format.json { render json: @gatha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @liga_tymy_are = LigaTymyAre.new(liga_tymy_are_params)\n\n respond_to do |format|\n if @liga_tymy_are.save\n format.html { redirect_to @liga_tymy_are, notice: 'Liga tymy are was successfully created.' }\n format.json { render :show, status: :created, location: @liga_tymy_are }\n else\n format.html { render :new }\n format.json { render json: @liga_tymy_are.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apost = Apost.new(apost_params)\n\n respond_to do |format|\n if @apost.save\n format.html { redirect_to @apost, notice: 'Apost was successfully created.' }\n format.json { render :show, status: :created, location: @apost }\n else\n format.html { render :new }\n format.json { render json: @apost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @keiyaku = Keiyaku.new(keiyaku_params)\n\n respond_to do |format|\n if @keiyaku.save\n format.html { redirect_to @keiyaku, notice: 'Keiyaku was successfully created.' }\n format.json { render :show, status: :created, location: @keiyaku }\n else\n format.html { render :new }\n format.json { render json: @keiyaku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postIdea(community_id, idea_title, category_id, tags, params)\n\n url_base = \"#{getURIBase}/api/v1/communities/#{community_id}/ideas\"\n\n headers = Hash.new\n headers['Content-Type'] = 'application/json'\n\n parameters = Hash.new\n parameters['title'] = idea_title\n parameters['category_id'] = category_id.to_i\n parameters['tags'] = tags.nil? ? '' : tags\n parameters['post_anonymously'] = false\n\n # if no params were sent then no need to add an empty hash\n unless params.nil? or params == ''\n parameters['template_fields'] = APIClientWrapper.new.__parseStringToHash__(params)\n end\n\n makePostCall(url_base, headers, parameters)\n end",
"def create\n @twet = Twet.new(twet_params)\n\n respond_to do |format|\n if @twet.save\n format.html { redirect_to @twet, notice: \"Twet was successfully created.\" }\n format.json { render :show, status: :created, location: @twet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @twet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @odeme_akademist = Odeme::Akademist.new(params[:odeme_akademist])\n\n respond_to do |format|\n if @odeme_akademist.save\n format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully created.' }\n format.json { render json: @odeme_akademist, status: :created, location: @odeme_akademist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @odeme_akademist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @betraege = Betraege.new(params[:betraege])\n\n respond_to do |format|\n if @betraege.save\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully created.' }\n format.json { render :json => @betraege, :status => :created, :location => @betraege }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lakeside = Lakeside.new(lakeside_params)\n\n respond_to do |format|\n if @lakeside.save\n format.html { redirect_to @lakeside, notice: 'Lakeside was successfully created.' }\n format.json { render :show, status: :created, location: @lakeside }\n else\n format.html { render :new }\n format.json { render json: @lakeside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Your Tutorial post was successfully created and is now live...' }\n format.json { render :show, status: :created, location: @tutorial }\n else\n format.html { render :new }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tyre = Tyre.new(tyre_params)\n respond_to do |format|\n if @tyre.save\n format.html { redirect_to @tyre, notice: 'Tyre was successfully created.' }\n format.json { render :show, status: :created, location: @tyre }\n else\n format.html { render :new }\n format.json { render json: @tyre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hanghoa = Hanghoa.new(hanghoa_params)\n\n respond_to do |format|\n if @hanghoa.save\n format.html { redirect_to @hanghoa, notice: \"Hanghoa was successfully created.\" }\n format.json { render :show, status: :created, location: @hanghoa }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @hanghoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tyre = Tyre.new(tyre_params)\n\n respond_to do |format|\n if @tyre.save\n format.html { redirect_to @tyre, notice: 'Tyre was successfully created.' }\n format.json { render :show, status: :created, location: @tyre }\n else\n format.html { render :new }\n format.json { render json: @tyre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @beattape = Beattape.new(params[:beattape])\n\n respond_to do |format|\n if @beattape.save\n format.html { redirect_to @beattape, notice: 'Beattape was successfully created.' }\n format.json { render json: @beattape, status: :created, location: @beattape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @beattape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n @tape = Tape.new(tape_params)\n\n respond_to do |format|\n if @tape.save\n format.html { redirect_to @tape, notice: 'Tape was successfully created.' }\n format.json { render :show, status: :created, location: @tape }\n else\n format.html { render :new }\n format.json { render json: @tape.errors, status: :unprocessable_entity }\n end #if\n end #do\n end",
"def create\n @klasa = Klasa.new(klasa_params)\n\n respond_to do |format|\n if @klasa.save\n format.html { redirect_to @klasa, notice: 'Klasa was successfully created.' }\n format.json { render :show, status: :created, location: @klasa }\n else\n format.html { render :new }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(data = {})\n call data, method: :post\n end",
"def create\n @dish = @cafeteria.dishes.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @cafeteria, notice: 'El plato se ha creado.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { redirect_to @cafeteria, alert: 'No se pudo crear el plato.' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eaten = Eaten.new(eaten_params)\n\n respond_to do |format|\n if @eaten.save\n format.html { redirect_to @eaten, notice: 'Eaten was successfully created.' }\n format.json { render :show, status: :created, location: @eaten }\n else\n format.html { render :new }\n format.json { render json: @eaten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tea = Tea.new(params[:tea])\n @tea.user = current_user\n respond_to do |format|\n if @tea.save\n format.html { redirect_to @tea, notice: 'Tea was successfully created.' }\n format.json { render json: @tea, status: :created, location: @tea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serach_word = SerachWord.new(params[:serach_word])\n\n respond_to do |format|\n if @serach_word.save\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully created.' }\n format.json { render json: @serach_word, status: :created, location: @serach_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pony = Pony.new(params[:pony])\n\n respond_to do |format|\n if @pony.save\n t = Tweet.create(:status =>\"Ya llegue al mundo magico de ponies\", :pony_id => @pony[:id])\n\n format.html { redirect_to @pony, notice: 'Pony was successfully created.' }\n format.json { render json: @pony, status: :created, location: @pony }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n \n\n end\n end",
"def POST; end",
"def create\n @yourstory = Yourstory.new(params[:yourstory])\n\n respond_to do |format|\n if @yourstory.save\n format.html { redirect_to @yourstory, notice: 'Yourstory was successfully created.' }\n format.json { render json: @yourstory, status: :created, location: @yourstory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @yourstory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params = nil)\n response = @connection.post do |req|\n req.headers = generate_headers\n req.url path\n req.body = params.to_json\n end\n Arke::Log.fatal(build_error(response)) if response.env.status != 201\n response\n end",
"def create\n redirect_to root_url\n\n # @fluke = Fluke.new(fluke_params)\n\n # respond_to do |format|\n # if @fluke.save\n # format.html { redirect_to @fluke, notice: 'Fluke was successfully created.' }\n # format.json { render :show, status: :created, location: @fluke }\n # else\n # format.html { render :new }\n # format.json { render json: @fluke.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @teach = Teach.new(teach_params)\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render :show, status: :created, location: @teach }\n else\n format.html { render :new }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aka = Aka.new(aka_params)\n\n respond_to do |format|\n if @aka.save\n format.html { redirect_to @aka, notice: 'Aka was successfully created.' }\n format.json { render :show, status: :created, location: @aka }\n else\n format.html { render :new }\n format.json { render json: @aka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todoroute = Todoroute.new(todoroute_params)\n\n respond_to do |format|\n if @todoroute.save\n format.html { redirect_to @todoroute, notice: 'Todoroute was successfully created.' }\n format.json { render :show, status: :created, location: @todoroute }\n else\n format.html { render :new }\n format.json { render json: @todoroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:bubble_tea][:store_id] = params[:id] unless params[:bubble_tea][:store_id].present?\n @bubble_tea = BubbleTea.new(bubble_tea_params)\n\n if @bubble_tea.save\n # successful bubble tea drink creation\n render json: @bubble_tea\n else\n render plain: \"Failed to save drink.\"\n end\n end",
"def create\n @threats_answer = ThreatsAnswer.new(threats_answer_params)\n @threat = Threat.find(@threats_answer.threat)\n @plano = current_user.plano\n @threats = @plano.threats\n respond_to do |format|\n if @threats_answer.save\n format.html { redirect_to @threats_answer, notice: 'Threats answer was successfully created.' }\n format.json { render :show, status: :created, location: @threats_answer }\n format.js\n else\n format.html { render :new }\n format.json { render json: @threats_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @geocach = Geocach.new(params[:geocach])\n\n respond_to do |format|\n if @geocach.save\n format.html { redirect_to @geocach, notice: 'A Geocache was successfully created.' }\n format.json { render json: @geocach, status: :created, location: @geocach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @geocach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trophy = Trophy.new(trophy_params)\n\n respond_to do |format|\n if @trophy.save\n format.html { redirect_to @trophy, notice: 'Trophy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trophy }\n else\n format.html { render action: 'new' }\n format.json { render json: @trophy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gotcha = Gotcha.new(params[:gotcha])\n\n respond_to do |format|\n if @gotcha.save\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully created.' }\n format.json { render json: @gotcha, status: :created, location: @gotcha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n category = params[:text].scan(/#(\\w+)/).flatten\n\n idea = Idea.create!(\n content: params[:text],\n category: category,\n user: User.find_by(uid: params[:user_id]),\n channel: params[:channel_name],\n stage: \"seed\"\n )\n json = {\n \"text\": \"#{idea.content}\",\n \"attachments\": [\n {\n \"text\": \"#{idea.user.firstname} just logged a new idea!\",\n \"fallback\": \"You are unable to choose a game\",\n \"callback_id\": \"wopr_game\",\n \"color\": \"#3AA3E3\",\n \"attachment_type\": \"default\",\n \"actions\": [\n {\n \"name\": \"game\",\n \"text\": \"endorse\",\n \"type\": \"button\",\n \"value\": \"chess\"\n },\n {\n \"name\": \"game\",\n \"text\": \"Suggest\",\n \"type\": \"button\",\n \"value\": \"maze\"\n },\n ]\n }\n ]\n }\n\n render json: json\n end",
"def create\n @eat = Eat.new(eat_params)\n\n respond_to do |format|\n if @eat.save\n format.html { redirect_to @eat, notice: 'Eat was successfully created.' }\n format.json { render :show, status: :created, location: @eat }\n else\n format.html { render :new }\n format.json { render json: @eat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_episode = TimeEpisode.new(params[:time_episode])\n\n respond_to do |format|\n if @time_episode.save\n format.html { redirect_to @time_episode, notice: 'Time episode was successfully created.' }\n format.json { render json: @time_episode, status: :created, location: @time_episode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_episode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @traceroute = Traceroute.new(traceroute_params)\n\n respond_to do |format|\n if @traceroute.save\n flash[:notice] = 'traceroute was successfully created.'\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n format.json { render action: 'show', status: :created, location: @traceroute }\n else\n format.html { render action: 'new' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @tourism_article.save\n format.html { redirect_to @tourism_article, notice: 'Tourism article was successfully created.' }\n format.json { render json: @tourism_article, status: :created, location: @tourism_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tourism_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ways_of_admission = WaysOfAdmission.new(params[:ways_of_admission])\n\n respond_to do |format|\n if @ways_of_admission.save\n format.html { redirect_to @ways_of_admission, :notice => 'Ways of admission was successfully created.' }\n format.json { render :json => @ways_of_admission, :status => :created, :location => @ways_of_admission }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ways_of_admission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @templete = Templete.new(params[:templete])\n\n respond_to do |format|\n if @templete.save\n format.html { redirect_to @templete, :notice => 'Templete was successfully created.' }\n format.json { render :json => @templete, :status => :created, :location => @templete }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @templete.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @thuctap = Thuctap.new(thuctap_params)\n respond_to do |format|\n if @thuctap.save\n format.html { redirect_to @thuctap, notice: 'Thuctap was successfully created.' }\n format.json { render :show, status: :created, location: @thuctap }\n else\n format.html { render :new }\n format.json { render json: @thuctap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipomedalla = Tipomedalla.new(params[:tipomedalla])\n\n respond_to do |format|\n if @tipomedalla.save\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully created.' }\n format.json { render json: @tipomedalla, status: :created, location: @tipomedalla }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asana = Asana.new(asana_params)\n\n respond_to do |format|\n if @asana.save\n format.html { redirect_to @asana, notice: 'Asana criado com sucesso.' }\n format.json { render :show, status: :created, location: @asana }\n else\n format.html { render :new }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.62331986",
"0.608334",
"0.6050477",
"0.60193133",
"0.5928199",
"0.59031975",
"0.58509755",
"0.58329386",
"0.58242935",
"0.580276",
"0.57687545",
"0.5760426",
"0.57530797",
"0.5752694",
"0.5751293",
"0.5714319",
"0.57073456",
"0.56998605",
"0.5693231",
"0.56797504",
"0.56612414",
"0.56596214",
"0.56479615",
"0.56450945",
"0.56418526",
"0.5634041",
"0.5627055",
"0.5624354",
"0.561555",
"0.56096876",
"0.560452",
"0.5601359",
"0.5599519",
"0.5599519",
"0.5592355",
"0.55921006",
"0.5572697",
"0.5566013",
"0.5563647",
"0.5561911",
"0.5542513",
"0.5542424",
"0.55423385",
"0.553986",
"0.55365527",
"0.5529698",
"0.55265564",
"0.5525416",
"0.55186653",
"0.55132014",
"0.5511244",
"0.550709",
"0.54918444",
"0.54914504",
"0.5490725",
"0.54899055",
"0.54890275",
"0.54783356",
"0.54781175",
"0.5477865",
"0.5471962",
"0.54717296",
"0.5470035",
"0.54700196",
"0.54685134",
"0.5466983",
"0.5464694",
"0.54558426",
"0.5455744",
"0.5455248",
"0.5453767",
"0.5452458",
"0.54510087",
"0.54507136",
"0.5446997",
"0.5445207",
"0.5445207",
"0.5445207",
"0.544094",
"0.54398835",
"0.5439864",
"0.54393417",
"0.5439034",
"0.5438917",
"0.5438515",
"0.54360795",
"0.5433606",
"0.5432916",
"0.5432101",
"0.5431359",
"0.5430998",
"0.54309154",
"0.5429646",
"0.5424886",
"0.5424609",
"0.542321",
"0.542181",
"0.54162866",
"0.54154295",
"0.54121673"
] |
0.6510152
|
0
|
PATCH/PUT /theloaisaches/1 or /theloaisaches/1.json
|
def update
respond_to do |format|
if @theloaisach.update(theloaisach_params)
format.html { redirect_to @theloaisach, notice: "Theloaisach was successfully updated." }
format.json { render :show, status: :ok, location: @theloaisach }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @theloaisach.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @arthicle.update(arthicle_params)\n format.html { redirect_to @arthicle, notice: 'Arthicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @arthicle }\n else\n format.html { render :edit }\n format.json { render json: @arthicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n if @tea.update_attributes(params[:tea])\n format.html { redirect_to @tea, notice: 'Tea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @loa.update(loa_params)\n format.html { redirect_to @loa, notice: 'Letter of Applicaton was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @loa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @the_loai_sach.update(the_loai_sach_params)\n format.html { redirect_to @the_loai_sach, notice: \"The loai sach was successfully updated.\" }\n format.json { render :show, status: :ok, location: @the_loai_sach }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @the_loai_sach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @walikela.update(walikela_params)\n format.html { redirect_to @walikela, notice: 'Walikela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @walikela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n if @apunte.update_attributes(params[:apunte])\n format.html { redirect_to @apunte, notice: 'Apunte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @holla.update(holla_params)\n format.html { redirect_to @holla, notice: 'Holla was successfully updated.' }\n format.json { render :show, status: :ok, location: @holla }\n else\n format.html { render :edit }\n format.json { render json: @holla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n if @rayon.update_attributes(params[:rayon])\n format.html { redirect_to @rayon, notice: 'Rayon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trophy.update(trophy_params)\n format.html { redirect_to @trophy, notice: 'Trophy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trophy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lakeside.update(lakeside_params)\n format.html { redirect_to @lakeside, notice: 'Lakeside was successfully updated.' }\n format.json { render :show, status: :ok, location: @lakeside }\n else\n format.html { render :edit }\n format.json { render json: @lakeside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @theoretical_part.update_attributes(params[:theoretical_part])\r\n format.html { redirect_to @theoretical_part, notice: 'Theoretical part was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @theoretical_part.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n if @hotele.update_attributes(params[:hotele])\n format.html { redirect_to @hotele, notice: 'Hotele was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hotele.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n if @gethotel.update_attributes(params[:gethotel])\n format.html { redirect_to @gethotel, notice: 'Gethotel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gethotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @alley.update_attributes(params[:alley])\n format.html { redirect_to @alley, notice: 'Bahn erfolgreich geändert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @believer = Believer.find(params[:id])\n\n respond_to do |format|\n if @believer.update_attributes(params[:believer])\n format.html { redirect_to @believer, notice: 'Believer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @believer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @leadership.update(leadership_params)\n format.html { redirect_to @leadership, notice: 'Leadership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @leadership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n if @tipomedalla.update_attributes(params[:tipomedalla])\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @litigante.update(litigante_params)\n format.html { redirect_to @litigante, notice: 'Litigante was successfully updated.' }\n format.json { render :show, status: :ok, location: @litigante }\n else\n format.html { render :edit }\n format.json { render json: @litigante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @geocach = Geocach.find(params[:id])\n\n respond_to do |format|\n if @geocach.update_attributes(params[:geocach])\n format.html { redirect_to @geocach, notice: 'This Geocache was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @geocach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lensa.update(lensa_params)\n format.html { redirect_to @lensa, notice: 'Lensa was successfully updated.' }\n format.json { render :show, status: :ok, location: @lensa }\n else\n format.html { render :edit }\n format.json { render json: @lensa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @headline.update(headline_params)\n format.html { redirect_to @headline, notice: 'Headline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @headline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n if @railway.update_attributes(params[:railway])\n format.html { redirect_to @railway, notice: 'Railway was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @liga_tymy_are.update(liga_tymy_are_params)\n format.html { redirect_to @liga_tymy_are, notice: 'Liga tymy are was successfully updated.' }\n format.json { render :show, status: :ok, location: @liga_tymy_are }\n else\n format.html { render :edit }\n format.json { render json: @liga_tymy_are.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n if @yourstory.update_attributes(params[:yourstory])\n format.html { redirect_to @yourstory, notice: 'Yourstory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yourstory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @athlete.altered_by = current_user.id\n namesplit = @athlete.name.split(' ')\n @athlete.short_name = \"#{namesplit.first} #{namesplit.last}\" if namesplit.length > 1\n @athlete.short_name = \"#{namesplit.first}\" if namesplit.length == 1\n\n respond_to do |format|\n\n if @athlete.update(athlete_params)\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n format.html { redirect_to club_path(@athlete.club_id), notice: 'Atleta criado com sucesso.' }\n else\n format.html { redirect_to @athlete, notice: 'Atleta actualizado com sucesso.' }\n end\n format.json { head :no_content }\n else\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n flash[:error] = @athlete.errors.full_messages.join(\".<br>\").html_safe\n format.html { redirect_to club_path(@athlete.club_id) }\n else\n format.html { render action: 'edit' }\n end\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html { redirect_to @housing, notice: 'Housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html {\n redirect_to housings_url, notice: 'Housing was successfully updated.' }\n format.json {\n render json: {}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @heel.update(heel_params)\n format.html { redirect_to @heel, notice: 'Heel was successfully updated.' }\n format.json { render :show, status: :ok, location: @heel }\n else\n format.html { render :edit }\n format.json { render json: @heel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @theader.update(theader_params)\n format.html { redirect_to office_path(@theader), notice: 'Theader was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @theader.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n if @heli_kit.update_attributes(params[:heli_kit])\n format.html { redirect_to @heli_kit, notice: 'Heli kit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heli_kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @joa.update(joa_params)\n format.html { redirect_to @joa, notice: 'Joa was successfully updated.' }\n format.json { render :show, status: :ok, location: @joa }\n else\n format.html { render :edit }\n format.json { render json: @joa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thre.update(thre_params)\n format.html { redirect_to @thre, notice: 'Thre was successfully updated.' }\n format.json { render :show, status: :ok, location: @thre }\n else\n format.html { render :edit }\n format.json { render json: @thre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tale.update(tale_params)\n format.html { redirect_to @tale, notice: 'Tale was successfully updated.' }\n format.json { render :show, status: :ok, location: @tale }\n else\n format.html { render :edit }\n format.json { render json: @tale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @single_housing.update(single_housing_params)\n format.html { redirect_to @single_housing, notice: 'Single housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @single_housing }\n else\n format.html { render :edit }\n format.json { render json: @single_housing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa editada com sucesso.' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @norma.update(norma_params)\n render :show, status: :ok, location: @norma\n else\n render json: @norma.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @athlete.update(athlete_params)\n format.html { redirect_to @athlete, notice: 'Athlete was successfully updated.' }\n format.json { render :show, status: :ok, location: @athlete }\n else\n format.html { render :edit }\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @athlete.update(athlete_params)\n format.html { redirect_to @athlete, notice: 'Athlete was successfully updated.' }\n format.json { render :show, status: :ok, location: @athlete }\n else\n format.html { render :edit }\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n if @idea.update_attributes(params[:idea])\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sheep.update(sheep_params)\n format.html { redirect_to @sheep, notice: 'Sau ble oppdatert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to \"/trabalhos\", notice: 'Trabalho alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aka.update(aka_params)\n format.html { redirect_to @aka, notice: 'Aka was successfully updated.' }\n format.json { render :show, status: :ok, location: @aka }\n else\n format.html { render :edit }\n format.json { render json: @aka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @athletes_team.update(athletes_team_params)\n format.html { redirect_to @athletes_team, notice: 'Athletes team was successfully updated.' }\n format.json { render :show, status: :ok, location: @athletes_team }\n else\n format.html { render :edit }\n format.json { render json: @athletes_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t 'view.teaches.edit_title'\n\n respond_to do |format|\n if @teach.update(teach_params)\n format.html { redirect_to @teach, notice: t('view.teaches.correctly_updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::StaleObjectError\n flash.alert = t 'view.teaches.stale_object_error'\n redirect_to edit_teach_url(@teach)\n end",
"def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.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 @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @atricle.update(atricle_params)\n format.html { redirect_to @atricle, notice: 'Atricle was successfully updated.' }\n format.json { render :show, status: :ok, location: @atricle }\n else\n format.html { render :edit }\n format.json { render json: @atricle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @linehaul.update(linehaul_params)\n format.html { redirect_to linehauls_path, notice: 'Linehaul was successfully updated.' }\n format.json { render :show, status: :ok, location: @linehaul }\n else\n format.html { render :edit }\n format.json { render json: @linehaul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n if @clothing_article.update_attributes(params[:clothing_article])\n format.html { redirect_to @clothing_article, notice: 'Clothing article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clothing_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @habitant.update(habitant_params)\n format.html { redirect_to @habitant, notice: 'Habitant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @habitant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n if @pony.update_attributes(params[:pony])\n format.html { redirect_to @pony, notice: 'Pony was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tailor.update(tailor_params)\n format.html { redirect_to @tailor, notice: \"Tailor was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tailor }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tailor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favorite_web_thing.update(favorite_web_thing_params)\n format.html { redirect_to @favorite_web_thing, notice: 'Favorite web thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favorite_web_thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @howto = Howto.find(params[:id])\n\n respond_to do |format|\n if @howto.update_attributes(params[:howto])\n flash[:notice] = 'Howto was successfully updated.'\n format.html { redirect_to(@howto) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @howto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @headline.update(headline_params)\n format.html { redirect_to @headline, notice: \"Headline was successfully updated.\" }\n format.json { render :show, status: :ok, location: @headline }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @headline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @archetype = Archetype.find(params[:id])\n\n respond_to do |format|\n if @archetype.update_attributes(params[:archetype])\n format.html { redirect_to @archetype, notice: 'Archetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @archetype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource_response(@headline, headline_params)\n end",
"def update\n @meteor = Meteor.find(params[:id])\n\n respond_to do |format|\n if @meteor.update_attributes(params[:meteor])\n format.html { redirect_to @meteor, notice: 'Meteor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meteor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @painel.update(painel_params)\n format.html { redirect_to @painel, notice: 'Painel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @painel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @beast.update(beast_params)\n format.html { redirect_to @beast, notice: 'Dane bestii zostały zaktualizowane' }\n format.json { render :show, status: :ok, location: @beast }\n else\n format.html { render :edit }\n format.json { render json: @beast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @legshome2.update(legshome2_params)\n format.html { redirect_to \"/legshome2s\"}\n format.json { render :show, status: :ok, location: @legshome2 }\n else\n format.html { render :edit }\n format.json { render json: @legshome2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @alejandro.update(alejandro_params)\n format.html { redirect_to @alejandro, notice: 'Alejandro was successfully updated.' }\n format.json { render :show, status: :ok, location: @alejandro }\n else\n format.html { render :edit }\n format.json { render json: @alejandro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @animal = Animal.find(params[:id])\n @species = ['Lion', 'Koala', 'Panda']\n @zoo = Zoo.find(params[:zoo_id])\n\n respond_to do |format|\n\n if @animal.update_attributes(params[:animal])\n format.html { redirect_to zoo_animal_path(params[:zoo_id],@animal.id),\n notice: 'animal was successfully updated.' }\n format.json { head :no_content }\n else\n\n format.html { render action: \"edit\"}\n format.json { render json: @animal.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n if @tetramod.update_attributes(params[:tetramod])\n format.html { redirect_to @tetramod, notice: 'Tetramod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tetramod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teather.update(teather_params)\n format.html { redirect_to @teather, notice: 'Teather was successfully updated.' }\n format.json { render :show, status: :ok, location: @teather }\n else\n format.html { render :edit }\n format.json { render json: @teather.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appeal.update_attributes(params[:appeal])\n format.html { redirect_to [@conference, @appeal], notice: 'Appeal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appeal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tyre.update(tyre_params)\n format.html { redirect_to @tyre, notice: 'Tyre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tyre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @leye = Leye.find(params[:id])\n\n respond_to do |format|\n if @leye.update_attributes(params[:leye])\n format.html { redirect_to @leye, notice: 'Leye was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @leye.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @raffle.update(raffle_params)\n format.html do\n redirect_to @raffle, notice: 'Raffle was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @raffle }\n else\n format.html { render :edit }\n format.json do\n render json: @raffle.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @eat.update(eat_params)\n format.html { redirect_to @eat, notice: 'Eat was successfully updated.' }\n format.json { render :show, status: :ok, location: @eat }\n else\n format.html { render :edit }\n format.json { render json: @eat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hanghoa.update(hanghoa_params)\n format.html { redirect_to @hanghoa, notice: \"Hanghoa was successfully updated.\" }\n format.json { render :show, status: :ok, location: @hanghoa }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @hanghoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n if @goat.update_attributes(params[:goat])\n format.html { redirect_to @goat, notice: 'Goat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hail.update(hail_params)\n format.json { render :show, status: :ok, location: @hail }\n else\n format.json { render json: @hail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tattoo = Tattoo.find(params[:id])\n\n respond_to do |format|\n if @tattoo.update_attributes(params[:tattoo])\n format.html { redirect_to @tattoo, notice: 'Tattoo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tattoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @something = Something.find(params[:id])\n\n respond_to do |format|\n if @something.update_attributes(params[:something])\n format.html { redirect_to @something, notice: 'Something was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @something.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6350506",
"0.62601316",
"0.6170705",
"0.61663663",
"0.61515725",
"0.6132433",
"0.6128296",
"0.6124237",
"0.61210877",
"0.61175823",
"0.6057317",
"0.60144114",
"0.5969454",
"0.59593225",
"0.5950163",
"0.59428006",
"0.59189516",
"0.5917302",
"0.5913498",
"0.59021586",
"0.58939236",
"0.58908427",
"0.58906585",
"0.58887744",
"0.58770776",
"0.5874562",
"0.586895",
"0.58667606",
"0.5862786",
"0.58625853",
"0.5857852",
"0.58573794",
"0.5854859",
"0.5853988",
"0.5850902",
"0.58468807",
"0.5840544",
"0.58371234",
"0.5829246",
"0.5825857",
"0.5817289",
"0.58152854",
"0.58134866",
"0.58123285",
"0.5807215",
"0.58027166",
"0.5797546",
"0.57922965",
"0.57909137",
"0.5790059",
"0.57888645",
"0.57888645",
"0.5786594",
"0.5786148",
"0.5783734",
"0.5783729",
"0.57824934",
"0.5780506",
"0.5779922",
"0.5768218",
"0.57667154",
"0.5766607",
"0.57626706",
"0.57583296",
"0.5757779",
"0.57576203",
"0.57514906",
"0.5750896",
"0.57485366",
"0.57476246",
"0.57459587",
"0.5744182",
"0.5741889",
"0.57397723",
"0.5738959",
"0.57381517",
"0.57336897",
"0.5730704",
"0.5729553",
"0.57267445",
"0.5725508",
"0.5724102",
"0.57218",
"0.57217044",
"0.5719447",
"0.5718702",
"0.5718691",
"0.571846",
"0.5718248",
"0.5716405",
"0.57150483",
"0.5711825",
"0.57116795",
"0.57101035",
"0.57062227",
"0.5706146",
"0.57047135",
"0.5704251",
"0.5703996",
"0.57029384"
] |
0.6319693
|
1
|
DELETE /theloaisaches/1 or /theloaisaches/1.json
|
def destroy
@theloaisach.destroy
respond_to do |format|
format.html { redirect_to theloaisaches_url, notice: "Theloaisach was successfully destroyed." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @thema.destroy\n respond_to do |format|\n format.html { redirect_to themata_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @the_loai_sach.destroy\n respond_to do |format|\n format.html { redirect_to the_loai_saches_url, notice: \"The loai sach was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @walikela.destroy\n respond_to do |format|\n format.html { redirect_to walikelas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theader.destroy\n respond_to do |format|\n format.html { redirect_to offices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geocach = Geocach.find(params[:id])\n @geocach.destroy\n\n respond_to do |format|\n format.html { redirect_to geocaches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @thema = Thema.find(params[:id])\n @thema.destroy\n\n respond_to do |format|\n format.html { redirect_to themengruppe_path(@thema.themengruppe) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hotele = Hotele.find(params[:id])\n @hotele.destroy\n\n respond_to do |format|\n format.html { redirect_to hoteles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\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 @kela.destroy\n respond_to do |format|\n format.html { redirect_to kelas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @antenne = Antenne.find(params[:id])\r\n @antenne.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to antennes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @tl_sach.destroy\n respond_to do |format|\n format.html { redirect_to tl_saches_url, notice: \"Tl sach was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotel = Gethotel.find(params[:id])\n @gethotel.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arthicle.destroy\n respond_to do |format|\n format.html { redirect_to arthicles_url, notice: 'Arthicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tarefa = Tarefa.find(params[:id])\n @tarefa.destroy\n\n respond_to do |format|\n format.html { redirect_to tarefas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @liga_tymy_are.destroy\n respond_to do |format|\n format.html { redirect_to liga_tymy_ares_url, notice: 'Liga tymy are was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apunte = Apunte.find(params[:id])\n @apunte.destroy\n\n respond_to do |format|\n format.html { redirect_to apuntes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aadt = Aadt.find(params[:id])\n @aadt.destroy\n\n respond_to do |format|\n format.html { redirect_to aadts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { redirect_to word_praats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @atr = Atr.find(params[:id])\n @atr.destroy\n\n respond_to do |format|\n format.html { redirect_to atrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @evangelism.destroy\n respond_to do |format|\n format.html { redirect_to evangelisms_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @goat = Goat.find(params[:id])\n @goat.destroy\n\n respond_to do |format|\n format.html { redirect_to goats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtythree.destroy\n respond_to do |format|\n format.html { redirect_to thirtythrees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leito = Leito.find(params[:id])\n @leito.destroy\n\n respond_to do |format|\n format.html { redirect_to leitos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @pichanga = Pichanga.find(params[:id])\n @pichanga.destroy\n\n respond_to do |format|\n format.html { redirect_to pichangas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etape = Etape.find(params[:id])\n @etape.destroy\n\n respond_to do |format|\n format.html { redirect_to etapes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @himalaya = Himalaya.find(params[:id])\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @assunto = Assunto.find(params[:id])\n @assunto.destroy\n\n respond_to do |format|\n format.html { redirect_to assuntos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aneart.destroy\n respond_to do |format|\n format.html { redirect_to anearts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aream.destroy\n respond_to do |format|\n format.html { redirect_to areams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thre.destroy\n respond_to do |format|\n format.html { redirect_to thres_url, notice: 'Thre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foodhamper = Foodhamper.find(params[:id])\n @foodhamper.destroy\n\n respond_to do |format|\n format.html { redirect_to foodhampers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n @odeme_akademist.destroy\n\n respond_to do |format|\n format.html { redirect_to odeme_akademists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @he = He.find(params[:id])\n @he.destroy\n\n respond_to do |format|\n format.html { redirect_to hes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adotando_animal = AdotandoAnimal.find(params[:id])\n @adotando_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adotando_animais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @avert = Avert.find(params[:id])\n @avert.destroy\n\n respond_to do |format|\n format.html { redirect_to averts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to zoo_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @painel.destroy\n respond_to do |format|\n format.html { redirect_to painels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @something = Something.find(params[:id])\n @something.destroy\n\n respond_to do |format|\n format.html { redirect_to somethings_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @representante_athlete = Representante::Athlete.find(params[:id])\n @representante_athlete.destroy\n\n respond_to do |format|\n format.html { redirect_to representante_athletes_url, notice: 'Atleta apagado com sucesso' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leadership.destroy\n respond_to do |format|\n format.html { redirect_to leaderships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tyre.destroy\n respond_to do |format|\n format.html { redirect_to tyres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yourstory = Yourstory.find(params[:id])\n @yourstory.destroy\n\n respond_to do |format|\n format.html { redirect_to yourstories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trophy.destroy\n respond_to do |format|\n format.html { redirect_to trophies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cafeterium.destroy\n respond_to do |format|\n format.html { redirect_to cafeteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades2 = Humanidades2.find(params[:id])\n @humanidades2.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades2s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tattoo = Tattoo.find(params[:id])\n @tattoo.destroy\n\n respond_to do |format|\n format.html { redirect_to tattoos_url }\n format.json { head :no_content }\n end\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end"
] |
[
"0.70291334",
"0.69779515",
"0.69654626",
"0.6963724",
"0.6958891",
"0.6955817",
"0.6955817",
"0.6901878",
"0.6884223",
"0.6882267",
"0.6878711",
"0.6865196",
"0.68605876",
"0.685439",
"0.6836049",
"0.68346196",
"0.68263817",
"0.68033034",
"0.6800072",
"0.6792529",
"0.6792154",
"0.6788631",
"0.6787518",
"0.6786322",
"0.67835337",
"0.6779085",
"0.6772547",
"0.6763129",
"0.675612",
"0.6750643",
"0.67504317",
"0.67400706",
"0.67399216",
"0.6736489",
"0.6719021",
"0.67033184",
"0.6703063",
"0.6700225",
"0.66986746",
"0.6695508",
"0.66868377",
"0.6686496",
"0.66749203",
"0.667455",
"0.66739506",
"0.6672401",
"0.6671123",
"0.6670476",
"0.6668936",
"0.66628444",
"0.66614044",
"0.66608423",
"0.6657602",
"0.66506416",
"0.66505295",
"0.6650191",
"0.66484857",
"0.6648342",
"0.664702",
"0.6645252",
"0.6639853",
"0.66347593",
"0.6634349",
"0.663316",
"0.66317403",
"0.66300476",
"0.66300476",
"0.66294473",
"0.6625736",
"0.66253704",
"0.6622501",
"0.6622125",
"0.6621359",
"0.6619763",
"0.6617285",
"0.6616114",
"0.66152877",
"0.6613046",
"0.6607952",
"0.66067505",
"0.6605472",
"0.66054624",
"0.6603708",
"0.6602207",
"0.6601051",
"0.6601051",
"0.6601051",
"0.66004336",
"0.66002923",
"0.659835",
"0.6594651",
"0.65924275",
"0.6589676",
"0.6588547",
"0.65851635",
"0.65850145",
"0.65843046",
"0.65839463",
"0.6581878",
"0.6577942"
] |
0.71921873
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_theloaisach
@theloaisach = Theloaisach.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def theloaisach_params
params.require(:theloaisach).permit(:ma_sach, :ten_sach, :mtg, :mtl, :maNXB, :nxb)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Returns a single project segment
|
def segment(project_id, key_id, language_iso, segment_number, req_params = {})
params = { query: [project_id, key_id, language_iso, segment_number], req: req_params }
data = endpoint(name: 'Segments', params: params).do_get
resource 'Segment', data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def project\n self.projects.first unless projects.empty?\n end",
"def segment\n return asset_on_segment_history.segment rescue nil\n end",
"def project\n self.format.try(:project)\n end",
"def project_number\n segments = @audience.split \"/\"\n idx = segments.index \"projects\"\n return nil if idx.nil? || idx + 1 == segments.size\n segments[idx + 1]\n end",
"def project_number\n segments = @audience.split \"/\"\n idx = segments.index \"projects\"\n return nil if idx.nil? || idx + 1 == segments.size\n segments[idx + 1]\n end",
"def selected_project\n if @task and @task.project_id.to_i > 0\n selected_project = @task.project_id\n else\n selected_project = current_user.projects.find(:first, :order => 'name').id\n end\n \n\n return selected_project\n end",
"def get_segment(position)\n @segments[position]\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",
"def get_project\n @project ||= Project.find(params[:project_id])\n end",
"def resource\n @project ||= Project.find_by_slug!(params[:id])\n end",
"def show\n \t@segments = @organization.segments\n session[:current_segment] = @segment = Segment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @segment }\n end\n end",
"def project\n request :project\n end",
"def project(id)\n self.projects(\"all\").detect { |p| p.id == id }\n end",
"def project\n @client.project(:id => project_id)\n end",
"def segment_0; segments[0]; end",
"def find_project\n @project = Project.find(params[:id])\n end",
"def find_project\n\t\t@project = Project.find(params[:project_id])\n\tend",
"def find_project\n\t\t@project = Project.find(params[:project_id])\n\tend",
"def find_project\n\t\t@project = Project.find(params[:project_id])\n\tend",
"def find_project\n\t\t@project = Project.find(params[:project_id])\n\tend",
"def find_project\n\t\t@project = Project.find(params[:project_id])\n\tend",
"def project\n service.project\n end",
"def segment_number(number)\n s = Array(segments.select{|ss| ss.number == number}).first\n s || Array(segments.where(number:number)).first\n end",
"def show\n @project = @pds_project\n end",
"def project_id\n service.project\n end",
"def project_id\n service.project\n end",
"def project_id\n service.project\n end",
"def show\n @project = @expense_period.project\n end",
"def project\n object.project.id\n end",
"def project\n @project ||= DataStore.find_project_by_id(project_id)\n end",
"def getProjectByID(id)\n ret = nil \n @Projects.each do |project| \n ret = project if project.ID == id \n end \n\n return ret \n end",
"def show\n @project = Project.find(params[:project_id])\n end",
"def find_project\n @project = @account.projects.find(params[:project_id])\n end",
"def find_project\n\t\t@project = Project.find(params[:project_id] || params[:id])\n\tend",
"def project\n threaded[:project]\n end",
"def segment(id_or_options, options = {})\n id, options = parse_args(id_or_options, options)\n Strava::Models::Segment.new(get(\"segments/#{id}\", options))\n end",
"def show\n @subsystem = Subsystem.find(params[:id])\n @project = @subsystem.project\n end",
"def path\n project\n end",
"def find_project\n @project = Project.find_by_identifier(params[:id])\n rescue ActiveRecord::RecordNotFound\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def show\n @project = Project.find(params[:id])\n end",
"def segment\n Segment.initialize_with(self)\n end",
"def find_project\n identifier = get_identifier\n project = Project.find_by_identifier(identifier.downcase)\n fail(\n ActiveRecord::RecordNotFound,\n \"No project found with identifier '#{identifier}'\"\n ) if project.nil?\n project\n end",
"def segment(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = SegmentRef.new(Native.Run_segment(@handle.ptr, index))\n result\n end",
"def segment(segment)\n { segment: segment }\n end",
"def project\n object.featured_project\n end",
"def getProject(project)\r\n\t\t\t\tproject_json = JSON.parse project\r\n\t\t\t\tproject_array = project_json[\"projects\"]\r\n\t\t\t\treturn jsonToProject(project_array[0])\r\n\t\t\tend",
"def find_project\n identifier = params[:project_id]\n scope = Project.active.has_module(:repository)\n project = scope.find_by_identifier(identifier.downcase)\n raise ActiveRecord::RecordNotFound unless project\n return project\n end",
"def project \n organizing_city.current_project\n end",
"def first_segment(rrecord)\n return load_from_row(DBIntf.get_first_row(\"SELECT * FROM segments WHERE rrecord=#{rrecord};\"))\n end",
"def project_id\n service.project_id\n end",
"def show\n @project = Project.friendly.find(params[:id])\n end",
"def show\n @project = @model.project\n end",
"def project_id\n data[:project_id]\n end",
"def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\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 find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def show\n @info = Info.find(params[:id])\n @subproject = @info.subproject\n @project = @subproject.project\n end",
"def find_project\r\n @project = Project.find(params[:id])\r\n @html_title = @project.name\r\n rescue ActiveRecord::RecordNotFound\r\n render_404\r\n end",
"def get_project (project_name)\n\t\tproject = Project.find_by_name(project_name)\n\t\tif project\n\t\t\tif (project.accessibility == 1 or (user_signed_in? and project.user == current_user))\n\t\t\t\treturn project, nil\n\t\t\telse\n\t\t\t\treturn nil, I18n.t('controllers.application.get_project.private', :project_name => project_name)\n\t\t\tend\n\t\telse\n\t\t\treturn nil, I18n.t('controllers.application.get_project.not_exist', :project_name => project_name)\n\t\tend\n\tend",
"def show\n @project = @integrant.project\n end",
"def find_project\n @project = InitializeProject.call id: params[:id]\n end",
"def details\n get(\"project/details\")[\"project\"]\n end",
"def project_id project_name\n if @version < \"1.0\"\n project = projects.find { |project| project[:name] == project_name }\n else\n project = project_by_name(project_name).first\n end\n\n project.nil? ? nil : project[:id].to_i\n end",
"def project\n get_or_make_reference('Project', @data, 'project_id')\n end",
"def project\n get_or_make_reference('Project', @data, 'project_id')\n end",
"def show\n @project = Project.find(params[:project_id])\n @subproject = Subproject.find(params[:id])\n end",
"def set_project\n\n @project = Project.where(\"title LIKE ?\",params[:id]).limit(1).last\n end",
"def project_id\n @service.project_id\n end",
"def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def project(key)\n @tracker.getProjects.detect { |pro| pro.key == key }\n end",
"def project_id\n return self.project_id\n end",
"def get(project_name)\n response = get_request(\"/projects/#{project_name}/\")\n TheShiningSource::Project.new(response)\n end",
"def find_project\n @project = current_user.find_project(params[:project_id] || params[:id], preview_token)\n end",
"def get_project_by_id(id)\n require_relative 'telerivet/project'\n Project.new(self, self.do_request(\"GET\", get_base_api_path() + \"/projects/#{id}\"))\n end",
"def gcloud_project_id\n stdout = Open3.capture3(\"gcloud config list project\").first\n stdout.scan(/project = (.*)/).first.first\nend",
"def find_project\n @project = Project.find(params[:project_id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\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 project(name)\n @projects.find { |p| p.name == name }\n end",
"def project_id\n @attributes[:project_id]\n end",
"def project_id\n return @project_id\n end",
"def project\n params['project'].gsub('_', '-')\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def show\n @segment_name = SegmentName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @segment_name }\n end\n end",
"def [](id)\n return id if id.respond_to?(:is_project?) && id.is_project?\n if id == :all\n Project.all\n else\n if id.to_s !~ /^(\\/gdc\\/(projects|md)\\/)?[a-zA-Z\\d]+$/\n raise ArgumentError.new('wrong type of argument. Should be either project ID or path')\n end\n\n id = id.match(/[a-zA-Z\\d]+$/)[0] if id =~ /\\//\n\n response = GoodData.get PROJECT_PATH % id\n Project.new response\n end\n end",
"def show\n project = Project.where(id: params[:id]).first\n if project.present?\n @tasks = project.tasks\n end\n end",
"def project_find(label)\n @project = projects.find { |item| item.text.include? label }\n end",
"def resource\n @index.project.resource( @id )\n end",
"def project\n case namespace\n when /cybox/\n :cybox\n when /stix/, /data-marking/\n :stix\n else\n nil\n end\n end",
"def show\n if params[:name]\n @project = Project.where(name: \"#{params[:name]}\").first\n else\n set_project\n end\n end",
"def select_project\n @projects = Project.find(:all)\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 find_project(project_id)\n # check if we already fetched the project\n @projects.each do |proj|\n return proj if proj.id == project_id\n end\n # project not found, fetch it\n @projects << PivotalTracker::Project.find(project_id)\n @projects.last\n end"
] |
[
"0.62779295",
"0.6224353",
"0.6086003",
"0.60174924",
"0.60174924",
"0.59211",
"0.58989817",
"0.5890216",
"0.5889555",
"0.5869268",
"0.585898",
"0.5847536",
"0.5816321",
"0.5809094",
"0.5784023",
"0.57799643",
"0.57666916",
"0.57666916",
"0.57666916",
"0.57666916",
"0.57666916",
"0.5757116",
"0.5743855",
"0.57109636",
"0.56933165",
"0.56933165",
"0.56933165",
"0.56779164",
"0.5662328",
"0.5657086",
"0.5648652",
"0.563443",
"0.5631843",
"0.56311494",
"0.56202656",
"0.56184846",
"0.56116754",
"0.55918986",
"0.5586659",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5584573",
"0.5583153",
"0.55784315",
"0.55755883",
"0.5566626",
"0.5564939",
"0.55552673",
"0.5545949",
"0.5544654",
"0.5534122",
"0.5502903",
"0.54865617",
"0.54852486",
"0.54585177",
"0.5455998",
"0.5455326",
"0.5455326",
"0.5452256",
"0.54475504",
"0.54449314",
"0.54403985",
"0.54323",
"0.5420724",
"0.542064",
"0.54183406",
"0.54183406",
"0.54135084",
"0.54073834",
"0.5404975",
"0.539932",
"0.5396612",
"0.5395004",
"0.5394479",
"0.5389474",
"0.537939",
"0.5375361",
"0.53728175",
"0.53659606",
"0.53634423",
"0.5363349",
"0.5361448",
"0.53579587",
"0.5355827",
"0.535419",
"0.5353965",
"0.53507596",
"0.53501743",
"0.5341226",
"0.5340228",
"0.5320581",
"0.53196883",
"0.5316374",
"0.5315597"
] |
0.6414373
|
0
|
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.welcome.subject
|
def registration_confirmation(user)
@user = user
# attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png")
mail(:to => "#{user.nickname} <#{user.email}>", :subject => "Registered")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def subject\n @mail.subject\n end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def welcome_email(user)\n @user = user\n mail(to: @user.email, subject: t(\"users.email.welcome.subject\"))\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def welcome_email\n NotifierMailer.welcome_email User.take\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"email@domain.com\", :subject => \"Subject line\"\n \n end",
"def welcome_email(user)\n \t@user = user\n\n \tmail :to\t\t=> user.email,\n \t\t :subject\t=> \"Welcome to Project Help!\"\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def welcome_email\n UserMailer.welcome_email\n end",
"def welcome_email\n UserMailer.welcome_email\n end",
"def welcome_mail(user)\n mail to: user.email,\n subject: \"Welcome to Startglory\"\n\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def welcome_email(user_info)\n @email = user_info[:mail]\n @name = user_info[:name]\n mail(:to => @email, :subject => \"تم تأكيد تسجيلك في !\")\n end",
"def send_welcome_email(user)\n mail to: user.email, subject: \"Sign Up Confirmation - Welcome to NetworkMill\"\n Email.create(:user_id => user.id, :sent_to => user.email, :title => \"welcome_email\")\n end",
"def welcome_user_email(user)\n @user = user\n @url = login_url\n mail(\n :subject => \"Welcome to StudyHall\",\n :from => \"noreply@studyhall.com\",\n :to => @user.email\n )\n end",
"def send_welcome(user)\n @user = user\n mail(:to => user.email, :subject => \"Welcome to My Awesome Site\", :content_type => 'text/html', :template_name => 'send_welcome.html')\n end",
"def subject_name\n return @subject_name\n end",
"def welcome_email(user)\n @user = user\n mail to: @user.email, subject: 'Welcome to Our Jungle Store'\n end",
"def send_welcome\n UserMailer.welcome_email(self).deliver\n end",
"def welcome(organisation)\n @organisation = organisation\n\n if !@organisation.email.nil? and ['en', 'fr'].include? @organisation.locale\n I18n.with_locale(@organisation.locale) do\n mail(to: @organisation.email, subject: t('emails.welcome.subject')) do |format|\n format.html { render layout: 'email_simple.html.erb' }\n format.text\n end\n end\n end\n end",
"def welcome_email(user)\n @user = user\n mail( to: user.email,\n subject: 'Thanks for signing up for Shiftable!',\n sent_on: Time.now )\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def subject_titles\n @subject_titles ||= sw_subject_titles\n end",
"def welcome_email(user)\n @user = user\n\n mail to: user.email, subject: 'Welcome to Alumni Connection!', from: 'WebMaster@AlumniConnection.com'\n end",
"def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end",
"def send_welcome_email\n UserMailer.welcome(self).deliver_now\n end",
"def welcome_email(user)\n @user = user\n @url = 'http://example.com/login' #\n mail(to: @user.email, subject: 'Welcome to My Awesome Site') #gets user email address and supplies a generic subject line\n end",
"def user_welcome_notice(user)\n @user = user\n mail(:to => @user.email, :subject => \"Welcome to SocialStreet\") unless @user.email.blank?\n end",
"def subject_name\n subject_full_name\n end",
"def send_welcome\n UserMailer.welcome_email(self).deliver!\n end",
"def welcome_email(user)\n\t\t@user = user\n\t\tmail(to: user.email.to_s, subject: \"Welcome to Interest Points\")\t\n\tend",
"def send_welcome_mail\n UserMailer.welcome(self).deliver_now\n end",
"def welcome_email(user)\n @user = user\n @subject = \"Welcome to Rays Cruiser, home of customized cruisers\"\n result = mail(:to => @user.email, :subject => @subject)\n # puts \"+++++++ Notification Email status: -> \" + result.to_s\n end",
"def welcome_email(person, options = {})\n @person = person\n @host = ENV['HOST_NAME'] || \"localhost:3000\"\n\n mail(:to => [@person.personal_email],\n :subject => options[:subject] || \"Welcome to Carnegie Mellon University Silicon Valley (\" + @person.email + \")\",\n :date => Time.now)\n\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def welcome(user)\n @appname = \"Oasis Books\"\n mail( :to => user.email,\n :subject => \"Welcome to #{@appname}!\")\n end",
"def subject\n self['subject']\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def welcome_email(user, currenthost)\n\t @user = user\n\t @currenthost = currenthost\n\n\t mail(to: @user.email, subject: 'Welcome to Changefindr').deliver()\n\tend",
"def heading_message\n return I18n.t('application.my_dashboard') if any_courses?\n return I18n.t('application.greeting2')\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def message_subject\n return @message_subject\n end",
"def group_welcome_email\n NotifierMailer.group_welcome_email Group.take\n end",
"def subject\n message.subject\n end",
"def welcome(user)\n @user = user\n @greeting = \"Hi\"\n\n mail to: \"thomasjyang@gmail.com\", :subject => \"Awesome subject for welcome\"\n end",
"def welcome_email(user)\n @greeting = \"Hi\"\n\n mail to: user.email\n end",
"def welcome_email\n # NewsletterMailer.welcome_email.deliver\n mail(:to => \"rajakuraemas@gmail.com\", :subject => \"Welcome to My Awesome Site\")\n end",
"def send_welcome_email\n UserMailer.welcome_message(self).deliver_later\n end",
"def welcome(user)\n @name = user.email.split(\"@\").first\n @name = @name.titleize\n @greeting = \"Hi\"\n\n mail to: \"#{@name} <user.email>\"\n end",
"def welcome(user)\n @user = user\n mail :to => user.email, :subject => \"vm2014.ifkff.org - Välkommen!\"\n end",
"def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end",
"def welcome(user)\n\n mail to: user.email, subject: \"Welcome to Teamhuddle\"\n end",
"def welcome\n UserMailer.welcome\n end",
"def set_subject(subject)\n\t\tend",
"def welcome_email email_address\n @greeting = \"Hi\"\n @user_name = UserInfo.last.user\n\n mail to: email_address\n end",
"def subject\n title \n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def welcome_email(user)\n\n @user = user\n Rails.logger.info 'hello'\n emails = ['leolopelofranco@gmail.com', 'leo@palmsolutions.co']\n\n mail(to: user[\"to\"], subject: user[\"subject\"])\n\n end",
"def default_i18n_subject(interpolations = {})\n ''\n end",
"def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end",
"def welcome_email\n UserMailer.with(user: @user).welcome_email.deliver_later\n end",
"def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end",
"def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end",
"def subject; @message_impl.getSubject; end",
"def welcome_signup_email(signup)\n @signup = signup\n mail(\n :subject => \"We will be coming to your school soon!\",\n :from => \"noreply@studyhall.com\",\n :to => @signup.email\n )\n end",
"def user_added_email(user)\n ActsAsTenant.without_tenant do\n @course = user.course\n end\n @recipient = user.user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end",
"def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend",
"def welcome(user)\n @user = user\n \n mail to: @user.email, subject: \"[Post] Welcome! Thanks for signing up.\"\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end"
] |
[
"0.69021374",
"0.67249674",
"0.6719583",
"0.66746026",
"0.6665844",
"0.6611136",
"0.6576607",
"0.6544792",
"0.65094864",
"0.65038246",
"0.6457452",
"0.64401805",
"0.6402087",
"0.63828045",
"0.63603675",
"0.63592607",
"0.6348857",
"0.63381743",
"0.6324099",
"0.63228494",
"0.63216054",
"0.63051873",
"0.6270331",
"0.6270331",
"0.62491363",
"0.6246309",
"0.6234057",
"0.6172173",
"0.61708623",
"0.6164436",
"0.6150959",
"0.6129996",
"0.6108291",
"0.61039615",
"0.60864913",
"0.6080668",
"0.6077503",
"0.6076838",
"0.60674256",
"0.60674256",
"0.60674256",
"0.60674256",
"0.60674256",
"0.60674256",
"0.60674256",
"0.60674256",
"0.6059163",
"0.60518223",
"0.60517627",
"0.6051383",
"0.60358727",
"0.6029477",
"0.6025378",
"0.60211444",
"0.60176396",
"0.6015913",
"0.6009265",
"0.6008135",
"0.6006028",
"0.60054505",
"0.5993996",
"0.59847087",
"0.59847087",
"0.59847087",
"0.59847087",
"0.59762156",
"0.596578",
"0.59543914",
"0.5954252",
"0.5948379",
"0.59430635",
"0.5937042",
"0.59281963",
"0.59279203",
"0.5927444",
"0.5924411",
"0.5922362",
"0.59211904",
"0.5921104",
"0.59162027",
"0.59052414",
"0.5898953",
"0.5891161",
"0.58908814",
"0.58828723",
"0.5877761",
"0.5876163",
"0.58743125",
"0.58610994",
"0.58579236",
"0.5856947",
"0.58500856",
"0.5826747",
"0.58263826",
"0.58173186",
"0.5800629",
"0.5795946",
"0.5795946",
"0.5795946",
"0.5795946",
"0.5795946"
] |
0.0
|
-1
|
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.forgot_password.subject
|
def forgot_password
@greeting = "Hi"
mail to: "to@example.org"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def password_reset(user)\n @user = user\n mail :to => user.email, :subject => I18n.t(\"reset_password\")\n end",
"def reset_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @body [\"name\"] = user.login\n @subject = 'Your password has been reset'\n end",
"def subject\n @mail.subject\n end",
"def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def password_reset_notice (email, accounts)\n @from = Bolt::Config.email_from\n @recipients = email\n @subject = \"Reset your password for #{Bolt::Config.application_name}\"\n @body = {:accounts => accounts}\n end",
"def reset_password_email(user)\n @user = User.find user.id\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(to: user.email,\n subject: \"[Fjord Bootcamp] #{I18n.t(\"your_password_has_been_reset\")}\")\n end",
"def reset_password_email(user)\n @user = user\n @password_reset_url = edit_password_reset_url(user.reset_password_token)\n mail to: user.email, subject: \"Reset your VCDelta.org password\"\n end",
"def reset_password_email(user)\n @user = User.find(user.id)\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(:to => user.email,\n :subject => \"パスワードリセットのご案内\")\n end",
"def password_reset_mail(user)\n subject \"Password Reset Instructions\"\n from \"sender_email_id@test.com\"\n recipients user\n content_type \"text/html\"\n sent_on Time.now\n body \"RESET your Password\"\n end",
"def forgot_password_mail\n Accounts.forgot_password_mail\n end",
"def forgot_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @subject = 'Request to change your password'\n @body [\"name\"] = user.login\n @body[\"url\"] = \"http://#{Site.current.domain}/reset_password/#{user.reset_password_code}\" \n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def reset_password_email(user)\n @user = user\n @url = edit_password_reset_url(@user.reset_password_token)\n @subject = \"[#{SITE_NAME}] Password reset request\"\n mail(bcc: @user.email, subject: @subject)\n end",
"def password_reset(user)\n mail_to user, password_reset_subject\n end",
"def forgot_password(to, login, pass, sent_at = Time.now)\n @subject = \"Satori: New password\"\n @body['login'] = login\n @body['pass'] = pass\n @recipients = to\n @from = 'satori@hcl.com'\n @sent_on = sent_at\n @headers = {}\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def reset_password_instructions(resource, token, _options)\n @resource = resource\n @token = token\n mail(\n to: resource.email,\n subject: ['¿Solicitaste un cambio de contraseña en tus servicios de ',\n 'GurúComm?'].join('')\n )\n end",
"def reset_password_instructions(user)\n @resource = user\n mail(:to => @resource.email,\n :subject => \"Reset password instructions\",\n :tag => 'password-reset',\n :content_type => \"text/html\") do |format|\n format.html { render \"devise/mailer/reset_password_instructions\" }\n end\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Återställning av ditt lösenord på Biblion.\"\n end",
"def password_reset(user)\n @user = user\n mail :to => user.email#, :subject => t(\"Password_Reset\")\n end",
"def reset_password_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def forgotten(name, email, password)\n @subject = 'Your Boxroom password'\n @body['name'] = name\n @body['password'] = password\n @recipients = email\n @from = 'Boxroom <mischa78@xs4all.nl>'\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def password_reset(teacher)\n @teacher = teacher\n mail to: teacher.email, subject: \"Password reset\"\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def notify_password_reset!\n with_user_locale do\n reset_single_access_token!\n UserMailer.password_reset(self).deliver!\n end\n end",
"def change_password_email(user)\n @user = user\n mail(to: @user.email, subject: t(\"users.email.change_password.subject\"))\n end",
"def password_reset( user )\n @user = user\n mail( to: @user.email, subject: 'Restablecer contraseña Happitch' )\n end",
"def reset_password_instructions(user)\n @user = user\n setup_mail(:reset_password_instructions, :headers => {:to => @user.email})\n end",
"def reset_password_email\n UserMailer.reset_password_email(User.first)\n end",
"def reset_password(user, reset_link)\r\n recipients user.email\r\n from system_email(reset_link)\r\n subject \"#{subject_prefix}Forgotton Password\"\r\n body :user => user, :reset_link => reset_link\r\n end",
"def password_reset\n #@greeting = \"Pershendetje\"\n\n #mail to: \"to@example.org\"\n end",
"def reset_password\n [send_email(MailPart.new_subject(I18n.t('devise.mailer.reset_password_instructions.subject')),\n nil,\n MailPart.new_body(''),\n EmailStuff::TYPES[:reset_password],\n reset_pass_call),\n @candidate_mailer_text.token]\n end",
"def reset_password(user)\n setup_email(user)\n subject \"Password reset link\"\n\n body :user => user, :host => FROM_HOST\n end",
"def forgot_password\n @title=\"Email Password\"\n @header=\"<h1>Email Password</h1><em>Enter your email address to have a new password sent to you.</em>\"\n end",
"def send_password(clear_password) \n self.password = Digest::SHA1.hexdigest(self.password_salt.to_s + clear_password)\n self.save\n \n Mailer.deliver_message(\n {:recipients => self.email,\n :subject => \"Your Expertiza password has been reset\",\n :body => {\n :user => self,\n :password => clear_password,\n :first_name => ApplicationHelper::get_user_first_name(self),\n :partial_name => \"send_password\" \n }\n }\n )\n \n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def password_reset(user)\n @user = user\n\n mail to: user.email, subject: t(:mailer_user_password_reset_subject)\n end",
"def password_changed_mail(user)\n mail to: user.email\n end",
"def reset_password_email(user)\n @user = user\n @url = edit_forgot_password_url(user.reset_password_token)\n mail(to: user.email,\n subject: \"Your ClosetGroupie password has been reset\")\n end",
"def password_reset(user)\n #@greeting = \"Hi\"\n @user = user\n #mail to: user.email, subject: \"Password Reset\"\n mail to: user.email, subject: 'Welcome to Project Quest!'\n end",
"def password_reset(user)\n @user = user\n mail :to => user.email, :subject => \"Password reset for Project Help\"\n end",
"def forgot_password\n NotificationsMailer.forgot_password\n end",
"def forgot_password\n NotificationsMailer.forgot_password\n end",
"def forgot_password\n NotificationsMailer.forgot_password\n end",
"def password_reset(user)\n @user=user\n mail(:to=>@user.email,:subject=>\"Hey there! Thanks for using instaprint\")\n#mail (:to=>@user.email,:from=>'basics.aki@gmail.com',:subject=>\"Please find the password reset instructions\")\n end",
"def password_reset(user)\n @user = user\n\n mail :to => user.email, :subject => t(:password_recover)\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def student_password_reset\n StudentMailer.student_password_reset\n end",
"def reset_notification(user)\n\t\tsetup_email(user)\n\t\tsubject self.site_name+\" : \"+I18n.t('mailer.reset_notification.subject')\n\t\tbody :url => self.daurl+\"/admin/reset_password/#{user.password_reset_code}\",\n\t\t\t:user_login => user.login,\n\t\t\t:site => self.site_name\n end",
"def i18n_label\n \"email.#{name}_label\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset for TechScreen.net\"\n end",
"def forgot_password(to, name, pass)\n mail(\n :to => to,\n :subject => \"Sugebewa\",\n :body => \"Name is: #{name}.\\n\nYour new password is #{pass}\\n\nPlease login and change it to something more memorable.\\n\nClick here this link to login http://sugebewa.com/signin\\n\\n\"\n )\n end",
"def reset_password_instructions(token, resource)\n @token = token\n @resource = resource\n mail to: @resource, subject: \"Reset your password\"\n end",
"def set_subject(subject)\n\t\tend",
"def send_reset_password_email(user)\n \t@user = user\n \tmail( :to => @user.email ,\n \t:subject => '[Todo Manager] Password Reset')\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: 'Password reset'\n # @greeting = \"Hi\"\n # mail to: \"to@example.org\"\n end",
"def forgot_password\n @greeting = \"Hi\"\n\n mail to: \"ajayashok.01@gmail.com\"\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def subject\n message.subject\n end",
"def password_reset(user)\n @user = user\n\n mail to: user.email, subject: 'Password Reset Instructions for Application'\n end",
"def password_reset(user)\n @user = user\n mail(:to => user.email, :subject => \"Password Reset\", :from => 'bassoonfingeringfinder@gmail.com') \n \n end",
"def forgot_password\n @greeting = 'Hi'\n\n mail to: 'to@example.org'\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset [Delfy]\", from: \"Delfy <noreply@delfy.us>\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Cloud Gephi - Password reset\"\n end",
"def reset_password\n # TODO: Implement actual functionality -- Wed Jun 13 15:26:53 2012\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"nitish.k008@gmail.com\"\n end",
"def user_forgot_password_template\n 'forgot_password'\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.username, subject: \"Umedoc Password Reset\"\n end",
"def password_reset(user)\n @user = user\n # missing \"from: \"norply@example.com\"\" -> error\n mail to: user.email, subject: \"Password reset\"\n end"
] |
[
"0.69499105",
"0.6791501",
"0.65838724",
"0.65776485",
"0.65767306",
"0.65633065",
"0.6562831",
"0.65615106",
"0.65575516",
"0.65428513",
"0.65345335",
"0.6479871",
"0.64787537",
"0.64552516",
"0.64471054",
"0.64469117",
"0.64234436",
"0.6407296",
"0.63911825",
"0.6362709",
"0.63610387",
"0.63570434",
"0.6350343",
"0.63254505",
"0.6314604",
"0.628595",
"0.6282648",
"0.628097",
"0.62615216",
"0.6242403",
"0.6239642",
"0.62383765",
"0.62382734",
"0.6233188",
"0.6220514",
"0.6220401",
"0.6211443",
"0.62071514",
"0.61817294",
"0.61713207",
"0.6150417",
"0.6124915",
"0.61204976",
"0.61174303",
"0.6117082",
"0.6112302",
"0.6108271",
"0.60999405",
"0.6096517",
"0.6094953",
"0.60931176",
"0.6088108",
"0.6086578",
"0.608171",
"0.6077833",
"0.6077833",
"0.6077833",
"0.6067255",
"0.6066287",
"0.606269",
"0.60624325",
"0.60624325",
"0.60624325",
"0.60624325",
"0.6050995",
"0.60503215",
"0.60378045",
"0.6031795",
"0.6029621",
"0.60251045",
"0.6019202",
"0.6018778",
"0.6016643",
"0.6016498",
"0.5998733",
"0.59976155",
"0.59976155",
"0.59976155",
"0.59976155",
"0.59976155",
"0.59976155",
"0.59976155",
"0.59976155",
"0.59950763",
"0.59933317",
"0.59929013",
"0.59848297",
"0.59843093",
"0.5977169",
"0.59765005",
"0.59695375",
"0.59683275",
"0.59675455",
"0.59675455",
"0.59675455",
"0.59618205",
"0.59617525"
] |
0.59637046
|
97
|
Given a hash with numeric values, return the key for the smallest value
|
def key_for_min_value(name_hash)
i = 0
j = 1
result = nil
array = name_hash.collect do |key, value| value end
result = array[i]
while i < array.length
while j < array.length
if array[j] < result
result = array[j]
end
j += 1
end
i += 1
end
name_hash.select do |key, value|
if value == result
return key
end
end
return result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend",
"def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend",
"def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend",
"def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend",
"def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend",
"def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend",
"def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend",
"def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend",
"def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end",
"def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end",
"def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend",
"def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend",
"def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend",
"def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend",
"def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend",
"def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend",
"def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end",
"def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend",
"def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend",
"def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = 0\n comp = nil\n name_hash.each do |key,val|\n comp = val\n if smallest_key == 0\n smallest_key = key\n smallest_val = val\n end \n if comp < smallest_val\n smallest_val = comp\n smallest_key = key\n end\n end\n if smallest_key == 0 \n return nil \n else\n return smallest_key\n end\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend",
"def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend",
"def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend",
"def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend",
"def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend",
"def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend",
"def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end",
"def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend",
"def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend",
"def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend",
"def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend",
"def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend",
"def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend",
"def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend",
"def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend",
"def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend",
"def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend",
"def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend",
"def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend",
"def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end",
"def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend",
"def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend",
"def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend",
"def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend",
"def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend",
"def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend"
] |
[
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585",
"0.84359556",
"0.84328413",
"0.8430745",
"0.8428166",
"0.84090126",
"0.8388222",
"0.83684903",
"0.83568215",
"0.83524764",
"0.8345625",
"0.8343887",
"0.8328773",
"0.83284044",
"0.83269894",
"0.83253354",
"0.83201903",
"0.83164364",
"0.8312503",
"0.8312319",
"0.8304851",
"0.83014053",
"0.83008987",
"0.82917446",
"0.8288315",
"0.82870966",
"0.8274123",
"0.82674986",
"0.8267187",
"0.82527804",
"0.8250538",
"0.82443976",
"0.82439804",
"0.8243696",
"0.82416916",
"0.8240566",
"0.823854",
"0.82375354",
"0.82283455",
"0.82274485",
"0.82205135",
"0.82190055",
"0.82136935",
"0.82136935",
"0.82102376",
"0.82101446",
"0.82060164",
"0.8200657",
"0.81985617",
"0.81966525",
"0.81958514",
"0.81932545",
"0.81874573",
"0.8186549",
"0.8185174",
"0.8183619",
"0.8183068",
"0.8182941",
"0.8179895",
"0.8173536",
"0.81732464",
"0.8172825",
"0.81721044",
"0.8171692",
"0.81681263",
"0.8165602",
"0.81609225",
"0.8160289",
"0.81587887",
"0.815757",
"0.8154019",
"0.81534094",
"0.8152752",
"0.81524456",
"0.8151455",
"0.81511825",
"0.8151019",
"0.8146792",
"0.814368",
"0.8142542",
"0.81412685"
] |
0.0
|
-1
|
set and return user name or sname or mname ( example for set> name('sname', 'Petrov' ) example for get> name('mname') )
|
def name(type, newval = nil)
@usr_fio[type.to_sym] = newval.nil? ? @usr_fio[type.to_sym] : newval
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_name_set(name)\n self.username.set name if nil_or_empty?(username[:value])\n end",
"def name=(user_name)\n @first_name, @last_name = user_name.split\n # The above simplified code does the same as below!!!\n # names = user_name.split\n # @first_name = names[0]\n # @last_name = names[1]\n end",
"def name=(user)\n\t\t@name=user\n\tend",
"def set_name(name)\n\t\tfirst_name, last_name = name.split(/\\s+/)\n\t\tset_first_name(first_name)\n\t\tset_last_name(last_name)\n\tend",
"def set_user_name_field(user_name)\n end",
"def user_name= (name)\n options = self.class.rauth_options\n name = name.strip.downcase if options[:clean_username]\n self[:user_name] = name\n end",
"def name_or_username\n name || username\n end",
"def set_name\n name = \"\"\n\n if self.firstname.blank? && self.lastname.blank?\n unless self.login.blank?\n name = self.login\n else\n name = self.email\n end\n else\n name = \"#{self.firstname} #{self.lastname}\"\n end\n\n self.update_column(:name, name)\n #self.name = \"Ferdinand\"\n end",
"def name=(name)\n @first_name = @name.split(\" \").first\n @last_name = @name.split(\" \").last\n end",
"def name\n username || email\n end",
"def name\n username || email\n end",
"def username=(new_name)\n @username = new_name.upcase\n end",
"def my_name(value)\n name = value\nend",
"def name=(new_name)\n name_parts = new_name.split(' ')\n\n self.first_name = name_parts.shift.to_s\n self.last_name = name_parts.pop.to_s\n self.middle_name = name_parts.join(' ')\n end",
"def set_name\n unless self.surname.blank?\n unless self.given_name.blank?\n self.name = self.surname + \", \" + self.given_name\n else\n self.name = self.surname\n end\n else \n if ![nil,\"\"].include?( self.given_name )\n self.name = self.given_name\n end\n end\n end",
"def name=(new_name)\n \t# new_name is split by the space\n \tnames = new_name.strip.split(' ')\n \tself.first_name = names[0]\n \tself.last_name = names[1]\n \tself.save!\n end",
"def set_name\n person = CMU::Person.find(andrew_id)\n if !person.nil?\n self.first_name = person.first_name\n self.last_name = person.last_name\n end\n end",
"def username=(val)\n write_attribute(:username, val.downcase.split(\" \").join)\n end",
"def user_name(name = nil)\n return user_name_from_name(name) if name\n\n user_name_random\n end",
"def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end",
"def name=(name)\n # String.empty? does the same as String == \"\"\n raise_missing_attribute_error(\"name\") if name.nil? or name.empty?\n\n name = capitalize(name)\n # set the instance variable @name to be able to access it over person.name\n @name = name\n end",
"def name=(name)\n @name = name\n return @name\n end",
"def set_name(name)\n unless name.nil?\n @name = name\n end\n @name\n end",
"def set_name=(name)\n @name=name\n end",
"def set_name(info)\n # Do NOT override the value if it's returned from the CAS server\n return info['name'] if info['name']\n info['name'] = case options.name_format\n when :cn\n info['common_name']\n when :full_name\n info['full_name']\n when :first_last_name\n \"#{info['first_name']} #{info['last_name']}\"\n end\n info['name'] ||= info['common_name'] || info['full_name'] ||\n \"#{info['first_name']} #{info['last_name']}\"\n end",
"def name_setter\n @name\n end",
"def set_name(v)\n Saklient::Util::validate_type(v, 'String')\n @m_name = v\n @n_name = true\n return @m_name\n end",
"def set_name(v)\n Saklient::Util::validate_type(v, 'String')\n @m_name = v\n @n_name = true\n return @m_name\n end",
"def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end",
"def naming\n name || nickname\n end",
"def first_name=(s)\n write_attribute(:first_name, s.to_s.capitalize)\n end",
"def name= val # Setter - set a value\n @name = val \n end",
"def user_name\n \"someone\"\n end",
"def name(name)\n @name = name\nend",
"def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end",
"def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end",
"def name\n userName\n end",
"def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end",
"def name=(s)\n write_attribute(:name, s.to_s.titleize)\n end",
"def user_name\n name = user.nil? ? '' : user.name\n end",
"def username(name = nil)\n if !name then @username\n else @username = name\n end\n end",
"def set_name(name)\n @person[:name] = name\n end",
"def name(entered_name)\n split_name = entered_name.split\n @first_name = split_name[0].capitalize\n @last_name = split_name[1].capitalize\n end",
"def name=(name)\r\n @name = name.capitalize\r\n end",
"def username=(value)\n write_attribute :username, value.downcase\n end",
"def last_name_set(name)\n self.lastname.set name if nil_or_empty?(lastname[:value])\n end",
"def name\n if self[:name].blank?\n (self[:email] || \"\").split('@')[0].split('.').map(&:capitalize).join(' ')\n else\n self[:name]\n end\n end",
"def name=(new_name) \n @name = new_name\n end",
"def name\n \"#{user_name.titleize}\"\n end",
"def name= new_name\n @name = new_name\n end",
"def username=(s)\n write_attribute(:username, s.to_s.strip.sub(/^@/, '').downcase)\n end",
"def set_name=(name)\n @name = name\n end",
"def last_name=(value)\n write_attribute :last_name, value.titleize\n end",
"def name\r\n\t\t@usr_name\r\n\tend",
"def name\r\n\t\t@usr_name\r\n\tend",
"def name=(value)\n write_attribute :name, value.to_s.downcase\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def name=(name)\n\t@name = name\nend",
"def assign_name(name = 'Bob')\r\n name \r\n end",
"def name=(val)\n self[:name] = val\n end",
"def first_name=(value)\n write_attribute :first_name, value.titleize\n end",
"def user_name=(name)\n self.user = User.find_or_create_by(name: name)\n end",
"def set_name\n @name = session[:name]\n if @name.nil?\n @name = session[:name] = Haikunator.haikunate\n end\n end",
"def name_setter(new_name)\n @name = new_name\n end",
"def username=(value)\n\t write_attribute(:username, value.downcase)\n\tend",
"def name=(value)\n if value == \"\"\n raise \"Name cannot be blank!\"\n elsif value.is_a? Integer\n raise \"Name cannot contain numbers!\"\n else\n if value.is_a? String\n @name = value\n end\n end\n end",
"def name=(val)\n @name = val\n end",
"def username=(username)\n write_attribute(:username, username.downcase)\n end",
"def username=(username)\n write_attribute(:username, username.downcase)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def name=(new_name)\n @name=new_name\n end",
"def username\n name\n end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def setName\n self.name.nil? ? \"invalid\" : self.name.upcase\n self.second_name.nil? ? \"\" : self.second_name.titleize\n # self.name = self.name.upcase if not self.name.nil?\n # self.second_name = self.second_name.titleize if not self.second_name.nil?\n end",
"def name=(str) \n self[:name] = compact_string(str); \n end",
"def name=(str) \n self[:name] = compact_string(str); \n end",
"def name=(new_name)\n\t\t@name = new_name\n\tend",
"def username=(user) #method name is username= and it takes on the user parameter and sets it equals to the username variable \n @username = user\n end",
"def name=(aname)\n\t\t@name=aname\n\tend",
"def get_name(user_info)\n return user_info[\"name\"]\n end",
"def login_name=(value)\n @login_name = value\n end",
"def first_name_set(name)\n self.firstname.set name if nil_or_empty?(firstname[:value])\n end",
"def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend",
"def name=(the_baby_name) \r\n @my_name = the_baby_name\r\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(value); end",
"def assign_name(name = 'Bob')\n\tname\nend",
"def name=(name) #don't forget it accepts an argument name = format\n @name = name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end"
] |
[
"0.7815543",
"0.74298126",
"0.7356613",
"0.7242506",
"0.71841085",
"0.7146544",
"0.71204895",
"0.71081483",
"0.70693624",
"0.7037341",
"0.7036977",
"0.70038617",
"0.6940672",
"0.6915634",
"0.6880692",
"0.68647593",
"0.68164897",
"0.67650044",
"0.67627645",
"0.67559475",
"0.67513835",
"0.67485434",
"0.67355794",
"0.6728398",
"0.671144",
"0.66936094",
"0.66882473",
"0.66882473",
"0.66812503",
"0.6677143",
"0.667135",
"0.6667735",
"0.66580814",
"0.6647626",
"0.66398674",
"0.66398674",
"0.6634913",
"0.6626714",
"0.6619249",
"0.66171134",
"0.6615126",
"0.6603337",
"0.65959007",
"0.65935874",
"0.6592445",
"0.658986",
"0.6573285",
"0.6563733",
"0.65633804",
"0.65562516",
"0.6552234",
"0.6528905",
"0.6518329",
"0.65177256",
"0.65177256",
"0.6513359",
"0.65094614",
"0.6509308",
"0.6503102",
"0.6501664",
"0.6500671",
"0.6490696",
"0.6487605",
"0.6482565",
"0.64748734",
"0.64738667",
"0.6470294",
"0.6466177",
"0.6466177",
"0.646574",
"0.646574",
"0.646574",
"0.64651597",
"0.6463966",
"0.6463966",
"0.6463966",
"0.6463966",
"0.6456577",
"0.6455837",
"0.6455735",
"0.6455735",
"0.6440293",
"0.64324564",
"0.64324564",
"0.6429164",
"0.64277387",
"0.64198506",
"0.64189726",
"0.6415833",
"0.64084154",
"0.6404539",
"0.64043176",
"0.6396049",
"0.6396049",
"0.6394359",
"0.6392059",
"0.639153",
"0.63881266",
"0.6384483",
"0.6384483",
"0.6384483"
] |
0.0
|
-1
|
set and return user rate: example > set_rate(4) if value user_rate is zero, user_rate sets random between from 1 to 5
|
def rate(user_rate = nil)
@user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rate=(value)\n @rate = value\n end",
"def rate(rate)\n @rated_times += 1\n @average_rating = (@average_rating + rate) / @rated_times\n end",
"def rate(stars, user, dirichlet_method=false)\n\n if can_rate? user\n rates.create! do |r|\n r.stars = stars\n r.rater = user\n end\n if dirichlet_method\n update_rate_average_dirichlet(stars)\n else\n update_rate_average(stars)\n end\n else\n raise 'User has already rated.'\n end\n end",
"def rate(rate_value)\n @template.rate = rate_value\n end",
"def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end",
"def change_rate(rate) #TODO: separate rate changes to be dependant on dates/reservations/blocks\n @rate = rate\n end",
"def set_update_rate(rate)\n rate = AMS.clamp(rate.to_i, 1, 100)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate)\n sim = MSPhysics::Simulation.instance\n sim.set_update_rate(rate) if sim\n return rate\n end",
"def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend",
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def set_rate(address,rate)\n\t \tinjector = eval \"@injector_#{address}\"\n\t \tinjector.syringe.rate = rate\n\t \tcmd = injector.syringe.get_rate_cmd\n\t \tadd_to_queue(address,cmd)\n\t\treturn true\n\t end",
"def applicable_pay_rate\n current_user_pay_rate = user.pay_rate || 0\n\n if user_id_was.present? && user_id != user_id_was\n current_user_pay_rate\n else\n pay_rate || current_user_pay_rate\n end\n end",
"def set_user_question_rate\n @user_question_rate = UserQuestionRate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def sample_rate=(value)\n if value == @defaults['sampleRate']\n @values.delete 'sampleRate' if @values.key? 'sampleRate'\n else\n @values['sampleRate'] = value\n end\n end",
"def set_defaults\n self.rate ||= 0\n end",
"def rate(value, ip_address, user_id)\n if can_rate? ip_address\n UserStore.create(:user_id => user_id, :store_id => self.store_id, :role => 'author') if self.store.user_stores.where(:user_id => user_id).blank?\n r = ratings.find_or_initialize_by_user_id(user_id)\n r.value = value\n r.ip_address = ip_address\n r.save!\n else\n errors.add :base, I18n.t(\"already_rated\")\n false\n end\n end",
"def set_rate(from, to, rate, opts = T.unsafe(nil)); end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end",
"def rate; end",
"def rate; end",
"def get_user_rate(currency, current_user)\n user_currency = User.get_currency(current_user)\n\n return 1 if user_currency.iso_code == currency\n\n return CurrencyRate.get_rate(currency, user_currency.iso_code)\n end",
"def update_rate=(rate)\n rate = AMS.clamp(rate.to_i, 1, 100)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate)\n sim = MSPhysics::Simulation.instance\n sim.update_rate = rate if sim\n end",
"def rate\n return @rate\n end",
"def rate=(_arg0); end",
"def rate=(_arg0); end",
"def sample_rate\n @values.fetch('sampleRate') { \n @values['sampleRate'] = 100.0\n }\n end",
"def reset_rate\n @rate = 500\n end",
"def rate(new_rating, save_object = true)\n new_rating = new_rating.to_i\n if new_rating >= Rateable.min and new_rating <= Rateable.max\n unless @rate_count\n @rating = new_rating\n @rate_count = 1\n else\n sum = @rating * @rate_count\n @rate_count += 1\n @rating = (sum + new_rating) / @rate_count\n end\n self.update(:only => [:rating, :rate_count]) if save_object\n end\n end",
"def add_rating(value, user)\n current_rating = Rating.find_by(rateable: self, user: user)\n if current_rating\n current_rating.update(value: value)\n else\n ratings.create(value: value, user: user)\n end\n end",
"def rate(rateable, rate)\n already_rated = Rating.find(:first, :conditions => [\n \"rater_id = ? AND rater_type = ? AND rateable_id = ? AND rateable_type = ?\",\n self.id, self.class.name, rateable.id, rateable.class.name\n ])\n if already_rated\n already_rated.update_attribute(:rating, rate)\n else\n rate = Rating.new(:rating => rate, :rateable => rateable, :rater => self)\n rate.save\n end\n end",
"def rate(new_rate)\n @ratings << new_rate\n @average_rating = @ratings.sum / @ratings.length\n end",
"def initialize\n @rate = 0.10\n end",
"def rate!(level)\n rating.increment!(level)\n end",
"def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend",
"def UpdateRate=(arg0)",
"def UpdateRate=(arg0)",
"def set_rate from, to, rate\n if self.class.rates_careful\n set_rate_with_time(from, to, rate)\n else\n super\n end\n end",
"def rate\n if(specific_rate?)\n if(rate_cents < 0)\n task_list.default_rate.to_money\n else\n specific_rate.to_money\n end\n else\n Money.new(0, \"USD\")\n end\n end",
"def set_rate_up\n @rate_up = RateUp.find(params[:id])\n end",
"def set_rand()\n rdm = Random.new()\n @step = rdm.rand(1..10) * 100\n @rate = rdm.rand(1.2..3.0) \n end",
"def set_rate\n return if self.disabled or self.initial_rate_pushed\n\n # check if it using master rate or not\n if self.is_configuration_master_rate?\n logs = Array.new\n\n # find the master rate mapping\n master_rate_channel_mapping = RoomTypeMasterRateChannelMapping.find_by_room_type_id_and_channel_id(self.room_type_id, self.channel_id)\n master_rate = master_rate_channel_mapping.master_rate_mapping\n loop_date = DateTime.now.in_time_zone.beginning_of_day\n\n # loop until 400th day\n while loop_date <= Constant.maximum_end_date\n existing_rate = MasterRate.find_by_date_and_property_id_and_pool_id_and_room_type_id(loop_date, master_rate.room_type.property.id, master_rate.pool_id, master_rate.room_type_id)\n if !existing_rate.blank?\n logs << MasterRateNewRoomLog.create_master_rate_new_room_log(existing_rate)\n end\n loop_date = loop_date + 1.day\n end\n MasterRateNewRoomChangeSet.create_job(logs, master_rate.pool, self.channel, self)\n else\n rate_to_use = self.is_configuration_new_rate? ? self.new_rate : self.room_type.basic_rack_rate\n puts rate_to_use\n RateUtils.delay.populate_rate_until_day_limit(rate_to_use, self.room_type, self.channel, PropertyChannel.find_by_channel_id_and_property_id(self.channel_id, self.room_type.property.id).pool, self.room_type.property)\n end\n\n self.update_attribute(:initial_rate_pushed, true)\n end",
"def rate\n\t\t# retrieve user with specified ID and rate him/her \n @user = User.find(params[:id])\n @user.rate(params[:stars], current_user, params[:dimension])\n\n\t\t# automatically display the new rating\n render :update do |page|\n page.replace_html @user.wrapper_dom_id(params), ratings_for(@user, params.merge(:wrap => false))\n page.visual_effect :highlight, @user.wrapper_dom_id(params)\n end\n end",
"def rate_class\n super\n end",
"def rate_class\n super\n end",
"def rate\n @story = Story.find(params[:id])\n if @story.rate_for_user(params[:rate], current_user)\n respond_to do |format|\n format.html { redirect_to(story_url(@story), :notice => 'Story was rated.') }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(story_url(@story), :notice => 'You have already rated.') }\n format.xml { head :ok }\n end\n end\n end",
"def data_rate=(new_data_rate)\n Klass.setDataRate(@handle, new_data_rate.to_i)\n new_data_rate.to_i\n end",
"def rate\n @rate * ONE_NANOS\n end",
"def skill_effect_rate(user, skill)\r\n # Calculate rate\r\n rate = 20\r\n rate += (user.str * skill.str_f / 100)\r\n rate += (user.dex * skill.dex_f / 100)\r\n rate += (user.agi * skill.agi_f / 100)\r\n rate += (user.int * skill.int_f / 100)\r\n # Return Rate\r\n return rate\r\n end",
"def set_rate_with_time(from, to, rate)\n rate_d = BigDecimal.new(rate.to_s)\n @mutex.synchronize {\n @rates[rate_key_for(from, to)] = {rate: rate_d, created_at: Time.now}\n }\n rate_d\n end",
"def set_admin_rate\n @admin_rate = Admin::Rate.find(params[:id])\n end",
"def user_rating(user_id)\n if user_rated?(user_id)\n @user_ratings.select { |user_rating| user_rating.user_id == user_id }.first.rating\n else\n 0\n end\n end",
"def rates; end",
"def rates; end",
"def current_rating(user)\n rating = ratings.find_by(user_id: user.id)\n rating ? rating.value : 0\n end",
"def set_default_rate\n currency_rates[base_currency] = DEFAULT_RATE\n end",
"def initialize\n @rate = 0.90\n end",
"def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end",
"def rating(u, m)\n @user_list[u].rating(m)\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rate_by(user, dimension = nil)\n filter = \"find_by_#{self.class.user_class_name}_id\"\n rates(dimension).send filter, user\n end",
"def add_rate(from, to, rate); end",
"def compute_user_rate(user)\n user_rate = Hash.new(0)\n user_movies = @data.select { |item| item[0].to_i == user }.each { |item| user_rate[item[1].to_i] = item[2].to_i }\n user_rate\n end",
"def mutation_rate=(value)\n @mutation_rate = validate!(:mutation_rate, value)\n end",
"def set_cpu_throttling_rate(rate:)\n {\n method: \"Emulation.setCPUThrottlingRate\",\n params: { rate: rate }.compact\n }\n end",
"def data_rate=(new_data_rate)\n Klass.setDataRate(@handle, @index, new_data_rate.to_i)\n new_data_rate.to_i\n end",
"def unrate( user_to_be_unrated )\n id_user_who_did_the_rating = self.id\n id_user_who_was_rated = user_to_be_unrated.id\n current_rating = Rate.find_by( rater_id: id_user_who_did_the_rating, rateable_id: id_user_who_was_rated )\n\n if current_rating\n current_rating.destroy\n end\n end",
"def rate\n if Rating.find(:first, :conditions =>{:user_id => current_user.id, :rateable_id => current_object.id, :rateable_type => current_object.class.to_s})\n #TODO TRANSLATE AND DISPLAY CORRECT MESSAGE IN blank.js\n message = \"Already Rated\"\n else\n current_object.add_rating(Rating.new(:rating => params[:rated].to_i,:user_id => current_user.id))\n current_object.update_attributes(:rates_average => Rating.average(:rating, :conditions =>{:rateable_id => current_object.id, :rateable_type => current_object.class.to_s}).to_i)\n message = \"Rated Successfully\"\n end\n\t\t\t\t# TODO : refresh the rate box ...\n render :text => message\n end",
"def rating (user, movie)\n\t\tif @train_data.has_key?(user) && @train_data[user].return_rating(movie)\n\t\t\treturn @train_data[user].return_rating(movie)\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def set_Rating(value)\n set_input(\"Rating\", value)\n end",
"def rating\n rating_calculator.rate(raters)\n end",
"def user_rate (user_ratings_arr, line)\r\n\t\tif user_ratings_arr[line[0]].nil? \r\n\t\t\tuser_ratings_arr[line[0]] = {line[1] =>line[2]}\r\n\t\telse\r\n\t\t\tuser_ratings_arr[line[0]][line[1]] = line[2]\r\n\t\tend\r\n\tend",
"def update_user_rateing(db,id,new_value)\n db.execute(\"UPDATE users SET user_rating=#{new_value} WHERE users.id =#{id}\")\nend",
"def pixel_rate=(val)\n if val > 5\n @pixel_rate = 5\n elsif val < 0\n @pixel_rate = 0\n else\n @pixel_rate = val\n end\n end",
"def default_values\n rating = 0\n if user_id.nil?\n user_id = User.find(1)\n end\n end",
"def rate_params\n params.require(:rate).permit(:val, :book_id, :user_id)\n end",
"def rate=(value)\n value = 0 if value <= 0\n value = 1 if value >= 1\n @rate = value\n state = (value * @nb_states).to_i\n state = @nb_states - 1 if state >= @nb_states\n w = (@bw * value).ceil\n w = 1 if w == 0 and value != 0\n @bar.src_rect.set(nil, @background.src_rect.height + @bh * state, w, nil)\n end",
"def default_rate_in_pounds\n default_rate_pence / 100\n end",
"def rate_site\n self.accessed_attempts += 1\n self.save\n end",
"def set_rating\n if !current_user\n raise \"MUST BE LOGGED IN\"\n end\n student_id = current_user.id\n company_id = params[:id]\n student_company_rating = StudentCompanyRating.find_or_create_by_student_id_and_company_id(student_id, company_id)\n student_company_rating.rating = params[:rating]\n student_company_rating.save!\n\n head :no_content\n end",
"def rating\n if in_the_future\n return nil\n else\n #TODO replace this with actual rating\n return rand(1..5)\n end\n end",
"def set_time_entry_actual_bill_rate\n data=params\n @time_entry = TneInvoiceTimeEntry.find(data[:id])\n @previous_final_billed_amount = @time_entry.calculate_final_billed_amt\n override_rate = !data[:value].blank? ? data[:value].to_f.roundf2(2) : 0\n @error=false\n #reg = /^[0-9]+(.[0-9]{1,5})$/\n if (override_rate > 0)\n ActiveRecord::Base.transaction do\n @time_entry.update_attribute(:actual_activity_rate,override_rate)\n @billed_amount = @time_entry.calculate_billed_amount\n @final_billed_amount = @time_entry.calculate_final_billed_amt\n @time_entry.update_attribute(:final_billed_amount,@final_billed_amount)\n end\n else\n @error=true\n flash[:error] = t(:flash_enter_valid_rate)\n end\n end",
"def acts_as_rateable(opts={})\n options = options_for_rateable(opts)\n extend FortiusOne::Acts::Rateable::SingletonMethods\n include FortiusOne::Acts::Rateable::InstanceMethods\n \n if opts[:average] == true\n has_many :ratings, :dependent => :destroy, :as => :rateable, :foreign_key => :rateable_id\n else\n has_one :rating, :dependent => :destroy, :as => :rateable, :foreign_key => :rateable_id \n class_eval { alias :old_rating :rating }\n \n end\n \n class_eval do\n \n # Rate this object with a_rating, also aliased as rating=\n def rate(a_rating, options={})\n options.merge!({\n :rating => a_rating.to_i\n })\n if average_rating?\n if options[:user_id]\n # Delete the old ratings for current user \n Rating.delete_all([\"rateable_type = ? AND rateable_id = ? AND user_id = ?\", self.class.base_class.to_s, self.id, options[:user_id]]) \n end\n self.ratings.create(options)\n else\n self.rating.nil? ? create_rating(options) : self.old_rating.update_attribute(:rating, a_rating.to_i)\n end\n end\n # alias for rate\n alias :rating= :rate\n\n # Return the rating of this object\n def rating\n if average_rating?\n # Integerize it for now -- no fractional average ratings\n (the_ratings = ratings.average(:rating)) ? the_ratings.round : 0.0\n else\n self.old_rating.nil? ? nil : self.old_rating.rating\n end\n end\n \n def total_ratings\n average_rating? ? ratings.count : 1\n end\n \n def average_rating?\n self.respond_to?(\"ratings\")\n end\n \n end\n end",
"def user_reaccept_required_frequency=(value)\n @user_reaccept_required_frequency = value\n end",
"def rate_source=(source)\n @rate_source = source\n end",
"def rate score, post\n ratings.create :score => (score.is_a?(Integer) ? score : Rating.score_for(score)), :post_id => Post.wrap(post).id\n end",
"def set_rate_limited(time, new_time_value = true)\n\n self.user.update_attribute(:rate_limited_until, Time.at(time).utc ) if new_time_value\n\n self.update_attributes(rescheduled_at: Time.at(time).utc,\n status: \"DELAYED\",\n sent_at: Time.now.utc)\n end",
"def add_rate from, to, rate\n set_rate from, to, rate\n end",
"def rate_scale; end",
"def rating(value)\n @ole.Rating = value\n nil\n end",
"def rateable\n self\n end",
"def final_rate_adjustment rate\n (rate/100.0).ceil - 0.01\n end",
"def set_gm_rate\n @gm_rate = GmRate.find(params[:id])\n end",
"def set_PopulateRates(value)\n set_input(\"PopulateRates\", value)\n end"
] |
[
"0.767989",
"0.7085148",
"0.70643735",
"0.704562",
"0.6980152",
"0.6906819",
"0.67577386",
"0.6691674",
"0.6688505",
"0.66768706",
"0.6667784",
"0.66606396",
"0.6628255",
"0.6628255",
"0.6628255",
"0.6628255",
"0.66172",
"0.6570844",
"0.6539932",
"0.6525699",
"0.64806056",
"0.64806056",
"0.64806056",
"0.64561224",
"0.6453116",
"0.6453116",
"0.64212674",
"0.64088607",
"0.6401559",
"0.63815665",
"0.63815665",
"0.63771045",
"0.6366858",
"0.63477767",
"0.634347",
"0.6321332",
"0.6307476",
"0.6301016",
"0.62906134",
"0.62753636",
"0.6263839",
"0.6263839",
"0.6256679",
"0.6253861",
"0.62418556",
"0.62263113",
"0.6217698",
"0.62125903",
"0.6203181",
"0.6203181",
"0.620086",
"0.618277",
"0.6177277",
"0.6156484",
"0.61320806",
"0.60986793",
"0.60709244",
"0.60631144",
"0.60631144",
"0.6055793",
"0.6045027",
"0.6015246",
"0.6011617",
"0.59458864",
"0.59268814",
"0.59268814",
"0.5923793",
"0.5915051",
"0.5905129",
"0.59025455",
"0.5902484",
"0.5900454",
"0.58929944",
"0.5880282",
"0.5879431",
"0.5863899",
"0.5861402",
"0.58604026",
"0.5854493",
"0.5850706",
"0.5842075",
"0.58393663",
"0.5821306",
"0.58042634",
"0.58009",
"0.5762816",
"0.5752274",
"0.5748094",
"0.5744963",
"0.5722242",
"0.5721894",
"0.5699141",
"0.5697612",
"0.56956077",
"0.5695386",
"0.5695287",
"0.5692802",
"0.5691379",
"0.5683881",
"0.56829065"
] |
0.8673743
|
0
|
return users info (id, fio, rate, ocp) : example get_info(1010) > ID 3 Rate4 )
|
def info(inf = '1110')
infarray = []
infarray.push("ID-#{@user_id}") unless inf[0].to_i.zero?
infarray.push("ФИО-#{@usr_fio.values.join(' ')}") unless inf[1].to_i.zero?
infarray.push("Rate-#{rate}") unless inf[2].to_i.zero?
infarray.push("Occupation-#{occupation}") unless inf[3].to_i.zero?
infarray.compact.join(' ').to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def info\n\t@user = User.find(params[:id])\n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def basicInfo (userid)\n\t\tname = nil\n\t\ticonid = nil\n\t\tnameError = nil\n\t\ticonidError = nil\n\t\t\n\t\tbegin\n\t\t\tname = db_select_user_name(userid)\n\t\trescue Exception => ex\n\t\t\tnameError = ex.message\n\t\tend\n\t\t\n\t\tbegin\n\t\t\ticonid = db_select_usersicons_iconid(userid)\n\t\trescue Exception => ex\n\t\t\ticonidError = ex.message\n\t\tend\n\t\t\n\t\treturn generateJSON_BasicInfo(name, nameError, iconid, iconidError)\n\tend",
"def api_get_info( uid )\n\n # варианты размера аватарок = 'photo_rec, photo_big, photo_medium_rec'\n\n url = URI.encode(\"https://api.vkontakte.ru/method/getProfiles?uid=#{ uid }&fields='photo,photo_medium_rec,'&access_token=#{ OFFLINE_TOKEN }\")\n\n Vk_HTTP.request_api(url)[0]\n\n end",
"def get_info\n end",
"def get_info\n end",
"def get_info\n end",
"def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end",
"def getUser(user, info)\n @@users[user][info]\n end",
"def info(query=nil, options={})\n # options[:number] ||= options.delete(:phone) if options.has_key? :phone\n # options[:endpoint] ||= Mogreet.endpoint(\"user.info\")\n # options[:method] ||= \"user.info\" unless options.has_key? :endpoint\n method = \"user.info\"\n Mogreet::Response::Base.new Mogreet.get_response(method, query, options)\n end",
"def get_detail_info(fids)\n uri = \"https://api.twitter.com/1/users/lookup.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fids, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run\n JSON.parse(req.response.body)\n \n end",
"def get_info\n puts @name + ' [ID: ' + @id.to_s + ' @ '+ @@company + ']'\n end",
"def get_infos\n #detail = Info.find_by_status(true).detail\n #if detail \n # return detail\n #else\n # return \"wating for updatting.....\"\n #end\n info = Info.random_to_show_info\n return info.detail\n\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end",
"def get_info()\n\t\tputs \"This information report is about #{@name}.\"\n\t\tif (@sex == \"male\") || (@sex == \"Male\") || (@sex == \"M\")\n\t\t\tputs \"He is #{@age} years old.\"\n\t\t\tputs \"He is a #{@occupation}.\"\n\t\telse\n\t\t\tputs \"She is #{@age} years old.\"\n\t\t\tputs \"She is a #{@occupation}.\"\n\t\tend\n\tend",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def user_info_by_cid( id )\n\n print \"Looking up user details for #{id}...\"\n\n # lookup the user by computing id\n user_info = Helpers.lookup_user( id )\n if user_info.nil?\n puts \"not found\"\n return nil\n end\n\n puts \"done\"\n return user_info\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def get_info(id = @id)\n res = @session.request(\"CakeMail::API::ClassUser\", \"GetInfo\", { :user_id => id, :user_key => @user_key })\n @email = res['email'].first unless res['email'].nil?\n @status = res['status'].first unless res['status'].nil?\n @created_on = res['created_on'].first unless res['created_on'].nil?\n @last_activity = res['last_activity'].first unless res['last_activity'].nil?\n @first_name = res['first_name'].first unless res['first_name'].nil?\n @last_name = res['last_name'].first unless res['last_name'].nil?\n @title = res['title'].first unless res['title'].nil?\n @language = res['language'].first unless res['language'].nil?\n @timezone = res['timezone'].first unless res['timezone'].nil?\n @timezone_id = res['timezone_id'].first unless res['timezone_id'].nil?\n @office_phone = res['office_phone'].first unless res['office_phone'].nil?\n @mobile_phone = res['mobile_phone'].first unless res['mobile_phone'].nil?\n @wysiwyg = res['wysiwyg'].first unless res['wysiwyg'].nil?\n @group_ids = res['group_id'] unless res['group_id'].nil?\n end",
"def info\n\tend",
"def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def investigate info\n #TODO if we already have data for a user, should we look it up?\n \n #http://en.wikipedia.org/w/api.php?action=query&titles=User:Tisane&prop=info|flagged&list=blocks|globalblocks|logevents|recentchanges|tags\n \n account = find_account_history(info)\n \n #http://en.wikipedia.org/w/api.php?action=query&list=logevents&leuser=Tisane&lelimit=max <- actions taken by user\n #get_xml({:format => :xml, :action => :query, :list => :logevents, :leuser => info[4], :lelimit => :max })\n \n #http://en.wikipedia.org/w/api.php?action=query&list=blocks&bkprop=id|user|by|timestamp|expiry|reason|range|flags&bklimit=max&bkusers=Tisane\n #get_xml({:format => :xml, :action => :query, :list => :blocks, :bkusers => info[4], :bklimit => :max, :bkprop => 'id|user|by|timestamp|expiry|reason|range|flags' })\n \n #http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=Tisane&usprop=blockinfo|groups|editcount|registration|emailable\n #get_xml({:format => :xml, :action => :query, :list => :users, :ususers => info[4], :usprop => 'blockinfo|groups|editcount|registration|emailable' })\n \n #http://en.wikipedia.org/w/api.php?action=query&list=recentchanges&rcuser=Tisane&rcprop=user|comment|timestamp|title|ids|sizes|redirect|loginfo|flags\n #get_xml({:format => :xml, :action => :query, :list => :recentchanges, :rcuser => info[4], :rcprop => 'user|comment|timestamp|title|ids|sizes|redirect|loginfo|flags' })\n \n #res = parse_xml(get_xml())\n db_write!(\n ['sample_id', 'account_creation', 'account_lifetime', 'total_edits', 'edits_last_second', 'edits_last_minute', 'edits_last_hour', 'edits_last_day', 'edits_last_week', 'edits_last_month', 'edits_last_year'],\n [info[0]] + account\n )\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_info(id = @id)\n @user.session.request(\"CakeMail::API::ClassClient\", \"GetInfo\", { :client_id => @id, :user_key => @user.user_key })\n @registered_date = res['registered_date'].first\n @last_activity = res['last_activity'].first\n @manager_id = res['manager_id'].first\n @parent_id = res['parent_id'].first\n @contact_id = res['contact_id'].first\n @province_id = res['province_id'].first\n @country_id = res['country_id'].first\n @limit = res['limit'].first\n @status = res['status'].first\n @currency = res['currency'].first\n @company_name = res['company_name'].first\n @address1 = res['address1'].first\n @address2 = res['address2'].first\n @city = res['city'].first\n @postal_code = res['postal_code'].first\n @website = res['website'].first\n @phone = res['phone'].first\n @fax = res['fax'].first\n end",
"def mf_api_get_user_info\n\n # Get the user from the DB\n user = User.find(params[:user_id])\n\n # If no user, return error response\n unless user\n response = {\n success: false,\n message: 'User not found'\n }\n\n render json: response and return\n end\n\n # Create User Info Response\n response = {\n success: true,\n message: 'User Info successfully retrieved',\n user_id: user.id,\n user_infusionsoft_id: user.clientid,\n user_first_name: user.first_name,\n user_last_name: user.last_name,\n user_email: user.email,\n }\n\n # Return success response\n render json: response\n\n end",
"def select_all_user_info_id(user_id)\n p \"uder id #{user_id}s\"\n p \"look here#{get_db_as_hash().execute(\"SELECT * FROM user WHERE user_id = ?\", user_id).first}\"\n return get_db_as_hash().execute(\"SELECT * FROM user WHERE user_id = ?\", user_id).first\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def getinfo\n @api.request 'getinfo'\n end",
"def get_user_info(*fields)\n str_fields = fields.map(&:to_s).join(',')\n url = GRAPH_URL + @user.id + '?fields=' + str_fields + '&access_token=' +\n ENV['ACCESS_TOKEN']\n begin\n return call_graph_api(url)\n rescue => e\n return false\n end\n end",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def get_info\r\n return @infoxml unless @infoxml.nil?\r\n \r\n response = Net::Flickr.instance().request('flickr.people.getInfo', 'user_id' => @id)\r\n \r\n return @infoxml = response.at('person')\r\n end",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend",
"def user_details\n if (params[:user_uid] != nil)\n user = User.select(:name, :blood_group, :age, :id, :user_picture).find_by(user_uid: params[:user_uid])\n path = user.user_picture.path.present? ? user.user_picture.path.gsub(\"/home/altius/Uma/project/BC4_api/public\", \"http://192.168.1.238:4020/\") :nil\n contacts = EmergencyDetail.where(user_id: user.id)\n health_detail = HealthDetail.find_by(user_id: user.id, name: \"health\")\n policy_details = HealthDetail.find_by(user_id: user.id, name: \"policy\")\n render json: { user: user, profile_picture: path, contacts: contacts, health_detail: health_detail, policy_details: policy_details }, status: :ok\n else\n render json: { \"error\": \"Give the user UID\" }, status: :unprocessable_entity\n end\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def get_info(id)\n url = \"http://www.omdbapi.com/?i=#{id}&y=&plot=short&r=json\"\n return_result(url)\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def getUserInfo(idUser)\n \n begin\n \n query = \"SELECT last_name,first_name,email,birthdate,facebook_id,profile_img FROM `#{USER_TABLE}` WHERE `id_user` = ?\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute(idUser)\n count=0\n userinf=false\n sth.fetch() { |row| \n userinf = Hash[\"last_name\" => self.to_utf8(row[0]),\n \"first_name\" => self.to_utf8(row[1]),\n \"email\" => row[2],\n \"birthdate\" => row[3],\n \"facebook_id\" => row[4],\n \"profile_img\" => row[5]]\n } \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return userinf\n \n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} stars\"\n\tend",
"def account_info(*fields)\n get(\"/me#{field_selector(fields)}\")\n end",
"def profile_info_items(user)\n occupation = [\"Occupation\", user.occupation]\n company = [\"Company\", user.company]\n location = [\"Location\", user.location]\n birthday = [\"Birthday\", user.birthday? ? user.birthday.strftime(\"%m/%d/%Y\") : nil]\n [ occupation, company, location, birthday ]\n end",
"def info(*args)\n case args.size\n when 0\n info_filter(VM_POOL_METHODS[:info],\n @user_id,\n -1,\n -1,\n INFO_NOT_DONE)\n when 1\n info_filter(VM_POOL_METHODS[:info],\n args[0],\n -1,\n -1,\n INFO_NOT_DONE)\n when 3\n info_filter(VM_POOL_METHODS[:info],\n args[0],\n args[1],\n args[2],\n INFO_NOT_DONE)\n when 4\n info_filter(VM_POOL_METHODS[:info],\n args[0],\n args[1],\n args[2],\n args[3])\n end\n end",
"def getinfo\n request :getinfo\n end",
"def profile(username, **info)\n print username\n info.each { |k, v| puts \"#{k} = #{v}\" }\nend",
"def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend",
"def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => user_hash['LastName'],\n 'name' => [user_hash['FirstName'], user_hash['LastName']].reject{|n| n.nil? || n.empty?}.join(' '),\n }\n end",
"def raw_info\n yql = \"select * from social.profile where guid='#{uid}'\"\n request = \"https://query.yahooapis.com/v1/yql?q=#{encode_uri_component(yql)}&format=json\"\n @raw_info ||= MultiJson.decode(access_token.get(request).body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def _user uid = 0\n\t\t@infos \t\t\t= {}\n\t\t@infos[:uid] \t= uid\n\t\t@infos[:name] \t= 'unknown'\n\t\t@infos[:level] \t= 0\n\t\t@infos[:sid] \t= ''\n\n\t\t# get uid\n\t\tif uid == 0\n\t\t\t# checks the uid whether exists in session\n\t\t\tif sid = request.cookies['sid']\n\t\t\t\tuid = _session_has sid\n\t\t\tend\n\t\tend\n\n\t\t# fetch info by uid\n\t\tif uid.to_i > 0\n\t\t\tds = Sdb[:_user].filter(:uid => uid)\n\t\t\t@infos[:uid]\t\t= uid\n\t\t\t@infos[:name] \t= ds.get(:name)\n\t\t\t@infos[:level] \t= ds.get(:level)\n\t\t\t@infos[:sid] \t= sid\n\t\tend\n\t\t@infos\n\tend",
"def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end",
"def getUserInfo\n login_user_id = params[:my_id].to_i\n login_user = User.find(login_user_id)\n\n target_user_id = params[:target_id].to_i\n target_user = User.find(target_user_id)\n\n # target_userをフォローしているか\n login_user_follow = login_user.follows_of_from_user.pluck(:id).include?(target_user_id)\n\n # target_userの記事一覧を取得\n articles_hash = make_articles_hash(target_user.articles, target_user)\n\n if articles_hash.blank?\n res = {\n result: false,\n data: nil\n }\n else\n res = {\n result: true,\n data: {\n user_id: target_user_id,\n name: target_user.name,\n follow: login_user_follow,\n profile_image: target_user.profile_image_path,\n articles: articles_hash\n }\n }\n end\n\n render json: res\n end",
"def getInfo\n if session[:userType] == \"Seller\"\n @usertype = \"Seller\"\n @CurrentSeller ||=Seller.find_by(id:session[:seller_id])\n elsif session[:userType] == \"User\"\n @CurrentUser ||=User.find_by(id:session[:user_id])\n if @CurrentUser.nil?\n @usertype = \"Guest\"\n else\n if @CurrentUser.admin == true\n @usertype = \"Admin\"\n else\n @usertype = \"User\"\n end\n end\n\n else\n @usertype = \"Guest\"\n end\n end",
"def get_info\n @output = \"Politician, #{@name}, #{@party}\"\n end",
"def info\n {\n account_id: @account_id,\n date_taken: @date_taken.iso8601,\n username: @user.nil? ? \"\" : @user.username,\n schema: @schema,\n state: @state,\n files: files\n }\n end",
"def getUserData(radio, username, api_url)\n if radio == \"username\"\n return HTTParty.get(api_url + \"predict_json_by_name?screen_name=#{username}\")\n else\n if radio == \"bd\"\n res = HTTParty.get(api_url + \"predict_json_by_id?user_id=#{get_bipolar()}\")\n res['profile']['name'] = \"Bipolar Patient\"\n res['profile']['screen_name'] = 'randomBipolarPatient'\n else\n res = HTTParty.get(api_url + \"predict_json_by_id?user_id=#{get_bpd()}\")\n res['profile']['name'] = \"BPD Patient\"\n res['profile']['screen_name'] = 'randomBPDPatient'\n end\n res['profile']['profile_image_url'] = 'https://pixabay.com/static/uploads/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png'\n res['profile']['profile_banner_url'] = 'https://pbs.twimg.com/profile_banners/6253282/1431474710/1500x500'\n res['profile']['description'] = ''\n end\n res\n end",
"def info(id)\n _params = {:id => id}\n return @master.call 'subaccounts/info', _params\n end",
"def info(*args)\n case args.size\n when 0\n info_filter(BACKUPJOB_POOL_METHODS[:info], @user_id, -1, -1)\n when 3\n info_filter(BACKUPJOB_POOL_METHODS[:info], args[0], args[1], args[2])\n end\n end",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def account_info(command)\n pp @client.users.info('me')\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def info\n request('getinfo')\n end",
"def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end",
"def fetch_user_details(iam_id)\n result = {}\n # Each we use ___[0] because get_from_api returns an array\n # We know we only need [0] because we are querying by iamId\n\n # Get ids, names and affiliations\n basic_info = get_from_api(\"api/iam/people/search\", \"iamId\" => iam_id)\n result[\"basic_info\"] = !basic_info || basic_info.empty? ? [] : basic_info\n\n # Get email, postaladdress, phone numbers\n contact_info = get_from_api(\"api/iam/people/contactinfo/search\", \"iamId\" => iam_id)\n result[\"contact_info\"] = !contact_info || contact_info.empty? ? [] : contact_info\n\n # Get kerberos loginid\n kerberos_info = get_from_api(\"api/iam/people/prikerbacct/search\", \"iamId\" => iam_id)\n result[\"kerberos_info\"] = !kerberos_info || kerberos_info.empty? ? [] : kerberos_info\n\n # Get PPS department, title, and position type\n pps_info = get_from_api(\"api/iam/associations/pps/search\", \"iamId\" => iam_id)\n result[\"pps_info\"] = !pps_info || pps_info.empty? ? [] : pps_info\n\n # Get ODR department and title\n odr_info = get_from_api(\"api/iam/associations/odr/#{iam_id}\")\n result[\"odr_info\"] = !odr_info || odr_info.empty? ? [] : odr_info\n\n # Get student information\n student_info = get_from_api(\"api/iam/associations/sis/search\", \"iamId\" => iam_id)\n result[\"student_info\"] = !student_info || student_info.empty? ? [] : student_info\n\n return result\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def my_info\r\n end",
"def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end",
"def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end",
"def user_info(user_id, list_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listings WHERE list_id=?\", list_id)]\nend",
"def get_info\n @output = \"Voter, #{@name}, #{@politics}\"\n end",
"def info\n fill_usage_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end",
"def info\n @info\n end",
"def info\n {\n email: username\n }\n end",
"def info; end",
"def info; end",
"def get_user_informations(user_id)\n url = \"#{GRAPH_URL}/#{user_id}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.get url\n if data.empty?\n puts \"MessengerBot - Unable to get user_informations (User has not already send a message or has revoked platform permissions on Facebook)\"\n nil\n else\n puts \"MessengerBot - Get user information with user_id : #{user_id}\"\n JSON.parse(data)\n end\n end",
"def info(username)\n perform_request({:action => 'reseller-info', :username => username}) && returned_parameters\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def get_stats()\n result = Array.new()\n res = @db.query(\"SELECT * FROM UserStats;\")\n while row = res.fetch_row do\n result.push(UserInfo.new(row[0], row[1], row[2], row[3]))\n end\n result\n end",
"def info\n kind = (params[:kind] || \"account,locations,offers,usage,messages\").split(/\\s*,\\s*/)\n \n info = {}\n\n # General account info\n if kind.include?(\"account\")\n info[:account] = {\n :domain => current_account.full_domain,\n :venue_name => current_account.venue_name, \n :venue_address => current_account.venue_address, \n :venue_type => current_account.venue_type, \n :venue_type_other => current_account.venue_type_other,\n :on_hold => current_account.on_hold\n }\n end\n \n # Offers\n if kind.include?(\"offers\")\n info[:offers] = current_account.offers.map do |o|\n { :id => o.id,\n :name => o.name,\n :text => o.text,\n :details => o.details }\n end\n end\n \n # Message format\n if kind.include?(\"messages\")\n info[:messages] = {\n :conf_message => current_account.conf_message,\n :conf_prepend_venue => current_account.conf_prepend_venue,\n :page_message => current_account.page_message,\n :page_prepend_venue => current_account.page_prepend_venue,\n :offer_id => current_account.offer_id\n }\n end\n \n if kind.include?(\"locations\")\n info[:locations] = current_account.locations.map do |l|\n { :id => l.id,\n :name => l.name,\n :internal_id => l.internal_id }\n end\n end\n \n if kind.include?(\"usage\")\n info[:usage] = usage_info\n end\n \n render :text => info.to_json\n end",
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def show\n @info = {\n name: Customer.where(:id => params[:id])\n }\n\n if user_signed_in?\n @info[:user_id] = current_user.id\n @info[:disabled] = \"\"\n end\n\n end",
"def user_information(username)\n response = get \"v1/market/user:#{username}.json\"\n response[:user]\n end",
"def info(username)\n perform_request(action: 'reseller-info', username: username) && returned_parameters\n end",
"def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end",
"def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def get_profile_info\n res = {}\n res[:user] = User.select(:login, :city_id, :email, :admin).where(id: session[:user_id]).take\n res[:character] = Character.select(:id, :title).where(id: @current_user.character_id).take\n render json: res\n end",
"def basic_info\n\t\t#Grab some basic info using OID values which should be fairly generic in nature\n\t\ttarget = \"#{@manager.config[:host]}:#{@manager.config[:port]}\"\n\t\tcstring = @manager.config[:community]\n\t\t@snmp_version = @manager.config[:version] #We need this one later for some decisions so setting to class var\n\t\tsys_name = @manager.get_value(\"sysName.0\")\n\t\tsys_descr = @manager.get_value(\"sysDescr.0\")\n\n\t\t#Print out our basic info for user\n\t\tputs \"[*] \".light_green + \"Target\".light_yellow + \": #{target}\".white\n\t\tputs \"[*] \".light_green + \"Community String\".light_yellow + \": #{cstring}\".white\n\t\tif @snmp_version\n\t\t\tputs \"[*] \".light_green + \"SNMP Version\".light_yellow + \": #{@snmp_version}\".white\n\t\telse\n\t\t\tprint_caution(\"Unable to determine SNMP Version in use?\")\n\t\tend\n\t\tif sys_name\n\t\t\tputs \"[*] \".light_green + \"System Name\".light_yellow + \": #{sys_name}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to determine system name!\")\n\t\tend\n\t\tif sys_descr\n\t\t\tputs \"[*] \".light_green + \"System Description\".light_yellow + \": \\n#{sys_descr}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to find system description!\")\n\t\tend\n\t\tif @sys_time\n\t\t\tputs \"[*] \".light_green + \"System Uptime\".light_yellow + \": #{@sys_time}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to find system description!\")\n\t\tend\n\tend"
] |
[
"0.6873489",
"0.6687257",
"0.6669461",
"0.6615454",
"0.66069484",
"0.66069484",
"0.66069484",
"0.651687",
"0.650275",
"0.6459174",
"0.6429083",
"0.64124054",
"0.6400884",
"0.63695914",
"0.6352976",
"0.6328135",
"0.6317834",
"0.6310971",
"0.6308948",
"0.6250193",
"0.6221836",
"0.6208635",
"0.6181866",
"0.61680955",
"0.6144539",
"0.6114918",
"0.6099421",
"0.6087536",
"0.60684395",
"0.60588354",
"0.6036951",
"0.6036657",
"0.60327667",
"0.6027494",
"0.6023559",
"0.6016858",
"0.60077107",
"0.6002913",
"0.59904987",
"0.59674853",
"0.5961005",
"0.5959223",
"0.5957867",
"0.5934244",
"0.59222245",
"0.5920126",
"0.59198433",
"0.59075683",
"0.5905026",
"0.5902494",
"0.58940816",
"0.58902085",
"0.5889902",
"0.5885407",
"0.588221",
"0.58820426",
"0.5880218",
"0.5878986",
"0.5867895",
"0.5866369",
"0.58654237",
"0.58635885",
"0.5861665",
"0.5856046",
"0.5851096",
"0.5842037",
"0.583989",
"0.5835509",
"0.5830821",
"0.58233",
"0.58221877",
"0.58074284",
"0.5789496",
"0.5788338",
"0.57815295",
"0.57705575",
"0.57672703",
"0.57657707",
"0.57615715",
"0.5750701",
"0.5747694",
"0.5745073",
"0.57441694",
"0.57435095",
"0.57435095",
"0.57430726",
"0.57217455",
"0.5712095",
"0.5712095",
"0.57040364",
"0.56964093",
"0.5693935",
"0.56908727",
"0.5688598",
"0.568842",
"0.5677705",
"0.5677705",
"0.56615335",
"0.5657235",
"0.5656813"
] |
0.6352683
|
15
|
add user in Usergroup
|
def add_user(newuser)
@group_users.push(newuser)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_user_to_group(user, group)\n\t\t\tend",
"def add_user(user)\n UserGroup.create(user_id: user.id, group_id: id)\n end",
"def add_user(user)\n group_members.create(group: self, user: user, accepted: DateTime.now)\n end",
"def addUserToGroup\n @user_to_add = User.find(params[:user_to_add])\n @current_group = Group.find_by_id(session[:current_group_id])\n @user_to_add.groups << @current_group\n redirect_to findAvailableUsers_url, notice: 'User was successfully added.'\n end",
"def add_member\n @group = Group.find(params[:id])\n @user = User.find_by_username(params[:username])\n\n unless @user.nil? || @group.users.include?(@user)\n @group.users << @user\n flash[:notice] = \"Miembro añadido exitosamente.\" if @group.save\n else\n flash[:error] = \"No se pudo añadir a este usuario. Verifique que el usuario a añadir sea el correcto.\"\n end\n\n redirect_to group_path(@group)\n end",
"def add_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group(self)\n end",
"def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend",
"def add_user!( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group!(self)\n end",
"def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => group_id, :user_id => user_id)\n \tm.save\n end",
"def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end",
"def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => @group_id, :user_id => @user_id)\n \tm.save\n end",
"def add_user_to_group(user, group)\n send(run_method, \"groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}\")\n end",
"def add(user)\n GroupMembers.new(:id => id).post(user)\n end",
"def add(name, ugid, homedir)\n fail 'user already exists' if include?(name)\n syscmd(\"groupadd -g #{ugid} #{name}\")\n syscmd(\"useradd -u #{ugid} -g #{ugid} -d #{homedir} -c #{COMMENT} #{name}\")\n exclusively { users[name] = ugid }\n end",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def add_user_to_usergroup(group)\n groups = `getent group | grep #{group} | cut -d \":\" -f1`.split(\"\\n\").join(',')\n if groups.empty?\n @ui.error(\"Cannot add user to #{group} group. #{group} group not found\") if groups.empty?\n return ERROR_RESULT\n end\n run_command(\"sudo usermod -a -G #{group} $(whoami)\")[:value].success?\n end",
"def add_user_to_group(username, groupname)\n\t\t\t\tif !user?(username)\n\t\t\t\t\traise(NoSuchUserError, \"No such user: #{username}\")\n\t\t\t\tend\n\n\t\t\t\tif !group?(groupname)\n\t\t\t\t\traise(NoSuchGroupError, \"No such user: #{groupname}\")\n\t\t\t\tend\n\t\t\tend",
"def add_user_member(user, group)\n ids = users_by_group_id(group.id).push(user).map(&:id)\n current_ids = users_by_group_id(group.id).map(&:id)\n create_member(ids, current_ids, 'User', inherited_by: group.id, destroy: false)\n end",
"def add_to_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:add_user)\n # just be lazy and hand off to the group to do the work...\n group.add_user(self)\n end",
"def add_user(data)\n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => data[:usrgrpids],\n :userids => data[:userids]\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end",
"def add_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Can't find user #{user_id_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? ||\n group.leader_id == @current_user.id ||\n @current_user.id == user.id\n\n group.add_user user\n group.save\n\n render json: { message: 'Successfully added user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't add user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end",
"def add(response)\n toggle_membership(response, :add_user_to_group, \"user_added\", \"user_already_in\")\n end",
"def add_user_to_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddUserToGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\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? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def add_user_to_group(orgname, user, groupname, actor=nil)\n alter_group(orgname, groupname, :add, :user, user.name, actor)\n end",
"def add_user(user_id, is_editor = false, is_administrator = false, is_creator = false)\n\t\tgroup = ProjectGroup.new\n\t\tgroup.user_id = user_id\n\t\tgroup.project_creator = is_creator\n\t\tgroup.project_editor = is_editor\n\t\tgroup.project_administrator = is_administrator\n\t\tproject_groups << group\n\tend",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def add_group(user)\n # NB: system users aren't supported on solaris 10\n return <<-HERE.undent\n if ! getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupadd '#{user.group}'\n fi\n HERE\n end",
"def add\n @groups = CwaGroups.new\n\n user_name_regex = /^[a-zA-Z0-9-]{3,20}$/\n\n if params[:user_name] !~ ::CwaConstants::USER_REGEX\n flash[:error] = \"You entered an invalid username!\"\n redirect_to :action => :show, :group_name => params[:group_name]\n return\n end\n\n if @groups.add_to_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_add_member(params[:user_name], params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been added to \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem adding \\\"#{params[:user_name]}\\\" to \\\"#{params[:group_name]}\\\". The user probably does not exist.\"\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end",
"def add_user_to_group(default_group)\n if default_group.present?\n default_group.split(',').each do |group_name|\n if group = Group.named(group_name).first\n group.users << @user\n elsif logger\n logger.warn \"MailHandler: could not add user to [#{group_name}], group not found\"\n end\n end\n end\n end",
"def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end",
"def add_to_group(team, this_user)\n team[:user_ids] << this_user\n end",
"def add_user_to_groups(user, groups)\n user_groups_operation(user, groups, :add)\n end",
"def add(response)\n return unless valid_message?(response)\n\n if Lita::Authorization.add_user_to_group(response.user, @user, @group)\n response.reply \"#{@user.name} was added to #{@group}.\"\n else\n response.reply \"#{@user.name} was already in #{@group}.\"\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reagent_group = ReagentGroup.new(params[:reagent_group])\n unless @reagent_group.users.include? current_user\n @reagent_group.users << current_user\n end\n respond_to do |format|\n if @reagent_group.save\n format.html { redirect_to @reagent_group, notice: 'Reagent group was successfully created.' }\n format.json { render json: @reagent_group, status: :created, location: @reagent_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reagent_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.users << current_user\n \n respond_to do |format|\n if @group.save\n @group.groups_users.first.update_attribute :level, 2\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.create(group_params)\n @owner = current_user\n if @group.persisted?\n flash[:green] = \"Group created!\"\n redirect_to groups_path\n else\n render root_path\n end\n end",
"def add_group(user)\n cmd_args = [\"'#{user.group}'\"]\n cmd_args.unshift '--system' if user.is_system\n\n groupadd_args = cmd_args.join \"\\s\"\n groupmod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupmod #{groupmod_args}\n else\n /usr/sbin/groupadd #{groupadd_args}\n fi\n HERE\n end",
"def create\n \n @group = Group.new(group_params)\n @group.owner_id = current_user.id\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_group(group_id, users)\n url = \"/groups/#{group_id}/members\"\n body = {\n members: users\n }\n post(url, body)\n end",
"def create\n @user = User.new(params[:user])\n @user.group = Group.new\n @user.group.name = \"Scriptwords\"\n @user.bright_text_application_id = BrightTextApplication.where(:name=>\"ScriptureWords\").first.id\n @user.user_type = 0\n\n respond_to do |format|\n if @user.save\n GroupMember.where(:email => @user.email).update_all(:user_id=>@user.id)\n log_in! @user\n format.html { redirect_to(scriptwords_root_url, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" , :layout => \"scriptwords\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\t@group.user_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend",
"def save_group(user)\n ActiveRecord::Base.transaction do\n save\n @user_group = UserGroup.new\n @user_group.user_id = user.id\n @user_group.group_id = id\n @user_group.save\n @member = GroupMember.new\n @member.e_mail = user.email\n @member.group_id = id\n @member.save\n end\n end",
"def add_user(user)\n self.users.create(id: user.id)\n end",
"def add_user_to_group(group_id, user_id, options = {})\n put(\"/groups/#{group_id}/users/#{user_id}\", options)\n end",
"def set_user_group\n @user_group = UserGroup.find(params[:id])\n end",
"def set_usergroup\n @usergroup = Usergroup.find(params[:id])\n end",
"def set_usergroup\n @usergroup = Usergroup.find(params[:id])\n end",
"def set_usergroup\n @usergroup = Usergroup.find(params[:id])\n end",
"def create\n @user = User.new(params[:user])\n @user.company_id = current_user.company_id\n\n password = @user.password.nil? ? @user.generate_password : false\n \n if @user.save && params.has_key?(:multiselect_user_grouping_ids)\n @user.update_groupings(params[:user][:grouping_ids])\n @user.notify_account(password) if password\n params.has_key?(:multiselect_user_role_ids) ? @user.update_roles(params[:user][:role_ids]) : @user.add_employee_role\n gflash :success => \"User created.\"\n else\n @user.errors[:base] << \"You must assign the user to one or more groups.\" unless params.has_key?(:user_groupings)\n @assigned_groups = current_user.root_grouping.id\n end\n \n respond_with(@user)\n end",
"def create\n @group = Group.new(params[:group])\n @group.users.push @current_user\n \n respond_to do |format|\n if @group.save\n @group.invite params[:invite_emails].split(',')\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\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 create\r\n @user = User.new(user_params)\r\n\r\n respond_to do |format|\r\n if @user.save\r\n # group=Group.find(1);\r\n #@user.groups<<group\r\n #UserMailer.welcome_email().deliver!\r\n #UserMailer.welcome_email(@user).deliver_later\r\n format.html { redirect_to @user, notice: 'User was successfully created .'}\r\n format.json { render :show, status: :created, location: @user }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @add_group_to_user = AddGroupToUser.new(params[:add_group_to_user])\n\n respond_to do |format|\n if @add_group_to_user.save\n format.html { redirect_to @add_group_to_user, notice: 'Add group to user was successfully created.' }\n format.json { render json: @add_group_to_user, status: :created, location: @add_group_to_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_group_to_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_group_as_member(group)\n self.groups.push group\n end",
"def add_to_group\n ids = params[:ids]\n group = Group.find(params[:group_id])\n if ids.present?\n users = User.where(id: ids)\n users.each do |u|\n GroupUser.create(user: u, group: group, created_by: current_user)\n if current_user != u\n u.notify(\n \"#{current_user.to_s} has added you to user group: #{group.name}\",\n group, \n \"group\"\n )\n else\n group.admin.each do |admin|\n admin.notify(\n \"#{current_user.to_s} has requested to be added to the user group: #{group.name}\",\n group,\n \"group\"\n )\n end\n end\n end\n if users.count === 1 && users.first === current_user\n flash[:notice] = \"Request sent!\"\n else\n flash[:notice] = \"#{\"Invitation\".pluralize(users)} sent!\"\n end\n end\n respond_to do |format|\n format.json { render :json => {}, :status => :ok }\n format.html {\n if users\n flash.now[:success] = \"Group membership pending for #{users.map(&:username).join(', ')}.\"\n end \n redirect_to group_path(group) \n }\n end\n end",
"def add_user(user,role = 'Member')\n self.users.create(id: user.id, role: role)\n end",
"def group_add(client, options)\n if options[:group].nil? or options[:email].nil?\n puts \"Missing arguments\"\n return\n end\n\n group = client.groups.get options[:group]\n account = get_account(client, options)\n\n if account.nil? or group.nil?\n puts \"Account or group not found\"\n return\n end\n\n account.add_group group\n puts \"Account added to group.\"\nend",
"def add_user(user, reason)\n compatibility_score = 0\n group_leader = User.find(self.creator)\n \n # initializing <tt>group</tt> because of something funky going on with <tt>self</tt> in this context\n group = Group.where(:creator => self.creator).first\n \n case reason\n when \"creator\"\n compatibility_score += 42\n self.initialize_group_meeting_times(user)\n self.initialize_group_schedule(user.schedule) # leader must have a schedule..\n when \"friend\"\n compatibility_score += 21\n compatibility_score += user.number_of_compatible_time_blocks_with(group_leader.schedule)\n else\n compatibility_score += user.number_of_compatible_time_blocks_with(group_leader.schedule)\n end\n \n if reason != \"creator\"\n group.update_group_meeting_times(user)\n group.update_group_schedule(user.schedule) if user.schedule != nil\n end\n \n Membership.create(:group_id => self.id, :user_id => user.id, :compatibility_score => compatibility_score)\n end",
"def set_user_group\n @user_group = UserGroup.find(params[:id])\n end",
"def set_user_group\n @user_group = UserGroup.find(params[:id])\n end",
"def add_user(name)\n\t@users << {:name => name}\n end",
"def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end",
"def create(id, user_id, name)\n user = get_user(user_id)\n group = Group.new(id, user.id, name)\n @@group[id] = group\n group.add(user.id)\n return \"Group Created\"\n end",
"def add_user_group(group_id, user_email)\n group = Group.find(group_id)\n if group\n user = get_user_discourse(user_email)\n if user\n #if user isn't already in group, add user\n if !GroupUser.find_by(group_id: group.id, user_id: user.id)\n group.add(user)\n end\n end\n end\n end",
"def add_new_user()\n new_user_link.click\n end",
"def add_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.post(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/$ref\", { \n \n body: user_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n \"Content-Type\" => 'application/json', \n\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end",
"def add_group(group, gid=nil)\n\t\t\tend",
"def add_group_members(members)\n logger.debug(\"#{new_resource} adding members #{members.join(\", \")}\") unless members.empty?\n members.each do |user|\n shell_out!(\"user\", \"mod\", \"-G\", new_resource.group_name, user)\n end\n end",
"def addUser\n id = params[:id] # retrieve project ID from URI route\n proj = Project.find(id)\n if proj.add_user(params[:username],params[:rolename])\n head :no_content\n else\n render_error(:unprocessable_entity, \"Could not add user\")\n end\n end",
"def create\n @user = Company.find(params[:company_id]).groups.find(params[:group_id]).users.new(user_params)\n\n if @user.save\n redirect_to company_group_user_path(@user.group.company_id, @user.group_id, @user), notice: '正常に作成しました'\n render :show, status: :created, location: @user\n else\n render :new\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def add_member(user)\n if (!self.members.include?(user))\n self.members << user\n else\n raise GroupsManagement::UserIsAlreadyMember, \"The user \" + user.email + \" is already a member of '\" + self.name + \"'.\"\n end\n end",
"def add username\n @members.add username\n end",
"def modify_image_launch_perm_add_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'add', :user_group => user_group.to_a)\n end",
"def add_group_member(group_id, user_id)\n post(\"/v1/groups/#{group_id}/members\", id: user_id)\n end",
"def add_member(user, group)\n relation = group.group_member_relations.find_or_initialize_by(user: user, accepted_at: nil)\n relation.accepted_at = Time.now\n relation.accepter = self\n relation.save\n end",
"def add_x_users(num, *args)\n\n puts \"Adding #{num} users, params=#{args.inspect}\"\n\n org = Org.find(:first)\n\n name = \"Test User\"\n login_name = \"testuser\"\n password = \"password\"\n phone = \"+123456789\"\n validated = true\n group_name = nil\n\n if args.length==1\n params = args[0]\n name = params[:name] if params[:name]\n login_name = params[:username] if params[:username]\n password = params[:password] if params[:password]\n phone = params[:phone] if params[:phone]\n validated = params[:validated] if params[:validated]\n group_name = params[:group]\n end\n\n if group_name and Group.find_by_name(:first,group_name)\n raise \"The group #{group_name} already exists!\"\n end\n \n # find the first unique test user name\n next_avail_user_num = 0\n found = true\n while found do\n next_avail_user_num = next_avail_user_num + 1\n found = User.find_by_login_name(login_name+next_avail_user_num.to_s) != nil \n print \".\"\n end\n\n puts \"found next #{login_name} #{next_avail_user_num}\"\n\n users = []\n num.times do |i|\n u = User.new\n u.org = org\n u.name = name + (next_avail_user_num+i).to_s\n u.login_name = login_name + (next_avail_user_num+i).to_s\n u.password = password\n u.phone = phone\n u.save!\n u.force_sms_validation!(validated)\n users << u\n puts \"Added user #{u.inspect}\"\n end\n\n if group_name\n # now create the group_name from this\n group = Group.new\n group.org = org\n group.name = group_name\n group.save!\n puts \"Added group #{group.inspect}\"\n users.each do |u|\n u.groups << group\n end\n puts \"Added all users to groups\"\n end\n\n users\nend",
"def create\n @user_group = UserGroup.new(user_group_params)\n authorize @user_group\n begin\n @user_group.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @user_group.errors.any? ? @user_group : e },\n status: :bad_request\n else\n toast!(title: \"User group created\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been created.\")\n render \"shared/reload\"\n end\n end",
"def create\n @group = current_user.groups.build(:name => params[:group][:name])\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'new'\n end\n\n end",
"def add_or_remove_user\n\t\t\tgroup = SystemGroup.find params[:id]\n\t\t\tuser = User.find params[:user_id]\n\n\t\t\tif params[:is_add] == '1'\n\t\t\t\tresult = group.add_user user\n\n\t\t\t\treturn render json: result if result[:status] != 0\n\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 0,\n\t\t\t\t\tresult: render_to_string(partial: 'user_items', locals: { users: [user] })\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tresult = group.remove_user user\n\n\t\t\t\trender json: result\n\t\t\tend\n\t\tend",
"def adduser(aNewUser,aPassword,aGroup=nil)\n\t\trun \"#{sudo} adduser --gecos '' #{aGroup ? '--ingroup '+aGroup : ''} #{aNewUser}\" do |ch, stream, out|\n\t\t\tch.send_data aPassword+\"\\n\" if out =~ /UNIX password:/\n\t\tend\n\tend",
"def create\n @group = Group.new(params[:group])\n @u = User.create(:login=>@group.name, :password=>@group.psd, :password_confirmation=>@group.psd, :email =>@group.name+'@mail.msiu.ru')\n @u.role=0\n @u.save\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Группа была создана.' }\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 add_member(user)\n update_membership(user, true)\n end",
"def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend",
"def add_user(user)\n @users << user\n end",
"def add_user(organization, user)\n organization.add_user user\n end",
"def add_members_to_group(team_id, group_id, user_ids)\n params = { query: [team_id, group_id, :members, :add], req: user_ids.to_array_obj(:users) }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_put\n\n resource 'TeamUserGroup', data\n end",
"def create\n @user = User.find(params[:user_id])\n if @user.is_member?(@group)\n render_error(404, request.path, 20100, \"User is already a member.\")\n else\n if @user.join!(@group)\n render json: { result: 1,\n group_id: @group.id,\n group_name: @group.name,\n user_count: @group.users.count }\n else\n render json: {result: 0}\n end\n end\n end",
"def create\n # Create the new user, given the params, but already a member of the group\n @group_user = @parent.new(params[:group_user])\n\n if !current_user or (!current_user.is_admin and !@group.owners.include?(current_user))\n redirect_to @group, :notice => \"You cannot add users to that group.\"\n return\n end\n\n respond_to do |format|\n if @group_user.save\n format.html { redirect_to(@group, :notice => 'Group user was successfully created.') }\n format.xml { render :xml => @group_user, :status => :created, :location => @group_user }\n else\n format.html { form_prep and render :action => \"new\" }\n format.xml { render :xml => @group_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_user!( user, update_user = true )\n puts \"add_user\"\n unless @users.include?( user )\n @users << user\n user.add_badge!( self, false ) if update_user\n end\n return @users\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def add_user(user)\n @users[user.name] = user\n end",
"def ensure_user_group\n if new_resource.gid.is_a?(String)\n group_name = new_resource.gid\n Etc.getgrnam(new_resource.gid).gid\n else\n group_name = new_resource.username\n Etc.getgrgid(new_resource.gid).gid\n end\nrescue ArgumentError\n Chef::Log.info(\n \"user_account[#{new_resource.username}] creating group #{group_name}\")\n group group_name do\n gid new_resource.gid if new_resource.gid.is_a?(Integer)\n end.run_action(:create)\n Etc.getgrnam(group_name).gid\nend",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def add_tokens_to_babysitter_user_group\n current_user.add_tokens(@request_group)\n end",
"def update\n if params[:commit] == \"Remove users\"\n @usergroup.users.each do |user|\n @usergroup.users.delete(user) if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n elsif params[:commit] == \"Add users\"\n User.all.each do |user|\n @usergroup.users << user if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n else\n @usergroup.update(usergroup_params)\n end\n redirect_to users_path\n end",
"def add_group_member(team_id, user_id, access_level)\n post(\"/groups/#{team_id}/members\", :body => {:user_id => user_id, :access_level => access_level})\n end",
"def backend_addUser(param) \n @Users.push(param) \n end"
] |
[
"0.866995",
"0.80869144",
"0.8024208",
"0.80109406",
"0.79968184",
"0.7844103",
"0.7824062",
"0.7791386",
"0.778691",
"0.77759737",
"0.7724631",
"0.7705011",
"0.7694962",
"0.7667048",
"0.7646646",
"0.7646646",
"0.7628266",
"0.75875455",
"0.7560802",
"0.75232434",
"0.75015485",
"0.7379801",
"0.73374283",
"0.7329634",
"0.73096365",
"0.7306795",
"0.72703916",
"0.72245735",
"0.7130176",
"0.71180356",
"0.71077913",
"0.70665234",
"0.7049724",
"0.70296437",
"0.7001297",
"0.6990915",
"0.6956413",
"0.69536966",
"0.69417036",
"0.69415605",
"0.6923453",
"0.69026566",
"0.6897675",
"0.6863282",
"0.6829518",
"0.67852855",
"0.6768506",
"0.6734918",
"0.67269236",
"0.67269236",
"0.67269236",
"0.67121524",
"0.6712064",
"0.67107946",
"0.6710543",
"0.67062104",
"0.6680737",
"0.6675964",
"0.6672524",
"0.66702694",
"0.66668653",
"0.66668653",
"0.66642",
"0.66577774",
"0.6653785",
"0.66403645",
"0.66362584",
"0.6635252",
"0.66323775",
"0.6629326",
"0.66268927",
"0.6623888",
"0.66134614",
"0.66098607",
"0.659968",
"0.6595857",
"0.6588474",
"0.6587854",
"0.6577504",
"0.6569482",
"0.6567581",
"0.6548155",
"0.65445083",
"0.6543385",
"0.6539064",
"0.6532608",
"0.6529024",
"0.6521061",
"0.65006286",
"0.6495512",
"0.6493809",
"0.6491749",
"0.6488556",
"0.64809793",
"0.64784914",
"0.6476762",
"0.6464753",
"0.64602095",
"0.645665",
"0.6454905"
] |
0.8232307
|
1
|
delete user from Usergroup with user_id
|
def delete_user(deluser_id)
@group_users.delete_if { |item| item.user_id == deluser_id }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end",
"def remove_user_from_group(user, group)\n\t\t\tend",
"def remove_user!( user )\n user.remove_group!( self )\n end",
"def remove_user(user)\n group_members.find_by(group: self, user: user).destroy\n end",
"def delete_user_from_groups(user, groups)\n user_groups_operation(user, groups, :delete)\n end",
"def remove(user)\n GroupMember.new(:group_id => id, :member_id => user.id).delete\n end",
"def remove_user_from_group(group_id, user_id, options = {})\n delete(\"/groups/#{group_id}/users/#{user_id}\", options)\n end",
"def remove_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.remove_group(self)\n end",
"def delete_user_from_group(username, groupname)\n\t\t\t\tif !user?(username)\n\t\t\t\t\traise(NoSuchUserError, \"No such user: #{username}\")\n\t\t\t\tend\n\n\t\t\t\tif !group?(groupname)\n\t\t\t\t\traise(NoSuchGroupError, \"No such user: #{groupname}\")\n\t\t\t\tend\n\t\t\tend",
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n begin\n @user_group.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"User group deleted\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been deleted.\")\n ensure\n redirect_to user_groups_path\n end\n end",
"def remove_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Remove failed. Can't find user #{user_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id || @current_user.id == user.id\n if group.leader_id == user.id\n render json: { error: \"Can't remove user that is the leader of the group.\" }, status: :bad_request\n return\n end\n\n membership = group.group_memberships.where(user_id: user).first\n membership.workflow_state = 'deleted'\n membership.save\n render json: { message: 'Successfully removed user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't remove user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end",
"def destroy\n UserGroup.find_by(user_id: @user.id).destroy if UserGroup.find_by(user_id: @user.id).present?\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: t('flash.notice.users.successfully_destroyed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n deleted_user = User.find(params[:user_id])\n DeleteUserFromGroup.call(@previa_group, deleted_user)\n\n respond_to do |format|\n format.html { redirect_to previa_group_current_users_path(@previa_group), notice: 'El usuario fue eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_user_rel = GroupUserRel.find(params[:id])\n @user = @group_user_rel.user\n @group_user_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_user_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = @authorized_group\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to group_users_path(@group) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_group_to_user = AddGroupToUser.find(params[:id])\n @add_group_to_user.destroy\n\n respond_to do |format|\n format.html { redirect_to add_group_to_users_url }\n format.json { head :no_content }\n end\n end",
"def remove_from_group\n @group_user = GroupUser.find(params[:id])\n @user_id = @group_user.user_id\n if !@login_user.belongs_to_group(@user_id).blank?\n @group_user.destroy\n @deleted = true\n @notice = \"User removed from group successfully.\"\n @group_user = @login_user.belongs_to_group(@user_id)\n if @group_user.blank?\n @defalut_group = @login_user.default_group[0]\n @new_group_user = GroupUser.create(:user_id=>@user_id,:group_id=>@defalut_group.id)\n end\n else\n @notice = \"The user must belongs to atleast one group.\"\n end\n respond_to do |format|\n format.js\n end\n \n end",
"def destroy\n @current_user_group = UserGroup.find_by(id: current_user.id)\n @user_group = UserGroup.find_by(id: params[:id])\n if @user_group.user_id == current_user || (current_user.admin == true && @current_user_group.group_id == @user_group.group_id)\n @user_group.destroy\n render json: {message: \"this user group has been successfully deleted\"}\n else\n render json: {:errors => @user_group.errors.full_messages}, Status: :Unauthorized\n end\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_groups_url) }\n format.xml { head :ok }\n end\n end",
"def postUserGroup_admin_remove( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"post\",\"/user/group_admin_remove\",params)\n end",
"def delete(data)\n result = @client.api_request(:method => \"usergroup.delete\", :params => data)\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end",
"def delete(group_id)\n if expired?(@begin_time)\n @auth = get_auth(@api_key)\n end\n Log.debug(\"#{@base_url}#{@get_post_delete_url}#{group_id}\")\n user_group = RestClient.delete \"#{@base_url}#{@get_post_delete_url}#{group_id}\", header\n end",
"def delete_from_group\n @user = User.find(params[:user_id], :select => \"id\")\n @group.delete_from_group(@user)\n\n respond_to do |format|\n format.js\n end\n end",
"def remove_user_with_custom_field()\r\n remove_user_without_custom_field\r\n GroupsUserIndexed.find_by_group_id_and_user_id(@group.id, params[:user_id]).try!(&:destroy)\r\n end",
"def delete_user(id)\n get_user_byid(id).destroy\n end",
"def delete_group(id)\n delete(\"groups/#{id}\")\n end",
"def remove_user\n group = Group.find(params[:group_id])\n user = User.find(params[:user_id])\n if (GroupsController.group_owner? current_user.id, group.id) && (user != current_user)\n group.users.delete user\n respond_to do |format|\n format.html { redirect_to group_path(group), alert: 'Removed user successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to group_path(group), alert: \"Not removed. You are not the owner of the group or you are attempting to remove the owner from the group\"}\n format.json { render json: \"Only owners can remove users from the group and owners themselves cannot be removed from the group\", status: :unauthorized}\n end\n end\n end",
"def call(group_id, user_id)\n client.delete(\"/api/rest/v1/groups/#{group_id}/memberships/#{user_id}.json\")\n true\n end",
"def destroy\n @groupc_user = GroupcUser.find(params[:id])\n @groupc_user.destroy\n\n respond_to do |format|\n format.html { redirect_to groupc_users_url }\n format.json { head :ok }\n end\n end",
"def remove_group_member(team_id, user_id)\n delete(\"/groups/#{team_id}/members/#{user_id}\")\n end",
"def delete_user(id)\n @user = User.destroy(id)\n end",
"def remove(name)\n syscmd(\"userdel -f #{name}\")\n syscmd(\"groupdel #{name}\", valid_rcs: [6])\n exclusively { users.delete(name) }\n end",
"def delete(user_id)\n self.class.delete(\"/#{@api_ver}/users/#{user_id}\", default_options_to_merge_with)\n end",
"def destroy\n @user.destroy\n redirect_to company_group_users_path, notice: '正常に削除しました'\n end",
"def destroy\n @group = Group.find(params[:id])\n u1 = User.where(:login=>@group.name).select(:id)\n @u2 = User.find(u1)\n @u2.destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def remove_from_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:remove_user)\n # just be lazy and hand off to the group to do the work...\n group.remove_user(self)\n end",
"def delete_user\n client.delete(user)\n end",
"def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end",
"def delete_user(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n path = \"#{users_path}/#{user_id}\"\n delete(path)\n end",
"def remove\n @group_user.remove!\n respond_to do |format|\n flash[:notice] = 'Membership was cancelled.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group = GROUP.first_or_get(params[:id])\n @group.current_user = current_user\n @group.destroy if @group\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully deleted.'\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def remove_group_member(group_id, user_id)\n delete(\"/v1/groups/#{group_id}/members/#{user_id}\")\n end",
"def destroy\n @group_user.destroy\n respond_to do |format|\n format.html { redirect_to group_users_url, notice: 'group_user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html do\n if request.env['HTTP_REFERER']\n redirect_to :back\n else\n redirect_to :controller => :user_groups, :action => :index\n end\n end\n format.xml do\n head :ok\n end\n end\n end",
"def delete_user(user)\n delete user_path(user)\n end",
"def delete_user(user_id)\n Result.new(call(CMD_DEL_USER % user_id))\n end",
"def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend",
"def delete_user(id)\n # accept an id input parameter\n # use the User Model class to remove the User associated with the `id` primary key from the database\n # (no return is required)\n (User.find_by(id: id)).destroy\n end",
"def remove_member(user)\n if (self.members.include?(user))\n self.memberships.find_by_user_id(user.id).destroy\n else\n raise GroupsManagement::UserIsNotMember, \"The user \" + user.email + \" is not a member of the group '\" + self.name + \"'.\"\n end\n \n end",
"def remove_user(user)\n self.users.destroy(id: user.id)\n end",
"def remove_user(user)\n self.users.destroy(id: user.id)\n end",
"def remove_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.delete(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/#{user_id}/$ref\", { \n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end",
"def remove_user_by_id(user_id)\n # ........\n end",
"def delete_group(group)\n\t\t\tend",
"def delete_group(group)\n\t\t\tend",
"def destroy\n @usergroup.destroy\n respond_to do |format|\n format.html { redirect_to usergroups_url, notice: 'User group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_user(user)\n self.users.destroy(user)\n end",
"def destroy(user)\n unless user.id\n self.class.invalid_object!(\"Cannot save user #{user.username} without a valid id\")\n end\n\n unless execute_sql(:validate, :user) { table.select(:id).filter(:id => user.id).any? }\n raise RecordNotFound, \"Can't delete user #{user.username} because it doesn't exist\"\n end\n\n execute_sql(:delete, :user) { table.filter(:id => user.id).delete }\n end",
"def remove_group(id)\n delete(\"/groups/#{id}\")\n end",
"def delete_user\n end",
"def destroy\n @usergroup.destroy\n respond_to do |format|\n format.html { redirect_to usergroups_url, notice: 'Usergroup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end",
"def delete_group(group)\n\t\t\t\tgroupname = nil\n\t\t\t\tif(group.respond_to(:groupname))\n\t\t\t\t\tgroupname = group.groupname\n\t\t\t\telse\n\t\t\t\t\tgroupname = group\n\t\t\t\tend\n\n\t\t\t\t`pw groupdel #{groupname}`\n\t\t\tend",
"def remove_user_group(email_address, group_id)\n # note the user is stored in the group via uid only\n user_dn = email_address\n group_dn = get_group_DN(group_id)\n\n filter = Net::LDAP::Filter.eq( \"cn\", group_id)\n Net::LDAP.open(@ldap_conf) do |ldap|\n group_found = ldap.search(:base => @group_base, :filter => filter).to_a()[0]\n\n if group_found\n removed = group_found[GROUP_MEMBER_ATTRIBUTE].delete(user_dn)\n if removed\n if group_found[GROUP_MEMBER_ATTRIBUTE].empty?\n if !ldap.delete(:dn => group_dn)\n raise ldap_ex(ldap, \"Could not remove user #{user_dn} for group #{group_id}\")\n end\n else\n if !ldap.replace_attribute(group_dn, GROUP_MEMBER_ATTRIBUTE, group_found[GROUP_MEMBER_ATTRIBUTE])\n raise ldap_ex(ldap, \"Could not remove user #{user_dn} for group #{group_id}\")\n end\n end\n end\n end\n end\n end",
"def leave_group(group_id)\n\t\tGroupUser.destroy(user_id: user_id, group_id: group_id) unless Group.find(group_id).created_by == id\n\tend",
"def destroy\n @member = Member.where(user_id: params[:user_id], group_id: params[:group_id]).take\n @member.destroy\n redirect_to root_path, notice: 'Вы удалились из группы'\n end",
"def delete_users_account_groups( user_uid, group_dns )\n return unless group_dns\n engines_api_system.delete_users_account_groups( user_uid, group_dns )\n end",
"def remove_from_group(group)\n self.memberships.find_by(group_id: group.id).destroy!\n end",
"def delete_group\n @group = Group.find(params[:id])\n @created_g_u= Array.new\n @defalut_group = @login_user.default_group[0]\n @group.group_users.each do |g_u|\n g_u.destroy\n group = @login_user.belongs_to_group(g_u.user_id)\n if group.blank?\n group_user = GroupUser.new(:user_id=>g_u.user_id,:group_id=>@defalut_group.id) if group.blank?\n @created_g_u << group_user if group_user.save\n end \n end\n @group.destroy\n #redirect_to :back\n respond_to do |format|\n format.js\n end\n end",
"def deleteUser(id) \n user_to_remove = getUserByID(id)\n\n if user_to_remove != nil \n @Users.delete(user_to_remove)\n else\n puts \"No such user.\"\n end \n end",
"def delete_user(id)\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"DELETE FROM posts WHERE user_id = ?\", id)\n \n db.execute(\"DELETE FROM users WHERE id = ?\", id)\n\n end",
"def delete_group(group_id)\n current_path = \"/api/v1/groups/#{group_id}\"\n @conn.delete(current_path)\n end",
"def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end",
"def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end",
"def delete_by_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").delete\n end",
"def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end",
"def delete_user(userid) \n $db.execute('DELETE FROM users WHERE userid=?', userid)\n end",
"def remove_group(group)\n self.groups.destroy group \n end",
"def delete\n @groups = CwaGroups.new\n\n if params[:user_name]\n if @groups.delete_from_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_remove_member(User.find_by_login(params[:user_name]), params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been removed from \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem removing \\\"#{params[:user_name]}\\\" from \\\"#{params[:group_name]}\\\"\"\n end\n else\n if @groups.delete_me_from_group params[:group_name]\n flash[:notice] = \"You have been removed from group \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem removing you from group \\\"#{params[:group_name]}\\\"\"\n end\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end",
"def destroy\n @personal_group = current_user.personal_groups.find(params[:id])\n @personal_group.destroy\n redirect_to(personal_groups_url)\n end",
"def delete_user(username)\n groups = Avalon::RoleControls.user_roles username\n User.where(Devise.authentication_keys.first => username).destroy_all\n groups.each do |group|\n Avalon::RoleControls.remove_user_role(username, group)\n end\n end",
"def destroy\n Group.delete_groups_and_acls([id])\n end",
"def delete_user(user_id:, params:)\n connection.delete(\"users/#{user_id}\", params).body\n end",
"def delete_old_user(user_id = nil)\n unless user_id.nil?\n user = User.find(user_id)\n user.delete\n end\n end",
"def destroy\n @group_user = @parent.find(params[:id])\n @user = @group_user.user\n if !current_user or (!current_user.is_admin and !@group.users.include?(current_user))\n redirect_to @group, :notice => \"You cannot remove users from that group.\"\n return\n end\n if @group_user.is_owner\n redirect_to @group, :notice => \"You cannot remove an owner from a group.\"\n return\n end\n if (!current_user.is_admin and !@group.owners.include?(current_user)) and @user != current_user\n redirect_to @group, :notice => \"You cannot remove that user from this group.\"\n return\n end\n \n @group_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @user_id = @group.user_id\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url(:user_id=>@user_id) }\n # format.html { redirect_to groups_sidebartab_url(:user_id=>@user_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n users = @group.users \n users.each do |user|\n if user.groups.length == 1\n events = Event.where(:organizer => user.id)\n events.each do |event|\n event.destroy\n end\n user.destroy\n end\n end \n \n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully deleted' }\n format.json { head :no_content }\n end\n end",
"def execute(user, options = {})\n delete_solo_owned_groups = options.fetch(:delete_solo_owned_groups, options[:hard_delete])\n\n unless Ability.allowed?(current_user, :destroy_user, user)\n raise Gitlab::Access::AccessDeniedError, \"#{current_user} tried to destroy user #{user}!\"\n end\n\n if !delete_solo_owned_groups && user.solo_owned_groups.present?\n user.errors[:base] << 'You must transfer ownership or delete groups before you can remove user'\n return user\n end\n\n # Calling all before/after_destroy hooks for the user because\n # there is no dependent: destroy in the relationship. And the removal\n # is done by a foreign_key. Otherwise they won't be called\n user.members.find_each { |member| member.run_callbacks(:destroy) }\n\n user.solo_owned_groups.each do |group|\n Groups::DestroyService.new(group, current_user).execute\n end\n\n namespace = user.namespace\n namespace.prepare_for_destroy\n\n user.personal_projects.each do |project|\n success = ::Projects::DestroyService.new(project, current_user).execute\n raise DestroyError, \"Project #{project.id} can't be deleted\" unless success\n end\n\n yield(user) if block_given?\n\n MigrateToGhostUserService.new(user).execute unless options[:hard_delete]\n\n # Destroy the namespace after destroying the user since certain methods may depend on the namespace existing\n user_data = user.destroy\n namespace.destroy\n\n user_data\n end",
"def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end",
"def remove_user_from_group(user_id, group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users/#{user_id}\"\n puts \"@url is #{@url}\"\n\n @deleteResponse = HTTParty.delete(@url, :headers => $header)\n puts(\" DELETE to remove user from group has Response.code #{@deleteResponse.code} and getResponse is #{@deleteResponse}\")\nend",
"def destroy\n @current_user.quit_group(@group)\n respond_to do |format|\n format.html { redirect_to groups_path }\n format.json { head :no_content }\n end\n end",
"def destroy_team_user_group(team_id, group_id)\n params = { query: [team_id, group_id] }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_delete\n\n RubyLokaliseApi::Generics::DeletedResource.new data.content\n end",
"def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end",
"def delete_author_group(project_id, author_group_id)\n delete \"projects/#{project_id}/group/author/#{author_group_id}\"\n end",
"def remove_user_from_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RemoveUserFromGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\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? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n if params[:commit] == \"Remove users\"\n @usergroup.users.each do |user|\n @usergroup.users.delete(user) if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n elsif params[:commit] == \"Add users\"\n User.all.each do |user|\n @usergroup.users << user if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n else\n @usergroup.update(usergroup_params)\n end\n redirect_to users_path\n end"
] |
[
"0.81837416",
"0.81311756",
"0.80089074",
"0.8001407",
"0.7976349",
"0.7850211",
"0.77733505",
"0.76814353",
"0.7675185",
"0.76748925",
"0.7647359",
"0.756417",
"0.74978167",
"0.7465452",
"0.7449766",
"0.7444721",
"0.74442255",
"0.7436912",
"0.74138004",
"0.7408918",
"0.7400567",
"0.73925143",
"0.73863494",
"0.73660004",
"0.73578596",
"0.7351721",
"0.7320201",
"0.7309353",
"0.7306497",
"0.72700477",
"0.72643584",
"0.7263076",
"0.72431594",
"0.7229808",
"0.71876454",
"0.7167807",
"0.7160164",
"0.71383446",
"0.71160287",
"0.7103277",
"0.7101623",
"0.7082839",
"0.70801616",
"0.70774186",
"0.7058581",
"0.7056986",
"0.70370215",
"0.7028019",
"0.702537",
"0.70226794",
"0.7018341",
"0.7002914",
"0.70021224",
"0.7001996",
"0.7001996",
"0.69999075",
"0.69852734",
"0.6984227",
"0.6984227",
"0.698099",
"0.6978922",
"0.6972334",
"0.69720227",
"0.69590586",
"0.69365066",
"0.69360757",
"0.69360626",
"0.6928368",
"0.69244003",
"0.6916817",
"0.69156575",
"0.6913219",
"0.68937534",
"0.6892019",
"0.68794477",
"0.6877373",
"0.6874414",
"0.68729943",
"0.6867501",
"0.68606263",
"0.685453",
"0.6841109",
"0.68310785",
"0.68221",
"0.68132645",
"0.6805654",
"0.6804636",
"0.6789929",
"0.6788421",
"0.6765214",
"0.67614675",
"0.6751273",
"0.67171794",
"0.67105377",
"0.6704178",
"0.6703405",
"0.67019063",
"0.66992164",
"0.6698746",
"0.6697611"
] |
0.83215886
|
0
|
retur user with max rate
|
def best_user
@group_users.max_by(&:rate)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def worst_user\n @group_users.min_by(&:get_rate)\n end",
"def rate(user_rate = nil)\n @user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i))\n end",
"def rate_limit\n return nil unless @client\n\n t = Time.now\n limit = API.cache[\"rate_limits/users/#{@client.key}\"]\n if limit.nil? or limit[0] <= t.to_i\n # Reset limit\n limit = [t.to_i + INTERVAL, REMAINING]\n end\n\n # Update limit\n limit[1] = limit[1] - 1\n\n if limit[1] <= 0\n # Limit exceeded\n raise API::RateLimitError, \"rate limit exceeded (#{REMAINING}/#{INTERVAL} seconds)\"\n end\n\n # Store limit\n API.cache.store(\"rate_limits/users/#{@client.key}\", limit, :ttl => limit[0] - t.to_i)\n \n # Set rate limit headers\n response['X-RateLimit-Limit'] = REMAINING.to_s\n response['X-RateLimit-Remaining'] = limit[1].to_s\n response['X-RateLimit-Reset'] = Time.at(limit[0]).xmlschema\n\n true\n end",
"def most_active_user\n \n end",
"def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end",
"def highest_bill\n \t@user = Review.order(totalbill: :desc).first(5)\n end",
"def twitter_api_rate_limit\n # +++ move to app config\n @@_admin_account_access_rate_limit ||= 50 # times per hour\n end",
"def biggest_plan\n is_user = @current_user.respond_to? :subscriptions \n subs = is_user ? (@current_user.subscriptions.map{ |x| x.price if x.subscription_status_id == 11 }.compact.max) : ({ m: 'Temp user' })\n render json: subs\n end",
"def max_rate_value\n options[:stars]\n end",
"def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end",
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end",
"def applicable_pay_rate\n current_user_pay_rate = user.pay_rate || 0\n\n if user_id_was.present? && user_id != user_id_was\n current_user_pay_rate\n else\n pay_rate || current_user_pay_rate\n end\n end",
"def max_rating\n 10\n end",
"def handle_rate_limit(&block)\n begin\n block.call\n rescue Twitter::Error::TooManyRequests => error\n wait_time = error.rate_limit.reset_in + 10\n if @verbose\n minutes = wait_time / 60\n puts\n puts \"RATE LIMIT HIT: Wait #{minutes} minutes.\"\n end\n countdown(wait_time)\n retry\n end\n end",
"def max_money(aid_amount, with_amount, rebel_rate, rebel_limit)\n max_with_amount = 0 \n while rebel_rate < rebel_limit && aid_amount > 0 \n aid_amount -= with_amount\n rebel_rate = rebel_rate * 2 \n max_with_amount += with_amount\n end\n max_with_amount\nend",
"def get_limit(user)\r\n fail \"missing user\" if user.nil?\r\n\r\n @member_limits.fetch(user.email).limit\r\n end",
"def reduce_credits(user)\n user.credits -= Integer(user.credits * CREDIT_REDUCE_RATE)\n end",
"def post_action_rate_limiter\n return unless is_flag? || is_bookmark? || is_like?\n\n return @rate_limiter if @rate_limiter.present?\n\n %w(like flag bookmark).each do |type|\n if public_send(\"is_#{type}?\")\n limit = SiteSetting.get(\"max_#{type}s_per_day\")\n\n if is_like? && user && user.trust_level >= 2\n multiplier = SiteSetting.get(\"tl#{user.trust_level}_additional_likes_per_day_multiplier\").to_f\n multiplier = 1.0 if multiplier < 1.0\n\n limit = (limit * multiplier).to_i\n end\n\n @rate_limiter = RateLimiter.new(user, \"create_#{type}\", limit, 1.day.to_i)\n return @rate_limiter\n end\n end\n end",
"def rate; end",
"def rate; end",
"def limit(val)\n @params[:retmax] = val\n self\n end",
"def nonpremium_max\n return nil if submitter.premium\n created_urls = submitter.submitted_urls\n raise \"Non-premium accounts are limited to 5 Shortened URLs per user\" if created_urls.count >= 5\n end",
"def store_credit_maximum_usable_amount\n if user.store_credits_total > 0\n user.store_credits_total > store_credit_maximum_amount ? store_credit_maximum_amount : user.store_credits_total\n else\n 0\n end\n end",
"def store_credit_maximum_usable_amount\n if user.store_credits_total > 0\n user.store_credits_total > store_credit_maximum_amount ? store_credit_maximum_amount : user.store_credits_total\n else\n 0\n end\n end",
"def rate_class\n super\n end",
"def rate_class\n super\n end",
"def unrate( user_to_be_unrated )\n id_user_who_did_the_rating = self.id\n id_user_who_was_rated = user_to_be_unrated.id\n current_rating = Rate.find_by( rater_id: id_user_who_did_the_rating, rateable_id: id_user_who_was_rated )\n\n if current_rating\n current_rating.destroy\n end\n end",
"def compute_user_rate(user)\n user_rate = Hash.new(0)\n user_movies = @data.select { |item| item[0].to_i == user }.each { |item| user_rate[item[1].to_i] = item[2].to_i }\n user_rate\n end",
"def set_winner_for_total_xp(user_or_team)\n return if Date.today < end_date \n units = competable_registrations.collect{|comp_s| comp_s.send(user_or_team)}\n winner = units.max { |a, b| a.total_xp_for_competition(self) <=> b.total_xp_for_competition(self) } \n set_winner(winner)\n end",
"def maximum\n\t\tif 2 < course.users.length and 0 < worth\n\t\t\tmaximum = 0\n\t\t\t\n\t\t\tcourse.users.each do |user|\n\t\t\t\tgrade = self.user_grade(user)\n\t\t\t\t\n\t\t\t\tif grade and maximum < grade\n\t\t\t\t\tmaximum = grade\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn maximum\n\t\tend\n\tend",
"def rate_site\n self.accessed_attempts += 1\n self.save\n end",
"def api_regen_multiplier(level)\n if level >= User::Levels::GOLD\n 4\n else\n 1\n end\n end",
"def allocate_rewards(score)\n \n # Power allocated for this round\n total_users = User.all.count\n total_feeds = Feed.all.count\n power = (total_users * 5).to_f / (total_feeds * 1000).to_f\n\n # Index values with related ids\n indexes = []\n total = 0.0\n val = 1\n \n # Sort each rating by update date\n ratings.order! 'updated_at ASC'\n ratings.each do |rating|\n user = User.find(rating.user_id)\n difference = rating.score - score \n consistency = 0.99 * user.consistency + 0.01 * difference \n index = Math.exp(-(val**1.5/total_users)) / \n (difference**2 + (consistency - difference)**2 + 1.0)\n indexes.append([user.id, index])\n total = total + index\n val = val + 1\n user.consistency = consistency\n user.save!\n end\n\n # Add respective new voting power\n indexes.each do |element|\n user = User.find(element[0])\n user.voting_power = user.voting_power + (element[1] / total) * power\n user.save!\n end\n\n # Normalize the voting power\n max = 0.0\n User.all.each do |user|\n max = max + user.voting_power\n end \n \n norm_factor = (5 * total_users) / max\n User.all.each do |user|\n user.voting_power = user.voting_power * norm_factor\n user.save!\n end\n \n end",
"def store_credit_maximum_amount\n item_total\n end",
"def store_credit_maximum_amount\n item_total - 0.01\n end",
"def rate_limit\n response = self.class.get('/rate_limit', options)\n\n return_value_for response\n end",
"def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end",
"def final_rate_adjustment rate\n (rate/100.0).ceil - 0.01\n end",
"def autosizedMaximumOutdoorAirFlowRate\n\n return self.model.getAutosizedValue(self, 'Maximum Outdoor Air Flow Rate', 'm3/s')\n \n end",
"def max_tp\r\n return 100\r\n end",
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def ensure_user_plan_limit_not_reached\n if @current_user.is_employee? || @person.is_employee?\n return\n end\n\n userplanservice = UserPlanService::Api.new\n @current_user_max_trusted_users = userplanservice.get_plan_feature_level(@current_user, :company_trusted_users)[:value]\n @other_company_max_trusted_users = userplanservice.get_plan_feature_level(@person, :company_trusted_users)[:value]\n current_user_followed_count = @current_user.followed_people.count\n other_company_followers_count = @person.followers.count\n\n # current user has reached followed limit\n if current_user_followed_count >= @current_user_max_trusted_users\n #@max_followed_reached = true\n flash[:error] = t('people.show.followed_limit_reached2', :link => get_wp_url('pricing')).html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n return\n end\n\n # other company has reached followers limit\n if other_company_followers_count >= @other_company_max_trusted_users\n #@max_follower_reached = true\n flash[:error] = t('people.show.followers_limit_reached').html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n end\n return\n end",
"def get_user_rate(currency, current_user)\n user_currency = User.get_currency(current_user)\n\n return 1 if user_currency.iso_code == currency\n\n return CurrencyRate.get_rate(currency, user_currency.iso_code)\n end",
"def grant_reward(user)\n score = user.score # get user score\n # for each category, get the value, if not nil, calculate new value for category\n attributes_to_update = {}\n [:stamina, :strength, :mind, :vitality, :agility].each do |reward_category|\n reward_value = send(\"#{reward_category}_reward\")\n if reward_value.present?\n # new_value = (score.send(reward_category).to_f * (1.0 + (reward_value.to_f / 100.0))).ceil\n new_value = score.send(reward_category).to_i + reward_value.to_i\n new_value = 100 if new_value > 100 # 100% max\n attributes_to_update[reward_category] = new_value\n end\n end\n score.update_attributes!(attributes_to_update)\n end",
"def user_reaccept_required_frequency\n return @user_reaccept_required_frequency\n end",
"def below_user_limit?(user, additional_items)\n if purchase_limit == 0\n true\n else\n current_count = current_count(user, additional_items)\n current_count < purchase_limit\n end\n end",
"def rating(u,m)\n rec=@users[u].rassoc(m)\n if rec==nil\n return 0\n end\n return rec[2]\n end",
"def beta_limit_reached?\n if User.count >= BETA_LIMIT\n errors[:base] << \"We do not accept more users at this time.\"\n end\n end",
"def rate\n return @rate\n end",
"def analyze_most_popular_users(user)\n\n # calculate score\n most_popular = 1\n most_popular *= (val = user.num_radlib_views_received) > 0 ? val : 1\n most_popular *= (val = user.num_likes_received) > 0 ? val : 1\n most_popular *= (val = user.num_radlibs_filled_by_others) > 0 ? val : 1\n\n # scale it down to avoid too big a number, using 10000.1 (with decimal ensures that we extend the value's significant digits)\n most_popular /= 100.1\n\n # analyze result\n analyze_most_generic(user.uid, most_popular.to_f, DOCS[:most_popular_users])\n self\n end",
"def maximum\n\t\tif course.users.length > 2 and worth > 0\n\t\t\treturn (grades.maximum(:grade).to_f / worth) * 100\n\t\tend\n\tend",
"def rate_scale; end",
"def quota\n @quota = 50 + @exp/2\n \n end",
"def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend",
"def rate_limit\n options[:rate_limit]\n end",
"def rate=(value)\n @rate = value\n end",
"def current_rating(user)\n rating = ratings.find_by(user_id: user.id)\n rating ? rating.value : 0\n end",
"def rateable\n self\n end",
"def showMostSearched\n @user = User.order('counter DESC').limit(params[:limit])\n render json: @user\n end",
"def max_reward_price\n @max_reward_price_cache ||= if self.offers_reward?\n result = Money.new(0, self.default_currency)\n self.rewards.visible.each {|reward| result = Money.max(result, reward.price)} # # .convert_to(self.default_currency)\n result\n end\n end",
"def rate_limit\n connection.rate_limit\n end",
"def rate(new_rating, save_object = true)\n new_rating = new_rating.to_i\n if new_rating >= Rateable.min and new_rating <= Rateable.max\n unless @rate_count\n @rating = new_rating\n @rate_count = 1\n else\n sum = @rating * @rate_count\n @rate_count += 1\n @rating = (sum + new_rating) / @rate_count\n end\n self.update(:only => [:rating, :rate_count]) if save_object\n end\n end",
"def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend",
"def withdrawal_rate\n (youngest_person_retirement_age - 15.0) / 1000.0\n end",
"def update\n #only admin or same user can update user object\n if current_user.is_admin.blank? and current_user.uuid != @user.uuid\n raise CanCan::AccessDenied\n end\n @user.temp_buy_more = params[:user][:buy_more_price]\n respond_to do |format|\n if @user.update(user_params)\n\n #check if settings update or upgrading for new subscriptions\n if params[:user][:settings_update].blank?\n\n logger.debug \"=========AMOUNT=======>\" + (@user.temp_buy_more.to_f * 100).to_s\n response = EXPRESS_GATEWAY.setup_purchase(params[:user][:buy_more_price].to_f * 100,\n :ip => request.remote_ip,\n :return_url => buy_more_orders_url,\n :cancel_return_url => buy_more_failed_orders_url,\n :currency => \"USD\",\n :description => \"Sms affirmation service - $#{\"%.2f\" % @user.temp_buy_more.to_f }\",\n #:return_url => buy_more_orders_url,\n #:cancel_return_url => buy_more_failed_orders_url\n )\n\n @user.update(:payment_token => response.token)\n redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token) and return\n\n else\n format.html { redirect_to edit_user_path(:id => @user.uuid), notice: 'Settings successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: 'buy_more' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rate(value, ip_address, user_id)\n if can_rate? ip_address\n UserStore.create(:user_id => user_id, :store_id => self.store_id, :role => 'author') if self.store.user_stores.where(:user_id => user_id).blank?\n r = ratings.find_or_initialize_by_user_id(user_id)\n r.value = value\n r.ip_address = ip_address\n r.save!\n else\n errors.add :base, I18n.t(\"already_rated\")\n false\n end\n end",
"def rates; end",
"def rates; end",
"def reputation_threshold_action\n :offer_reward\n end",
"def effective_rate; end",
"def update_user_balance\n user.decrement(:loyalty_points_balance, loyalty_points)\n user.save!\n end",
"def update\n #only for updating the rating field; nothing else can change\n prev_rating = @book.rating\n @book.rating = params[:book][:rating]\n\n if @book.save\n # update user's fav genres score\n case @book.genre\n when \"fantasy\"\n #undo prev rating, if there was one\n unless prev_rating.nil?\n current_user.fantasy -= (prev_rating - 3)\n end\n #add score for new rating. \n #The (rating - 3) allows bad ratings to negatively affect fav genre score\n current_user.fantasy = [0, current_user.fantasy + (@book.rating - 3)].max\n when \"science_fiction\"\n unless prev_rating.nil?\n current_user.scifi -= (prev_rating - 3)\n end\n\n current_user.scifi = [0, current_user.scifi + (@book.rating - 3)].max\n when \"mystery\"\n unless prev_rating.nil?\n current_user.mystery -= (prev_rating - 3)\n end\n\n current_user.mystery = [0, current_user.mystery + (@book.rating - 3)].max\n when \"romance\"\n unless prev_rating.nil?\n current_user.romance -= (prev_rating - 3)\n end\n\n current_user.romance = [0, current_user.romance + (@book.rating - 3)].max\n when \"nonfiction\"\n unless prev_rating.nil?\n current_user.nonfiction -= (prev_rating - 3)\n end\n\n current_user.nonfiction = [0, current_user.nonfiction + (@book.rating - 3)].max\n when \"history\"\n unless prev_rating.nil?\n current_user.history -= (prev_rating - 3)\n end\n\n current_user.history = [0, current_user.history + (@book.rating - 3)].max\n when \"drama\"\n unless prev_rating.nil?\n current_user.drama -= (prev_rating - 3)\n end\n\n current_user.drama = [0, current_user.drama + (@book.rating - 3)].max\n when \"thriller\"\n unless prev_rating.nil?\n current_user.thriller -= (prev_rating - 3)\n end\n\n current_user.thriller = [0, current_user.thriller + (@book.rating - 3)].max\n when \"adventure\"\n unless prev_rating.nil?\n current_user.adventure -= (prev_rating - 3)\n end\n\n current_user.adventure = [0, current_user.adventure + (@book.rating - 3)].max\n when \"poetry\"\n unless prev_rating.nil?\n current_user.poetry -= (prev_rating - 3)\n end\n\n current_user.poetry = [0, current_user.poetry + (@book.rating - 3)].max\n end\n current_user.save()\n\n flash[:notice] = \"Book rating sucessfully updated\"\n redirect_to '/profile'\n else\n flash[:alert] = @book.errors[:rating].first\n redirect_to edit_book_path(Book.find(params[:id]))\n end\n end",
"def reset_rate\n @rate = 500\n end",
"def highest_rated\n joins(:ratings).group('rateable_id').order('avg(ratings.value) desc').first\n end",
"def rating(u, m)\n @user_list[u].rating(m)\n end",
"def userScore\n settings.score = session[:user].getScore(settings.username)\n end",
"def rate=(_arg0); end",
"def rate=(_arg0); end",
"def get_last_user\n @last_user = User.last\n end",
"def max_time\n @max_time ||= 0.2\n end",
"def recalculate_balance\n if !last_login_at\n # never calculate balance for non app users\n logger.warn2 \"recalculate_balance method should not be called for non app user #{debug_info}\"\n return true\n end\n # find user(s)\n # find all closed deals for this user\n user_ids = [user_id]\n # find closed deals\n api_gifts = ApiGift.where('user_id_giver in (?) and user_id_receiver is not null or ' +\n 'user_id_receiver in (?) and user_id_giver is not null',\n user_ids, user_ids).includes(:gift)\n # remove closed deals without a price and remove delete marked deals\n api_gifts = api_gifts.find_all do |api_gift|\n (api_gift.user_id_giver and api_gift.gift.price and api_gift.gift.price != 0.00 and !api_gift.gift.deleted_at)\n end\n # remove closed deals with user(s) as giver AND receiver\n api_gifts = api_gifts.delete_if do |api_gift|\n (user_ids.index(api_gift.user_id_giver) and user_ids.index(api_gift.user_id_receiver))\n end\n # sort: 1 received_at, 2 id\n api_gifts = api_gifts.sort_by { |ag| [ag.gift.received_at, ag.gift.id] }\n # delete gift doublets\n old_gid = -1\n api_gifts = api_gifts.delete_if do |api_gift|\n if api_gift.gift.id == old_gid\n true\n else\n old_gid = api_gift.gift.id\n false\n end\n end # delete_if\n\n user_balance_hash = {BALANCE_KEY => 0.0} # BASE_CURRENCY\n user_negative_interest_hash = {BALANCE_KEY => 0.0} # BASE_CURRENCY (USD)\n missing_exchange_rates = false\n logger.debug2 \"user #{self.short_user_name}. #{api_gifts.size} gifts\"\n previous_date = nil\n date = nil\n exchange_rates_hash = {} # used as help variables for exchange rate gains/losses calculation in view\n api_gifts.each do |api_gift|\n # update user.balance hash and save balance in gift.balance for documentation\n # previous balance >= 0 - use FACTOR_POS_BALANCE_PER_DAY to calculate new price\n # previous balance < 0 - use FACTOR_NEG_BALANCE_PER_DAY to calculate new price\n # note a small problem as balance in BASE_CURRENCY is a sum of different currencies and sum changes when currency rates changes\n # balance in BASE_CURRENCY can change between >= 0 and < 0 in period between two deals\n # but only previous balance is used when selection negative interest rate\n balance_doc_hash = {}\n previous_date = api_gift.gift.received_at.to_date unless previous_date\n previous_balance_hash = user_balance_hash.clone\n balance_doc_hash[:previous_balance] = previous_balance_hash\n if previous_date != api_gift.gift.received_at.to_date\n # save old exchange rates for exchange rate difference calculation\n user_balance_hash.keys.each do |balance_hash_currency|\n next if balance_hash_currency == BALANCE_KEY\n exchange_rates_hash[balance_hash_currency] = ExchangeRate.exchange(1.0, BASE_CURRENCY, balance_hash_currency, previous_date)\n end\n end\n previous_exchange_rates_hash = exchange_rates_hash.clone\n balance_doc_hash[:previous_exchange_rates] = previous_exchange_rates_hash\n # logger.debug2 \"balance_doc_hash[:previous_balance] = #{balance_doc_hash[:previous_balance]}\"\n balance_doc_hash[:previous_date] = previous_date.to_yyyymmdd\n # balance_doc_hash[:number_of_days] = (g.received_at.to_date - previous_date).to_i\n\n # step 1 - calculate negative interest from previous gift to this gift\n # use FACTOR_POS_BALANCE_PER_DAY for positive balance - 0.9998594803001535 per day <=> 5 % per year\n # use FACTOR_NEG_BALANCE_PER_DAY for negative balance - 0.9997113827109777 per day <=> 10 % per year\n balance_sum = user_balance_hash[BALANCE_KEY] # current user balance in BASE_CURRENCY (USD)\n date = previous_date\n while (date < api_gift.gift.received_at.to_date) do\n date = 1.day.since(date)\n factor = (balance_sum >= 0 ? FACTOR_POS_BALANCE_PER_DAY : FACTOR_NEG_BALANCE_PER_DAY) # 5 OR 10 % in negative interest\n balance_sum = 0.0\n user_balance_hash.keys.each do |balance_hash_currency|\n next if balance_hash_currency == BALANCE_KEY\n user_balance_hash[balance_hash_currency] *= factor\n exchange_rate = ExchangeRate.exchange(1.0, balance_hash_currency, BASE_CURRENCY, date)\n balance_sum += user_balance_hash[balance_hash_currency] * exchange_rate\n exchange_rates_hash[balance_hash_currency] = 1.0 / exchange_rate if date == api_gift.gift.received_at.to_date\n end # each\n end # while\n user_balance_hash[BALANCE_KEY] = balance_sum\n # initialize negative interest hash\n logger.debug2 \"gift id #{api_gift.id}: initialize and save negative interest hash\"\n gift_negative_interest_hash = {}\n user_balance_hash.keys.each do |balance_hash_currency|\n next if balance_hash_currency == BALANCE_KEY\n gift_negative_interest = (previous_balance_hash[balance_hash_currency] - user_balance_hash[balance_hash_currency]).abs\n logger.debug2 \"gift id #{api_gift.id}, currency = #{balance_hash_currency}, old = #{previous_balance_hash[balance_hash_currency]}, new = #{user_balance_hash[balance_hash_currency]}, neg.int. = #{gift_negative_interest}\"\n gift_negative_interest_hash[balance_hash_currency] = gift_negative_interest\n user_negative_interest_hash[balance_hash_currency] = 0.0 unless user_negative_interest_hash.has_key?(balance_hash_currency)\n user_negative_interest_hash[balance_hash_currency] += gift_negative_interest\n end\n balance_sum = 0.0\n gift_negative_interest_hash.keys.each do |balance_hash_currency|\n balance_sum += ExchangeRate.exchange(gift_negative_interest_hash[balance_hash_currency], balance_hash_currency, BASE_CURRENCY, previous_date)\n end\n gift_negative_interest_hash[BALANCE_KEY] = balance_sum\n balance_doc_hash[:exchange_rates] = exchange_rates_hash\n balance_doc_hash[:negative_interest] = gift_negative_interest_hash\n previous_date = date\n\n # step 2: calculate previous_balance + negative_interest hash\n # used for exchange rate gains/losses calculation in view\n #previous_balance_neg_int_hash = {}\n #previous_balance_hash.keys.each do |balance_hash_currency|\n # next if balance_hash_currency == BALANCE_KEY\n # previous_balance_neg_int_hash[balance_hash_currency] = previous_balance_hash[balance_hash_currency] + gift_negative_interest_hash[balance_hash_currency]\n #end\n #balance_doc_hash[:previous_balance_and_negative_interest] = previous_balance_neg_int_hash\n\n # step 3 - new balance with this gift\n sign = user_ids.index(api_gift.user_id_giver) ? 1 : -1\n user_balance_hash[api_gift.gift.currency] = 0.0 unless user_balance_hash.has_key?(api_gift.gift.currency)\n user_balance_hash[api_gift.gift.currency] += api_gift.gift.price * sign\n user_balance_hash[BALANCE_KEY] += ExchangeRate.exchange((api_gift.gift.price*sign), api_gift.gift.currency, BASE_CURRENCY, date)\n balance_doc_hash[:sign] = sign > 0 ? '+' : '-'\n balance_doc_hash[:balance] = user_balance_hash\n\n # save balance and balance documentation\n api_gift.gift.set_balance(user_ids, user_balance_hash[BALANCE_KEY], balance_doc_hash)\n # g.save\n logger.debug2 \"recalculate_balance. gift.id = #{api_gift.gift.id}, gift.received_at = #{api_gift.gift.received_at}, balance_hash = #{user_balance_hash.to_s}, balance_doc_hash = #{balance_doc_hash}\"\n end # each\n return false if missing_exchange_rates # error - one or more missing currency rates\n today = Date.parse(Sequence.get_last_exchange_rate_date)\n if date\n # calculate negative interest from last gift and up to \"today\"\n # \"today\" as last date with known exchange rates from default money bank\n previous_balance_hash = user_balance_hash.clone\n while (date < today) do\n date = 1.day.since(date)\n factor = (user_balance_hash[BALANCE_KEY] >= 0 ? FACTOR_POS_BALANCE_PER_DAY : FACTOR_NEG_BALANCE_PER_DAY)\n balance_sum = 0.0\n user_balance_hash.keys.each do |balance_hash_currency|\n next if balance_hash_currency == BALANCE_KEY\n user_balance_hash[balance_hash_currency] *= factor\n balance_sum += ExchangeRate.exchange(user_balance_hash[balance_hash_currency], balance_hash_currency, BASE_CURRENCY, date)\n end # each\n user_balance_hash[BALANCE_KEY] = balance_sum\n end\n user_balance_hash.keys.each do |balance_hash_currency|\n user_negative_interest_hash[balance_hash_currency] = 0.0 unless user_negative_interest_hash.has_key?(balance_hash_currency)\n user_negative_interest_hash[balance_hash_currency] += (previous_balance_hash[balance_hash_currency] - user_balance_hash[balance_hash_currency])\n end\n end\n logger.debug2 \"user balance = #{user_balance_hash}\"\n logger.debug2 \"user negative_interest #{user_negative_interest_hash}\"\n # calculation ok - all needed exchange rates was found\n self.balance = user_balance_hash\n self.balance_at = today\n self.negative_interest = user_negative_interest_hash\n # todo: catch any exception and return false if transaction fails\n Gift.check_gift_and_api_gift_rel\n transaction do\n api_gifts.each do |api_gift|\n logger.debug2 \"api gift id = #{api_gift.id}\"\n api_gift.gift.save!\n end\n if user_ids.size > 1\n # user with shared accounts -\n User.where(:user_id => (user_ids - [self.user_id])).each do |other_user|\n other_user.balance = user_balance_hash\n other_user.balance_at = today\n other_user.negative_interest = user_negative_interest_hash\n other_user.save!\n end # each other_user\n end # if\n self.save!\n end\n true\n end",
"def set_rate_limited(time, new_time_value = true)\n\n self.user.update_attribute(:rate_limited_until, Time.at(time).utc ) if new_time_value\n\n self.update_attributes(rescheduled_at: Time.at(time).utc,\n status: \"DELAYED\",\n sent_at: Time.now.utc)\n end",
"def set_attempts_amount\n max_number <= 10 ? 2 : 10\nend",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end",
"def recalculate_rate!\n # If there's no good session timespan, we can fake one out\n self.sess_timespan.max ||= Time.now.utc\n self.sess_timespan.min ||= self.last_run\n # Whatever its origin, limit the session timespan\n if sess_timespan.size > RATE_PARAMETERS[:max_session_timespan]\n sess_timespan.min = sess_timespan.max - RATE_PARAMETERS[:max_session_timespan]\n end\n # Find and limit the session items rate\n if self.sess_items.to_f < 2\n self.sess_items = 2\n sess_items_rate = self.sess_items.to_f / RATE_PARAMETERS[:default_scrape_period]\n else\n # Find the items rate\n sess_items_rate = self.sess_items.to_f / sess_timespan.size.to_f\n end\n # Find and limit the previous items rate\n self.prev_items_rate = self.prev_items_rate.to_i rescue 0\n if self.prev_items_rate == 0\n self.prev_items_rate = target_items_per_job.to_f / RATE_PARAMETERS[:default_scrape_period]\n self.delay = RATE_PARAMETERS[:default_scrape_period].to_f\n end\n\n # New items rate is a weighted average of new and old\n #\n # If new rate is faster than the prev_rate, we use a high weight\n # (~1.0). When\n sess_wt = (sess_items_rate > prev_items_rate) ? RATE_PARAMETERS[:sess_weight_rising] : RATE_PARAMETERS[:sess_weight_slowing]\n new_items_rate = (prev_items_rate + (sess_items_rate * sess_wt)) / (1.0 + sess_wt)\n new_total_items = prev_items.to_i + sess_items.to_i\n since_start = (Time.now.utc - self.started_at).to_f\n new_period = (target_items_per_job / new_items_rate)\n new_delay = new_period - since_start\n\n # puts %Q{rates %6.3f %6.3f => %6.3f delay %5.2f %5.2f => %5.2f (%5.2f) want %d sess %d items/%5.1fs -- %10d < %10d -- %s } %\n # [sess_items_rate, prev_items_rate, new_items_rate,\n # target_items_per_job / sess_items_rate, self.delay, new_period, new_delay,\n # target_items_per_job, sess_items, sess_timespan.size.to_f,\n # sess_span.max, prev_max,\n # self.key]\n\n Log.info(\n %Q{resched\\tit %4d\\t%7.3f\\t%7.2f\\t%7.2f\\t%7.2f\\t%7.2f\\t%10d\\t%s } %\n [sess_items, sess_timespan.size.to_f, target_items_per_job / sess_items_rate, self.delay, new_period, new_delay, prev_max, self.key])\n\n self.delay = new_delay.to_f.clamp(RATE_PARAMETERS[:min_resched_delay], RATE_PARAMETERS[:max_resched_delay])\n self.prev_items_rate = new_items_rate\n self.prev_items = new_total_items\n end",
"def predict(u,m)\n similar_users=most_similar(u)\n weighted_rate=0.0\n sum=0.0\n similar_users.each do |user|\n rate=rating(user[0],m)\n if rate!=0\n weighted_rate+=user[1]*rate\n sum+=user[1]\n end\n end\n if sum==0\n return 0\n end\n return weighted_rate/sum\n end",
"def past_rating(u, m)\n\t\t\trating = @user_set[u.to_s][m.to_s]\n\t\t\tif (rating.nil?)\n\t\t\t\t0\n\t\t\telse\n\t\t\t\trating.to_i\n\t\t\tend\n\t\tend",
"def assign_score_limit; end",
"def add_money\n\t\t# get current user's money\n \t@user = current_user\n\t\t@money = @user.money\n\t\t# get refill limit\n\t\t@allowed = @user.money_refill\n\n\t\t# if limit has not been reached, add money to account\n\t\tif @allowed > 0\n\t\t\t@user.money = @money + 1000\n\t\t\t@user.money_refill = @allowed - 1\n\t\t\t@user.save\n\t\t\tgflash :success => \"Money Successfully Transferred to your account!\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\telse\n\t\t\t# otherwise flash pop up regarding depleted money reserve\n\t\t\tgflash :error => \"You have depleted your money reserve.\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\tend\n end",
"def dismax_query\n \"{!edismax v=$user_query}\"\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 user_rating(user_id)\n if user_rated?(user_id)\n @user_ratings.select { |user_rating| user_rating.user_id == user_id }.first.rating\n else\n 0\n end\n end",
"def get_max()\n end",
"def cost_for(users)\n user_count = (action == :split) ? users.count + 1 : users.count\n cost_per_user = amount / user_count\n cost_per_user = \"%.2f\" % ((cost_per_user*2.0).round / 2.0).to_f # Round to nearest $0.50\n\n cost_per_user.to_f\n end",
"def update_user_credits\n user.credits += credits - used_credit.to_f\n user.save\n end",
"def autosizedMaximumFlowRate\n\n return self.model.getAutosizedValue(self, 'Design Size Maximum Flow Rate', 'm3/s')\n \n end"
] |
[
"0.69234794",
"0.65097123",
"0.6312583",
"0.6200378",
"0.6195007",
"0.61941636",
"0.59912187",
"0.58899343",
"0.58846974",
"0.5860604",
"0.5834517",
"0.5830606",
"0.58122903",
"0.5795221",
"0.57940906",
"0.5776754",
"0.5765384",
"0.57529",
"0.5733467",
"0.5733467",
"0.57149756",
"0.5682782",
"0.5679442",
"0.5679442",
"0.56728226",
"0.56728226",
"0.5661853",
"0.56515986",
"0.56349295",
"0.56298447",
"0.5627796",
"0.5619172",
"0.5614454",
"0.55906695",
"0.5587057",
"0.55859214",
"0.55852395",
"0.5575502",
"0.55746335",
"0.55617505",
"0.55344176",
"0.5526041",
"0.55181384",
"0.5510962",
"0.54899186",
"0.5484476",
"0.5483588",
"0.5480518",
"0.5475933",
"0.5468835",
"0.54662",
"0.5456323",
"0.54429823",
"0.5416176",
"0.5409735",
"0.5399797",
"0.5370201",
"0.5367294",
"0.5355724",
"0.53506064",
"0.53482455",
"0.5347858",
"0.5345327",
"0.53391975",
"0.53374803",
"0.53306156",
"0.53292835",
"0.53292835",
"0.5327493",
"0.5323546",
"0.5323546",
"0.5321178",
"0.5316302",
"0.53144526",
"0.5309992",
"0.5305198",
"0.529016",
"0.5287222",
"0.5284624",
"0.52807736",
"0.52807736",
"0.5276418",
"0.5273736",
"0.52667403",
"0.5263772",
"0.52541023",
"0.5251745",
"0.52440107",
"0.5241817",
"0.52323425",
"0.5228531",
"0.52277917",
"0.5226879",
"0.5218234",
"0.52101123",
"0.52087986",
"0.5208122",
"0.5202514",
"0.52021295",
"0.5189777"
] |
0.724183
|
0
|
retur user with min rate
|
def worst_user
@group_users.min_by(&:get_rate)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rate(user_rate = nil)\n @user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i))\n end",
"def best_user\n @group_users.max_by(&:rate)\n end",
"def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end",
"def rate; end",
"def rate; end",
"def unrate( user_to_be_unrated )\n id_user_who_did_the_rating = self.id\n id_user_who_was_rated = user_to_be_unrated.id\n current_rating = Rate.find_by( rater_id: id_user_who_did_the_rating, rateable_id: id_user_who_was_rated )\n\n if current_rating\n current_rating.destroy\n end\n end",
"def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend",
"def rate_limit\n return nil unless @client\n\n t = Time.now\n limit = API.cache[\"rate_limits/users/#{@client.key}\"]\n if limit.nil? or limit[0] <= t.to_i\n # Reset limit\n limit = [t.to_i + INTERVAL, REMAINING]\n end\n\n # Update limit\n limit[1] = limit[1] - 1\n\n if limit[1] <= 0\n # Limit exceeded\n raise API::RateLimitError, \"rate limit exceeded (#{REMAINING}/#{INTERVAL} seconds)\"\n end\n\n # Store limit\n API.cache.store(\"rate_limits/users/#{@client.key}\", limit, :ttl => limit[0] - t.to_i)\n \n # Set rate limit headers\n response['X-RateLimit-Limit'] = REMAINING.to_s\n response['X-RateLimit-Remaining'] = limit[1].to_s\n response['X-RateLimit-Reset'] = Time.at(limit[0]).xmlschema\n\n true\n end",
"def reduce_credits(user)\n user.credits -= Integer(user.credits * CREDIT_REDUCE_RATE)\n end",
"def rating(u,m)\n rec=@users[u].rassoc(m)\n if rec==nil\n return 0\n end\n return rec[2]\n end",
"def rate_class\n super\n end",
"def rate_class\n super\n end",
"def api_regen_multiplier(level)\n if level >= User::Levels::GOLD\n 4\n else\n 1\n end\n end",
"def rating(u, m)\n @user_list[u].rating(m)\n end",
"def chargeUser(msisdn,amount,userToken)\n \tcontent = open('https://devapi.globelabs.com.ph/payments/2307').read\n\tjson = JSON.parse(content)\n\tincrement = json['result'].first['reference_code'].to_i+1\n\turi = URI.parse(\"https://devapi.globelabs.com.ph/payment/v1/transactions/amount/\")\n uri.query = \"access_token=#{userToken}\"\n response = HTTParty.post(uri,\n\t:body => {:description => 'desc', :endUserId => msisdn, :amount => amount, :referenceCode => 91131000001,\n\t:transactionOperationStatus => 'charged'})\n output(response)\n response.code.eql?(201) ? (Transaction.successful(msisdn,amount) ; sendSms(msisdn,amount,userToken)) : (Transaction.failed(msisdn,amount))\n end",
"def update\n #only admin or same user can update user object\n if current_user.is_admin.blank? and current_user.uuid != @user.uuid\n raise CanCan::AccessDenied\n end\n @user.temp_buy_more = params[:user][:buy_more_price]\n respond_to do |format|\n if @user.update(user_params)\n\n #check if settings update or upgrading for new subscriptions\n if params[:user][:settings_update].blank?\n\n logger.debug \"=========AMOUNT=======>\" + (@user.temp_buy_more.to_f * 100).to_s\n response = EXPRESS_GATEWAY.setup_purchase(params[:user][:buy_more_price].to_f * 100,\n :ip => request.remote_ip,\n :return_url => buy_more_orders_url,\n :cancel_return_url => buy_more_failed_orders_url,\n :currency => \"USD\",\n :description => \"Sms affirmation service - $#{\"%.2f\" % @user.temp_buy_more.to_f }\",\n #:return_url => buy_more_orders_url,\n #:cancel_return_url => buy_more_failed_orders_url\n )\n\n @user.update(:payment_token => response.token)\n redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token) and return\n\n else\n format.html { redirect_to edit_user_path(:id => @user.uuid), notice: 'Settings successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: 'buy_more' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate\n return @rate\n end",
"def rate\n\t\t# retrieve user with specified ID and rate him/her \n @user = User.find(params[:id])\n @user.rate(params[:stars], current_user, params[:dimension])\n\n\t\t# automatically display the new rating\n render :update do |page|\n page.replace_html @user.wrapper_dom_id(params), ratings_for(@user, params.merge(:wrap => false))\n page.visual_effect :highlight, @user.wrapper_dom_id(params)\n end\n end",
"def rate\n @story = Story.find(params[:id])\n if @story.rate_for_user(params[:rate], current_user)\n respond_to do |format|\n format.html { redirect_to(story_url(@story), :notice => 'Story was rated.') }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(story_url(@story), :notice => 'You have already rated.') }\n format.xml { head :ok }\n end\n end\n end",
"def get_min_rate(options={})\n post 'rates', options.merge(rate_filter: 'min_rate')\n end",
"def rate_site\n self.accessed_attempts += 1\n self.save\n end",
"def increment_karma_if_needed\n if $user.karma_incr_time.to_i < (Time.now.to_i-KarmaIncrementInterval)\n userkey = \"user:#{$user.id}\"\n $r.hset(userkey,\"karma_incr_time\",Time.now.to_i)\n $user.change_karma_by KarmaIncrementAmount\n end\nend",
"def update_user_credits\n user.credits += credits - used_credit.to_f\n user.save\n end",
"def applicable_pay_rate\n current_user_pay_rate = user.pay_rate || 0\n\n if user_id_was.present? && user_id != user_id_was\n current_user_pay_rate\n else\n pay_rate || current_user_pay_rate\n end\n end",
"def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend",
"def grant_reward(user)\n score = user.score # get user score\n # for each category, get the value, if not nil, calculate new value for category\n attributes_to_update = {}\n [:stamina, :strength, :mind, :vitality, :agility].each do |reward_category|\n reward_value = send(\"#{reward_category}_reward\")\n if reward_value.present?\n # new_value = (score.send(reward_category).to_f * (1.0 + (reward_value.to_f / 100.0))).ceil\n new_value = score.send(reward_category).to_i + reward_value.to_i\n new_value = 100 if new_value > 100 # 100% max\n attributes_to_update[reward_category] = new_value\n end\n end\n score.update_attributes!(attributes_to_update)\n end",
"def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end",
"def get_user_rate(currency, current_user)\n user_currency = User.get_currency(current_user)\n\n return 1 if user_currency.iso_code == currency\n\n return CurrencyRate.get_rate(currency, user_currency.iso_code)\n end",
"def current_rating(user)\n rating = ratings.find_by(user_id: user.id)\n rating ? rating.value : 0\n end",
"def rate=(value)\n @rate = value\n end",
"def rate(rate)\n @rated_times += 1\n @average_rating = (@average_rating + rate) / @rated_times\n end",
"def rate\n if Rating.find(:first, :conditions =>{:user_id => current_user.id, :rateable_id => current_object.id, :rateable_type => current_object.class.to_s})\n #TODO TRANSLATE AND DISPLAY CORRECT MESSAGE IN blank.js\n message = \"Already Rated\"\n else\n current_object.add_rating(Rating.new(:rating => params[:rated].to_i,:user_id => current_user.id))\n current_object.update_attributes(:rates_average => Rating.average(:rating, :conditions =>{:rateable_id => current_object.id, :rateable_type => current_object.class.to_s}).to_i)\n message = \"Rated Successfully\"\n end\n\t\t\t\t# TODO : refresh the rate box ...\n render :text => message\n end",
"def userScore\n settings.score = session[:user].getScore(settings.username)\n end",
"def compute_user_rate(user)\n user_rate = Hash.new(0)\n user_movies = @data.select { |item| item[0].to_i == user }.each { |item| user_rate[item[1].to_i] = item[2].to_i }\n user_rate\n end",
"def rate(stars, user, dirichlet_method=false)\n\n if can_rate? user\n rates.create! do |r|\n r.stars = stars\n r.rater = user\n end\n if dirichlet_method\n update_rate_average_dirichlet(stars)\n else\n update_rate_average(stars)\n end\n else\n raise 'User has already rated.'\n end\n end",
"def reset_rate\n @rate = 500\n end",
"def tp_rate\r\n @tp.to_f / 100\r\n end",
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def quota\n @quota = 50 + @exp/2\n \n end",
"def user_rating(user_id)\n if user_rated?(user_id)\n @user_ratings.select { |user_rating| user_rating.user_id == user_id }.first.rating\n else\n 0\n end\n end",
"def rateable\n self\n end",
"def users_rating\n @rating = Rating.find(params[:id])\n redirect_to skate_spot_path(@skate_spot) unless @rating.user_id == current_user.id\n end",
"def rate=(_arg0); end",
"def rate=(_arg0); end",
"def rate(value, ip_address, user_id)\n if can_rate? ip_address\n UserStore.create(:user_id => user_id, :store_id => self.store_id, :role => 'author') if self.store.user_stores.where(:user_id => user_id).blank?\n r = ratings.find_or_initialize_by_user_id(user_id)\n r.value = value\n r.ip_address = ip_address\n r.save!\n else\n errors.add :base, I18n.t(\"already_rated\")\n false\n end\n end",
"def rate(original, target)\n if SimpleXurrency.cache_enabled?\n cached_result = SimpleXurrency.cache_get(\"#{original}_#{target}\")\n\n if !cached_result.nil?\n return cached_result \n end\n end\n\n api_url = \"http://xurrency.com/api/#{[original, target].join('/')}/1\"\n \n api_url << \"?key=#{SimpleXurrency.key}\" if !SimpleXurrency.key.nil?\n \n uri = URI.parse(api_url)\n\n retries = 10\n json_response = nil\n begin\n Timeout::timeout(1){\n json_response = uri.open.read || nil # Returns the raw response\n }\n rescue Timeout::Error\n retries -= 1\n retries > 0 ? sleep(0.42) && retry : raise\n end\n \n return nil unless json_response && parsed_response = Crack::JSON.parse(json_response)\n if parsed_response['status'] == 'fail'\n raise parsed_response['message']\n end\n\n value = Hash.new\n \n value[:rate] = parsed_response['result']['value'].to_f\n value[:updated_at] = parsed_response['result']['updated_at'].to_s\n \n SimpleXurrency.cache_add(\"#{original}_#{target}\", value) if SimpleXurrency.cache_enabled?\n \n value\n end",
"def UpdateRate=(arg0)",
"def UpdateRate=(arg0)",
"def skill_effect_rate(user, skill)\r\n # Calculate rate\r\n rate = 20\r\n rate += (user.str * skill.str_f / 100)\r\n rate += (user.dex * skill.dex_f / 100)\r\n rate += (user.agi * skill.agi_f / 100)\r\n rate += (user.int * skill.int_f / 100)\r\n # Return Rate\r\n return rate\r\n end",
"def set_rate_limited(time, new_time_value = true)\n\n self.user.update_attribute(:rate_limited_until, Time.at(time).utc ) if new_time_value\n\n self.update_attributes(rescheduled_at: Time.at(time).utc,\n status: \"DELAYED\",\n sent_at: Time.now.utc)\n end",
"def rate_student\n AcceptedTutorRequest.where('student_rating IS NULL')\n .where('id = ?', params[:id])\n .update(params[:id], student_rating: params[:student_rating])\n head :ok\n end",
"def calc_user_time(user_id)\n @time_spent_g = 0\n @time_spent_p = 0\n $all_user_data.each do |k,v| \n if v[:user] == user_id\n @time_spent_g += v[:time].to_i if v[:method]=='G'\n @time_spent_p += v[:time].to_i if v[:method]=='P' \n end\n end\n puts \"User [#{user_id}] spent #{@time_spent_g} ms using GET method\"\n puts \"User [#{user_id}] spent #{@time_spent_p} ms using POST method\"\n end",
"def rates; end",
"def rates; 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 rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def set_remittent\n @user = User.find(params[:id])\n end",
"def user_reaccept_required_frequency\n return @user_reaccept_required_frequency\n end",
"def set_user_question_rate\n @user_question_rate = UserQuestionRate.find(params[:id])\n end",
"def rate_post\n render nothing: true\n\n post = Post.find(params[:id])\n\n assert(@post.kind_of?(Post))\n\n if not post.user_ratings.include? current_user.id\n post.user_ratings.push(current_user.id)\n post.save\n else\n redirect_to_back(root_path)\n end\n end",
"def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end",
"def rating(u,m)\n\t\tresult=@db.get_rate(u,m,:base)\n\t\tif result\n\t\t\treturn result.to_i\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def rate\n @album = Album.find(params[:id])\n authorize! :rate, @album\n @album_rating = AlbumRating.new({\n :user_id => current_user.id,\n :album_id => params[:id],\n :rating => params[:rating]\n })\n\n if @album_rating.save\n flash[:notice] = 'Thanks for rating'\n else\n flash[:alert] = \"Could not save your rating. You may have rated this already!\"\n end\n\n redirect_to :back\n end",
"def rate(new_rating, save_object = true)\n new_rating = new_rating.to_i\n if new_rating >= Rateable.min and new_rating <= Rateable.max\n unless @rate_count\n @rating = new_rating\n @rate_count = 1\n else\n sum = @rating * @rate_count\n @rate_count += 1\n @rating = (sum + new_rating) / @rate_count\n end\n self.update(:only => [:rating, :rate_count]) if save_object\n end\n end",
"def final_rate_adjustment rate\n (rate/100.0).ceil - 0.01\n end",
"def create\n if(@check_user)\n @valoracio = Rating.find_by(customer_id: params[:customer_id], evento_id: params[:evento_id])\n if @valoracio\n # UPDATE RATING\n if @valoracio.update(rating_params.except(:token))\n @valoracionsTotals = []\n @sum = 0\n @valoracionsTotals = Rating.where(company_id: params[:company_id])\n @valoracionsTotals.each do |rt|\n @sum = @sum + rt.rating\n @valoracio = @sum / @valoracionsTotals.count\n end\n @cmp = User.find_by(:id => params[:company_id])\n @cmp.rating = @valoracio\n @cmp.save()\n render json: @valoracio.to_json\n else\n render json: @valoracio.errors, status: :unprocessable_entity\n end\n else\n # CREATE RATING\n @rating = Rating.create(rating_params.except(:token))\n @user = User.find_by(:login_token => params[:token])\n @rating.customer_id = @user.id\n auto = false\n if rating_params[:company_id]==@user_id\n auto=true\n end\n if auto\n @message=\"ERROR: El client i la companyia han de ser diferents\"\n render json: @message\n elsif @rating.save\n @valoracions = []\n @sum = 0\n @valoracions = Rating.where(company_id: params[:company_id])\n @valoracions.each do |rt|\n @sum = @sum + rt.rating\n @valoracio = @sum / @valoracions.count\n end\n @cmp = User.find_by(:id => params[:company_id])\n @cmp.rating = @valoracio\n @cmp.save()\n render json: @rating.to_json\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end\n else\n @msg=\"ERROR: Usuari no autoritzat\"\n render json: @msg, status: :unauthorized, location: @favourite\n end\n end",
"def min_rating\n 0\n end",
"def change_rate(rate) #TODO: separate rate changes to be dependant on dates/reservations/blocks\n @rate = rate\n end",
"def add_money\n\t\t# get current user's money\n \t@user = current_user\n\t\t@money = @user.money\n\t\t# get refill limit\n\t\t@allowed = @user.money_refill\n\n\t\t# if limit has not been reached, add money to account\n\t\tif @allowed > 0\n\t\t\t@user.money = @money + 1000\n\t\t\t@user.money_refill = @allowed - 1\n\t\t\t@user.save\n\t\t\tgflash :success => \"Money Successfully Transferred to your account!\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\telse\n\t\t\t# otherwise flash pop up regarding depleted money reserve\n\t\t\tgflash :error => \"You have depleted your money reserve.\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\tend\n end",
"def initialize\n @rate = 0.10\n end",
"def rate!(level)\n rating.increment!(level)\n end",
"def rate_scale; end",
"def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end",
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end",
"def rating(u, m)\n return @trainingSet.allUsersHash[\"#{u}\"][\"#{m}\"].to_i if @trainingSet.allUsersHash[\"#{u}\"][\"#{m}\"] != nil\n return 0\n end",
"def withdrawal_rate\n (youngest_person_retirement_age - 15.0) / 1000.0\n end",
"def effective_rate; end",
"def rate\n @rate * ONE_NANOS\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n end",
"def allocate_rewards(score)\n \n # Power allocated for this round\n total_users = User.all.count\n total_feeds = Feed.all.count\n power = (total_users * 5).to_f / (total_feeds * 1000).to_f\n\n # Index values with related ids\n indexes = []\n total = 0.0\n val = 1\n \n # Sort each rating by update date\n ratings.order! 'updated_at ASC'\n ratings.each do |rating|\n user = User.find(rating.user_id)\n difference = rating.score - score \n consistency = 0.99 * user.consistency + 0.01 * difference \n index = Math.exp(-(val**1.5/total_users)) / \n (difference**2 + (consistency - difference)**2 + 1.0)\n indexes.append([user.id, index])\n total = total + index\n val = val + 1\n user.consistency = consistency\n user.save!\n end\n\n # Add respective new voting power\n indexes.each do |element|\n user = User.find(element[0])\n user.voting_power = user.voting_power + (element[1] / total) * power\n user.save!\n end\n\n # Normalize the voting power\n max = 0.0\n User.all.each do |user|\n max = max + user.voting_power\n end \n \n norm_factor = (5 * total_users) / max\n User.all.each do |user|\n user.voting_power = user.voting_power * norm_factor\n user.save!\n end\n \n end",
"def reputation_threshold_action\n :offer_reward\n end",
"def twitter_api_rate_limit\n # +++ move to app config\n @@_admin_account_access_rate_limit ||= 50 # times per hour\n end",
"def cost_of(user)\n self.riders.exists?(id: user.id) && self.cost/self.riders.count\n end",
"def minimum_spend_met?\n !(user.try(:wholesaler?) && item_total.to_f < MINIMUM_ITEM_TOTAL)\n end",
"def update! #update\n if @expires_in > LONG_EXPIRED\n add = 1\n elsif @expires_in > MEDIUM_EXPIRED\n add = 2\n elsif @expires_in > 0\n add = 3\n end\n @quality = @expires_in > 0 ? [@quality + add, 50].min : 0\n @expires_in -= 1\n end",
"def set_update_rate(rate)\n rate = AMS.clamp(rate.to_i, 1, 100)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate)\n sim = MSPhysics::Simulation.instance\n sim.set_update_rate(rate) if sim\n return rate\n end",
"def restaure\n montant = self.amount\n\n # je mets a jour le solde du client\n account = Await.find(self.id).customer.account\n customer = Await.find(self.id).customer\n if account.blank?\n\n puts \"Aucun utilisateur ne correspond a cette intention de retrait\"\n Raise ActiveRecord::RecordNotFound \"Pas de compte trouvé\"\n\n else\n\n if account.update(amount: account.amount + montant.to_f)\n puts \"Customer Updated\"\n else\n puts \"Une erreur est survenu\"\n end\n\n end\n \n end",
"def rating_formula\n time = Time.new\n age = ((time - self.created_at)/60/60/24).to_i\n if upvotes != nil\n rating = upvotes + age * (-0.5)\n else \n rating = age * (-0.5)\n end\n rating\n end",
"def apartment_credit_rating\n\n #Run Rate Credit\n therating = rate_credit @apt_avg_c\n\n #Pass results to model\n @apt_c_rating = therating\n\n end",
"def ratings_company\n @user = User.find_by(:id => params[:company_id])\n if @user.rating == nil or @user.rating == -1\n @message=\"La companyia no ha estat valorada\"\n render json: @message\n else\n render json: @user.rating.to_json\n end\n end",
"def initialize\n @rate = 0.90\n end",
"def rates_update\n @st = params[:st].to_s\n if @tariff and @st.length != 1\n dont_be_so_smart\n redirect_to :controller => :callc, :action => :main and return false\n end\n a=check_user_id_with_session(@tariff.owner_id)\n return false if !a\n @rates = @tariff.rates_by_st(@st, 0, 10000)\n @rates.each { |r|\n if params[:rate] and params[:rate][\"id_#{r.id}\".to_sym] and params[:rate][\"id_#{r.id}\".to_sym][:price] and r.price.to_d != params[:rate][\"id_#{r.id}\".to_sym][:price].to_d\n r.price = params[:rate][\"id_#{r.id}\".to_sym][:price].to_d\n r.save\n end\n }\n flash[:status] = _('Sms_rate_updated')\n redirect_to :action => 'rates', :id => params[:id], :st => @st, :page => params[:page]\n end",
"def rating(u,m)\n if @usermap[u].has_key?(m)\n @usrmap[u][m]\n else\n 0\n end\n end",
"def set_rate_usage(resp)\n rate_limit = resp[\"x-ratelimit-limit\"]\n usage_limit = resp[\"x-ratelimit-usage\"]\n return if rate_limit.nil? or usage_limit.nil?\n short_limit = rate_limit.split(\",\")[0].to_i\n long_limit = rate_limit.split(\",\")[1].to_i\n short_usage = usage_limit.split(\",\")[0].to_i\n long_usage = usage_limit.split(\",\")[1].to_i\n quarter_hours_left = [(DateTime.now.utc.end_of_day.to_i - DateTime.now.utc.to_i) / 900, 1].max\n short_max = [ ( (long_limit - long_usage) / quarter_hours_left.to_f).to_i, short_limit].min\n $redis.set(\"strava_short_limit\", short_limit)\n $redis.set(\"strava_long_limit\", long_limit)\n $redis.set(\"strava_short_usage\", short_usage)\n $redis.set(\"strava_long_usage\", long_usage)\n $redis.set(\"strava_last_time\", DateTime.now.to_i)\n $redis.set(\"strava_short_max\", short_max)\n end",
"def add_rate(from, to, rate); end",
"def user_rating\n document[\"statistics\"][\"userRating\"] rescue nil\n end",
"def credit_in_cents\n (user.credit * 100).to_i\n end",
"def rate_comment\n render nothing: true\n comment = Comment.find(params[:id])\n\n if(!comment.user_ratings.include? current_user.id)\n comment.user_ratings.push(current_user.id)\n comment.save\n else\n return redirect_to_back(root_path)\n end\n\n end"
] |
[
"0.68062645",
"0.6316115",
"0.6305841",
"0.60808563",
"0.60808563",
"0.6027617",
"0.5965653",
"0.5944634",
"0.5943455",
"0.5893678",
"0.5888269",
"0.5888269",
"0.5873097",
"0.5870971",
"0.58697945",
"0.58389455",
"0.58305746",
"0.5807044",
"0.5806139",
"0.58017963",
"0.5780647",
"0.57573473",
"0.57524496",
"0.5748622",
"0.57310593",
"0.57045597",
"0.5704399",
"0.5698223",
"0.56853807",
"0.5679321",
"0.5673269",
"0.56695163",
"0.5659467",
"0.56403387",
"0.56170946",
"0.5603599",
"0.5600431",
"0.5595501",
"0.5587345",
"0.55787927",
"0.55728453",
"0.5559836",
"0.555233",
"0.555233",
"0.55259734",
"0.5516844",
"0.55157155",
"0.55157155",
"0.5515343",
"0.5512463",
"0.55112743",
"0.5510732",
"0.55013144",
"0.55013144",
"0.54711014",
"0.5468854",
"0.5468854",
"0.5466139",
"0.5452901",
"0.5451482",
"0.54319006",
"0.5426163",
"0.5424072",
"0.54222757",
"0.54091966",
"0.539666",
"0.53934586",
"0.53928566",
"0.5390943",
"0.538212",
"0.53788733",
"0.5369817",
"0.53629905",
"0.5362608",
"0.53494626",
"0.5340545",
"0.5338319",
"0.53293645",
"0.5322381",
"0.53142196",
"0.531329",
"0.5313095",
"0.53092504",
"0.5305037",
"0.52990997",
"0.5295528",
"0.52891564",
"0.5284192",
"0.528343",
"0.5278703",
"0.5276576",
"0.5270721",
"0.5270379",
"0.5267705",
"0.526454",
"0.52642256",
"0.5253069",
"0.52526367",
"0.52520037",
"0.52515525"
] |
0.66465753
|
1
|
retur list of all users
|
def list_user(param = '1110')
@group_users.each { |item| puts item.info(param) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_all_users\n\n end",
"def list\n @all_users = User.find(:all)\n end",
"def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end",
"def list\n get('users')['users']\n end",
"def list_users\n @users = User.find(:all)\n end",
"def list_users\n self.class.get('/users')\n end",
"def getAllUsers()\n puts \"\\nUSERS:\"\n puts \"-------------------------------------------------\"\n @users.each {|user| puts \"ID: \" + user.id.to_s + \" Name: \" + user.name}\n puts \"-------------------------------------------------\"\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end",
"def get_all\n @user_repository.get_all_users\n end",
"def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end",
"def list_users\n BrickFTP::API::User.all\n end",
"def list_users\n BrickFTP::API::User.all\n end",
"def users_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('users/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tusers=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['users'].each_element('//user') { |user|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=user.elements['name'].text\n\t\t\t\tentry['admin']=user.elements['admin'].text\n\t\t\t\tentry['lastlogin']=user.elements['lastlogin'].text\n\t\t\t\tusers.push(entry)\n\t\t\t}\n\t\t\treturn users\n\t\tend",
"def all_users()\n User.all\n end",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def user_list\n @user=User.all\n end",
"def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end",
"def all\n @users = User.all\n end",
"def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end",
"def index\n \t@all_users = User.all\n end",
"def users\n get('get_users')\n end",
"def index\n @users = UserService.all_users\n end",
"def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end",
"def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end",
"def index\n\t\t@users = User.all\n\tend",
"def index\n\t\t@users = User.all\n\tend",
"def index\n\t\t@users = User.all\n\tend",
"def index\n\t\t@users = User.all\n\tend",
"def index\n\t\t@users = User.all\n\tend",
"def index\n\t\t@users = User.all\n\tend",
"def view_all_users\n # !! get all user so can interact after viewing them? all_users\n # User.select(:username).each_with_index {|user, index| puts \"#{index+1}. #{user.username}\"}\n #??????\n User.select(:username).each {|user| puts user.username}\n end",
"def index\n @users = UserService.getAllUserList\n end",
"def users_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :users_list, options).each do |page|\n yield page\n end\n else\n get(\"users\", options)\n end\n end",
"def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end",
"def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend",
"def index\n @users = User.all\n end",
"def users\n @users = User.find(:all)\n end",
"def index\n \t@users = User.all\n \tend",
"def get_users(request); end",
"def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end",
"def all_users\n `dscl . list /Users`.split(\"\\n\").delete_if { |e| e =~ /^_/ }\n end",
"def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend",
"def index\n @users = User.find_all_with_authorization(current_user)\n end",
"def index\n \t@users = User.all\n end",
"def index\n @all_users = User.all\n\trender \"list_users\"\n end",
"def all(instance)\n data = service.list_users(instance).to_h[:items] || []\n load(data)\n end",
"def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end",
"def list_users\n \t#p params[:search]\n \tif params[:search].nil?\n \t\t@users= User.all\n \telse\n \t\t@users= User.search_users(params)#this function from model\n \tend\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end",
"def index\n \t@users = UsersService.UserListAll(params[:page])\n end",
"def users\n []\n end",
"def users(list_id)\n Iterable.request(conf, '/lists/getUsers', listId: list_id).get\n end",
"def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end",
"def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end",
"def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end",
"def users\n gateway_check\n @users\n end",
"def get_all_user_names\n @user_manager.get_all_user_names\n end",
"def index\n\t\t@users = User.page(params[:page]).per(10)\n\tend",
"def get_all_users(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"user\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end",
"def index\n @users = User.all\n\tend",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\r\n @users = User.all\r\n end",
"def index\r\n @users = User.all\r\n end",
"def index\r\n @users = User.all\r\n end",
"def index\n\t@users = User.all\nend",
"def users\n @users = User.all\n end",
"def getUsers() #:name, :default_currency, :locale\r\n returnArray = []\r\n retrieveData(\"/v1/users\")[\"data\"].each do |item|\r\n returnArray << User.new(item[\"name\"], item[\"default_currency\"], item[\"locale\"])\r\n end\r\n return returnArray\r\n end",
"def list\n @user = User.all(:order => :login) # sort by login name\n end",
"def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end",
"def index # Used for list of favorites or followers/followings list\n @users = User.all\n end",
"def index\r\n # @users = User.all\r\n end",
"def index\n @users = User.find(:all)\n end",
"def index\n @users = User.find(:all)\n end",
"def index\n @users = User.find(:all)\n end",
"def index\n @users = current_user.users\n end",
"def index\n @list_users = ListUser.all\n end",
"def list_current_users *args\r\n puts \"not implemented yet\"\r\n end",
"def getUserList\n @userList\n end",
"def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end",
"def html_index\n\t\t@users = User.all\n\tend",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def show_users\n @users = User.all\n end"
] |
[
"0.8833515",
"0.8803131",
"0.8679127",
"0.86482",
"0.8521039",
"0.8359296",
"0.83026594",
"0.8270918",
"0.8204601",
"0.8200361",
"0.8174807",
"0.8136294",
"0.8136294",
"0.81337243",
"0.8125384",
"0.8100758",
"0.8097471",
"0.8078178",
"0.8075537",
"0.8070859",
"0.80555487",
"0.8034886",
"0.8034886",
"0.8022407",
"0.7993334",
"0.79849166",
"0.7982398",
"0.7959926",
"0.7959866",
"0.79251826",
"0.79251826",
"0.79251826",
"0.79251826",
"0.79251826",
"0.79251826",
"0.78967637",
"0.7895984",
"0.7892663",
"0.78808475",
"0.7869625",
"0.7847947",
"0.78420883",
"0.7838462",
"0.7829245",
"0.7816044",
"0.7810964",
"0.78058904",
"0.77947944",
"0.7775295",
"0.77701837",
"0.77681446",
"0.77674997",
"0.77641344",
"0.7749353",
"0.77432555",
"0.77432555",
"0.77432555",
"0.77344894",
"0.77266115",
"0.772503",
"0.77030444",
"0.76905596",
"0.7689366",
"0.7686891",
"0.7679025",
"0.7677205",
"0.76724416",
"0.7661962",
"0.7660045",
"0.76558894",
"0.76511484",
"0.76511484",
"0.76417345",
"0.76417345",
"0.76417345",
"0.76417345",
"0.76417345",
"0.76417345",
"0.76417345",
"0.76414627",
"0.76414627",
"0.76414627",
"0.7638882",
"0.7631426",
"0.7625927",
"0.7620974",
"0.76077074",
"0.75865096",
"0.75856334",
"0.75855654",
"0.75855654",
"0.75855654",
"0.75815237",
"0.75814956",
"0.75797164",
"0.7579285",
"0.75767875",
"0.7572863",
"0.7569343",
"0.7569343",
"0.75665945"
] |
0.0
|
-1
|
retur user with user_id
|
def user_by_id(user_id)
@group_users.find { |item| item.user_id == user_id }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user; User.find_by_id(user_id); end",
"def get_user(user_id)\n return User.find(user_id)\n end",
"def user(id:)\n User.find(id)\n end",
"def user\n User.get user_id || User.new\n end",
"def find_user(user_id)\n user = User.find(user_id)\n user\n end",
"def get(user_id)\n User.find user_id\n end",
"def user\n UserRepository.find(user_id)\n end",
"def get_user_byid(id)\n @user = User.find_by_id(id)\n end",
"def get_user \n\t\treturn User.find(self.user_id)\n\tend",
"def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end",
"def user\n return User.current unless user_id\n user = User.get_from_cache(user_id)\n user || User.first({:id => user_id})\n end",
"def get_user(id)\n @users[id]\n end",
"def user\n @user ||= User.find(user_id)\n end",
"def user\n user_id.get_object\n end",
"def get_user\n @user = User.find(params[:user_id])\n end",
"def get_user_from_id(user_id)\n \t\tuser = nil\n \t\tunless user_id.blank?\n\t \t\tcol = :email\n\t \t\tif CONFIG[:enable_username?]\n\t \t\t\tunless is_email(user_id)\n\t \t\t\t\tcol = :username\n\t \t\t\tend\n\t \t\tend\n#\t \t\tp \"Finding user by col: #{col}, user_id = #{user_id}\"\n\t \t\tuser = User.find_by(col => user_id.downcase)\n\t \tend\n\t \tuser\n \tend",
"def user\n User.find(self[:user_id])\n end",
"def get_user\n @user = User.find(params[:user_id])\n end",
"def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end",
"def get_user\n @user = User.find_by_id(params[:id])\n if @user \n return @user\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The user could not be found!\"}}\n end\n end",
"def user(id = 'self')\n get(\"users/#{id}\").user\n end",
"def fetch_user(id)\n client.user(id)\n end",
"def user\n find_user params._id\n end",
"def user\n Webmetrics.users.find_one('_id' => id)\n end",
"def get_user_from_id\n #convert URL id to integer and set into instance var user_id\n @user_id = params[:id].to_i\n #look up the user based on id and cast into instance var\n @user = User.find_by_id(@user_id)\n #if no user found redirect back to previous page with error\n if !@user\n flash[:error] = \"User does not exist\"\n custom_redirect_back\n end\n end",
"def user\n @user ||= User.find(\n params[:user_id] ) # needs to raise exception if user not found\n end",
"def get_user \n @user = User.find(params[:id])\n end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def user\n User.find_by_id self.user_id \n end",
"def get_user_id(reaktoruser_id)\n IdStore.get(:reaktoruser, reaktoruser_id)\n end",
"def find_user\n @user = User[:id => params[:id]]\n end",
"def db_user(db_connection, user_id)\n sql = 'SELECT * FROM users WHERE id=$1;'\n db_connection.exec_params(sql, [ user_id ]).first\n end",
"def find_user\n @user= User.where(id: params[:id]).first\n end",
"def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend",
"def find_user_by_id(id)\n User.find(id)\n end",
"def user\n # 自インスタンスのuser_idの値に紐付くuserインスタンスを戻り値として返す\n return User.find(self.user_id)\n end",
"def find_user\n User.find(params.fetch(:id))\n end",
"def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end",
"def user\n User.find_by(id: self.object.user_id)\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def user(id)\n @users[id.resolve_id]\n end",
"def find_user_by_id(id)\n users.find_by_id(id)\n end",
"def user\n User.where(id: object.user_id)[0]\n end",
"def get_user_or_404(id)\n @user = get_or_404(User, id)\n end",
"def user\n @user = User.find_by(id: params[:user_id]) || render_404\n end",
"def fetch_user(id)\n fetch( :user, id ).last_result_item\n end",
"def user_id\n @logged_in_user = User.find_by(id: params[:id])\n @user_id = @logged_in_user.id\n end",
"def find_user\n User.find_by_id(params[:id])\n end",
"def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end",
"def user_obj\r\n User.select(:name).where(id: object.user_id).last || User.new(name: \"Not Found\")\r\n end",
"def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def user\n return unless user_id && user_type\n return @user if instance_variable_defined?('@user')\n\n @user = user_type.constantize.find_by(id: user_id)\n end",
"def find_user\n\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_data(\n 'sm_gud_fu_1',\n 'Invalid user id',\n 'Invalid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user.blank? || @user.client_id != @client_id\n\n success\n end",
"def get_user(uid)\n @inv = User.find_by_id(uid)\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def get_user_by_id(id)\n resp = request('getUserByID', {:userID => id})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def user_id_for(user)\n find(user.id, user.login)\n end",
"def fetch_user\n id = params[:id] || params[:user].try(:fetch,:id)\n user = User.find(params[:id])\n authorize user, :update?\n return user\n end",
"def set_user\n #@user = User.find(params[:id])\n @user = User.where(:id => params[:user_id]).first\n end",
"def find_user\n @user = User.find(params[:user_id])\n end",
"def find_user\n @user = User.find(params[:user_id])\n end",
"def user\n user ||= User.find(self.user_id)\n end",
"def find_by_id\n User.find_by_id(@username_or_id)\n end",
"def retrieve_user\n @user = User.find_by(id: params[:id])\n\n return redirect_to root_path if @user.nil?\n end",
"def find_user \n @user = User.find_by(id: params[:id])\n end",
"def user(body)\n User.find(body[:id])\n end",
"def find_user\n @user = User.find(params[:user_id])\n end",
"def find_user\n @user = User.with_username(params[:id]).first\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def find_by_id!\n User.find(@username_or_id)\n end",
"def find(user_id)\n sql = \"SELECT * FROM users WHERE id=$1\"\n result = Repos.db_adapter.exec(sql, [user_id])\n User.new(result[0][\"name\"], result[0][\"email_address\"], result[0][\"id\"])\n end",
"def user(id)\n Bibliovore::User.new(\n get_endpoint(\"users/#{id}\", 'user'), self\n )\n end",
"def user\n User.load(self.user_id)\n end",
"def actual_user\n User.find_by_id(session[:user_id])\n end",
"def set_user\n if User.exists?(params[:id].to_i)\n @user = User.find(params[:id])\n end\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user(user_id = nil)\n user_id = username if user_id.nil? || user_id == \"\"\n if user_id.to_i.to_s == user_id.to_s\n users = connection.get(connection.build_url('users', :userids => user_id)).body\n else\n users = connection.get(connection.build_url('users', :logins => user_id)).body\n end\n users.map!{|hash| hash.values.first}\n users.first\n end",
"def user_id\n self.user.id unless user.nil?\n end",
"def set_user\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n if @user = User.find(params[:id])\n return @user\n else\n renderError(\"Not found\",404,\"User not found\")\n end\n end",
"def find_user\n raise ExceptionTypes::BadRequestError.new(\"user_id must be present\") unless params[:user_id].present?\n \n @user = User.find(params[:user_id])\n end",
"def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end",
"def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end",
"def user_id\n return nil unless success?\n\n @user_id\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end",
"def get_user(item)\n\t\t@user = User.find_by_id(item.user.id)\n\tend",
"def find_user\n @user = User.find(params[:id])\n end",
"def find_user\n @user = User.find(params[:id])\n end",
"def find_user\n @user = User.find(params[:id])\n end"
] |
[
"0.8010103",
"0.79049844",
"0.7816957",
"0.7755731",
"0.77448195",
"0.77191335",
"0.76655066",
"0.7584223",
"0.7582369",
"0.7522907",
"0.74880904",
"0.74861926",
"0.74617517",
"0.7446088",
"0.7444341",
"0.743328",
"0.7430964",
"0.7425594",
"0.74247503",
"0.7401402",
"0.7396199",
"0.7392498",
"0.7373233",
"0.73620385",
"0.735976",
"0.73577756",
"0.7355565",
"0.73533845",
"0.73527944",
"0.7349004",
"0.73429537",
"0.73353297",
"0.732539",
"0.73247015",
"0.7322289",
"0.72897106",
"0.7285485",
"0.7280052",
"0.7275832",
"0.7273015",
"0.7262461",
"0.7253053",
"0.7248387",
"0.7229022",
"0.7212092",
"0.72037315",
"0.7202845",
"0.7196905",
"0.7196436",
"0.7193109",
"0.7192728",
"0.7192573",
"0.71873146",
"0.71745855",
"0.7163662",
"0.71625966",
"0.7127111",
"0.7124506",
"0.7118133",
"0.7112532",
"0.7092851",
"0.7087547",
"0.7087547",
"0.7080514",
"0.7076869",
"0.7076139",
"0.70755506",
"0.7068899",
"0.70674926",
"0.70665354",
"0.70626664",
"0.7048361",
"0.7043961",
"0.704223",
"0.7032843",
"0.70300084",
"0.702043",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.70090616",
"0.7008325",
"0.7004245",
"0.6984169",
"0.6969075",
"0.69667435",
"0.69611245",
"0.69555503",
"0.69548154",
"0.6954328",
"0.69350797",
"0.69328666",
"0.69328666",
"0.6927269"
] |
0.7013424
|
77
|
Load platform specific implementation === Return true:: Always return true
|
def load_platform_specific
if linux?
require_linux
elsif mac?
require_mac
elsif windows?
require_windows
else
raise PlatformError.new('Unknown platform')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_for_platform?; true; end",
"def system_load_ok?\n true\n end",
"def installable_platform?\n # BACKCOMPAT If the file is coming out of a specified file, then we\n # ignore the platform. This code can be removed in RG 3.0.\n return true if @source.kind_of? Gem::Source::SpecificFile\n\n super\n end",
"def load_platform(v)\n Chef::Log.debug \"[dropwizard_pleaserun] loading platform #{v}\"\n platform_lib = \"pleaserun/platform/#{v}\"\n require platform_lib\n const = PleaseRun::Platform.constants.find { |c| c.to_s.casecmp(v).zero? }\n if const.nil?\n raise PlatformLoadError, \"Could not find platform named '#{v}' after loading library \" \\\n \"'#{platform_lib}'. This is probably a bug.\"\n end\n return PleaseRun::Platform.const_get(const)\nrescue LoadError => e\n raise PlatformLoadError, \"Failed to find or load platform '#{v}'. This could be a typo or \" \\\n \" a bug. If it helps, the error is: #{e}\"\nend",
"def supported?\n supports_platform? && supports_runtime?\n end",
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def rubinius?(platform = T.unsafe(nil)); end",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def supports_platform?\n if @supports_platform.nil?\n @supports_platform = metadata.supports_platform?(@backend)\n end\n if @backend.backend.class.to_s == \"Train::Transports::Mock::Connection\"\n @supports_platform = true\n end\n\n @supports_platform\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def mri?(platform = T.unsafe(nil)); end",
"def sos_mono?() raise NotImplementedError end",
"def using_native_target?; target.name =~ /native/i; end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def default_force_ruby_platform\n return false unless RUBY_ENGINE == \"truffleruby\"\n\n !Gem::Platform::REUSE_AS_BINARY_ON_TRUFFLERUBY.include?(name)\n end",
"def ios? ; RUBY_PLATFORM =~ /arm-darwin/i end",
"def dll?\n library?\n end",
"def detect_platform\n @@platform_features ||= {\n :interpreter => detect_interpreter,\n :interpreter_language => detect_interpreter_language,\n :ipv4 => detect_reachable_ip,\n :ruby_version => RUBY_VERSION,\n }.merge(detect_os).merge(detect_hardware)\n end",
"def platform?(what)\n\t\t(platform & what).empty? == false\n\tend",
"def osx?(platform = T.unsafe(nil)); end",
"def built_in_module?(name)\n true if platform_family?('suse') &&\n %w(systemd unixd http so access_compat core mpm_event mpm_prefork mpm_worker).include?(name)\n end",
"def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end",
"def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end",
"def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def has_os?\n delegate(provider, :has_os?)\n end",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def feature_provided?(name)\n if name.suffix?(\".rb\") or name.suffix?(LIBSUFFIX)\n return loaded? name\n elsif name.suffix? \".so\"\n # This handles cases like 'require \"openssl.so\"' on\n # platforms like OS X where the shared library extension\n # is not \".so\".\n return loaded?(name[0..-4] + LIBSUFFIX)\n else\n return true if loaded?(name + \".rb\")\n return loaded?(name + LIBSUFFIX)\n end\n\n return false\n end",
"def test_platform_uses_ruby_platform\n stubbed = 'ENCOM OS-12'\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, stubbed) do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def windows?(platform = T.unsafe(nil)); end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def maglev?(platform = T.unsafe(nil)); end",
"def detect\n end",
"def autoload?(p0) end",
"def autoload?(p0) end",
"def platform\n @platform ||= NoPlatform.new\n end",
"def platform; RUBY_PLATFORM; end",
"def registered?(ext); end",
"def registered?(ext); end",
"def linux?\n linux_internal?\n end",
"def linux?\n @linux\n end",
"def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end",
"def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end",
"def host_os; end",
"def host_os; end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def supports?\n web_inf? && !JavaBuildpack::Util::JavaMainUtils.main_class(@application)\n end",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end",
"def is?(platform)\n return false unless platform.is_a? Wow::Package::Target\n Wow::Package::Target.based_on?(platform, self)\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def platform\n @new_platform ||= Gem::Platform::RUBY\n end",
"def patchable?\n available? && loaded? && compatible?\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end",
"def installed?\n raise NotImplementedError\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end",
"def check_platform\n mobile_override = params[:mobile] && params[:mobile] == \"1\"\n desktop_override = params[:mobile] && params[:mobile] == \"0\"\n if ( (browser.mobile? and !browser.ipad?) or mobile_override ) and !request.xhr? and !desktop_override\n @platform = 'mobile'\n request.format = :mobile\n else\n @platform = 'desktop'\n end\n end",
"def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end",
"def include?(platform)\n fail ArgumentError unless platform.is_a? Wow::Package::Target\n Wow::Package::Target.based_on?(self, platform)\n end",
"def supported?\n false\n end",
"def gem_platforms(name, options) # :nodoc:\n platform_names = Array(options.delete :platform)\n platform_names.concat Array(options.delete :platforms)\n platform_names.concat @current_platforms if @current_platforms\n\n return true if platform_names.empty?\n\n platform_names.any? do |platform_name|\n raise ArgumentError, \"unknown platform #{platform_name.inspect}\" unless\n platform = PLATFORM_MAP[platform_name]\n\n next false unless Gem::Platform.match_gem? platform, name\n\n if engines = ENGINE_MAP[platform_name]\n next false unless engines.include? Gem.ruby_engine\n end\n\n case WINDOWS[platform_name]\n when :only then\n next false unless Gem.win_platform?\n when :never then\n next false if Gem.win_platform?\n end\n\n VERSION_MAP[platform_name].satisfied_by? Gem.ruby_version\n end\n end",
"def autoload?(arg0)\n end",
"def mac?\n RUBY_PLATFORM =~ /darwin/i\nend",
"def vista?\n (/vista/ =~ ruby_platform) != nil\n end",
"def on_rightscale_platform?\n File.exists?(RightScale::MetaDataFile)\nend",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def supports?\n !@version.nil?\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend",
"def platform_name; non_framework_platforms.first; end",
"def internal_or_core?(pin); end",
"def java?\n !! (RUBY_PLATFORM =~ /java/)\nend",
"def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end",
"def is_libname?(); @type == GRT_LIBNAME; end",
"def is_platform(symbol)\n platform = ENV['PLATFORM'] || 'all'\n platform = platform.downcase # If set, will be frozen.\n\n if platform == 'macos'\n # CocoaPods calls this osx\n platform = 'osx'\n end\n platform = platform.to_sym\n\n if symbol == platform || platform == :all\n puts \"Adding #{symbol} targets to the project\"\n return true\n else\n return false\n end\nend",
"def supported_by_platform?\n right_platform = RightScale::Platform.linux?\n right_platform && user_exists?('rightscale') # avoid calling user_exists? on unsupported platform(s)\n end",
"def physical_device?\n arches.any? do |arch|\n arch[/arm/, 0]\n end\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def linux?\n !!(ua =~ /Linux/)\n end",
"def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend",
"def windows_mobile?\n !!(ua =~ /Windows CE/)\n end",
"def looks_like_rackspace? \n has_rackspace_mac?\nend",
"def require_if_available(name)\n require name\nrescue LoadError\n false\nend",
"def platform\n @platform ||= data.platform\n end",
"def resolve_require_path\n if @path.suffix? CodeLoader.source_extension\n @type = :ruby\n elsif @path.suffix? LIBSUFFIX\n @type = :library\n elsif @path.suffix? \".so\"\n # This handles cases like 'require \"openssl.so\"' on\n # platforms like OS X where the shared library extension\n # is not \".so\".\n @path[-3..-1] = LIBSUFFIX\n @type = :library\n end\n\n if @type\n return false if CodeLoader.feature_provided? @path\n return true if verify_load_path @path\n else\n if verify_require_path(@path)\n return false if CodeLoader.feature_provided? @feature\n return true\n end\n end\n\n load_error unless CodeLoader.loaded? @path\n end",
"def wrap_sync_load?\n ( !defined?( JRUBY_VERSION ) ||\n version_lt?( JRUBY_VERSION, [9] ) ||\n version_gte?( JRUBY_VERSION, [9,0,5] ) )\n end",
"def platform?(*args)\n has_platform = false\n\n args.flatten.each do |platform|\n has_platform = true if platform.to_s == node[:platform]\n end\n\n has_platform\n end",
"def is_module_platform?(mod)\n platform_obj = Msf::Module::Platform.find_platform session.platform\n module_platforms = mod.target.platform ? mod.target.platform.platforms : mod.platform.platforms\n module_platforms.include? platform_obj\n rescue ArgumentError => e\n # When not found, find_platform raises an ArgumentError\n elog \"#{e.class} #{e.message}\\n#{e.backtrace * \"\\n\"}\"\n return false\n end"
] |
[
"0.74356",
"0.7203914",
"0.716804",
"0.6986426",
"0.69279",
"0.6924712",
"0.686197",
"0.6847967",
"0.6847967",
"0.6847967",
"0.68197435",
"0.68130875",
"0.68130875",
"0.67595285",
"0.67564553",
"0.6748567",
"0.6711085",
"0.6637507",
"0.6602516",
"0.6598843",
"0.656054",
"0.65590745",
"0.652165",
"0.647661",
"0.6437137",
"0.6436396",
"0.64348817",
"0.6410247",
"0.6410247",
"0.6410247",
"0.63996875",
"0.6393318",
"0.63905233",
"0.63905233",
"0.6379959",
"0.63760805",
"0.63606423",
"0.6349984",
"0.6318302",
"0.63069284",
"0.6280634",
"0.6268325",
"0.6268325",
"0.6219419",
"0.61888945",
"0.6169067",
"0.6169067",
"0.61685777",
"0.61669654",
"0.61587983",
"0.61587983",
"0.61583924",
"0.61583924",
"0.61457497",
"0.6140715",
"0.6134568",
"0.612943",
"0.6117489",
"0.61112463",
"0.6110246",
"0.61093944",
"0.60963106",
"0.6077681",
"0.60628384",
"0.60624385",
"0.6053912",
"0.6053827",
"0.60485095",
"0.6048241",
"0.6029721",
"0.6022635",
"0.6011828",
"0.6007681",
"0.60065544",
"0.6005497",
"0.59956783",
"0.5992226",
"0.59910804",
"0.59909946",
"0.5979084",
"0.5977029",
"0.5968642",
"0.5966746",
"0.5946219",
"0.59282494",
"0.5925342",
"0.5899083",
"0.58955336",
"0.58955336",
"0.58955336",
"0.58953255",
"0.58951133",
"0.5888564",
"0.5887",
"0.5882581",
"0.5879031",
"0.5868905",
"0.58604383",
"0.5860055",
"0.58503455"
] |
0.7198584
|
2
|
An alias for RUBY_PLATFORM === Return name(String):: RUBY_PLATFORM
|
def name
RUBY_PLATFORM
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def platform_name; non_framework_platforms.first; end",
"def platform; RUBY_PLATFORM; end",
"def ruby_platform\n RUBY_PLATFORM\n end",
"def platform\n RUBY_PLATFORM\n end",
"def platform_shortname\n if platform_family == 'rhel'\n 'el'\n else\n platform\n end\n end",
"def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end",
"def get_platform(platform = nil)\n platform ||= RUBY_PLATFORM\n case platform\n when /darwin/ then :MACOS\n when /cygwin|mswin|mingw|bccwin|wince|emx/ then :WINDOWS\n else :LINUX\n end\n end",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def platform_name\n self.platform ? self.platform.name : NOT_SET\n end",
"def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"def os_name # rubocop:disable Lint/DuplicateMethods\n @os_name ||= @name.match(PLATFORM_REGEX)[1]\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def platform\n osver[0]\n end",
"def platform\n self.class.name.split(\"::\").last.gsub(/(?<=[^A-Z])[A-Z]+/, \"-\\\\0\").downcase\n end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def platform\n @new_platform ||= Gem::Platform::RUBY\n end",
"def sys_uname_osname\n uname = `uname`\n if uname.include? 'Darwin' # macOS\n :macos\n elsif uname.include? 'Linux'\n :linux\n elsif uname.include? 'MINGW'\n :windows\n elsif uname.include? 'OpenBSD'\n :openbsd\n end\n end",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def platform\n \"win\"\n end",
"def platform_name\n capabilities['platformName']\n end",
"def platforms; platform_names; end",
"def name\n @name ||= if !OS.windows? && ruby?\n MRI\n elsif ruby? && engine? && engine == 'rbx'\n Rubinius\n elsif ruby? && engine? && engine == 'maglev'\n MagLev\n elsif engine? && engine == 'jruby'\n JRuby\n end\n end",
"def platform\n System::get_property('platform')\n end",
"def os_platform\n return @parsed_ua.os ? @parsed_ua.os : 'Unknown'\n end",
"def get_platform(host_os)\n return :osx if host_os =~ /darwin/\n return :linux if host_os =~ /linux/\n return :windows if host_os =~ /mingw32|mswin32/\n return :unknown\n end",
"def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend",
"def arch\n if windows? && windows_arch_i386?\n \"i386\"\n elsif solaris?\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n end\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end",
"def platform\n kernel.platform\n end",
"def platform_name\n \"Flist\"\n end",
"def platform_family\n Ohai.platform_family\n end",
"def os_family\n case os_type(:nice)\n when /Linux|Solaris|OSX/i then 'Generic'\n when /Windows/i then 'Windows'\n else 'Unknown'\n end\n end",
"def arch\n return `uname -m`.chomp\n end",
"def platform\n type = os_type(:nice)\n type = case type\n when /Linux/i then linux_type\n else type\n end\n \n # Grab the Solaris version; turns '5.9' into '9', for example. (Solaris has a really\n # bizarre numbering scheme.)\n #\n # FIXME: This should include patchlevel.\n if type =~ /Solaris/i\n if @solaris_version.nil?\n @solaris_version = @platform.exec(\"uname\", \"-r\").strip\n @solaris_version = $2 if @solaris_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*$/i\n end\n \n type += @solaris_version\n end\n \n # Grab the OS X version by looking at the Darwin kernel version.\n #\n # FIXME: This should include minor version, too (e.g., 10.4.7).\n if type =~ /OSX/i\n if @osx_version.nil?\n @osx_version = @platform.exec(\"uname\", \"-r\").strip\n if @osx_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+).*$/i\n minor_version = [ $1.to_i - 4, 0 ].max # i.e., Darwin 8.x => OS X 10.4, 7.x => OS X 10.3, etc.\n @osx_version = \"10.%d\" % minor_version\n else\n @osx_version = '-unknown-%s' % @osx_version\n end\n end\n \n type += @osx_version\n end\n \n # Grab the Windows version by System.getProperty\n if type =~ /Windows/i\n os_name = JavaSystem.getProperty('os.name');\n sun_os_patch_level = JavaSystem.getProperty('sun.os.patch.level');\n if @windows_version.nil?\n @windows_version = case os_name \n when /Windows 2003/i: \"win2k3\"\n when /Windows XP/i: \"winxp\"\n else os_name.gsub(/ /, '_')\n end\n unless sun_os_patch_level == \"unknown\"\n patch = ''\n sun_os_patch_level.split(/ /).each do |t|\n patch = \"#{patch}#{t[0..0]}\"\n end\n @windows_version += '-' + patch\n end \n end\n \n type = @windows_version\n end\n \n \"%s-%s\" % [ type.downcase, processor_type.downcase ]\n end",
"def architecture # rubocop:disable Lint/DuplicateMethods\n @architecture ||= @name.match(PLATFORM_REGEX)[3]\n end",
"def platform_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunMetadata_platform_name(@handle.ptr)\n result\n end",
"def full_name\n if platform == Gem::Platform::RUBY or platform.nil? then\n \"#{name}-#{version}\".untaint\n else\n \"#{name}-#{version}-#{platform}\".untaint\n end\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def architecture\n `uname -m`.strip\n end",
"def architecture\n `uname -m`.strip\n end",
"def platform(arg = nil)\n set_or_return(:platform, arg, kind_of: String, required: true)\n end",
"def get_os_name\n\t\t\t\treturn SystemDetector.get_os_name\n\t\t\tend",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def os\n return `uname -s`.chomp\n end",
"def platform\n if os.include?('Android')\n 'Android'\n else\n nil\n end\n end",
"def target_platform\n (target and target.platform) ? target.platform : platform\n end",
"def original_name # :nodoc:\n if platform == Gem::Platform::RUBY or platform.nil?\n \"#{@name}-#{@version}\"\n else\n \"#{@name}-#{@version}-#{@original_platform}\"\n end\n end",
"def platform_version\n osver[1]\n end",
"def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend",
"def vendor_mysql_platform(platform = nil)\n platform ||= RUBY_PLATFORM\n platform =~ /x64/ ? \"winx64\" : \"win32\"\nend",
"def platform\n Ohai.platform\n end",
"def platform\n backend.platform\n end",
"def get_os\n line = Cocaine::CommandLine.new('uname')\n output = line.run\n\n output.chomp.downcase.intern\n end",
"def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end",
"def user_os_simple\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n return \"Windows\" if ua.index('win')\r\n return \"Linux\" if ua.index('Linux')\r\n return \"Macintosh\" if ua.index('Macintosh')\r\n return \"unknown\"\r\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def for(platform)\n case platform.to_s\n when 'amazon' then for_amazon\n when 'core_api' then for_core\n end\n end",
"def ruby_implementation\n case RUBY_ENGINE\n when /java/\n 'jruby'\n when /ruby/\n # I'm actually not sure what rubinius or maglev or other implementions would return. I don't use rubies, other than mri or jruby.\n 'mri'\n else\n nil\n end\nend",
"def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end",
"def platform_type\n return @platform_type\n end",
"def platform_type\n return @platform_type\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def os(platform: self.platform)\n platform = self.platform unless fetch_all('computer.platform').include?(platform)\n fetch(\"computer.os.#{platform.downcase}\")\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def windows?\n ruby_platform?(:windows)\nend",
"def platform\n return @platform\n end",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def get_arch\n arch = `uname -m`\n if arch.include?(\"64\")\n return \"64\"\n else\n return \"32\"\n end\nend",
"def get_exotic_archname(platform_type)\n case platform_type\n when /aarch64/\n \"ARM\"\n when /ppc64le/\n \"Power\"\n else\n nil\n end\nend",
"def host_os_family; end",
"def get_platform\n rpc_get_fact_direct('kernel')\n end",
"def platform\n fetch('device.platform')\n end",
"def platform\n if self.version_sets.nil?\n raise 'The application has no version sets and Spaceship does not know what to do here.'\n end\n\n if self.version_sets.length == 1\n version_sets[0].platform\n elsif self.platforms == %w(ios appletvos)\n 'ios'\n end\n Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets'])['platformString']\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def platform\n spec.platform\n end",
"def platform(name)\n case ENV['PLATFORM']\n when 'windows_10_edge'\n {selenium_version: '3.141.59',\n platform_name: 'Windows 10',\n browser_name: 'edge',\n browser_version: '18.17763'}.merge(sauce_w3c(name))\n when 'windows_8_ie'\n # Note: w3c is not working for Windows 8 & IE 11\n {platform: 'Windows 8.1',\n browser_name: 'ie',\n selenium_version: '3.141.59',\n version: '11.0'}.merge(sauce_oss(name))\n when 'mac_sierra_chrome'\n # This is for running with w3c which is not yet the default\n # {platform_name: 'macOS 10.12',\n # browser_name: 'chrome',\n # \"goog:chromeOptions\": {w3c: true},\n # browser_version: '65.0'}.merge(sauce_w3c name)\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n when 'mac_mojave_safari'\n {platform_name: 'macOS 10.14',\n browser_name: 'safari',\n browser_version: '12.0'}.merge(sauce_w3c(name))\n when 'windows_7_ff'\n {platform_name: 'Windows 7',\n browser_name: 'firefox',\n browser_version: '60.0'}.merge(sauce_w3c(name))\n else\n # Always specify a default\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n end\n end",
"def platform\n window.execute_script('navigator.platform')\n end",
"def test_platform_uses_ruby_platform\n stubbed = 'ENCOM OS-12'\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, stubbed) do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def determine_os\n @os = \"linux\"\n end",
"def determine_os\n @os = 'linux'\n end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end",
"def platform\n @spec.platform\n end",
"def arch_lookup(sys_type)\n return \"x86_64\" if sys_type == \"x64-based PC\"\n return \"i386\" if sys_type == \"X86-based PC\"\n\n sys_type\n end",
"def safe_architecture\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end",
"def describePlatform\n TC.name.gsub(' ', '_')\nend",
"def os_version # rubocop:disable Lint/DuplicateMethods\n @os_version ||= @name.match(PLATFORM_REGEX)[2]\n end",
"def names\n platforms.map { |m| m.realname }\n end",
"def platform_tuple\n [platform_shortname, platform_version_for_package, machine]\n end",
"def os_type_decode(sys_type)\n case sys_type\n when 18 then \"WINNT\" # most likely so first\n when 0 then \"Unknown\"\n when 1 then \"Other\"\n when 14 then \"MSDOS\"\n when 15 then \"WIN3x\"\n when 16 then \"WIN95\"\n when 17 then \"WIN98\"\n when 19 then \"WINCE\"\n end\n end",
"def osx?(platform = T.unsafe(nil)); end",
"def platform\n @attributes[:platform]\n end"
] |
[
"0.8385413",
"0.80764323",
"0.79234445",
"0.79072535",
"0.7794235",
"0.76909053",
"0.7668009",
"0.76161766",
"0.7599129",
"0.75935096",
"0.7548656",
"0.7500768",
"0.74804527",
"0.7411195",
"0.73644245",
"0.7327517",
"0.72889",
"0.72582203",
"0.7254949",
"0.72412205",
"0.7238372",
"0.72343165",
"0.7228026",
"0.7176385",
"0.7173959",
"0.7119087",
"0.70824844",
"0.70490223",
"0.70415837",
"0.69760567",
"0.6969759",
"0.6964949",
"0.6946854",
"0.69382024",
"0.68978333",
"0.68788356",
"0.6876538",
"0.68707263",
"0.6866452",
"0.68602324",
"0.6855062",
"0.6840686",
"0.6840686",
"0.6835104",
"0.6835104",
"0.6821216",
"0.6809271",
"0.6803209",
"0.6802175",
"0.679701",
"0.6793839",
"0.6781845",
"0.6777552",
"0.6768945",
"0.67666173",
"0.67591816",
"0.6751393",
"0.67388564",
"0.67162436",
"0.67146945",
"0.67134213",
"0.6710273",
"0.6705507",
"0.6699077",
"0.6693257",
"0.6693257",
"0.66852486",
"0.66852486",
"0.66852486",
"0.66720307",
"0.666786",
"0.6665222",
"0.6662732",
"0.6645352",
"0.66416913",
"0.6630655",
"0.66302454",
"0.662588",
"0.6620297",
"0.6601918",
"0.6583071",
"0.65751064",
"0.657172",
"0.6562716",
"0.65514386",
"0.654163",
"0.6538626",
"0.6538316",
"0.6536738",
"0.6522435",
"0.6515573",
"0.6513043",
"0.65044165",
"0.6500453",
"0.6500438",
"0.64965844",
"0.6491685",
"0.6484641",
"0.6476143",
"0.6474033"
] |
0.8984987
|
0
|
Is current platform windows? === Return true:: If ruby interpreter is running on Windows false:: Otherwise
|
def windows?
@windows
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def windows_ruby?\n !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)\n end",
"def windows?\n RUBY_PLATFORM =~ /mswin/\n end",
"def windows?\n ::RUBY_PLATFORM =~ /mingw|mswin/\n end",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def windows?\n !!(RUBY_PLATFORM =~ /mswin|mingw/)\n end",
"def windows?\n !(RUBY_PLATFORM =~ /win32/).nil?\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def windows?\n (defined?(RbConfig) ? RbConfig : Config)::CONFIG['host_os'] =~ /mswin|win32|dos|mingw|cygwin/i\n end",
"def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end",
"def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end",
"def is_windows?\n win_patterns = [\n /bccwin/i,\n /cygwin/i,\n /djgpp/i,\n /mingw/i,\n /mswin/i,\n /wince/i\n ]\n\n case RUBY_PLATFORM\n when *win_patterns\n return true\n else\n return false\n end\nend",
"def windows?(platform = nil)\n get_platform(platform) == :WINDOWS\n end",
"def windows?\n kind_of? Windows::Platform rescue false\n end",
"def windows?\n @windows ||= is? /mswin|^win|mingw/\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def windows?\n return @windows if defined?(@windows)\n @windows = (RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i)\n end",
"def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end",
"def include_win?\n RUBY_PLATFORM.include?('mswin') or RUBY_PLATFORM.include?('mingw')\nend",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend",
"def target_win32?\n return true if ENV['OS'] == 'Windows_NT'\n build.is_a?(MRuby::CrossBuild) && build.host_target.to_s =~ /mingw/\nend",
"def windows_platform?(node = __getnode)\n node[\"platform\"] == \"windows\"\n end",
"def is_windows?\n return !!@name.match(/^windows.*$/)\n end",
"def windows?\n has_os? && !!os_image_type.match(/windows/i)\n end",
"def windows?(platform = T.unsafe(nil)); end",
"def is_windows? # {{{\n return @is_win if @is_win\n begin\n require \"win32ole\"\n rescue LoadError\n end\n @is_win ||= Object.const_defined?(\"WIN32OLE\")\n end",
"def windows?\n !!(ua =~ /Windows/)\n end",
"def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64|WOW64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n print_error(\"Problem confirming target is Windows!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\n end",
"def is_mingw?\n @path =~ /mingw/ # Kludge\n end",
"def unix?\n !windows?\n end",
"def is_windows?\n return @is_win if @is_win\n\n begin; require \"win32ole\"; rescue LoadError; end\n\n @is_win ||= Object.const_defined?(\"WIN32OLE\")\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def posix?\n !windows?\n end",
"def windows_xp?\n windows? && !!(ua =~ /Windows NT 5.1/)\n end",
"def windows?(node = __getnode(true))\n # This is all somewhat complicated. We prefer to get the node object so that chefspec can\n # stub the node object. But we also have to deal with class-parsing time where there is\n # no node object, so we have to fall back to RUBY_PLATFORM based detection. We cannot pull\n # the node object out of the Chef.run_context.node global object here (which is what the\n # false flag to __getnode is about) because some run-time code also cannot run under chefspec\n # on non-windows where the node is stubbed to windows.\n #\n # As a result of this the `windows?` helper and the `ChefUtils.windows?` helper do not behave\n # the same way in that the latter is not stubbable by chefspec.\n #\n node ? node[\"platform_family\"] == \"windows\" : windows_ruby?\n end",
"def is_windows?\n return @is_windows unless @is_windows.nil?\n\n require 'win32ole'\n @is_win = Object.const_defined?(:WIN32OLE)\n\n rescue LoadError\n @is_win = Object.const_defined?(:WIN32OLE)\n end",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def unix?\n not windows? and not java?\n end",
"def windows_gemfile_lock?\n platforms.detect do |platform|\n /mingw|mswin/.match(platform.os) if platform.is_a?(Gem::Platform)\n end\n end",
"def windows?\n return @windowsp unless @windowsp.nil?\n\n @windowsp = defined?(RSpec::Support) ? RSpec::Support::OS.windows? : !!File::ALT_SEPARATOR\nend",
"def on_windows?\n # Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard\n # library uses that to test what platform it's on.\n !!File::ALT_SEPARATOR\n end",
"def bash_on_windows?; end",
"def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n puts \"Problem confirming target is Windows\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n puts \"Sorry, can't continue without this piece\".light_red + \"....\\n\\n\".white\n exit 666;\n end\nend",
"def windows?\n ::File::ALT_SEPARATOR == '\\\\'\n end",
"def is_image_windows?\n ami && ami.platform == \"windows\"\n end",
"def ruby_platform_is?(platform)\n ruby_platform = ruby_version?(:<, '1.9.0') ? PLATFORM : RUBY_PLATFORM\n case platform\n when :unix\n ruby_platform =~ /linux|darwin|freebsd|netbsd|solaris|aix|hpux|cygwin/\n when :linux\n ruby_platform =~ /linux/\n when :osx, :darwin\n ruby_platform =~ /darwin/\n when :bsd\n ruby_platform =~ /freebsd|netbsd/\n when :cygwin\n ruby_platform =~ /cygwin/\n when :windows\n ruby_platform =~ /mswin32|mingw32/\n when :mswin32\n ruby_platform =~ /mswin32/\n when :mingw32\n ruby_platform =~ /mingw32/\n when :java\n ruby_platform =~ /java/\n else\n raise RuntimeError, \"Invalid platform specifier\"\n end ? true : false\n end",
"def linux?\n @linux ||= is? /linux|cygwin/\n end",
"def platform\n \"win\"\n end",
"def really_windows?; end",
"def windows_x64?\n !!(windows? && ua =~ /(Win64|x64)/)\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def unix?\n kind_of? Unix::Platform rescue false\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end",
"def linux?\n kind_of? Unix::Platform rescue false\n end",
"def windows_64?\n bool = false\n\n if respond_to?(:IsWow64Process, true)\n pbool = FFI::MemoryPointer.new(:int)\n\n # The IsWow64Process function will return false for a 64 bit process,\n # so we check using both the address size and IsWow64Process.\n if FFI::Platform::ADDRESS_SIZE == 64\n bool = true\n else\n if IsWow64Process(GetCurrentProcess(), pbool)\n bool = true if pbool.read_int == 1\n end\n end\n end\n\n bool\n end",
"def vanilla_windows?; end",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def linux?\n unix? and not mac?\n end",
"def linux?\n unix? and not mac?\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def windows_enabled\n return @windows_enabled\n end",
"def is_linux?\n return (!is_windows? && !is_unix?)\n end",
"def determine_if_x86_64\n (identify_windows_architecture =~ /64/) == 0\n end",
"def docker_for_mac_or_win?\n ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))['Name'] == 'moby'\n rescue\n false\n end",
"def windows_nano?\n return false unless inspec.os[:release].to_i >= 10\n\n inspec.powershell('Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Server\\ServerLevels\" | Select -ExpandProperty \"NanoServer\" ').stdout.chomp == '1'\n end",
"def windows_mobile?\n !!(ua =~ /Windows CE/)\n end",
"def linux?\n !darwin?\n end",
"def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end",
"def linux?\n @linux\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def mac?\n RUBY_PLATFORM =~ /darwin/i\nend",
"def older_than_win_2012_or_8?(node = run_context.nil? ? nil : run_context.node)\n false # we don't support platforms that would be true\n end",
"def vista?\n (/vista/ =~ ruby_platform) != nil\n end",
"def platform_version_windows(arg)\n # Make a best guess and assume a server OS\n # See: http://msdn.microsoft.com/en-us/library/windows/\n # desktop/ms724832(v=vs.85).aspx\n {\n '6.3' => '2012r2', '6.2' => '2012', '6.1' => '2008r2',\n '6.0' => '2008', '5.2' => '2003r2', '5.1' => 'xp', '5.0' => '2000'\n }[arg.match(/^[0-9]+\\.[0-9]+/).to_s]\n end",
"def ruby_platform\n RUBY_PLATFORM\n end",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def mac?\n kind_of? Mac::Platform rescue false\n end",
"def linux?\n linux_internal?\n end",
"def win_64bit?\n x86_64? && (latest_version? || new_resource.version.split('.').first.to_i >= 42)\nend",
"def windows_ansi?\n defined?(Win32::Console) || ENV['ANSICON'] || (windows? && mri_2?)\n end",
"def macys?\n ExecutionEnvironment.macys?\n end",
"def darwin?\n RUBY_PLATFORM.include?('darwin')\n end",
"def jruby?\n /java/ === RUBY_PLATFORM\nend",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def is_cross_compiled_linux?\n return (is_cross_compiled? && is_linux?)\n end",
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def linux?(platform = nil)\n get_platform(platform) == :LINUX\n end",
"def linux?\n !!(ua =~ /Linux/)\n end"
] |
[
"0.89685285",
"0.88856333",
"0.8876175",
"0.88279444",
"0.88044524",
"0.87782013",
"0.87726754",
"0.8738121",
"0.8675495",
"0.8602965",
"0.85876185",
"0.85861796",
"0.85861796",
"0.85363835",
"0.853565",
"0.84212756",
"0.8397273",
"0.83863753",
"0.83777785",
"0.8355444",
"0.83174455",
"0.82585645",
"0.82185847",
"0.8109795",
"0.8038185",
"0.79787445",
"0.7941484",
"0.79084265",
"0.7892954",
"0.7875964",
"0.7813108",
"0.7789542",
"0.7783523",
"0.7742295",
"0.7691949",
"0.76401895",
"0.76328605",
"0.75846726",
"0.7568372",
"0.7442816",
"0.7414135",
"0.74009216",
"0.739062",
"0.73859847",
"0.73856825",
"0.7384954",
"0.73015976",
"0.7294936",
"0.7270723",
"0.72422683",
"0.72215223",
"0.7213094",
"0.7206925",
"0.7100239",
"0.70879984",
"0.69664484",
"0.6923809",
"0.6920287",
"0.6910801",
"0.6888277",
"0.68486494",
"0.68203294",
"0.6774427",
"0.6754006",
"0.6673201",
"0.66385156",
"0.661916",
"0.6608219",
"0.6604016",
"0.65863335",
"0.65305734",
"0.651868",
"0.64858055",
"0.64693034",
"0.6458939",
"0.64281744",
"0.64221174",
"0.6416665",
"0.64092755",
"0.640885",
"0.640631",
"0.63973546",
"0.63844335",
"0.6373655",
"0.6348698",
"0.6337295",
"0.63354677",
"0.6322807",
"0.62977654",
"0.6288391",
"0.62809664",
"0.62755907",
"0.627078",
"0.6270254",
"0.62555605",
"0.62482685",
"0.6239708",
"0.6236015",
"0.6236003",
"0.62338746"
] |
0.6778876
|
62
|
Is current platform Mac OS X (aka Darwin)? === Return true:: If ruby interpreter is running on Mac false:: Otherwise
|
def mac?
@mac
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mac?\n (/darwin/ =~ ruby_platform) != nil\n end",
"def mac?\n (/darwin/ =~ RUBY_PLATFORM) != nil\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def darwin?\n RUBY_PLATFORM.include?('darwin')\n end",
"def mac?\n RUBY_PLATFORM =~ /darwin/i\nend",
"def darwin?\n /darwin/.match(RUBY_PLATFORM)\n end",
"def darwin?\n platform =~ /darwin/\n end",
"def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end",
"def mac?\n Config::CONFIG[\"host_os\"] =~ /darwin/i ? true : false\n end",
"def macos_ruby?\n !!(RUBY_PLATFORM =~ /darwin/)\n end",
"def mac?\n Config::CONFIG['target_os'] == \"darwin\"\n end",
"def mac?\n kind_of? Mac::Platform rescue false\n end",
"def is_darwin?\n Sprout.current_system.is_a?(Sprout::System::OSXSystem)\n end",
"def mac?\n !!(ua =~ /Mac OS X/ && !ios?)\n end",
"def osx?(platform = nil)\n get_platform(platform) == :MACOS\n end",
"def mac?\n @mac ||= is? /mac|darwin/\n end",
"def macos_platform?(node = __getnode)\n node[\"platform\"] == \"mac_os_x\"\n end",
"def macos?(node = __getnode)\n node ? node[\"platform_family\"] == \"mac_os_x\" : macos_ruby?\n end",
"def from_osx?\n @from_osx ||= begin\n p = `#{binary} -c \"import sys; print(sys.prefix)\"`.strip\n p.start_with?(\"/System/Library/Frameworks/Python.framework\")\n end\n end",
"def is_os_x?\n RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def macys?\n ExecutionEnvironment.macys?\n end",
"def is_macos?\n !!(@name =~ /^macos-.*$/ || @name =~ /^osx-.*$/)\n end",
"def linux?\n !darwin?\n end",
"def linux?\n unix? and not mac?\n end",
"def linux?\n unix? and not mac?\n end",
"def osx?(platform = T.unsafe(nil)); end",
"def ios? ; RUBY_PLATFORM =~ /arm-darwin/i end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def is_osx?\n VanagonLogger.info \"is_osx? is a deprecated method, please use #is_macos? instead.\"\n is_macos?\n end",
"def not_a_mac\n if mac?\n return false\n else\n puts I18n.t(:mac_only)\n return true\n end\n end",
"def mac?\n mac_internal?\n end",
"def mac?(req)\n user_agent_match(req, /(Macintosh)/)\n end",
"def jruby?\n /java/ === RUBY_PLATFORM\nend",
"def ruby_platform_is?(platform)\n ruby_platform = ruby_version?(:<, '1.9.0') ? PLATFORM : RUBY_PLATFORM\n case platform\n when :unix\n ruby_platform =~ /linux|darwin|freebsd|netbsd|solaris|aix|hpux|cygwin/\n when :linux\n ruby_platform =~ /linux/\n when :osx, :darwin\n ruby_platform =~ /darwin/\n when :bsd\n ruby_platform =~ /freebsd|netbsd/\n when :cygwin\n ruby_platform =~ /cygwin/\n when :windows\n ruby_platform =~ /mswin32|mingw32/\n when :mswin32\n ruby_platform =~ /mswin32/\n when :mingw32\n ruby_platform =~ /mingw32/\n when :java\n ruby_platform =~ /java/\n else\n raise RuntimeError, \"Invalid platform specifier\"\n end ? true : false\n end",
"def ios?\n platform_name.to_s.upcase == IOS\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def client_os? system\n detect_os == system.to_sym\n end",
"def unix?\n kind_of? Unix::Platform rescue false\n end",
"def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def platform; RUBY_PLATFORM; end",
"def unix?\n not windows? and not java?\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def is_unix?\n return !!@name.match(/^(solaris|aix|osx)-.*$/)\n end",
"def is_nix_os?\n RbConfig::CONFIG[\"host_os\"] =~ /linux|freebsd|darwin|unix/\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end",
"def is_platform(symbol)\n platform = ENV['PLATFORM'] || 'all'\n platform = platform.downcase # If set, will be frozen.\n\n if platform == 'macos'\n # CocoaPods calls this osx\n platform = 'osx'\n end\n platform = platform.to_sym\n\n if symbol == platform || platform == :all\n puts \"Adding #{symbol} targets to the project\"\n return true\n else\n return false\n end\nend",
"def java?\n (/java/ =~ ruby_platform) != nil\n end",
"def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end",
"def os_x_older?\n os_x? && RUBY_PLATFORM.include?('11')\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def workaround_older_macosx_misreported_cpu?\n os == :macosx && is_64_bit?\n end",
"def mac_os_onboarded\n return @mac_os_onboarded\n end",
"def can_run_headless?\n on_mac = (RUBY_PLATFORM =~ /darwin/)\n puts \"You requested to run headless, but this only works under Linux\" if wants_headless? and on_mac\n not on_mac\n end",
"def java?\n !! (RUBY_PLATFORM =~ /java/)\nend",
"def linux?\n kind_of? Unix::Platform rescue false\n end",
"def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end",
"def platform\n RUBY_PLATFORM\n end",
"def docker_for_mac_or_win?\n ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))['Name'] == 'moby'\n rescue\n false\n end",
"def ruby_platform\n RUBY_PLATFORM\n end",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def posix?\n !windows?\n end",
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend",
"def looks_like_rackspace? \n has_rackspace_mac?\nend",
"def detect_os\n @@os_features ||= nil\n return @@os_features if @@os_features\n @@os_features ||= {}\n\n # Mac Miner\n mac_miner = lambda do\n version = `sw_vers -productVersion`.match(/\\d+\\.\\d+(?:\\.\\d+)?/)[0]\n @@os_features.merge!({\n :platform => \"darwin\",\n :os_distro => \"Mac OSX\",\n :os_version => version,\n :os_nickname => case version.split(\".\")[0..1].join(\".\")\n when \"10.0\"; \"Cheetah\"\n when \"10.1\"; \"Puma\"\n when \"10.2\"; \"Jaguar\"\n when \"10.3\"; \"Panther\"\n when \"10.4\"; \"Tiger\"\n when \"10.5\"; \"Leopard\"\n when \"10.6\"; \"Snow Leopard\"\n when \"10.7\"; \"Lion\"\n when \"10.8\"; \"Mountain Lion\"\n when \"10.9\"; \"Mavericks\"\n when \"10.10\"; \"Yosemite\"\n else; \"Unknown Version of OSX\"\n end,\n :install_method => \"install\",\n :hostname => `hostname`.chomp,\n })\n if Pathname.which(\"brew\")\n @@os_features[:install_cmd] = \"brew install\"\n elsif Pathname.which(\"port\")\n @@os_features[:install_cmd] = \"port install\"\n else\n @@os_features[:install_method] = \"build\"\n end\n @@os_features\n end\n\n # Linux Miner\n linux_miner = lambda do\n # Ensure LSB is installed\n if not Pathname.which(\"lsb_release\")\n pkg_mgrs = {\n \"apt-get\" => \"install -y lsb\", # Debian/Ubuntu/Linux Mint/PCLinuxOS\n \"up2date\" => \"-i lsb\", # RHEL/Oracle\n \"yum\" => \"install -y lsb\", # CentOS/Fedora/RHEL/Oracle\n \"zypper\" => \"--non-interactive install lsb\", # OpenSUSE/SLES\n \"pacman\" => \"-S --noconfirm lsb-release\", # ArchLinux\n \"urpmi\" => \"--auto lsb-release\", # Mandriva/Mageia\n \"emerge\" => \"lsb_release\", # Gentoo\n \"slackpkg\" => \"\", # Slackware NOTE - doesn't have lsb\n }\n ret = false\n pkg_mgrs.each do |mgr,args|\n if Pathname.which(mgr)\n if mgr == \"slackpkg\" && File.exists?(\"/etc/slackware-version\")\n ret = true\n else\n ret = system(\"sudo #{mgr} #{args}\")\n end\n break if ret\n end\n end\n end\n\n arch_family = `arch 2> /dev/null`.chomp\n pkg_arch = arch_family\n install_method = \"install\"\n if File.exists?(\"/etc/slackware-version\") || Pathname.which(\"slackpkg\")\n # Slackware\n nickname = File.read(\"/etc/slackware-version\").strip\n version = nickname.split[1..-1].join(\" \")\n major_release = version.to_i\n distro = \"Slackware\"\n pkg_fmt = major_release < 13 ? \"tgz\" : \"txz\"\n install = \"slackpkg -batch=on -default_answer=y install\"\n local_install = \"installpkg\"\n elsif File.exists?(\"/etc/oracle-release\") || File.exists?(\"/etc/enterprise-release\")\n if File.exists?(\"/etc/oracle-release\")\n nickname = File.read(\"/etc/oracle-release\").strip\n else\n nickname = File.read(\"/etc/enterprise-release\").strip\n end\n version = nickname.match(/\\d+(\\.\\d+)?/)[0]\n major_release = version.to_i\n distro, pkg_fmt, install, local_install = \"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"\n else\n version = `lsb_release -r 2> /dev/null`.strip.split[1..-1].join(\" \")\n major_release = version.to_i\n nickname = `lsb_release -c 2> /dev/null`.strip.split[1..-1].join(\" \")\n lsb_release_output = `lsb_release -a 2> /dev/null`.chomp\n distro, pkg_fmt, install, local_install = case lsb_release_output\n when /(debian|ubuntu|mint)/i\n pkg_arch = \"amd64\" if arch_family == \"x86_64\"\n [$1, \"deb\", \"apt-get install -y\", \"dpkg -i\"]\n when /(centos|fedora)/i\n [$1, \"rpm\", \"yum install -y\", \"yum localinstall -y\"]\n when /oracle/i\n [\"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /redhat|rhel/i\n [\"RHEL\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /open\\s*suse/i\n [\"OpenSUSE\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /suse.*enterprise/i\n [\"SLES\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /archlinux/i\n [\"ArchLinux\", \"pkg.tar.xz\", \"pacman -S --noconfirm\", \"pacman -U --noconfirm\"]\n when /(mandriva|mageia)/i\n [$1, \"rpm\", \"urpmi --auto \", \"rpm -Uvh\"]\n when /pc\\s*linux\\s*os/i\n [\"PCLinuxOS\", \"rpm\", \"apt-get install -y\", \"rpm -Uvh\"]\n when /gentoo/i\n [\"Gentoo\", \"tgz\", \"emerge\", \"\"]\n else\n install_method = \"build\"\n [`lsb_release -d 2> /dev/null`.strip.split[1..-1].join(\" \")]\n end\n end\n ret = {\n :platform => \"linux\",\n :os_distro => distro,\n :pkg_format => pkg_fmt,\n :pkg_arch => pkg_arch,\n :os_version => version,\n :install_method => install_method,\n :install_cmd => install,\n :local_install_cmd => local_install,\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n # Solaris Miner\n solaris_miner = lambda do\n distro = `uname -a`.match(/(open\\s*)?(solaris)/i)[1..-1].compact.map { |s| s.capitalize }.join\n version = `uname -r`.strip\n nickname = \"#{distro} #{version.split('.')[-1]}\"\n if distro == \"OpenSolaris\"\n nickname = File.read(\"/etc/release\").match(/OpenSolaris [a-zA-Z0-9.]\\+/i)[0].strip\n end\n @@os_features.merge!({\n :platform => \"solaris\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg install\",\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n })\n end\n\n # *BSD Miner\n bsd_miner = lambda do\n distro = `uname -s`.strip\n version = `uname -r`.strip\n @@os_features.merge!({\n :platform => \"bsd\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg_add -r\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # BeOS Miner\n beos_miner = lambda do\n version = `uname -r`.strip\n distro = `uname -s`.strip\n @@os_features.merge!({\n :platform => \"beos\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"build\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # Windows Miner\n windows_miner = lambda do\n sysinfo = `reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\"`.chomp\n\n hostname = `reg query \"HKEY_LOCAL_MACHINE\\\\System\\\\CurrentControlSet\\\\Control\\\\ComputerName\\\\ComputerName\"`.chomp\n hostname = hostname.match(/^\\s*ComputerName\\s+\\w+\\s+(.*)/i)[1].strip\n\n version = sysinfo.match(/^\\s*CurrentVersion\\s+\\w+\\s+(.*)/i)[1].strip << \".\"\n version << sysinfo.match(/^\\s*CurrentBuildNumber\\s+\\w+\\s+(.*)/i)[1].strip\n\n nickname = sysinfo.match(/^\\s*ProductName\\s+\\w+\\s+(.*)/i)[1].strip\n nickname = \"Microsoft #{nickname}\" unless nickname =~ /^Microsoft/\n\n try_boot_ini = `type C:\\\\boot.ini 2> nul | findstr /C:\"WINDOWS=\"`.chomp\n unless try_boot_ini.empty?\n nickname = try_boot_ini.match(/WINDOWS=\"([^\"]+)\"/i)[1].strip\n end\n\n install_method, install_cmd = case ::RbConfig::CONFIG['host_os'].downcase\n when /mingw/; [\"build\", nil]\n when /mswin/; [\"install\", \"install\"]\n when /cygwin/; [\"install\", \"setup.exe -q -D -P\"] # TODO - Does this detect cygwin properly?\n end\n ret = {\n :os_distro => nickname.split(/\\s+/).reject { |s| s =~ /microsoft|windows/i }.join(\" \"),\n :hostname => hostname,\n :os_nickname => nickname,\n :os_version => version,\n :platform => \"windows\", # TODO - Cygwin / MinGW\n :install_method => install_method,\n :install_cmd => install_cmd,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n case ::RbConfig::CONFIG['host_os'].downcase\n when /darwin/; mac_miner[]\n when /mswin|mingw/; windows_miner[]\n when /linux/; linux_miner[]\n when /bsd/; bsd_miner[]\n when /solaris/; solaris_miner[]\n else\n case `uname -s`.chomp.downcase\n when /linux/; linux_miner[]\n when /darwin/; mac_miner[]\n when /solaris/; solaris_miner[]\n when /bsd/; bsd_miner[]\n when /dragonfly/; bsd_miner[]\n when /haiku/; beos_miner[]\n when /beos/; beos_miner[]\n end\n end\n\n @@os_features.freeze\n end",
"def unix?\n !windows?\n end",
"def needs_sandbox?\n MAC_OS_X_PRODUCT_VERSION > 10.7\n end",
"def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end",
"def os_s\n\t\tif(os == 'iPad' || os == 'BlackBerry' || os == 'iPhone' || os == 'Android')\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end",
"def should_do_python_install?\n return (osx? and (not (File.exists?(python_directory))))\n end",
"def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end",
"def as_framework?\n (self.installed? and File.exists? prefix+\"Frameworks/Python.framework\") or build_framework?\n end",
"def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end",
"def linux?\n !!(ua =~ /Linux/)\n end",
"def netbsd_platform?(node = __getnode)\n node[\"platform\"] == \"netbsd\"\n end",
"def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend",
"def windows?(platform = T.unsafe(nil)); end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end",
"def get_platform(platform = nil)\n platform ||= RUBY_PLATFORM\n case platform\n when /darwin/ then :MACOS\n when /cygwin|mswin|mingw|bccwin|wince|emx/ then :WINDOWS\n else :LINUX\n end\n end",
"def windows?\n ::RUBY_PLATFORM =~ /mingw|mswin/\n end",
"def target_win32?\n return true if ENV['OS'] == 'Windows_NT'\n build.is_a?(MRuby::CrossBuild) && build.host_target.to_s =~ /mingw/\nend",
"def is_os? os\n Os.is_os? request.user_agent, os\n end",
"def is_cross_compiled_linux?\n return (is_cross_compiled? && is_linux?)\n end",
"def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end",
"def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end",
"def os\n app = app_with_comments\n return app.comment[0] if app && app.comment[0]\n\n app = detect_product(DARWIN)\n [IOS, OperatingSystems::Darwin::IOS[app.version.to_s]].compact.join(' ') if app\n end",
"def openbsd_platform?(node = __getnode)\n node[\"platform\"] == \"openbsd\"\n end",
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def linux?\n linux_internal?\n end",
"def apple_silicon?\n RUBY_PLATFORM.match(/arm64/)\n end"
] |
[
"0.8963423",
"0.8803325",
"0.8684129",
"0.866403",
"0.8634658",
"0.861514",
"0.8592091",
"0.85783565",
"0.85065717",
"0.84583765",
"0.84462",
"0.8441988",
"0.8429795",
"0.8189937",
"0.81176597",
"0.8073296",
"0.79785526",
"0.7952804",
"0.7930211",
"0.78919923",
"0.784425",
"0.7752802",
"0.7655202",
"0.76167005",
"0.75736713",
"0.7559981",
"0.74646455",
"0.742607",
"0.73047256",
"0.7253628",
"0.71057785",
"0.70856494",
"0.70451397",
"0.6993104",
"0.6956837",
"0.69367915",
"0.6859573",
"0.68408984",
"0.6794221",
"0.6790651",
"0.67769104",
"0.67657596",
"0.6760472",
"0.6738431",
"0.6725488",
"0.6700169",
"0.66813755",
"0.666602",
"0.66413796",
"0.65948296",
"0.6586306",
"0.6570717",
"0.656501",
"0.6559229",
"0.65552056",
"0.6550579",
"0.65431905",
"0.653387",
"0.6530604",
"0.65295196",
"0.649807",
"0.6494853",
"0.64946973",
"0.64835244",
"0.6475461",
"0.64610064",
"0.64520144",
"0.64345545",
"0.64301497",
"0.63938314",
"0.6388921",
"0.63341856",
"0.63282526",
"0.6326913",
"0.6324228",
"0.631891",
"0.6290982",
"0.6284195",
"0.62722105",
"0.62656397",
"0.6248538",
"0.6205772",
"0.6186815",
"0.6166706",
"0.6165787",
"0.61518776",
"0.6142409",
"0.61375535",
"0.6134328",
"0.61326003",
"0.61321086",
"0.6120986",
"0.6119223",
"0.6118254",
"0.6118254",
"0.6116282",
"0.6113091",
"0.61122054",
"0.6103348",
"0.6096402"
] |
0.6322379
|
75
|
Is current platform linux? === Return true:: If ruby interpreter is running on Linux false:: Otherwise
|
def linux?
@linux
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def linux?\n kind_of? Unix::Platform rescue false\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def is_linux?\n return (!is_windows? && !is_unix?)\n end",
"def linux?\n !!(ua =~ /Linux/)\n end",
"def linux?\n linux_internal?\n end",
"def linux?(platform = nil)\n get_platform(platform) == :LINUX\n end",
"def linux?\n unix? and not mac?\n end",
"def linux?\n @linux ||= is? /linux|cygwin/\n end",
"def linux?\n unix? and not mac?\n end",
"def linux?\n has_os? && !!os_image_type.match(/suse|redhat|ubuntu|debian|centos|fedora/i)\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def is_cross_compiled_linux?\n return (is_cross_compiled? && is_linux?)\n end",
"def linux?\n !darwin?\n end",
"def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def unix?\n kind_of? Unix::Platform rescue false\n end",
"def ruby_platform_is?(platform)\n ruby_platform = ruby_version?(:<, '1.9.0') ? PLATFORM : RUBY_PLATFORM\n case platform\n when :unix\n ruby_platform =~ /linux|darwin|freebsd|netbsd|solaris|aix|hpux|cygwin/\n when :linux\n ruby_platform =~ /linux/\n when :osx, :darwin\n ruby_platform =~ /darwin/\n when :bsd\n ruby_platform =~ /freebsd|netbsd/\n when :cygwin\n ruby_platform =~ /cygwin/\n when :windows\n ruby_platform =~ /mswin32|mingw32/\n when :mswin32\n ruby_platform =~ /mswin32/\n when :mingw32\n ruby_platform =~ /mingw32/\n when :java\n ruby_platform =~ /java/\n else\n raise RuntimeError, \"Invalid platform specifier\"\n end ? true : false\n end",
"def ubuntu_platform?(node = __getnode)\n node[\"platform\"] == \"ubuntu\"\n end",
"def linuxmint_platform?(node = __getnode)\n node[\"platform\"] == \"linuxmint\"\n end",
"def oracle_linux?(node)\n node['platform'] == 'oracle'\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def unix?\n not windows? and not java?\n end",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def linux_mint?(node)\n node['platform'] == 'linuxmint'\n end",
"def linux_type\n redhat_linux_type || suse_linux_type || unknown_linux_type\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def is_nix_os?\n RbConfig::CONFIG[\"host_os\"] =~ /linux|freebsd|darwin|unix/\n end",
"def is_unix?\n return !!@name.match(/^(solaris|aix|osx)-.*$/)\n end",
"def supported_by_platform?\n right_platform = RightScale::Platform.linux?\n right_platform && user_exists?('rightscale') # avoid calling user_exists? on unsupported platform(s)\n end",
"def amazon_linux?(node)\n node['platform'] == 'amazon'\n end",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def unix?\n !windows?\n end",
"def ubuntu?(node)\n node['platform'] == 'ubuntu'\n end",
"def determine_os\n @os = 'linux'\n end",
"def posix?\n !windows?\n end",
"def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end",
"def ruby_platform\n RUBY_PLATFORM\n end",
"def determine_os\n @os = \"linux\"\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end",
"def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end",
"def linux\n raise PlatformError.new(\"Only available under Linux\") unless linux?\n require_linux\n return Linux.new\n end",
"def scientific_linux?(node)\n node['platform'] == 'scientific'\n end",
"def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end",
"def ubuntu16x?\n platform_family?('debian') && node['platform_version'][/^16/]\n end",
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def raspbian_platform?(node = __getnode)\n node[\"platform\"] == \"raspbian\"\n end",
"def centos_platform?(node = __getnode)\n node[\"platform\"] == \"centos\"\n end",
"def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end",
"def ubuntu12x?\n platform_family?('debian') && node['platform_version'][/^12/]\n end",
"def ubuntu12x?\n platform_family?('debian') && node['platform_version'][/^12/]\n end",
"def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end",
"def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end",
"def debian_platform?(node = __getnode)\n node[\"platform\"] == \"debian\"\n end",
"def openbsd_platform?(node = __getnode)\n node[\"platform\"] == \"openbsd\"\n end",
"def linux_version\n case ENV['MACHTYPE']\n when \"s390x-suse-linux\"\n :sles_zlnx\n when /^i[356]86/\n if File.exist? \"/etc/fedora-release\"\n :linux_ia32_cell\n else\n :linux_ia32\n end\n else\n if File.exist? \"/etc/rhel-release\"\n :rhel\n elsif File.exist? \"/etc/redhat-release\"\n `awk '/release 5/||/release 4.9/{v=5};/release 4/{v=4}; END {print \"rhel\" v}' /etc/redhad-release`.to_sym\n elsif File.exist? \"/etc/SuSE-release\"\n `awk '$1==\"VERSION\" { v=$3}; END { print \"sles\" v}' /etc/SuSE-release`.to_sym\n elsif File.exist? \"/etc/yellowdog-release\"\n :yhpc\n else\n :rhel\n end\n end\nend",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end",
"def centos?(node)\n node['platform'] == 'centos'\n end",
"def debian?\n platform_family?('debian')\n end",
"def debian?\n platform_family?('debian')\n end",
"def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end",
"def freebsd_platform?(node = __getnode)\n node[\"platform\"] == \"freebsd\"\n end",
"def netbsd_platform?(node = __getnode)\n node[\"platform\"] == \"netbsd\"\n end",
"def windows_ruby?\n !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)\n end",
"def gcc?\n linux? && present?('g++')\n end",
"def shell_ruby_platform\n `ruby -rrbconfig -e \"puts RbConfig::CONFIG['sitearchdir']\"`\n end",
"def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend",
"def ubuntu14x?\n platform_family?('debian') && node['platform_version'][/^14/]\n end",
"def ubuntu14x?\n platform_family?('debian') && node['platform_version'][/^14/]\n end",
"def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end",
"def platform; RUBY_PLATFORM; end",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def is_yum_platform\n node[:platform_family] == \"rhel\"\nend",
"def mac?\n RUBY_PLATFORM =~ /darwin/i\nend",
"def jruby?\n /java/ === RUBY_PLATFORM\nend",
"def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end",
"def fedora_platform?(node = __getnode)\n node[\"platform\"] == \"fedora\"\n end",
"def platform\n RUBY_PLATFORM\n end",
"def is_windows?\n win_patterns = [\n /bccwin/i,\n /cygwin/i,\n /djgpp/i,\n /mingw/i,\n /mswin/i,\n /wince/i\n ]\n\n case RUBY_PLATFORM\n when *win_patterns\n return true\n else\n return false\n end\nend",
"def mac?\n (/darwin/ =~ ruby_platform) != nil\n end",
"def sysv_semaphores_supported?\n /linux/.match(RUBY_PLATFORM)\n end",
"def windows?\n (defined?(RbConfig) ? RbConfig : Config)::CONFIG['host_os'] =~ /mswin|win32|dos|mingw|cygwin/i\n end",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def keygen_platform?\n return true if platform?('amazon', 'fedora')\n return true if rhel_7_plus?\n opensuse_15_plus?\n end",
"def mac?\n kind_of? Mac::Platform rescue false\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def is_os_x?\n RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n end",
"def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end",
"def darwin?\n RUBY_PLATFORM.include?('darwin')\n end"
] |
[
"0.9147632",
"0.9111422",
"0.9108628",
"0.88047165",
"0.87938666",
"0.87110966",
"0.8699413",
"0.86540294",
"0.8617134",
"0.85832095",
"0.85815465",
"0.8543316",
"0.8516964",
"0.84376806",
"0.84174037",
"0.8249068",
"0.8237718",
"0.8211903",
"0.8143571",
"0.7845609",
"0.763768",
"0.76345664",
"0.7611557",
"0.758641",
"0.7570675",
"0.75697035",
"0.7548069",
"0.75234425",
"0.7497832",
"0.7369796",
"0.73502505",
"0.7336059",
"0.7310977",
"0.73002565",
"0.72763544",
"0.7266776",
"0.7236957",
"0.7235714",
"0.7226135",
"0.7196073",
"0.7174908",
"0.71367806",
"0.71195257",
"0.7113069",
"0.7110076",
"0.7109329",
"0.7109329",
"0.71005726",
"0.70992565",
"0.7084346",
"0.7072517",
"0.7040815",
"0.7039972",
"0.70358604",
"0.70324516",
"0.70321906",
"0.70099086",
"0.6995558",
"0.6995558",
"0.69938266",
"0.69938266",
"0.697825",
"0.69670045",
"0.6966865",
"0.69542855",
"0.693271",
"0.69183",
"0.6891826",
"0.68878686",
"0.6872763",
"0.6872763",
"0.6868886",
"0.68661594",
"0.686552",
"0.6836573",
"0.6826859",
"0.6819696",
"0.67814577",
"0.6779974",
"0.6779974",
"0.6769011",
"0.67681825",
"0.6741481",
"0.6741417",
"0.673888",
"0.6731257",
"0.672559",
"0.67090666",
"0.6706377",
"0.6705377",
"0.66927224",
"0.66816306",
"0.6671145",
"0.6665139",
"0.6633106",
"0.6632943",
"0.6631468",
"0.66287965",
"0.66178983",
"0.6597901"
] |
0.8602709
|
9
|
Are we in an EC2 cloud? === Return true:: If machine is located in an EC2 cloud false:: Otherwise
|
def ec2?
resolve_cloud_type if @ec2.nil?
@ec2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end",
"def on_ec2?\n ec2 != nil\n end",
"def on_ec2?\n ec2 != nil\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def on_ec2?\n ec2 != nil\nend",
"def ec2?(node)\n node.key?('ec2')\n end",
"def cloud?(node)\n node.key?('cloud')\n end",
"def ec2_instance?\n Net::HTTP.get_response(URI.parse(metadata_url)) && true\n rescue\n false\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def ec2?(node = __getnode)\n node.key?(\"ec2\")\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def amazon_linux?(node)\n node['platform'] == 'amazon'\n end",
"def is_instance_ossec_agent?\n listing = run_ssh_command 'sudo ls /var/ossec/etc'\n if listing.index('cannot access').nil?\n return true\n else\n notify 'seems to be not an ossec instance:'\n notify listing\n return false\n end\n end",
"def aws?\n bosh_provider == \"aws\"\n end",
"def resolve_cloud_type\n cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n @ec2 = false\n @rackspace = false\n @eucalyptus = false\n case cloud_type\n when 'ec2' then ec2 = true\n when 'rackspace' then @rackspace = true\n when 'eucalyptus' then eucalyptus = true\n end\n end",
"def amazon_platform?(node = __getnode)\n node[\"platform\"] == \"amazon\"\n end",
"def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end",
"def ec2_instance_ready?(instance)\n instance.exists? && instance.status.eql?(:running) && systems_ok(instance)\n end",
"def centos?\n @flavor =~ /centos/\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def amazon?(node = __getnode)\n node[\"platform_family\"] == \"amazon\"\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def use_existing_vpc?\n return false unless configured?\n\n @aws_config['use_existing_vpc']\n end",
"def ubuntu?\n @flavor =~ /ubuntu/\n end",
"def check_instance\n return if ec2_instance?\n abort 'FATAL: NOT an EC2 instance or could not connect to Metadata'\n end",
"def instance_exists?(ec2_client, instance_id)\n ec2_client.describe_instances(instance_ids: [instance_id])\n return true\nrescue StandardError\n return false\nend",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def server_exist?(server_name)\n compute = find_match(@compute.servers, server_name)\n Puppet.debug \"found server #{compute.name}\" if compute != nil\n Puppet.debug \"server not found : #{server_name}\" if compute == nil\n return (compute != nil)\n end",
"def on_openstack?\n openstack != nil\n end",
"def on_openstack?\n openstack != nil\n end",
"def use_ssh?\r\n return false if lxd_transport_selected?\r\n return true if config[:ssh_login]\r\n return false if config[:ssh_login] == false # allow forced disable for cloud-images... or (TODO: should I not default enable for them?)\r\n cloud_image?\r\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"def centos?(node)\n node['platform'] == 'centos'\n end",
"def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def gce?(node)\n node.key?('gce')\n end",
"def esxi_installed?\n os_image_type == \"vmware_esxi\" && os_installed?\n end",
"def google_cloud_environment?(url = nil)\n url ||= self.url\n !!url.match(/\\.c4d\\.devops\\.fds\\.com/) || !!url.match(/\\.gce\\.c4d\\.griddynamics\\.net/)\n end",
"def openstack?\n bosh_provider == \"openstack\"\n end",
"def hosted_service?\n return false unless registration_name\n find_provider\n return false unless config[:host_match]\n !matches?(config[:host_match])\n end",
"def is_online?\n begin\n dc_version = crm_attribute '-q', '--type', 'crm_config', '--query', '--name', 'dc-version'\n return false unless dc_version\n return false if dc_version.empty?\n return false unless cib_section_nodes_state\n true\n rescue Puppet::ExecutionFailure\n false\n end\n end",
"def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend",
"def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"def valid_target_url?\n return false unless cloud_info = cloud_info()\n return false unless cloud_info[:name]\n return false unless cloud_info[:build]\n return false unless cloud_info[:support]\n return false unless cloud_info[:version]\n true\n rescue\n false\n end",
"def exists_on_server?\n false\n end",
"def is_cloudfront?\n type.downcase == \"cloudfront\"\n end",
"def i2c_exists?\n\tFile.exist?('/dev/i2c-0') || File.exist?('/dev/i2c-1')\nend",
"def is_ubuntu?\n return !!@name.match(/^ubuntu-.*$/)\n end",
"def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end",
"def ubuntu?(node)\n node['platform'] == 'ubuntu'\n end",
"def dell_server?\n provider.dell_server?\n end",
"def ready?\n return false unless exists?\n instance_arns = ecs_client.list_container_instances(cluster: name).container_instance_arns\n return false if instance_arns.nil? or instance_arns.empty?\n res = ecs_client.describe_container_instances(\n cluster: name,\n container_instances: instance_arns\n )\n # unless res.respond_to?(\"container_instances\") or\n # res.container_instances.nil?\n # return false\n # end\n res.container_instances.all? {|i| i.status == \"ACTIVE\" }\n end",
"def on_gce?\n gce != nil\n end",
"def on_gce?\n gce != nil\n end",
"def exists?\n @aws_instance.exists? && @aws_instance.state.name != 'terminated'\n end",
"def ssh_to_compute_node?\n if !cluster_ssh_to_compute_node?.nil?\n return cluster_ssh_to_compute_node?\n else\n return global_ssh_to_compute_node?\n end\n end",
"def rhel?\n @flavor =~ /redhatenterpriseserver/\n end",
"def available?\n @vpc.state == 'available'\n end",
"def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end",
"def is_production?\n %w(prod production).include?(node.chef_environment)\n end",
"def local?(ip = remote_ip)\n # TODO: should check if requesting machine is the one the server is running\n return true if ip == '127.0.0.1'\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def local?\r\n return ['localhost', '127.0.0.1'].include?($options[:host])\r\nend",
"def doi_server_reachable?\n # Invoke the API and get response\n true\n end",
"def ready?\n self.class.ready?(@cloud_id, credentials: @credentials)\n end",
"def test_system?\n rack_env?(:test) && pegasus_hostname == \"test.#{site_domain}\"\n end",
"def openstack?(node)\n node.key?('openstack')\n end",
"def vhost?\n !service.use_ssl && service.use_vhost && \"#@name.#{S3.host}\" =~ /\\A#{URI::REGEXP::PATTERN::HOSTNAME}\\Z/\n end",
"def server?\n @role == :server\n end",
"def active?\n servers.any?\n end",
"def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend",
"def instance_running? instance\n\t\t\tunless instance.host == host\n\t\t\t\traise ArgumentError, \"Cannot check instances on remote hosts!\"\n\t\t\tend\n\t\t\t# This seems like a reasonable way to check without `ps ...`.\n\t\t\tFile.directory?(\"/proc/#{instance.pid}\")\n\t\tend",
"def exists?\n\t\t# Look for cluster\n\t\t@cluster_id = DSMAPIServer.find_server(@resource[:name], @resource[:storagecenter])\n\t\tif @cluster_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end",
"def ec?\n @spki.public_key.kind_of?(OpenSSL::PKey::EC)\n end",
"def cuisineaz_host? url\n return url.include? CUISINEAZ_HOST[:desktop]\n end",
"def configured_network?(network, server)\n case network.type\n when \"FIP_SNOOPING\"\n false\n when \"PXE\"\n server.os_image_type == \"vmware_esxi\" || !server.os_installed?\n else\n true\n end\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def not_cloud_start(cloud_type, vm_ips, vm_ip_roles, vm_img_roles, pm_up)\n \n # Try to find one virtual machine that is already running\n vm_ips.each do |vm|\n if alive?(vm)\n # This machine is running\n puts \"#{vm} is up\"\n vm_leader = vm\n\n # Inform the user of this machine\n puts \"#{vm_leader} is already running\"\n puts \"Do 'puppet apply manifest.pp' on #{vm_leader}\"\n return\n end\n end\n \n # No machines are running\n puts \"All virtual machines are stopped\"\n puts \"Starting one of them...\"\n \n # Start one of the virtual machines\n vm = vm_ips[rand(vm_ips.count)] # Choose one randomly\n puts \"Starting #{vm} ...\"\n \n @vm_manager.start_vm(vm, vm_ip_roles, vm_img_roles, pm_up)\n \n # That virtual machine will be the \"leader\" (actually the chosen one)\n vm_leader = vm\n \n # Copy important files to it\n #copy_cloud_files(vm_leader, cloud_type)\n \n puts \"#{vm_leader} is being started\"\n puts \"Once started, do 'puppet apply manifest.pp' on #{vm_leader}\"\n\n end",
"def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end",
"def one_running?\n system = OpenNebula::System.new(OpenNebula::Client.new)\n config = system.get_configuration\n\n OpenNebula.is_error?(config)\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 accessible_from?(cluster)\n @mob.host.any? do |host_mount|\n next if host_mount.key.runtime.in_maintenance_mode\n cluster.host.include?(host_mount.key)\n end\n end",
"def solaris2?(node)\n node['platform'] == 'solaris2'\n end",
"def on_azure?\n azure != nil\n end",
"def on_azure?\n azure != nil\n end",
"def get_ec2_values \n cloud[:public_ip][0] = ec2['public_ipv4']\n cloud[:private_ip][0] = ec2['local_ipv4']\n cloud[:provider] = \"ec2\"\nend",
"def local?\n ip = server_ip.to_s\n is_localhost = ip == '127.0.0.1'\n is_in_ifconfig = `/sbin/ifconfig -a`.include? ip\n is_in_ip_addr = `/sbin/ip addr show`.include? ip\n is_localhost || is_in_ifconfig || is_in_ip_addr\n rescue => err\n (MorLog.my_debug '#{err.message}') && (return false)\n end"
] |
[
"0.7770823",
"0.77519435",
"0.77519435",
"0.7539143",
"0.7538713",
"0.7261664",
"0.72427356",
"0.72195977",
"0.6968421",
"0.6890333",
"0.6847384",
"0.68048495",
"0.6792794",
"0.6792794",
"0.67596835",
"0.6728041",
"0.65887463",
"0.6585326",
"0.6583575",
"0.651594",
"0.64500993",
"0.64387244",
"0.6424323",
"0.6407237",
"0.63884574",
"0.6341973",
"0.6310491",
"0.62858117",
"0.6264685",
"0.6261157",
"0.62501574",
"0.6248115",
"0.6246575",
"0.6232258",
"0.6232258",
"0.62165457",
"0.6211531",
"0.61886567",
"0.6178316",
"0.6171475",
"0.6167496",
"0.61583126",
"0.6151956",
"0.61499876",
"0.61487347",
"0.61421645",
"0.61333376",
"0.61305386",
"0.6119627",
"0.6118724",
"0.6111416",
"0.6103263",
"0.61021596",
"0.6099894",
"0.6089533",
"0.6074627",
"0.6057409",
"0.60441524",
"0.6042092",
"0.60400015",
"0.60400015",
"0.60031605",
"0.59918654",
"0.59705037",
"0.59662616",
"0.5957424",
"0.595535",
"0.5953072",
"0.5940106",
"0.59350216",
"0.59350216",
"0.59350216",
"0.59345925",
"0.5895751",
"0.58946663",
"0.58893156",
"0.58853155",
"0.5860776",
"0.5856729",
"0.58566546",
"0.5853014",
"0.5851758",
"0.5844281",
"0.58377963",
"0.5833961",
"0.58333117",
"0.5832812",
"0.5828805",
"0.5828805",
"0.5828805",
"0.5825636",
"0.58058757",
"0.58056766",
"0.58048433",
"0.5801846",
"0.5798805",
"0.5797703",
"0.5797703",
"0.5784932",
"0.5782485"
] |
0.7923933
|
0
|
Are we in a Rackspace cloud? === Return true:: If machine is located in an EC2 cloud false:: Otherwise
|
def rackspace?
resolve_cloud_type if @rackspace.nil?
@rackspace
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_rackspace?\n rackspace != nil\n end",
"def on_rackspace?\n rackspace != nil\n end",
"def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend",
"def on_rackspace?\n rackspace != nil\nend",
"def rackspace?(node)\n node.key?('rackspace')\n end",
"def cloud?(node)\n node.key?('cloud')\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def looks_like_rackspace? \n has_rackspace_mac?\nend",
"def on_ec2?\n ec2 != nil\n end",
"def on_ec2?\n ec2 != nil\n end",
"def looks_like_rackspace?\n hint?('rackspace') || has_rackspace_metadata? || has_rackspace_kernel?\nend",
"def has_rackspace_metadata?\n status, stdout, stderr = xenstore_command(\"read\", \"vm-data/provider_data/provider\")\n if status == 0\n stdout.strip.downcase == 'rackspace'\n else\n false\n end\nend",
"def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end",
"def rackspace?(node = __getnode)\n node.key?(\"rackspace\")\n end",
"def centos?\n @flavor =~ /centos/\n end",
"def on_ec2?\n ec2 != nil\nend",
"def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end",
"def on_openstack?\n openstack != nil\n end",
"def on_openstack?\n openstack != nil\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def openstack?\n bosh_provider == \"openstack\"\n end",
"def amazon_linux?(node)\n node['platform'] == 'amazon'\n end",
"def ec2_instance?\n Net::HTTP.get_response(URI.parse(metadata_url)) && true\n rescue\n false\n end",
"def is_instance_ossec_agent?\n listing = run_ssh_command 'sudo ls /var/ossec/etc'\n if listing.index('cannot access').nil?\n return true\n else\n notify 'seems to be not an ossec instance:'\n notify listing\n return false\n end\n end",
"def amazon?(node = __getnode)\n node[\"platform_family\"] == \"amazon\"\n end",
"def aws?\n bosh_provider == \"aws\"\n end",
"def amazon_platform?(node = __getnode)\n node[\"platform\"] == \"amazon\"\n end",
"def rhel?\n @flavor =~ /redhatenterpriseserver/\n end",
"def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def resolve_cloud_type\n cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n @ec2 = false\n @rackspace = false\n @eucalyptus = false\n case cloud_type\n when 'ec2' then ec2 = true\n when 'rackspace' then @rackspace = true\n when 'eucalyptus' then eucalyptus = true\n end\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def ec2?(node)\n node.key?('ec2')\n end",
"def vhost?\n !service.use_ssl && service.use_vhost && \"#@name.#{S3.host}\" =~ /\\A#{URI::REGEXP::PATTERN::HOSTNAME}\\Z/\n end",
"def esxi_installed?\n os_image_type == \"vmware_esxi\" && os_installed?\n end",
"def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end",
"def openstack?(node)\n node.key?('openstack')\n end",
"def has_host?(wspace,addr)\n\t\twspace.hosts.find_by_address(addr)\n\tend",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def gce?(node)\n node.key?('gce')\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def test_system?\n rack_env?(:test) && pegasus_hostname == \"test.#{site_domain}\"\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def centos?(node)\n node['platform'] == 'centos'\n end",
"def ubuntu?\n @flavor =~ /ubuntu/\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"def has_borne?\n sncf_self_service_machine == \"t\"\n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def hosted_service?\n return false unless registration_name\n find_provider\n return false unless config[:host_match]\n !matches?(config[:host_match])\n end",
"def is_cloudfront?\n type.downcase == \"cloudfront\"\n end",
"def google_cloud_environment?(url = nil)\n url ||= self.url\n !!url.match(/\\.c4d\\.devops\\.fds\\.com/) || !!url.match(/\\.gce\\.c4d\\.griddynamics\\.net/)\n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def on_gce?\n gce != nil\n end",
"def on_gce?\n gce != nil\n end",
"def host_is_app_host?(hostname)\n hostname == \"adapt.127.0.0.1.xip.io\"\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def server_exist?(server_name)\n compute = find_match(@compute.servers, server_name)\n Puppet.debug \"found server #{compute.name}\" if compute != nil\n Puppet.debug \"server not found : #{server_name}\" if compute == nil\n return (compute != nil)\n end",
"def is_ubuntu?\n return !!@name.match(/^ubuntu-.*$/)\n end",
"def check_zone_is_installed()\n if options['host-os-name'].to_s.match(/SunOS/)\n if options['host-os-release'].split(/\\./)[0].to_i > 10\n exists = true\n else\n exists = false\n end\n else\n exists = false\n end\n return exists\nend",
"def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end",
"def dev_host\n case Socket.gethostname\n when /romeo-foxtrot/i ; true\n else ; false\n end\nend",
"def openstack?(node = __getnode)\n node.key?(\"openstack\")\n end",
"def has_host?(wspace,addr)\n ::ApplicationRecord.connection_pool.with_connection {\n address, scope = addr.split('%', 2)\n wspace.hosts.find_by_address(addr)\n }\n end",
"def exists_on_server?\n false\n end",
"def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end",
"def configured_network?(network, server)\n case network.type\n when \"FIP_SNOOPING\"\n false\n when \"PXE\"\n server.os_image_type == \"vmware_esxi\" || !server.os_installed?\n else\n true\n end\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 cuisineaz_host? url\n return url.include? CUISINEAZ_HOST[:desktop]\n end",
"def ec2?(node = __getnode)\n node.key?(\"ec2\")\n end",
"def default_tenancy?\n @vpc.instance_tenancy == 'default'\n end",
"def accessible_from?(cluster)\n @mob.host.any? do |host_mount|\n next if host_mount.key.runtime.in_maintenance_mode\n cluster.host.include?(host_mount.key)\n end\n end",
"def server?\n @role == :server\n end",
"def rackserver?\n physical_type == \"RACK\"\n end",
"def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend",
"def active?\n servers.any?\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def fcoe_and_esxi_installed_on?(server)\n server.fcoe? && server.os_image_type == \"vmware_esxi\" && server.os_installed?\n end",
"def use_ssh?\r\n return false if lxd_transport_selected?\r\n return true if config[:ssh_login]\r\n return false if config[:ssh_login] == false # allow forced disable for cloud-images... or (TODO: should I not default enable for them?)\r\n cloud_image?\r\n end",
"def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"def has_rackspace_mac? \n network[:interfaces].values.each do |iface|\n unless iface[:arp].nil?\n return true if iface[:arp].value?(\"00:00:0c:07:ac:01\")\n end\n end\n false\nend",
"def rackspace_cloudbackup_test_platforms\n return {\n ubuntu: %w(12.04),\n debian: %w(7.2), # Requires Fauxhai chicanery as https://github.com/customink/fauxhai/pull/60\n # hasn't made its way to RubyGems yet.\n centos: %w(6.4 6.5)\n }\nend",
"def local?(ip = remote_ip)\n # TODO: should check if requesting machine is the one the server is running\n return true if ip == '127.0.0.1'\n end",
"def exists?\n\t\t# Look for cluster\n\t\t@cluster_id = DSMAPIServer.find_server(@resource[:name], @resource[:storagecenter])\n\t\tif @cluster_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def server?\n node['splunk']['is_server'] == true\nend",
"def bare_metal_tagged_network?(network, server)\n if network.type == \"PXE\"\n server.os_installed?\n elsif server.workload_network_vlans.size > 1\n true\n elsif workload_network_count(network, server) > 1\n true\n elsif workload_with_pxe?(network, server)\n true\n else\n false\n end\n end",
"def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end",
"def ec2_instance_ready?(instance)\n instance.exists? && instance.status.eql?(:running) && systems_ok(instance)\n end",
"def haveBootstrapped?\n @inventory.haveNode?(@server.mu_name)\n end",
"def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end",
"def service_x25?()\n return true if (@service == TAC_PLUS_AUTHEN_SVC_X25)\n return false\n end",
"def host_allowed?(arg)\n true\n end",
"def centos?\n File.exist?('/etc/centos-release')\nend",
"def is_production?\n %w(prod production).include?(node.chef_environment)\n end",
"def host?\n self.host\n end",
"def provider\n 'Rackspace'\n end"
] |
[
"0.73676956",
"0.73676956",
"0.71825504",
"0.71666217",
"0.70988107",
"0.7036013",
"0.70162314",
"0.69914424",
"0.6989146",
"0.6876613",
"0.6876613",
"0.68709594",
"0.6845766",
"0.68402237",
"0.6818065",
"0.67730516",
"0.6763897",
"0.67538035",
"0.6740978",
"0.6740978",
"0.66899335",
"0.6673487",
"0.6613709",
"0.6561221",
"0.65072465",
"0.6503029",
"0.6471102",
"0.64702404",
"0.64444983",
"0.6438419",
"0.64311755",
"0.64070547",
"0.64070094",
"0.6396546",
"0.6396546",
"0.63908994",
"0.6373299",
"0.63724494",
"0.6371055",
"0.6352867",
"0.6312723",
"0.6311343",
"0.6310937",
"0.629601",
"0.6281034",
"0.62691236",
"0.62623954",
"0.6260188",
"0.6257477",
"0.6251981",
"0.62379867",
"0.623629",
"0.62195915",
"0.6205586",
"0.619742",
"0.6166708",
"0.61615527",
"0.6134792",
"0.6134792",
"0.61153185",
"0.61139804",
"0.6094299",
"0.6090233",
"0.60875535",
"0.60811055",
"0.6075607",
"0.60728896",
"0.6071566",
"0.60573184",
"0.6052436",
"0.60437894",
"0.6036788",
"0.59906256",
"0.59903544",
"0.59807545",
"0.5962844",
"0.5937817",
"0.5930528",
"0.5904727",
"0.5902587",
"0.5899088",
"0.5896187",
"0.58899724",
"0.5887521",
"0.58814216",
"0.58809304",
"0.58788437",
"0.58777",
"0.58769965",
"0.58758426",
"0.58716875",
"0.58696777",
"0.58635044",
"0.58579785",
"0.5856373",
"0.5849986",
"0.5849206",
"0.584804",
"0.5844698",
"0.5833954"
] |
0.742828
|
0
|
Are we in a Eucalyptus cloud? === Return true:: If machine is located in an EC2 cloud false:: Otherwise
|
def eucalyptus?
resolve_cloud_type if @eucalyptus.nil?
@eucalyptus
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end",
"def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end",
"def cloud?(node)\n node.key?('cloud')\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def on_ec2?\n ec2 != nil\n end",
"def on_ec2?\n ec2 != nil\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def on_ec2?\n ec2 != nil\nend",
"def resolve_cloud_type\n cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n @ec2 = false\n @rackspace = false\n @eucalyptus = false\n case cloud_type\n when 'ec2' then ec2 = true\n when 'rackspace' then @rackspace = true\n when 'eucalyptus' then eucalyptus = true\n end\n end",
"def ec2?(node)\n node.key?('ec2')\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def ec2_instance?\n Net::HTTP.get_response(URI.parse(metadata_url)) && true\n rescue\n false\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def centos?\n @flavor =~ /centos/\n end",
"def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def amazon_linux?(node)\n node['platform'] == 'amazon'\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def is_instance_ossec_agent?\n listing = run_ssh_command 'sudo ls /var/ossec/etc'\n if listing.index('cannot access').nil?\n return true\n else\n notify 'seems to be not an ossec instance:'\n notify listing\n return false\n end\n end",
"def gce?(node)\n node.key?('gce')\n end",
"def ec2?(node = __getnode)\n node.key?(\"ec2\")\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def google_cloud_environment?(url = nil)\n url ||= self.url\n !!url.match(/\\.c4d\\.devops\\.fds\\.com/) || !!url.match(/\\.gce\\.c4d\\.griddynamics\\.net/)\n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def centos?(node)\n node['platform'] == 'centos'\n end",
"def on_gce?\n gce != nil\n end",
"def on_gce?\n gce != nil\n end",
"def esxi_installed?\n os_image_type == \"vmware_esxi\" && os_installed?\n end",
"def amazon_platform?(node = __getnode)\n node[\"platform\"] == \"amazon\"\n end",
"def ubuntu?\n @flavor =~ /ubuntu/\n end",
"def aws?\n bosh_provider == \"aws\"\n end",
"def amazon?(node = __getnode)\n node[\"platform_family\"] == \"amazon\"\n end",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def is_ubuntu?\n return !!@name.match(/^ubuntu-.*$/)\n end",
"def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend",
"def is_online?\n begin\n dc_version = crm_attribute '-q', '--type', 'crm_config', '--query', '--name', 'dc-version'\n return false unless dc_version\n return false if dc_version.empty?\n return false unless cib_section_nodes_state\n true\n rescue Puppet::ExecutionFailure\n false\n end\n end",
"def on_openstack?\n openstack != nil\n end",
"def on_openstack?\n openstack != nil\n end",
"def hosted_service?\n return false unless registration_name\n find_provider\n return false unless config[:host_match]\n !matches?(config[:host_match])\n end",
"def is_cloudfront?\n type.downcase == \"cloudfront\"\n end",
"def server_exist?(server_name)\n compute = find_match(@compute.servers, server_name)\n Puppet.debug \"found server #{compute.name}\" if compute != nil\n Puppet.debug \"server not found : #{server_name}\" if compute == nil\n return (compute != nil)\n end",
"def valid_target_url?\n return false unless cloud_info = cloud_info()\n return false unless cloud_info[:name]\n return false unless cloud_info[:build]\n return false unless cloud_info[:support]\n return false unless cloud_info[:version]\n true\n rescue\n false\n end",
"def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end",
"def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"def rhel?\n @flavor =~ /redhatenterpriseserver/\n end",
"def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"def instance_exists?(ec2_client, instance_id)\n ec2_client.describe_instances(instance_ids: [instance_id])\n return true\nrescue StandardError\n return false\nend",
"def ec2_instance_ready?(instance)\n instance.exists? && instance.status.eql?(:running) && systems_ok(instance)\n end",
"def check_zone_is_installed()\n if options['host-os-name'].to_s.match(/SunOS/)\n if options['host-os-release'].split(/\\./)[0].to_i > 10\n exists = true\n else\n exists = false\n end\n else\n exists = false\n end\n return exists\nend",
"def use_ssh?\r\n return false if lxd_transport_selected?\r\n return true if config[:ssh_login]\r\n return false if config[:ssh_login] == false # allow forced disable for cloud-images... or (TODO: should I not default enable for them?)\r\n cloud_image?\r\n end",
"def test_system?\n rack_env?(:test) && pegasus_hostname == \"test.#{site_domain}\"\n end",
"def dell_server?\n provider.dell_server?\n end",
"def openstack?\n bosh_provider == \"openstack\"\n end",
"def cuisineaz_host? url\n return url.include? CUISINEAZ_HOST[:desktop]\n end",
"def ready?\n return false unless exists?\n instance_arns = ecs_client.list_container_instances(cluster: name).container_instance_arns\n return false if instance_arns.nil? or instance_arns.empty?\n res = ecs_client.describe_container_instances(\n cluster: name,\n container_instances: instance_arns\n )\n # unless res.respond_to?(\"container_instances\") or\n # res.container_instances.nil?\n # return false\n # end\n res.container_instances.all? {|i| i.status == \"ACTIVE\" }\n end",
"def use_existing_vpc?\n return false unless configured?\n\n @aws_config['use_existing_vpc']\n end",
"def ubuntu?(node)\n node['platform'] == 'ubuntu'\n end",
"def ec?\n @spki.public_key.kind_of?(OpenSSL::PKey::EC)\n end",
"def is_production?\n %w(prod production).include?(node.chef_environment)\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def not_cloud_start(cloud_type, vm_ips, vm_ip_roles, vm_img_roles, pm_up)\n \n # Try to find one virtual machine that is already running\n vm_ips.each do |vm|\n if alive?(vm)\n # This machine is running\n puts \"#{vm} is up\"\n vm_leader = vm\n\n # Inform the user of this machine\n puts \"#{vm_leader} is already running\"\n puts \"Do 'puppet apply manifest.pp' on #{vm_leader}\"\n return\n end\n end\n \n # No machines are running\n puts \"All virtual machines are stopped\"\n puts \"Starting one of them...\"\n \n # Start one of the virtual machines\n vm = vm_ips[rand(vm_ips.count)] # Choose one randomly\n puts \"Starting #{vm} ...\"\n \n @vm_manager.start_vm(vm, vm_ip_roles, vm_img_roles, pm_up)\n \n # That virtual machine will be the \"leader\" (actually the chosen one)\n vm_leader = vm\n \n # Copy important files to it\n #copy_cloud_files(vm_leader, cloud_type)\n \n puts \"#{vm_leader} is being started\"\n puts \"Once started, do 'puppet apply manifest.pp' on #{vm_leader}\"\n\n end",
"def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"def test_multicloud\n cid = VirtualMonkey::Toolbox::determine_cloud_id(s_one)\n if cid == 232\n test_cloud_files\n else\n if @storage_type == \"ros\"\n test_s3\n elsif @storage_type == \"volume\"\n test_ebs\n end\n end\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 has_host?(wspace,addr)\n\t\twspace.hosts.find_by_address(addr)\n\tend",
"def ssh_to_compute_node?\n if !cluster_ssh_to_compute_node?.nil?\n return cluster_ssh_to_compute_node?\n else\n return global_ssh_to_compute_node?\n end\n end",
"def centos_platform?(node = __getnode)\n node[\"platform\"] == \"centos\"\n end",
"def gce?(node = __getnode)\n node.key?(\"gce\")\n end",
"def check_instance\n return if ec2_instance?\n abort 'FATAL: NOT an EC2 instance or could not connect to Metadata'\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def fcoe_and_esxi_installed_on?(server)\n server.fcoe? && server.os_image_type == \"vmware_esxi\" && server.os_installed?\n end",
"def digital_ocean?(node = __getnode)\n node.key?(\"digital_ocean\")\n end",
"def centos?\n File.exist?('/etc/centos-release')\nend",
"def on_azure?\n azure != nil\n end",
"def on_azure?\n azure != nil\n end",
"def exists_on_server?\n false\n end",
"def local?\r\n return ['localhost', '127.0.0.1'].include?($options[:host])\r\nend",
"def eip?\n !eip.nil?\n end",
"def accessible_from?(cluster)\n @mob.host.any? do |host_mount|\n next if host_mount.key.runtime.in_maintenance_mode\n cluster.host.include?(host_mount.key)\n end\n end",
"def ready?\n self.class.ready?(@cloud_id, credentials: @credentials)\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end",
"def hyperv_with_dedicated_intel_iscsi?(network, server)\n return false unless network.type == \"STORAGE_ISCSI_SAN\"\n return false unless server.is_hyperv?\n\n iscsi_card = server.network_cards[1]\n\n iscsi_card && iscsi_card.nic_info.product =~ /Intel/\n end",
"def configured_network?(network, server)\n case network.type\n when \"FIP_SNOOPING\"\n false\n when \"PXE\"\n server.os_image_type == \"vmware_esxi\" || !server.os_installed?\n else\n true\n end\n end",
"def openstack?(node)\n node.key?('openstack')\n end",
"def i2c_exists?\n\tFile.exist?('/dev/i2c-0') || File.exist?('/dev/i2c-1')\nend",
"def dev_host\n case Socket.gethostname\n when /romeo-foxtrot/i ; true\n else ; false\n end\nend",
"def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend",
"def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end",
"def cloud\n ext_management_system.provider.cloud_ems.first\n end",
"def host_in_use?(hostname)\n @hosts[hostname][:used]\n end"
] |
[
"0.75492007",
"0.7413398",
"0.7403377",
"0.7314464",
"0.72841483",
"0.72841483",
"0.718199",
"0.7144862",
"0.68322986",
"0.6804218",
"0.6792275",
"0.6792275",
"0.67383534",
"0.67111564",
"0.66921395",
"0.6677335",
"0.66766465",
"0.66143095",
"0.66097546",
"0.6541074",
"0.65178776",
"0.64710313",
"0.641725",
"0.64102066",
"0.6400051",
"0.63975006",
"0.6396974",
"0.6374956",
"0.63158965",
"0.63104415",
"0.63104415",
"0.63103867",
"0.62940323",
"0.6272638",
"0.6252516",
"0.62115467",
"0.61908954",
"0.6173993",
"0.61522585",
"0.61455935",
"0.61424536",
"0.6142066",
"0.6142066",
"0.61400527",
"0.61254656",
"0.6100444",
"0.6098873",
"0.6096742",
"0.6094759",
"0.60794395",
"0.6056767",
"0.60547763",
"0.60325444",
"0.5992712",
"0.59745425",
"0.5967908",
"0.59675604",
"0.59535676",
"0.5943698",
"0.59394497",
"0.5939095",
"0.5938525",
"0.59352744",
"0.59285474",
"0.59250027",
"0.59027344",
"0.5902244",
"0.58937067",
"0.5893338",
"0.5890411",
"0.5882437",
"0.58806336",
"0.5871921",
"0.5867456",
"0.5860938",
"0.5860938",
"0.5860938",
"0.58368415",
"0.5830876",
"0.58224714",
"0.5808066",
"0.5808066",
"0.5806294",
"0.57975197",
"0.5792078",
"0.5786242",
"0.5785976",
"0.5785593",
"0.5785593",
"0.5785593",
"0.5782965",
"0.57773215",
"0.57683885",
"0.5761451",
"0.5759367",
"0.5758874",
"0.57564676",
"0.575368",
"0.57457745",
"0.5743878"
] |
0.63980865
|
25
|
Controller object === Return c(Controller):: Platformspecific controller object
|
def controller
platform_service(:controller)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def controller\n @controller ||= ApplicationController.new\n end",
"def controller\n @controller ||= controller_name.constantize\n end",
"def controller\n @controller ||= MainController.new\n end",
"def controller client\n client.env[CONTROLLER_NAME]\n end",
"def controller\n return @controller\n end",
"def controller(name, &block)\n existing = @base.controllers.select { |a| a.name == name }.first\n if existing\n controller = existing\n else\n controller = Moonrope::Controller.new(@base, name)\n @base.controllers << controller\n end\n controller.dsl.instance_eval(&block) if block_given?\n controller\n end",
"def controller=(value)\n @controller = value\n end",
"def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end",
"def controller_instance(controller_class)\n # ensure protocol compliance\n unless controller_class.method_defined?(:call) \\\n && controller_class.instance_method(:call).arity == 2\n return\n end\n controller = controller_class.new\n controller.kenji = self if controller.respond_to?(:kenji=)\n return controller if controller\n nil # default return value\n end",
"def controller\n self::Controller\n end",
"def controller(&block)\n @config.controller.class_exec(&block) if block_given?\n @config.controller\n end",
"def controller_class; end",
"def controller_class; end",
"def controller_model\n @controller_model ||= begin\n controller_name.singularize.camelize.constantize\n rescue\n nil\n end\n end",
"def controller\n @controller ||= Authlogic::TestCase::MockController.new\n end",
"def set_controller\n @controller = Controller.find(params[:id])\n end",
"def controller\n Thread.current[:authlogic_controller]\n end",
"def controller=(value)\n Thread.current[:authlogic_controller] = value\n end",
"def controller=(value)\n Thread.current[:authlogic_controller] = value\n end",
"def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n end",
"def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n end",
"def controller\n self\n end",
"def controller\n @controller\n end",
"def current\n Thread.current[:CURRENT_CONTROLLER]\n end",
"def controller; nil; end",
"def controller\n nil\n end",
"def create_controller(controller)\n case controller\n when String\n controller = Object.const_get(controller).new(self)\n when Class\n controller = controller.new(self)\n end\n controller.shell = self\n controller\n end",
"def controller(controller); end",
"def controller\n MSPhysics::Newton::BallAndSocket.get_controller(@address)\n end",
"def controller\n MSPhysics::Newton::Hinge.get_controller(@address)\n end",
"def controller(path)\n controller_name.constantize.new(controller_name, action_name,\n get_params(path))\n end",
"def _rails_controller_instance\n controller = rails_controller.new\n rails_request = ActionDispatch::Request.new(scope.env)\n\n prepare_rails_controller(controller, rails_request)\n\n controller\n end",
"def controller(name)\n controllers.select { |a| a.name == name }.first\n end",
"def compete_controller\n @kernel.resources.controllers.compete\n end",
"def controller\n ApplicationController\n end",
"def controller(data)\n path = data.get(:path)\n path = path.native if path.is_a?(WAB::Data)\n return path_controller(path) unless path.nil? || (path.length <= @path_pos)\n\n content = data.get(:content)\n return @controllers[content.get(@type_key)] || default_controller unless content.nil?\n\n default_controller\n end",
"def controller\n @params['controller'] || @params[:controller]\n end",
"def controller\n rotate_device to: :portrait, button: :bottom\n @controller = FunctionalScreen.new(nav_bar: true)\n @controller.navigationController\n end",
"def initialize(controller)\n @controller = controller\n end",
"def initialize(controller)\n @controller = controller\n end",
"def touch_controller(klass)\n klass.controller_class\n end",
"def controller_for(subpath)\n subpath = '/_' if subpath == '/'\n path = \"#{@root}controllers#{subpath}.rb\"\n return nil unless File.exist?(path)\n require path\n controller_name = subpath.split('/').last.sub(/^_/, 'Root')\n controller_class =\n Object.const_get(controller_name.to_s.to_camelcase + 'Controller')\n controller_instance(controller_class)\n end",
"def model\n\t\tObject.const_get(controller_name.classify)\n\tend",
"def controller\n self\n end",
"def controller\n end",
"def controller\n end",
"def klass_from_controller(c = controller_name)\n c.singularize.camelize.constantize\n end",
"def new_controller\n print 'Controller class name: '\n controller_name = STDIN.gets.chomp\n\n dir_controllers = get_or_create_controllers_folder\n group_controllers = get_or_create_xcode_controllers_group\n\n create_base_if_needed\n\n controller_properties = @view_generator.get_properties\n controller_snippets = create_controller_snippets controller_properties\n\n controller_fileref = @view_generator.write_template\"#{TEMPLATE_PATH}ControllerTemplate.swift\",\n \"#{controller_name}ViewController.swift\",\n dir_controllers,\n group_controllers,\n {'___CONTROLLERNAME___' => \"#{controller_name}\"},\n controller_snippets\n\n controller_viewmodel_snippets = create_viewmodel_snippets controller_properties\n controller_r_fileref = @view_generator.write_template\"#{TEMPLATE_PATH}ControllerViewModelTemplate.swift\",\n \"#{controller_name}ViewModel.swift\",\n dir_controllers,\n group_controllers,\n { '___CONTROLLERNAME___' => controller_name },\n controller_viewmodel_snippets\n\n @target.add_file_references([controller_fileref, controller_r_fileref])\n end",
"def controller_plugin_const(plugin_symbol)\n ::Sorcery::Plugins.plugin_const(plugin_symbol).const_get('Controller')\n end",
"def controller\n nil\n end",
"def controller\n nil\n end",
"def controllers\n raise NotImplementedError\n end",
"def controller\n rotate_device to: :portrait, button: :bottom\n @map ||= TestMapScreen.new(nav_bar: true)\n @map.will_appear\n @map.navigation_controller\n end",
"def controller=(_arg0); end",
"def controller=(_arg0); end",
"def controller=(_arg0); end",
"def controller\n if nextResponder && nextResponder.is_a?(UIViewController)\n nextResponder\n elsif nextResponder\n nextResponder.controller\n else\n nil\n end\n end",
"def controller\n if nextResponder && nextResponder.is_a?(UIViewController)\n nextResponder\n elsif nextResponder\n nextResponder.controller\n else\n nil\n end\n end",
"def active_controller\n if self.delegate.nil? then\n return self\n else\n return self.delegate.active_controller\n end\n end",
"def make_controller(klass)\n @controller = eval(\"#{klass.to_s.camelize}Controller\").new\n end",
"def initialize(controller)\n @controller = controller\n end",
"def class_for_controller_name\n controller_model\n end",
"def init_controller(model, the_controller)\n Lorj.debug(1, \"Loading Controller/definition '%s'\", the_controller)\n\n ok = load_controller(model, the_controller)\n\n PrcLib.warning(\"Controller '%s' not properly loaded.\",\n the_controller) unless ok\n\n model\n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def cnam\r\n CNAMController.instance\r\n end",
"def create_controller\n template \"controller.rb\", controller\n end",
"def barn_controller!\n @controller = Class.new(ApotomoController) do\n def initialize(*)\n super\n self.request = ActionController::TestRequest.new\n end\n \n def self.name; \"BarnController\"; end\n \n def self.default_url_options; {:controller => :barn}; end\n end.new\n end",
"def is_controller?; false; end",
"def set_controller(controller)\n @routes = ::Rails.application.routes\n @controller = controller.new\n end",
"def controller_name\n self.class.controller_name\n end",
"def initialize(controller)\n @controller = controller\n end",
"def controller(controller)\n self.class.new(routes: @routes.select { |rt| rt.url_details[:controller] == controller.to_s })\n end",
"def main_controller\n window.rootViewController\n end",
"def controller(controller)\n scenario.controller = controller\n end",
"def embedded_class(options)\n if controller = options[:controller]\n controller.is_a?(Class) ? controller : \"#{controller.camelize}Controller\".constantize\n else\n self.class\n end\n end",
"def instance\n @instance ||= Fleet::Controller.new\n end",
"def create_controller(ctrl_action)\n ctrl_name, action_name = ctrl_action.split('#')\n klass = Object.const_get \"#{ctrl_name.capitalize}Controller\"\n klass.new(name: ctrl_name, action: action_name.to_sym, request: request)\n end",
"def method_missing(method, *args, &block)\n if controller.respond_to?(method)\n define_singleton_method(method) do |*args, &block|\n controller.send(method, *args, &block)\n end\n send(method, *args, &block)\n else\n super\n end\n end",
"def people_controller\n @kernel.resources.controllers.people\n end",
"def controller_name\n @controller_name ||= controller.class.to_s.sub('Controller', '').underscore\nend",
"def get_controller_for_url_generation(opts)\n controller = opts[:controller] || @web_controller.params[:controller]\n raise \"No Controller Specified for url()\" unless controller\n controller\n end",
"def get_controller_for_url_generation(opts)\n controller = opts[:controller] || @web_controller.params[:controller]\n raise \"No Controller Specified for url()\" unless controller\n controller\n end",
"def full_implementation_controller_name\n \"#{model_class_name.pluralize}Controller\"\n end",
"def Controller(matcher)\n make(matcher)\n end",
"def controller_model_class\n c = controller_name.to_s.pluralize.singularize.camelize.constantize\n if c.respond_to? :new\n c # looks like we've got a real class\n else\n nil # TODO throw error?\n end\n end",
"def compile_controllers\n puts \"Compiling Controllers\"\n js = V8::Context.new\n js.eval \"window = {}\"\n js.eval \"controllers = {}\"\n Dir[File.join(APP_ROOT, \"app\", \"controllers\", \"**\", \"*.*\")].each do |file|\n ext = file.split(\".\").last\n filename = file.split(\"/\").last.split(\".\").first\n next unless %w[js coffee].include?(ext)\n scrpt = File.read(file)\n scrpt = CoffeeScript.compile(scrpt, bare: true) if ext == \"coffee\"\n scrpt = <<-EOS\n#{scrpt}\ncontrollers['#{filename.class_case}Controller'] = new #{filename.class_case}Controller()\nEOS\n js.eval scrpt\n end\n File.open(File.join(APP_ROOT, \"public\", \"javascripts\", \"rocket_controllers.js\"), \"w\") {|f| f.write recursive_object_dump(js[\"controllers\"], \"controllers\")}\n puts \"Finished Compiling Controllers\"\n end",
"def default_controller(params)\n params[:resources_controller] || Wallaby.configuration.mapping.resources_controller\n end",
"def controllers\n base_controller_class.constantize.descendants\n end",
"def default_controller\n Wallaby.configuration.mapping.resources_controller\n end",
"def instance\n @controller.instance_variable_get(:\"@#{instance_name}\")\n end",
"def initialize(controller)\n @controller = controller\n @controller.extend ControllerExtension\n end"
] |
[
"0.7643023",
"0.75106966",
"0.72431034",
"0.7160315",
"0.7066273",
"0.6995412",
"0.69361246",
"0.69347775",
"0.68931943",
"0.6866875",
"0.67717665",
"0.67452484",
"0.67452484",
"0.6734607",
"0.6731051",
"0.6721731",
"0.67209756",
"0.6696914",
"0.6696914",
"0.6620909",
"0.6620909",
"0.6601633",
"0.65930206",
"0.6581821",
"0.6560831",
"0.6529431",
"0.64976335",
"0.6495499",
"0.6471966",
"0.6455401",
"0.64514077",
"0.64511406",
"0.6446041",
"0.6415128",
"0.6413156",
"0.6364627",
"0.6283872",
"0.62535936",
"0.624616",
"0.624616",
"0.62162304",
"0.61860174",
"0.61806077",
"0.61791915",
"0.6154489",
"0.6154489",
"0.613017",
"0.6122473",
"0.6117528",
"0.61095554",
"0.61095554",
"0.6105393",
"0.6104015",
"0.6100461",
"0.6100461",
"0.6100461",
"0.607291",
"0.607291",
"0.6058779",
"0.6058717",
"0.6050388",
"0.60478663",
"0.60092705",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5994659",
"0.5979244",
"0.59658504",
"0.5965736",
"0.5957338",
"0.5955144",
"0.5949051",
"0.59364337",
"0.59345764",
"0.5909905",
"0.58995336",
"0.5897984",
"0.58936745",
"0.589321",
"0.5879528",
"0.58781266",
"0.58675903",
"0.5852421",
"0.5851488",
"0.58493423",
"0.58447266",
"0.5841353",
"0.5839525",
"0.58386093",
"0.5836167",
"0.58166033",
"0.5794064",
"0.57893366"
] |
0.78103113
|
0
|
Filesystem config object === Return fs(Filesystem):: Platformspecific filesystem config object
|
def filesystem
platform_service(:filesystem)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filesystem_data\n self['filesystem2'] || self['filesystem']\n end",
"def get_filesystem\n @@current_fake ? @@current_fake[:filesystem] : ''\n end",
"def filesystem_impl=(impl)\n @filesystem_impl = impl\n end",
"def filesystem_file(host)\n case host['platform']\n when %r{aix}\n '/etc/filesystems'\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n '/etc/fstab'\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Unable to determine filesystem table file location for #{host['platform']}\")\n end\n end",
"def filesystem\n Filesystem.new(@loop)\n end",
"def filesystem\n\t\tRush::Entry.factory('/', self)\n\tend",
"def fs\n return @file_system if @file_system\n\n @file_system = Rosh::FileSystem.new(@name)\n @file_system.add_observer(self)\n\n @file_system\n end",
"def file_system\n if !block_given?\n if @cached_file_system != nil\n return @cached_file_system\n end\n return @cached_file_system = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:fileSystem, []).call(),::Vertx::FileSystem)\n end\n raise ArgumentError, \"Invalid arguments when calling file_system()\"\n end",
"def filesystem\n Filesystem.new(@reactor)\n end",
"def fstype\n return self['fstype'] if has_key?('fstype')\n Chef::Log.info([\n self['fstype'], current[:fstype],\n File.exists?(device) && `file -s '#{device}'`.chomp,\n self,\n ].inspect)\n return current[:fstype] if current[:fstype]\n return unless File.exists?(device)\n dev_type_str = `file -s '#{device}'`.chomp\n case\n when dev_type_str =~ /SGI XFS/ then self['fstype'] = 'xfs'\n when dev_type_str =~ /Linux.*(ext[2-4])/ then self['fstype'] = $1\n else\n raise \"Can't determine filesystem type of #{device} -- set it explicitly in node[:volumes]\"\n end\n self['fstype']\n end",
"def configure_filesystems(\n machine,\n instance_profile,\n provider\n)\n\n filesystems = lookup_values_yaml(instance_profile, ['providers', provider, 'instance', 'storage', 'filesystems'])\n\n configure_synced_fs_objects(machine, instance_profile, filesystems)\n\nend",
"def current\n return {} unless device && node[:filesystem] && node[:filesystem][ device ]\n curr = Mash.new(node[:filesystem][ device ].to_hash)\n curr['fstype'] ||= curr['fs_type']\n curr\n end",
"def config_directory\n \"C:\\\\chef\"\n end",
"def config_file\n CONFIG_FILE\n end",
"def filesystem_type(host)\n case host['platform']\n when %r{aix}\n 'jfs2'\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n 'ext3'\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Unable to determine a standard filesystem table type for #{host['platform']}\")\n end\n end",
"def configuration_file_path; end",
"def storage_config\n YAML.load_file(Rails.root.join('config', 'storage.yml'))[Rails.env]\n end",
"def file_utils\n @fu ||= NanDoc::Config.file_utils\n end",
"def config_path\n @config_path ||= local_config_path\n end",
"def try_files\n files = Files.new(config, settings)\n files.configure\n end",
"def config\n @config ||= OpenStruct.new(YAML.load_file(self.config_path))\n end",
"def select_filesystem(name = nil)\n @@current_fake = @@fakes[name]\n end",
"def filesystem_dir\n @@filesystem_dir ||= ::File.join(::Rails.public_path, 'images', 'captchas')\n end",
"def virtual_fs\n VirtualFS::Union.new(VirtualFS::Embedded.new(file),\n VirtualFS::Native.new(File.dirname(file)))\n end",
"def path\n @path ||= File.dirname @config_file\n end",
"def fs(path)\n OodAppkit.files.url(path: path).to_s\n end",
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def env\n\t\t@rootDir = Dir.new( @rootDir )\n\n\t\t# config file exist\n\t\tif Dir.exist?( @configDir )\n\t\t\t@configDir = Dir.new( @configDir )\n\t\telse\n\t\t\t@configDir = Dir.mkdir( @configDir )\n\t\tend\n\n\t\t@configFile = File.join( @configDir, @configFile )\n\n\t\t# parse config file\n\t\t@configFile = File.new( @configFile ) unless !File.exist?( @configFile )\n\n\t\t@configFile = JSON.parse( @configFile )\n\n\t\tif @configFile['webroot'] == nil\n\t\t\t@configFile['webroot'] = @@webroot\n\t\tend\n\n\t\tif @configFile['port'] == nil\n\t\t\t@configFile['port'] = @@port\n\t\tend\n\tend",
"def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end",
"def config_file\n @config_file\n end",
"def config\n @config_file\n end",
"def name\n\t\t\"Stdapi: File system\"\n\tend",
"def initialize\n define_os\n define_path\n read_settings\n end",
"def root_fs\n\t\t\t\tfind_root[2].to_s\n\t\t\tend",
"def read_config(config_path = T.unsafe(nil)); end",
"def config_file\n FilePath.new(@directory, 'tc-config.xml')\n end",
"def chef_api_config_path\n ENV[\"CHEF_API_CONFIG\"] || if ENV.key?(\"HOME\")\n \"~/.chef-api\"\n else\n nil\n end\n end",
"def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end",
"def chef_config\n @chef_config ||= Berkshelf::ChefConfigCompat.new(ENV[\"BERKSHELF_CHEF_CONFIG\"])\n end",
"def remote_fs(arg = nil)\n set_or_return(:remote_fs, arg, kind_of: String)\n end",
"def storage_use_nfs\n super\n end",
"def configuration\n @configuration ||= begin\n ConfigFile.new(GLOBAL_CONFIG).merge_file(LOCAL_CONFIG)\n rescue TypeError\n raise AssistedWorkflow::Error, \"Error on loading .awconfig files. Please check the content format.\"\n end\n end",
"def config\n @config ||= Config.create ConfigLoader.new(root, CONFIG_FILE).to_hash, options.merge_config\n end",
"def initialize params={}, *args\n check_and_set_environment\n @conf = Java::org.apache.hadoop.conf.Configuration.new\n uri = Java::java.net.URI.new params[:filesystem] if params[:filesystem]\n fs_params = uri ? [ uri, @conf ] : [ @conf ]\n @hdfs = Java::org.apache.hadoop.fs.FileSystem.get *fs_params\n end",
"def find_config_file\n if ENV[\"SMITH_CONFIG\"]\n to_pathname(ENV[\"SMITH_CONFIG\"]).tap do |path|\n raise ConfigNotFoundError, \"Cannot find a config file name: #{path}\" unless path.exist?\n end\n else\n user = [\"./.#{CONFIG_FILENAME}\", \"#{ENV['HOME']}/.#{CONFIG_FILENAME}\"].map { |p| to_pathname(p) }\n system = [\"/etc/#{CONFIG_FILENAME}\", \"/etc/smith/#{CONFIG_FILENAME}\"].map { |p| to_pathname(p) }\n default = [default_config_file]\n\n (user + system + default).detect { |path| path.exist? }\n end\n end",
"def initialize (file = '/etc/fstab')\n\n @source_file = file\n @fs_by_id = Hash.new\n\n File.foreach(file) do |line|\n\n dev, mp, fstype, options = line.split\n\n next if options == nil\n next if line[0] == ?#\n next if mp[0] != ?/ # skip pseudo fs\n next if NOFS.has_key? fstype\n next if options =~ /loop/ # no need to readahead loop fs\n\n fs = FileSystem.new(dev, mp, fstype)\n @fs_by_id[fs.device_id] ||= fs\n\n end\n\n @fs_by_id.delete(0) # in case we get device_id=0 for hotplug devices.\n\n # the filesystem for block special files\n @fs_by_id[$BDEV_ID] = FileSystem.new($BDEV_NAME, '', $BDEV_NAME)\n\n self\n end",
"def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end",
"def fs_path\n @changeset.fs_path(@path)\n end",
"def default_authoritative_config_directory\n case node['platform_family']\n when 'debian'\n '/etc/powerdns'\n when 'rhel'\n '/etc/pdns'\n end\nend",
"def chef_config\n Berkshelf::ChefConfigCompat.from_file(chef_config_path)\n end",
"def path_boot\n case node['platform']\n when \"exherbo\", \"ubuntu\", \"arch\"\n return \"/etc/modules-load.d/#{new_resource.name}.conf\"\n when \"debian\", \"ubuntu\"\n return \"/etc/modules\"\n end\nend",
"def filesystem_dir=(dir)\n @@filesystem_dir = dir\n end",
"def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend",
"def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend",
"def fs_value(p, val)\n key = case val\n when 'size'\n 'kb_size'\n when 'used'\n 'kb_used'\n when 'available'\n 'kb_available'\n when 'percent'\n 'percent_used'\n else\n fail \"fb_helpers: Unknown FS val #{val} for node.fs_value\"\n end\n fs = self.filesystem_data\n # Some things like /dev/root and rootfs have same mount point...\n if fs && fs['by_mountpoint'] && fs['by_mountpoint'][p] &&\n fs['by_mountpoint'][p][key]\n return fs['by_mountpoint'][p][key].to_f\n end\n\n Chef::Log.warn(\n \"fb_helpers: Tried to get filesystem information for '#{p}', but it \" +\n 'is not a recognized filesystem, or does not have the requested info.',\n )\n nil\n end",
"def tmpfs\n\t\t\t\tret = {}\n\t\t\t\tmounts.each { |x|\n\t\t\t\t\tret.merge!({x.split[1] => x}) if x.start_with?('tmpfs '.freeze)\n\t\t\t\t}\n\t\t\t\tret\n\t\t\tend",
"def chef_config_path\n if Chef::Config['config_file']\n ::File.dirname(Chef::Config['config_file'])\n else\n raise(\"No chef config file defined. Are you running \\\nchef-solo? If so you will need to define a path for the ohai_plugin as the \\\npath cannot be determined\")\n end\n end",
"def config(value)\n # require value if File.exists?(value)\n if File.exists?(value)\n fc = File.read(value)\n self.instance_eval(fc)\n end\n end",
"def config\n @config ||= YAML.load_file(BASE_PATH + '/local.config.yml')\nend",
"def set_file_system\n @file_system = FileSystem.find(params[:id])\n end",
"def local_blobstore\n config_dev = { \"dev_name\" => name }\n create_file \"config/dev.yml\", YAML.dump(config_dev)\n\n config_private = { \"blobstore_secret\" => 'BLOBSTORE_SECRET' }\n create_file \"config/private.yml\", YAML.dump(config_private)\n\n case blobstore_type\n when :local\n say_status \"warning\", \"config/final.yml defaulting to local blobstore /tmp/blobstore\", :yellow\n config_final = { \"blobstore\" => {\n \"provider\" => \"local\",\n \"options\" => { \"blobstore_path\" => '/tmp/blobstore' }\n }\n }\n when :s3\n config_private = { \"blobstore_secret\" => 'BLOBSTORE_SECRET' }\n config_final = { \"blobstore\" => {\n \"provider\" => \"s3\",\n \"options\" => {\n \"bucket_name\" => \"BOSH\",\n \"access_key_id\" => \"AWS_ACCESS_KEY\",\n \"secret_access_key\" => \"AWS_SECRET_ACCESS_KEY\",\n \"encryption_key\" => \"PERSONAL_RANDOM_KEY\",\n }\n }\n }\n when :atmos\n config_final = { \"blobstore\" => {\n \"provider\" => \"atmos\",\n \"options\" => {\n \"tag\" => \"BOSH\",\n \"url\" => \"https://blob.cfblob.com\",\n \"uid\" => \"ATMOS_UID\"\n }\n }\n }\n end\n \n create_file \"config/final.yml\", YAML.dump(config_final)\n end",
"def get_configuration_file\n file = PREFERENCES_LEGACY\n file = PREFERENCES if File.exists? '/usr/libexec/opendirectoryd'\n file\n end",
"def config\n\t\t\t@config ||= begin\n\t\t\t\tfile = File.join(self.location, \"config.yaml\")\n\t\t\t\tif File.exists?(file)\n\t\t\t\t\tYAML::load_file(file)\n\t\t\t\telse\n\t\t\t\t\t{}\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def fs_path(mode='fs')\n Egnyte::Item.fs_path(@session, mode)\n end",
"def config_file\n File.join AppRoot, ConfigFile\n end",
"def config\n path = config_path\n @config ||= path.exist? ? JSON.parse(path.read) : {}\n end",
"def windows_platform_config(name)\n {\n 'driver' => ec2_driver_config.merge({\n 'instance_type' => 'm3.medium',\n 'retryable_tries' => 120,\n }),\n 'provisioner' => {\n 'product_name' => 'chef',\n 'channel' => chef_version ? 'stable' : 'current',\n 'product_version' => chef_version,\n },\n 'transport' => {\n 'name' => 'winrm',\n 'ssh_key' => \"#{base}/test/ec2/ssh.key\",\n },\n }.tap do |cfg|\n if name == 'windows-2008sp2'\n cfg['driver']['image_id'] = 'ami-f6a043e0'\n cfg['driver']['instance_type'] = 'm1.medium'\n cfg['driver']['subnet_id'] = ENV['AWS_SUBNET_ID'] || DEFAULT_EC2_LEGACY_INSTANCES_SUBNET_ID\n cfg['provisioner']['architecture'] = 'i386'\n end\n end\n end",
"def eql?(fs)\n fs.host.eql?(@host) and fs.dir.eql?(@dir) and fs.files.eql?(self.files)\n end",
"def dir\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::Dir)\n\tend",
"def _FILESDIR; Config._FILES; end",
"def nfs_opts_setup()\n @folders.each do |k, opts|\n if !opts[:linux__nfs_options]\n opts[:linux__nfs_options] ||= [\"rw\", \"no_subtree_check\", \"all_squash\", \"insecure\"]\n end\n\n # Only automatically set anonuid/anongid if they weren't\n # explicitly set by the user.\n hasgid = false\n hasuid = false\n opts[:linux__nfs_options].each do |opt|\n hasgid = !!(opt =~ /^anongid=/) if !hasgid\n hasuid = !!(opt =~ /^anonuid=/) if !hasuid\n end\n\n opts[:linux__nfs_options] << \"anonuid=#{opts[:map_uid]}\" if !hasuid\n opts[:linux__nfs_options] << \"anongid=#{opts[:map_gid]}\" if !hasgid\n opts[:linux__nfs_options] << \"fsid=#{opts[:uuid]}\"\n\n # Expand the guest path so we can handle things like \"~/vagrant\"\n expanded_guest_path = @machine.guest.capability(\n :shell_expand_guest_path, opts[:guestpath])\n\n # Do the actual creating and mounting\n @machine.communicate.sudo(\"mkdir -p #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chown -R vagrant:vagrant #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chmod u+rw #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chmod g+rws #{expanded_guest_path}\")\n end\n end",
"def create_filesystem(fstype, where, label)\n if fstype == 'fat32'\n execute!(\"mkfs.fat -F -F32 -n#{label} #{where}\")\n elsif fstype == 'fat16'\n execute!(\"mkfs.fat -F -F16 -n#{label} #{where}\")\n elsif fstype == 'swap'\n execute!(\"mkswap -L #{label} #{where}\")\n else\n execute!(\"mkfs.#{fstype} -L \\\"#{label}\\\" #{where}\")\n end\n end",
"def config( path = nil )\n if ( !@config )\n @config = Config.new( path )\n end\n\n @config\n end",
"def with_system(sys_config)\n @config[AF::SYSTEM] = sys_config\n self\n end",
"def wfs_path\n return unless @config && visibility && geo_file_set? && file_set_format?\n \"#{path}/#{@config[:workspace]}/wfs\"\n end",
"def initialize file_separator = nil, working_dir = nil\n @file_separator = file_separator || ::File::ALT_SEPARATOR || ::File::SEPARATOR\n @working_dir = working_dir ? ((root? working_dir) ? (posixify working_dir) : (::File.expand_path working_dir)) : ::Dir.pwd\n @_partition_path_sys = {}\n @_partition_path_web = {}\n end",
"def conf_file_data\n VMConfiguration.new(self).config_data\n end",
"def default_global_config_file\n File.join(File.expand_path(ENV[\"HOME\"]), \".kitchen\", \"config.yml\")\n end",
"def transport_config\n {\n # Use the sftp transport from kitchen-sync.\n 'name' => 'sftp',\n # Use the SSH key for this driver.\n 'ssh_key' => case kitchen_driver\n when 'docker'\n \"#{base}/.kitchen/docker_id_rsa\"\n when 'ec2'\n \"#{base}/test/ec2/ssh.key\"\n else\n nil\n end,\n }\n end",
"def config\n if defined?(Rails)\n yml = YAML.load_file( Rails.root.join(\"config/mogilefs.yml\") )\n yml[Rails.env][\"connection\"].symbolize_keys\n else\n { :domain => \"default\", :hosts => [\"127.0.0.1:7001\"] }\n end\n end",
"def read_config_file; end",
"def secondary_storage\n unless ::File.exist?(@current_resource.nfs_path)\n directory @current_resource.nfs_path do\n owner \"root\"\n group \"root\"\n action :create\n recursive true\n end\n end\n end",
"def conf\n @c ||= JSON.load(File.read('/etc/knife-kvm/config.json'))\nend",
"def get_config(storage, path)\n file = (storage and path) ? storage + path : @defaults[:storage] + @defaults[:config]\n file = File.expand_path file\n return load file\n end",
"def config_file\n File.join(root, 'config.yml')\n end",
"def config\n @config ||= read_config\n end",
"def prefix\n @options[:fs_name] || DEFAULT_ROOT\n end",
"def global_config_dir\n '/etc/vgh'\n end",
"def mount_status(desired)\n # We treat tmpfs specially. While we don't want people to mount tmpfs with\n # a device of 'none' or 'tmpfs', we also don't want to make them remount\n # (and lose all their data) just to convert to fb_fstab. So we'll make\n # them use a new name in the config, but we will treat the pre-mounted\n # mounts as valid/the same. Besides, since the device is meaningless, we\n # can just ignore it for the purposes of this test anyway.\n if desired['type'] == 'tmpfs'\n return tmpfs_mount_status(desired)\n end\n\n key = \"#{desired['device']},#{desired['mount_point']}\"\n fs_data = node.filesystem_data\n mounted = nil\n if fs_data['by_pair'][key]\n mounted = fs_data['by_pair'][key].to_hash\n else\n key = \"#{desired['device']}/,#{desired['mount_point']}\"\n if fs_data['by_pair'][key]\n mounted = fs_data['by_pair'][key].to_hash\n end\n end\n\n if mounted\n Chef::Log.debug(\n \"fb_fstab: There is an entry in node['filesystem'] for #{key}\",\n )\n # If it's a virtual device, we require the fs type to be identical.\n # otherwise, we require them to be similar. This is because 'auto'\n # is meaningless without a physical device, so we don't want to allow\n # it to be the same.\n if compare_fstype(desired['type'], mounted['fs_type']) ||\n (desired['device'].start_with?('/') &&\n [desired['type'], mounted['fs_type']].include?('auto'))\n Chef::Log.debug(\n \"fb_fstab: FS #{desired['device']} on #{desired['mount_point']}\" +\n ' is currently mounted...',\n )\n if compare_opts(desired['opts'], mounted['mount_options'])\n Chef::Log.debug('fb_fstab: ... with identical options.')\n return :same\n else\n Chef::Log.debug(\n \"fb_fstab: ... with different options #{desired['opts']} vs \" +\n mounted['mount_options'].join(','),\n )\n Chef::Log.info(\n \"fb_fstab: #{desired['mount_point']} is mounted with options \" +\n \"#{canonicalize_opts(mounted['mount_options'])} instead of \" +\n canonicalize_opts(desired['opts']).to_s,\n )\n return :remount\n end\n else\n Chef::Log.warn(\n \"fb_fstab: Device #{desired['device']} is mounted at \" +\n \"#{mounted['mount']} as desired, but with fstype \" +\n \"#{mounted['fs_type']} instead of #{desired['type']}\",\n )\n return :conflict\n end\n end\n\n # In this case we don't have the device we expect at the mountpoint we\n # expect. Assuming it's not NFS/Gluster which can be mounted in more than\n # once place, we look up this device and see if it moved or just isn't\n # mounted\n unless ['nfs', 'nfs4', 'glusterfs'].include?(desired['type'])\n device = fs_data['by_device'][desired['device']]\n # Here we are checking if the device we want\n # has already a mount defined\n # We want to return :moved if it does except\n # in the case when it's a btrfs\n # disk and our desired and current options\n # are trying to mount different subvolumes\n if device && device['mounts'] && !device['mounts'].empty? &&\n !(\n FB::Fstab.btrfs_subvol?(\n device['fs_type'],\n device['mount_options'].join(','),\n ) &&\n FB::Fstab.btrfs_subvol?(\n desired['type'],\n desired['opts'],\n ) &&\n !FB::Fstab.same_subvol?(\n device['mounts'][0],\n device['mount_options'].join(','),\n desired['opts'],\n )\n )\n\n Chef::Log.warn(\n \"fb_fstab: #{desired['device']} is at #{device['mounts']}, but\" +\n \" we want it at #{desired['mount_point']}\",\n )\n return :moved\n end\n end\n\n # Ok, this device isn't mounted, but before we return we need to check\n # if anything else is mounted where we want to be.\n if fs_data['by_mountpoint'][desired['mount_point']]\n devices = fs_data['by_mountpoint'][\n desired['mount_point']]['devices']\n Chef::Log.warn(\n \"fb_fstab: Device #{desired['device']} desired at \" +\n \"#{desired['mount_point']} but something #{devices} already \" +\n 'mounted there.',\n )\n return :conflict\n end\n :missing\n end",
"def kitchen_driver_file\n { virtualbox: File.join(@opts[:path], '.kitchen.yml'),\n docker: File.join(@opts[:path], '.kitchen.local.yml'),\n solusvm: File.join(@opts[:path], '.kitchen.local.yml')\n }\n end",
"def platform\n kernel.platform\n end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def config_path(config_type)\n config_type = config_type.to_s\n if (config_path = config_options.fetch(\"#{config_type}_config_path\".to_sym, nil))\n raise ConfigurationError, \"file does not exist #{config_path}\" unless ::File.file? config_path\n return ::File.expand_path(config_path)\n end\n\n # if solr, attempt to use path where fedora.yml is first\n if config_type == \"solr\" && (config_path = check_fedora_path_for_solr)\n return config_path\n end\n\n if defined?(Rails.root)\n config_path = \"#{Rails.root}/config/#{config_type}.yml\"\n return config_path if ::File.file? config_path\n end\n\n return \"#{Dir.getwd}/config/#{config_type}.yml\" if ::File.file? \"#{Dir.getwd}/config/#{config_type}.yml\"\n\n # Last choice, check for the default config file\n config_path = ::File.join(ActiveFedora.root, \"config\", \"#{config_type}.yml\")\n raise ConfigurationError, \"Couldn't load #{config_type} config file!\" unless ::File.file?(config_path)\n\n ActiveFedora::Base.logger.warn \"Using the default #{config_type}.yml that comes with active-fedora. If you want to override this, pass the path to #{config_type}.yml to ActiveFedora - ie. ActiveFedora.init(:#{config_type}_config_path => '/path/to/#{config_type}.yml') - or set Rails.root and put #{config_type}.yml into \\#{Rails.root}/config.\"\n config_path\n end",
"def create_filesystem(host, mount_name)\n fs_type = filesystem_type(host)\n\n case host['platform']\n when %r{aix}\n volume_group = on(host, 'lsvg').stdout.split(\"\\n\")[0]\n on(host, \"mklv -y #{mount_name} #{volume_group} 1M\")\n on(host, \"mkfs -V #{fs_type} -l #{mount_name} /dev/#{mount_name}\")\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n on(host, \"dd if=/dev/zero of='/tmp/#{mount_name}' count=16384\", acceptable_exit_codes: [0, 1])\n on(host, \"yes | mkfs -t #{fs_type} -q '/tmp/#{mount_name}'\", acceptable_exit_codes: (0..254))\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Creating filesystems on #{host['platform']} is not currently supported.\")\n end\n end",
"def initialize\n @path = File.join(File.expand_path('.'), FILE_NAME)\n unless File.exist?(@path)\n @path = (ENV['ASPELLBEE_CONFIG_PATH'] || File.join(File.expand_path('~'), FILE_NAME))\n end\n @data = load_config_file\n end",
"def determine_os\n @os = 'linux'\n end",
"def configuration\n\t\t\t\tconfiguration = Configuration.new\n\t\t\t\t\n\t\t\t\tself.resolved_paths.each do |path|\n\t\t\t\t\tpath = File.expand_path(path)\n\t\t\t\t\t\n\t\t\t\t\tconfiguration.load_file(path)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn configuration\n\t\t\tend"
] |
[
"0.6952392",
"0.69179416",
"0.65042853",
"0.6335989",
"0.632909",
"0.63050026",
"0.62324154",
"0.60316855",
"0.5980779",
"0.5933646",
"0.5915341",
"0.58948094",
"0.5754041",
"0.57516235",
"0.5748909",
"0.5716312",
"0.56952953",
"0.5685673",
"0.56470746",
"0.56381303",
"0.56236553",
"0.561768",
"0.5599746",
"0.5590033",
"0.55586594",
"0.5552326",
"0.55474794",
"0.5541553",
"0.5540239",
"0.5535819",
"0.5533584",
"0.5515185",
"0.5514701",
"0.54871374",
"0.5486827",
"0.5484102",
"0.548006",
"0.5450202",
"0.54437864",
"0.54314834",
"0.5430041",
"0.54188806",
"0.54130536",
"0.54120994",
"0.5411679",
"0.5409037",
"0.53994936",
"0.5386301",
"0.53794533",
"0.53516203",
"0.5346805",
"0.53280437",
"0.5322608",
"0.5322608",
"0.53175426",
"0.5311546",
"0.53008413",
"0.52874047",
"0.5277661",
"0.52756447",
"0.5272615",
"0.5260139",
"0.5243073",
"0.52257705",
"0.5209687",
"0.52050745",
"0.51962996",
"0.51951575",
"0.5186508",
"0.51788694",
"0.51749617",
"0.51719695",
"0.51708657",
"0.51640093",
"0.51552373",
"0.5149609",
"0.5142989",
"0.51425683",
"0.51421994",
"0.5139591",
"0.5136884",
"0.51318717",
"0.512758",
"0.51233447",
"0.5117235",
"0.5111655",
"0.511063",
"0.5106771",
"0.51057345",
"0.510004",
"0.5096451",
"0.5094947",
"0.5094947",
"0.5094947",
"0.5094947",
"0.50918543",
"0.50904906",
"0.5086026",
"0.50829864",
"0.50784993"
] |
0.75143844
|
0
|
Shell information object === Return platform specific shell information object
|
def shell
platform_service(:shell)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def system_info\n si = SysInfo.new\n si.to_hash\n rescue \n {}\n end",
"def info\n [[\"about\", Mysh::DESCRIPTION],\n [\"version\", Mysh::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mysh\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mysh\").to_s}],\n [\"init file\", $mysh_init_file.to_host_spec],\n [\"user\", ENV['USER']],\n [\"home\", (ENV['HOME'] || \"\").to_host_spec],\n [\"name\", (t = MNV[:name]).empty? ? $PROGRAM_NAME.to_host_spec : t],\n [\"os shell\", (ENV['SHELL'] || ENV['ComSpec'] || \"\").to_host_spec],\n [\"host\", ENV['HOSTNAME'] || ENV['COMPUTERNAME']],\n [\"os\", ENV['OS']],\n [\"platform\", MiniTerm::TERM_PLATFORM],\n [\"java?\", MiniTerm.java? ? true : false],\n [\"PID\", $PROCESS_ID]\n ]\n end",
"def platform_details\n data[:platform_details]\n end",
"def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n\t\tsystem_data[:version] = version\n\t\tsystem_data[:kernel] = kernel_version\n\t\tsystem_data[:hostname] = kernel_version.split(\" \")[1]\n\t\treturn system_data\n\tend",
"def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end",
"def get_os\n line = Cocaine::CommandLine.new('uname')\n output = line.run\n\n output.chomp.downcase.intern\n end",
"def platform\n System::get_property('platform')\n end",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def get_windows_info()\n sysname = \"\"\n processor = \"\"\n os_info = \"\"\n\n require 'win32/registry'\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion') do |reg|\n type, sysname = reg.read('ProductName')\n end\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\\ControlSet001\\Control\\Session Manager\\Environment') do |reg|\n type, processor = reg.read('PROCESSOR_ARCHITECTURE')\n end\n\n os_info = sysname + \" \" + processor\n os_info\nend",
"def get_sysinfo\n system_data = {}\n kernel_version = cmd_exec(\"uname -a\")\n version = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n system_data[:version] = version\n system_data[:kernel] = kernel_version\n system_data[:hostname] = kernel_version.split(\" \")[1]\n host_info = {\n :host => rhost,\n :os_name => 'Solaris',\n :name => system_data[:hostname]\n }\n # Test cases for these can be found here:\n # http://rubular.com/r/MsGuhp89F0\n # http://rubular.com/r/DWKG0jpPCk\n # http://rubular.com/r/EjiIa1RFxB\n if /(?<OS>(?<!Open|Oracle )Solaris).+s2?(?<major>\\d?\\d)[x|s]?(_u)(?<minor>\\d?\\d)/ =~ system_data[:version]\n host_info[:os_flavor] = \"#{major}.#{minor}\"\n elsif /(?<OS>Oracle Solaris) (?<major>\\d\\d)\\.(?<minor>\\d?\\d)/ =~ system_data[:version]\n host_info[:os_flavor] = \"#{major}.#{minor}\"\n elsif /(?<OS>OpenSolaris|OpenIndiana [\\w]+) (?<major>\\d\\d\\d\\d)\\.(?<minor>\\d\\d)/ =~ system_data[:version]\n host_info[:os_flavor] = \"#{major}.#{minor}\"\n end\n report_host(host_info)\n return system_data\n end",
"def init_kernel\n kernel Mash.new\n [[\"uname -s\", :name], [\"uname -r\", :release],\n [\"uname -v\", :version], [\"uname -m\", :machine],\n [\"uname -p\", :processor]].each do |cmd, property|\n so = shell_out(cmd)\n kernel[property] = so.stdout.strip\n end\n kernel\n end",
"def init_kernel\n kernel Mash.new\n [[\"uname -s\", :name], [\"uname -r\", :release],\n [\"uname -v\", :version], [\"uname -m\", :machine],\n [\"uname -p\", :processor]].each do |cmd, property|\n so = shell_out(cmd)\n kernel[property] = so.stdout.split($/)[0]\n end\n kernel\n end",
"def get_platform\n rpc_get_fact_direct('kernel')\n end",
"def platform\n data[:platform]\n end",
"def get_unix_info()\n v = $VERBOSE\n $VERBOSE = nil\n sysname = `uname -s`\n $VERBOSE = v\n sysname = sysname.chomp\n\n if(sysname.include?(\"Linux\")) # for linux (rhel, suse, oel)\n # check if it is SUSE\n filepath = Pathname.new(\"/etc/SuSE-release\")\n if(filepath.exist?())\n release_file = '/etc/SuSE-release'\n else # for RHEL, OEL, etc.\n release_file = '/etc/issue'\n end\n\n $VERBOSE = nil\n flavor = `head -n 1 #{release_file}`\n $VERBOSE = v\n sysname = flavor.sub(/\\(\\w+\\)/, '').chomp\n sysname = sysname.sub(/\\s+\\Z/, \"\")\n\n else # for other unix platforms (solaris, aix, hpux)\n $VERBOSE = nil\n if(sysname.eql?(\"AIX\"))\n version = `oslevel`\n else\n version = `uname -r`\n end\n $VERBOSE = v\n sysname = sysname + \" \" + version.chomp\n end\n\n $VERBOSE = nil\n if(sysname.eql?(\"HP-UX\"))\n processor = `uname -m`\n else\n processor = `uname -p`\n end\n\n if(sysname.include?(\"SunOS\"))\n isainfo = `isainfo -b`\n isainfo = isainfo.chomp\n bitinfo = \" \" + isainfo + \"-bit\"\n else\n bitinfo = \"\"\n end\n $VERBOSE = v\n\n os_info = sysname + \" \" + processor.chomp + bitinfo\n os_info\nend",
"def platform\n Ohai.platform\n end",
"def platform\n type = os_type(:nice)\n type = case type\n when /Linux/i then linux_type\n else type\n end\n \n # Grab the Solaris version; turns '5.9' into '9', for example. (Solaris has a really\n # bizarre numbering scheme.)\n #\n # FIXME: This should include patchlevel.\n if type =~ /Solaris/i\n if @solaris_version.nil?\n @solaris_version = @platform.exec(\"uname\", \"-r\").strip\n @solaris_version = $2 if @solaris_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*$/i\n end\n \n type += @solaris_version\n end\n \n # Grab the OS X version by looking at the Darwin kernel version.\n #\n # FIXME: This should include minor version, too (e.g., 10.4.7).\n if type =~ /OSX/i\n if @osx_version.nil?\n @osx_version = @platform.exec(\"uname\", \"-r\").strip\n if @osx_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+).*$/i\n minor_version = [ $1.to_i - 4, 0 ].max # i.e., Darwin 8.x => OS X 10.4, 7.x => OS X 10.3, etc.\n @osx_version = \"10.%d\" % minor_version\n else\n @osx_version = '-unknown-%s' % @osx_version\n end\n end\n \n type += @osx_version\n end\n \n # Grab the Windows version by System.getProperty\n if type =~ /Windows/i\n os_name = JavaSystem.getProperty('os.name');\n sun_os_patch_level = JavaSystem.getProperty('sun.os.patch.level');\n if @windows_version.nil?\n @windows_version = case os_name \n when /Windows 2003/i: \"win2k3\"\n when /Windows XP/i: \"winxp\"\n else os_name.gsub(/ /, '_')\n end\n unless sun_os_patch_level == \"unknown\"\n patch = ''\n sun_os_patch_level.split(/ /).each do |t|\n patch = \"#{patch}#{t[0..0]}\"\n end\n @windows_version += '-' + patch\n end \n end\n \n type = @windows_version\n end\n \n \"%s-%s\" % [ type.downcase, processor_type.downcase ]\n end",
"def os_metadata\n os =\n case RbConfig::CONFIG['host_os']\n when /mac|darwin/\n 'macos'\n when /linux|cygwin/\n 'linux'\n when /mingw|mswin/\n 'windows'\n else\n 'other'\n end\n metadata = \"os/#{os}\"\n local_version = Gem::Platform.local.version\n metadata += \"##{local_version}\" if local_version\n metadata += \" md/#{RbConfig::CONFIG['host_cpu']}\"\n metadata\n end",
"def gene_compatible_shell\n \trequire 'find'\n \trequire 'json'\n \tshells = {}\n \t#Read shells' info from SPEC files\n \tFind.find(File.expand_path(\"#{Dir.home}/.hcode/repos/\")) do |path|\n \t if path =~ /.*hcode\\.spec$/\n \t json = File.read(path)\n spec = JSON.parse(json)\n \t if(spec[\"type\"] == \"shell\")\n \t shell = {}\n \t shell[:name] = spec[\"name\"]\n shell[:compatible_shell] = Hash.new\n \t if (spec[\"compatible_shell\"] != nil)\n \t spec[\"compatible_shell\"].each{|k, v|\n \t shell[:compatible_shell][k] = v\n \t }\n \t end\n \t shells[shell[:name]] = shell\n \t end\n \t end\n \tend\n\n shells.each{|k_i,v_i|\n v_i[:compatible_shell].each{|k_j, v_j|\n if(shells[k_j] != nil)\n shells[k_j][:compatible_shell][k_i] = v_j\n else\n puts \"No shell exist: #{k_j}\"\n end\n }\n }\n\n File.open(File.expand_path(\"#{Dir.home}/.hcode/compatible_shell.json\"), 'w') { |fo| \n fo.puts shells.to_json\n }\n end",
"def info\n info = Hash.new\n output = @filer.invoke(\"system-get-info\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.children_get[0].children_get.each do |naelem|\n info[naelem.name] = naelem.content\n end\n end\n info\n end",
"def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def host_os; end",
"def host_os; end",
"def platform\n @attributes[:platform]\n end",
"def platform\n data.platform\n end",
"def platform_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunMetadata_platform_name(@handle.ptr)\n result\n end",
"def platform\n kernel.platform\n end",
"def sysinfo\n\t\trequest = Packet.create_request('stdapi_sys_config_sysinfo')\n\t\tresponse = client.send_request(request)\n\n\t\t{\n\t\t\t'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),\n\t\t\t'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),\n\t\t}\n\tend",
"def platform_name\n capabilities['platformName']\n end",
"def platform_tuple\n [platform_shortname, platform_version_for_package, machine]\n end",
"def uname\n shell(%w[uname])\n end",
"def platform\n fetch('device.platform')\n end",
"def get_sysinfo\n\t\tsystem_data = {}\n\t\tetc_files = cmd_exec(\"ls /etc\").split()\n\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tsystem_data[:kernel] = kernel_version\n\n\t\t# Debian\n\t\tif etc_files.include?(\"debian_version\")\n\t\t\tif kernel_version =~ /Ubuntu/\n\t\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\t\tsystem_data[:distro] = \"ubuntu\"\n\t\t\t\tsystem_data[:version] = version\n\t\t\telse\n\t\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\t\tsystem_data[:distro] = \"debian\"\n\t\t\t\tsystem_data[:version] = version\n\t\t\tend\n\n\t\t# Amazon\n\t\telsif etc_files.include?(\"system-release\")\n\t\t\tversion = read_file(\"/etc/system-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"amazon\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Fedora\n\t\telsif etc_files.include?(\"fedora-release\")\n\t\t\tversion = read_file(\"/etc/fedora-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"fedora\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Oracle Linux\n\t\telsif etc_files.include?(\"enterprise-release\")\n\t\t\tversion = read_file(\"/etc/enterprise-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"oracle\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# RedHat\n\t\telsif etc_files.include?(\"redhat-release\")\n\t\t\tversion = read_file(\"/etc/redhat-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"redhat\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Arch\n\t\telsif etc_files.include?(\"arch-release\")\n\t\t\tversion = read_file(\"/etc/arch-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"arch\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Slackware\n\t\telsif etc_files.include?(\"slackware-version\")\n\t\t\tversion = read_file(\"/etc/slackware-version\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"slackware\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Mandrake\n\t\telsif etc_files.include?(\"mandrake-release\")\n\t\t\tversion = read_file(\"/etc/mandrake-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"mandrake\"\n\t\t\tsystem_data[:version] = version\n\n\t\t#SuSE\n\t\telsif etc_files.include?(\"SuSE-release\")\n\t\t\tversion = read_file(\"/etc/SuSE-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"suse\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Gentoo\n\t\telsif etc_files.include?(\"gentoo-release\")\n\t\t\tversion = read_file(\"/etc/gentoo-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"gentoo\"\n\t\t\tsystem_data[:version] = version\n\t\telse\n\n\t\t\t# Others\n\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"linux\"\n\t\t\tsystem_data[:version] = version\n\t\tend\n\t\treturn system_data\n\tend",
"def read_shell(length = nil, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def sys\n return `uname -n`.chomp\n end",
"def VendorInfo()\r\n ret = @dispatch._getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend",
"def platform\n \"win\"\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def platform\n osver[0]\n end",
"def get_platform(host_os)\n return :osx if host_os =~ /darwin/\n return :linux if host_os =~ /linux/\n return :windows if host_os =~ /mingw32|mswin32/\n return :unknown\n end",
"def get_osx_release_data\n cmd = \"uname -s\"\n kernel = if InstallBuddy.get_option(:remote)\n Remote.exec(cmd)\n else\n `#{cmd}`\n end\n return [\"ID=MacOSX\"] if kernel.match(/^Darwin/)\n []\n end",
"def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end",
"def shell_env\n @shell.env\n end",
"def platform\n @platform ||= data.platform\n end",
"def fetch_basic_info\n {\n server: Socket.gethostname,\n rails_root: defined?(Rails) ? Rails.root : nil,\n process: $PROCESS_ID,\n uname: Sys::Uname.uname,\n timestamp: @timestamp,\n pwd: File.expand_path($PROGRAM_NAME)\n }\n end",
"def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend",
"def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"def platforms; platform_names; end",
"def get_machine_system_info(machine, output_format = 'LIST')\n handle_action_exceptions(__method__) do\n info = machine_run(machine, \"systeminfo /FO #{output_format.upcase}\")\n @json ? { 'result' => 'Success', 'content' => info } : info\n end\n end",
"def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end",
"def arch\n if windows? && windows_arch_i386?\n \"i386\"\n elsif solaris?\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n end\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end",
"def platform_version\n Ohai.platform_version\n end",
"def arch\n return `uname -m`.chomp\n end",
"def platform_types\n @platform_types.to_hash\n end",
"def os_values\n {\n debian: { owner: '136693071363', name: 'debian-10-amd64-*' },\n ubuntu: { owner: '099720109477', name: 'ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*' },\n }.with_indifferent_access\n end",
"def VendorInfo()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file)\n cmdline = IO.read(cmdline_file).split(?\\x00)\n else\n cmdline = ProcTable.ps(Process.pid).cmdline.split(' ')\n end\n\n if RUBY_PLATFORM =~ /darwin/i\n cmdline.delete_if{ |e| e.include?('=') }\n process[:name] = cmdline.join(' ')\n else\n process[:name] = cmdline.shift\n process[:arguments] = cmdline\n end\n\n process[:pid] = Process.pid\n # This is usually Process.pid but in the case of containers, the host agent\n # will return to us the true host pid in which we use to report data.\n process[:report_pid] = nil\n process\n end",
"def stack\n platform = self.platform\n os = fetch(\"computer.os.#{platform.downcase}\")\n \"#{platform}, #{os}\"\n end",
"def open_shell()\n\t\traise NotImplementedError\n\tend",
"def environment\n begin\n result = Shellter.run!(vbox_manage, \"showvminfo\", \":name\", \"--machinereadable\", :name => name)\n {}.with_indifferent_access.tap do |map|\n result.stdout.read.lines.each do |line|\n name, value = line.strip.split(\"=\").map { |y| y.gsub(/(^\"|\"$)/, \"\") }\n map[name] = value\n end\n end\n rescue\n {}\n end\n end",
"def run\n print_status(\"Gathering System info ....\")\n vm = nil\n dmi_info = nil\n ls_pci_data = nil\n\n if is_root?\n dmi_info = cmd_exec(\"/usr/sbin/dmidecode\")\n end\n\n # Check DMi Info\n if dmi_info\n case dmi_info\n when /microsoft corporation/i\n vm = \"MS Hyper-V\"\n when /vmware/i\n vm = \"VMware\"\n when /virtualbox/i\n vm = \"VirtualBox\"\n when /qemu/i\n vm = \"Qemu/KVM\"\n when /domu/i\n vm = \"Xen\"\n end\n end\n\n # Check Modules\n if not vm\n loaded_modules = cmd_exec(\"/sbin/lsmod\")\n case loaded_modules.to_s.gsub(\"\\n\", \" \")\n when /vboxsf|vboxguest/i\n vm = \"VirtualBox\"\n when /vmw_ballon|vmxnet|vmw/i\n vm = \"VMware\"\n when /xen-vbd|xen-vnif/\n vm = \"Xen\"\n when /virtio_pci|virtio_net/\n vm = \"Qemu/KVM\"\n when /hv_vmbus|hv_blkvsc|hv_netvsc|hv_utils|hv_storvsc/\n vm = \"MS Hyper-V\"\n end\n end\n\n # Check SCSI Driver\n if not vm\n proc_scsi = read_file(\"/proc/scsi/scsi\") rescue \"\"\n case proc_scsi.gsub(\"\\n\", \" \")\n when /vmware/i\n vm = \"VMware\"\n when /vbox/i\n vm = \"VirtualBox\"\n end\n end\n\n # Check IDE Devices\n if not vm\n case cmd_exec(\"cat /proc/ide/hd*/model\")\n when /vbox/i\n vm = \"VirtualBox\"\n when /vmware/i\n vm = \"VMware\"\n when /qemu/i\n vm = \"Qemu/KVM\"\n when /virtual [vc]d/i\n vm = \"Hyper-V/Virtual PC\"\n end\n end\n\n # Check using lspci\n if not vm\n case get_sysinfo[:distro]\n when /oracle|centos|suse|redhat|mandrake|slackware|fedora/i\n lspci_data = cmd_exec(\"/sbin/lspci\")\n when /debian|ubuntu/\n lspci_data = cmd_exec(\"/usr/bin/lspci\")\n else\n lspci_data = cmd_exec(\"lspci\")\n end\n\n case lspci_data.to_s.gsub(\"\\n\", \" \")\n when /vmware/i\n vm = \"VMware\"\n when /virtualbox/i\n vm = \"VirtualBox\"\n end\n end\n\n # Xen bus check\n if not vm\n if cmd_exec(\"ls -1 /sys/bus\").to_s.split(\"\\n\").include?(\"xen\")\n vm = \"Xen\"\n end\n end\n\n # Check using lscpu\n if not vm\n case cmd_exec(\"lscpu\")\n when /Xen/i\n vm = \"Xen\"\n when /KVM/i\n vm = \"KVM\"\n when /Microsoft/i\n vm = \"MS Hyper-V\"\n end\n end\n\n # Check dmesg Output\n if not vm\n dmesg = cmd_exec(\"dmesg\")\n case dmesg\n when /vboxbios|vboxcput|vboxfacp|vboxxsdt|vbox cd-rom|vbox harddisk/i\n vm = \"VirtualBox\"\n when /vmware virtual ide|vmware pvscsi|vmware virtual platform/i\n vm = \"VMware\"\n when /xen_mem|xen-vbd/i\n vm = \"Xen\"\n when /qemu virtual cpu version/i\n vm = \"Qemu/KVM\"\n when /\\/dev\\/vmnet/\n vm = \"VMware\"\n end\n end\n\n if vm\n print_good(\"This appears to be a '#{vm}' virtual machine\")\n report_virtualization(vm)\n else\n print_status(\"This does not appear to be a virtual machine\")\n end\n\n end",
"def shell_ruby_platform\n `ruby -rrbconfig -e \"puts RbConfig::CONFIG['sitearchdir']\"`\n end",
"def get_os_name\n\t\t\t\treturn SystemDetector.get_os_name\n\t\t\tend",
"def commands\n {\n 'help' => 'Help menu',\n 'background' => 'Backgrounds the current shell session',\n 'sessions' => 'Quickly switch to another session',\n 'resource' => 'Run a meta commands script stored in a local file',\n 'shell' => 'Spawn an interactive shell (*NIX Only)',\n 'download' => 'Download files (*NIX Only)',\n 'upload' => 'Upload files (*NIX Only)',\n 'source' => 'Run a shell script on remote machine (*NIX Only)',\n 'irb' => 'Open an interactive Ruby shell on the current session',\n 'pry' => 'Open the Pry debugger on the current session'\n }\n end",
"def os\n return `uname -s`.chomp\n end",
"def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end",
"def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end",
"def init_shell()\n\t\traise NotImplementedError\n\tend",
"def platform\n return @platform\n end",
"def name\n Properties[self.class] ||= {}\n return Properties[self.class][:name] || 'shell'\n end",
"def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end",
"def platform\n backend.platform\n end",
"def platform\n @spec.platform\n end",
"def determine_os\n @os = 'linux'\n end",
"def describePlatform\n TC.name.gsub(' ', '_')\nend",
"def platform_version\n osver[1]\n end",
"def platform\n window.execute_script('navigator.platform')\n end",
"def get_uname\n `uname -a`\n end",
"def determine_os\n @os = \"linux\"\n end",
"def user_os_simple\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n return \"Windows\" if ua.index('win')\r\n return \"Linux\" if ua.index('Linux')\r\n return \"Macintosh\" if ua.index('Macintosh')\r\n return \"unknown\"\r\n end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def get_device_info()\n @errors = []\n info = {}\n return info unless @programmer_path\n\n response = IO.popen(\"#{@programmer_path} I\").readlines\n puts response if $debug\n response.each do |line|\n if line =~ /Error/i\n errors << line\n else\n parts = line.split(/:|\\.\\.\\./)\n info[parts[0].strip.split.join.to_sym] = parts[1].strip if parts.size == 2\n end\n end # each\n info\n end",
"def determine_cpu\n cpu = @info[:cpu] = {}\n\n lscpu = @shell.query('LSCPU', 'lscpu')\n if lscpu.empty?\n cpuinfo = @shell.query('cat /proc/cpuinfo')\n count = cpuinfo.lines.select { |l| l =~ /^processor\\s*: [0-9]/}\n speed = cpuinfo.lines.select { |l| l =~ /MHz/ }\n cpu[:count] = count.size\n cpu[:speed] = speed[0].to_s.gsub(/.* /, '')\n else\n cpu[:count] = lscpu.select { |l| l =~ /CPU\\(s\\)/ }.gsub(/.* /, '')\n cpu[:speed] = lscpu.select { |l| l =~ /MHz/ }.gsub(/.* /, '')\n end\n end",
"def platform\n fetch('game.platform')\n end",
"def shell_api; end",
"def platform; RUBY_PLATFORM; end",
"def powershell_prefix\n [\n Mixlib::Install::Generator::PowerShell.get_script(\"helpers.ps1\"),\n \"$platform_architecture = Get-PlatformArchitecture\",\n \"$platform_version = Get-PlatformVersion\",\n ].join(\"\\n\")\n end",
"def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end",
"def shell_cmd\n if !config[:shell].nil?\n config[:sudo] ? \"sudo #{config[:shell]}\" : \"#{config[:shell]}\"\n elsif windows_os?\n \"powershell\"\n else\n config[:sudo] ? \"sudo pwsh\" : \"pwsh\"\n end\n end",
"def name\n RUBY_PLATFORM\n end",
"def os_platform\n return @parsed_ua.os ? @parsed_ua.os : 'Unknown'\n end",
"def platform\n @root.attributes[\"pl\"].to_i\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def user_system_info\n {\n :system => NoPlanB::HttpHeaderUtils.extract_system_info(request.env['HTTP_USER_AGENT']),\n :browser => NoPlanB::HttpHeaderUtils.extract_browser_info(request.env['HTTP_USER_AGENT']),\n :ip_address => request.remote_ip\n }\n end"
] |
[
"0.6689762",
"0.6636347",
"0.66170174",
"0.6578006",
"0.65085405",
"0.6442196",
"0.64024925",
"0.6366687",
"0.63666725",
"0.6339518",
"0.62957776",
"0.6282682",
"0.6281499",
"0.62346214",
"0.61682725",
"0.6156232",
"0.6148804",
"0.61254436",
"0.6071706",
"0.6061344",
"0.605206",
"0.602818",
"0.602818",
"0.6026061",
"0.60216075",
"0.6002851",
"0.59768647",
"0.59503776",
"0.59287167",
"0.5901067",
"0.5894675",
"0.58809096",
"0.5870904",
"0.5870859",
"0.58570135",
"0.5856067",
"0.5856054",
"0.5856054",
"0.5856054",
"0.5854291",
"0.5850996",
"0.5845723",
"0.58401227",
"0.58338016",
"0.58333135",
"0.5832589",
"0.58115023",
"0.57790065",
"0.5753589",
"0.57477975",
"0.573975",
"0.57334685",
"0.5720621",
"0.57076454",
"0.5702839",
"0.57024044",
"0.56887126",
"0.56877965",
"0.56800723",
"0.5670287",
"0.566544",
"0.56551117",
"0.56547856",
"0.5652543",
"0.5651354",
"0.5651277",
"0.5645044",
"0.5639785",
"0.5637599",
"0.5637304",
"0.5635281",
"0.5633505",
"0.56315655",
"0.5629177",
"0.56152767",
"0.5612316",
"0.56009936",
"0.55975413",
"0.55956775",
"0.5587193",
"0.5584161",
"0.5583052",
"0.55816436",
"0.5581323",
"0.55799687",
"0.55743724",
"0.55518097",
"0.555126",
"0.5549699",
"0.55482876",
"0.5545387",
"0.55297977",
"0.5525102",
"0.5522106",
"0.5521595",
"0.5515028",
"0.5510431",
"0.5510431",
"0.5510431",
"0.5506853"
] |
0.65523195
|
4
|
SSH information object === Return platform specific ssh object
|
def ssh
platform_service(:ssh)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ssh_info\n # Run a custom action called \"read_ssh_info\" which does what it says\n # and puts the resulting SSH info into the `:machine_ssh_info` key in\n # the environment.\n #\n # Ssh info has following format..\n #\n #{\n # :host => \"1.2.3.4\",\n # :port => \"22\",\n # :username => \"mitchellh\",\n # :private_key_path => \"/path/to/my/key\"\n #}\n env = @machine.action(\"read_ssh_info\")\n env[:machine_ssh_info]\n end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_info\n # If the VM is not running that we can't possibly SSH into it\n return nil if state.id != :running\n\n detected_ip = @driver.ssh_ip\n\n # If ip couldn't be detected then we cannot possibly SSH into it,\n # and should return nil too.\n return nil if !detected_ip\n\n # Return ip from running machine, use ip from config if available\n {\n host: detected_ip,\n port: @driver.ssh_port(@machine.config.ssh.guest_port)\n }\n end",
"def get_ssh_info\n\n h = Hash.new()\n\n if @ssh_info.class.eql?(Hash)\n @logger.debug('using cached SSH info')\n h = @ssh_info\n else\n\n res = self.vagrant(sprintf('ssh-config %s', @name))\n\n res.split(\"\\n\").each do |line|\n if line.match(/HostName (.*?)$/)\n h[:hostname] = $1\n elsif line.match(/User (\\w*?)$/)\n h[:user] = $1\n elsif line.match(/Port (\\d*?)$/)\n h[:ssh_port] = $1\n elsif line.match(/IdentityFile (.*?)$/)\n h[:identity_file] = $1\n @logger.info(sprintf('vagrant specified key[%s] differs from provided[%s], will use both', @sshkey, h[:identity_file]))\n end\n end\n\n @ssh_info = h\n end\n\n h\n end",
"def info\n results = {\n :host => @vm.config.ssh.host,\n :port => @vm.config.ssh.port || @vm.driver.ssh_port(@vm.config.ssh.guest_port),\n :username => @vm.config.ssh.username,\n :forward_agent => @vm.config.ssh.forward_agent,\n :forward_x11 => @vm.config.ssh.forward_x11,\n :password => @vm.config.ssh.password\n }\n\n # This can happen if no port is set and for some reason Vagrant\n # can't detect an SSH port.\n raise Errors::SSHPortNotDetected if !results[:port]\n\n # Determine the private key path, which is either set by the\n # configuration or uses just the built-in insecure key.\n pk_path = @vm.config.ssh.private_key_path || @vm.env.default_private_key_path\n results[:private_key_path] = File.expand_path(pk_path, @vm.env.root_path)\n\n # We need to check and fix the private key permissions\n # to make sure that SSH gets a key with 0600 perms.\n check_key_permissions(results[:private_key_path])\n\n # Return the results\n return results\n end",
"def kind\n :ssh\n end",
"def ssh_info\n # If the Container is not created then we cannot possibly SSH into it, so\n # we return nil.\n return nil if state == :not_created\n\n network = @driver.inspect_container(@machine.id)['NetworkSettings']\n ip = network['IPAddress']\n\n # If we were not able to identify the container's IP, we return nil\n # here and we let Vagrant core deal with it ;)\n return nil unless ip\n\n {\n :host => ip,\n :port => @machine.config.ssh.guest_port\n }\n end",
"def ssh_command(ssh_info)\n command_options = %W[\n -o Compression=yes\n -o DSAAuthentication=yes\n -o LogLevel=#{ssh_info[:log_level] || 'FATAL'}\n -o StrictHostKeyChecking=no\n -o UserKnownHostsFile=/dev/null\n ]\n\n if ssh_info[:forward_x11]\n command_options += %w[\n -o ForwardX11=yes\n -o ForwardX11Trusted=yes\n ]\n end\n\n if ssh_info[:forward_agent]\n command_options += %w[-o ForwardAgent=yes]\n end\n\n ssh_info[:private_key_path].each do |path|\n command_options += ['-i', path]\n end\n\n if ssh_info[:port]\n command_options += ['-p', ssh_info[:port]]\n end\n\n \"ssh #{command_options.join(' ')}\"\n end",
"def getSSHConfig\n describe(cloud_id: @cloud_id)\n# XXX add some awesome alternate names from metadata and make sure they end\n# up in MU::MommaCat's ssh config wangling\n return nil if @config.nil? or @deploy.nil?\n\n nat_ssh_key = nat_ssh_user = nat_ssh_host = nil\n if !@config[\"vpc\"].nil? and !MU::Cloud.resourceClass(\"Google\", \"VPC\").haveRouteToInstance?(cloud_desc, credentials: @config['credentials'])\n\n if !@nat.nil?\n if @nat.cloud_desc.nil?\n MU.log \"NAT was missing cloud descriptor when called in #{@mu_name}'s getSSHConfig\", MU::ERR\n return nil\n end\n _foo, _bar, _baz, nat_ssh_host, nat_ssh_user, nat_ssh_key = @nat.getSSHConfig\n if nat_ssh_user.nil? and !nat_ssh_host.nil?\n MU.log \"#{@config[\"name\"]} (#{MU.deploy_id}) is configured to use #{@config['vpc']} NAT #{nat_ssh_host}, but username isn't specified. Guessing root.\", MU::ERR, details: caller\n nat_ssh_user = \"root\"\n end\n end\n end\n\n if @config['ssh_user'].nil?\n if windows?\n @config['ssh_user'] = @config['windows_admin_user']\n @config['ssh_user'] ||= \"Administrator\"\n else\n @config['ssh_user'] = \"root\"\n end\n end\n\n return [nat_ssh_key, nat_ssh_user, nat_ssh_host, canonicalIP, @config['ssh_user'], @deploy.ssh_key_name]\n\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def get_os_version(ssh_session)\n (ssh_session,os_version) = ssh_session_exec(ssh_session,\"uname -r\")\n os_version = os_version.chomp\n if $verbose_mode == true\n puts \"vSphere version: \"+os_version\n end\n return ssh_session,os_version\nend",
"def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end",
"def getSSHConfig\n node, config, deploydata = describe(cloud_id: @cloud_id)\n# XXX add some awesome alternate names from metadata and make sure they end\n# up in MU::MommaCat's ssh config wangling\n ssh_keydir = Etc.getpwuid(Process.uid).dir+\"/.ssh\"\n return nil if @config.nil? or @deploy.nil?\n\n nat_ssh_key = nat_ssh_user = nat_ssh_host = nil\n if !@config[\"vpc\"].nil? and !MU::Cloud::AWS::VPC.haveRouteToInstance?(cloud_desc, region: @config['region'], credentials: @config['credentials'])\n if !@nat.nil?\n if @nat.is_a?(Struct) && @nat.nat_gateway_id && @nat.nat_gateway_id.start_with?(\"nat-\")\n raise MuError, \"Configured to use NAT Gateway, but I have no route to instance. Either use Bastion, or configure VPC peering\"\n end\n\n if @nat.cloud_desc.nil?\n MU.log \"NAT was missing cloud descriptor when called in #{@mu_name}'s getSSHConfig\", MU::ERR\n return nil\n end\n # XXX Yanking these things from the cloud descriptor will only work in AWS!\n\n nat_ssh_key = @nat.cloud_desc.key_name\n\t\t\t\t\t\t\tnat_ssh_key = @config[\"vpc\"][\"nat_ssh_key\"] if !@config[\"vpc\"][\"nat_ssh_key\"].nil?\n nat_ssh_host = @nat.cloud_desc.public_ip_address\n nat_ssh_user = @config[\"vpc\"][\"nat_ssh_user\"]\n if nat_ssh_user.nil? and !nat_ssh_host.nil?\n MU.log \"#{@config[\"name\"]} (#{MU.deploy_id}) is configured to use #{@config['vpc']} NAT #{nat_ssh_host}, but username isn't specified. Guessing root.\", MU::ERR, details: caller\n nat_ssh_user = \"root\"\n end\n end\n end\n\n if @config['ssh_user'].nil?\n if windows?\n @config['ssh_user'] = \"Administrator\"\n else\n @config['ssh_user'] = \"root\"\n end\n end\n\n return [nat_ssh_key, nat_ssh_user, nat_ssh_host, canonicalIP, @config['ssh_user'], @deploy.ssh_key_name]\n\n end",
"def ssh\n @ssh ||= @remote.connect\n @remote\n end",
"def getSSHConfig\n cloud_desc(use_cache: false) # make sure we're current\n# XXX add some awesome alternate names from metadata and make sure they end\n# up in MU::MommaCat's ssh config wangling\n return nil if @config.nil? or @deploy.nil?\n\n nat_ssh_key = nat_ssh_user = nat_ssh_host = nil\n if !@config[\"vpc\"].nil? and !MU::Cloud.resourceClass(\"AWS\", \"VPC\").haveRouteToInstance?(cloud_desc, region: @region, credentials: @credentials)\n if !@nat.nil?\n if @nat.is_a?(Struct) && @nat.nat_gateway_id && @nat.nat_gateway_id.start_with?(\"nat-\")\n raise MuError, \"Configured to use NAT Gateway, but I have no route to instance. Either use Bastion, or configure VPC peering\"\n end\n\n if @nat.cloud_desc.nil?\n MU.log \"NAT was missing cloud descriptor when called in #{@mu_name}'s getSSHConfig\", MU::ERR\n return nil\n end\n # XXX Yanking these things from the cloud descriptor will only work in AWS!\n\n nat_ssh_key = @nat.cloud_desc.key_name\n\t\t\t\t\t\t\tnat_ssh_key = @config[\"vpc\"][\"nat_ssh_key\"] if !@config[\"vpc\"][\"nat_ssh_key\"].nil?\n nat_ssh_host = @nat.cloud_desc.public_ip_address\n nat_ssh_user = @config[\"vpc\"][\"nat_ssh_user\"]\n if nat_ssh_user.nil? and !nat_ssh_host.nil?\n MU.log \"#{@config[\"name\"]} (#{MU.deploy_id}) is configured to use #{@config['vpc']} NAT #{nat_ssh_host}, but username isn't specified. Guessing root.\", MU::ERR, details: caller\n nat_ssh_user = \"root\"\n end\n end\n end\n\n if @config['ssh_user'].nil?\n if windows?\n @config['ssh_user'] = \"Administrator\"\n else\n @config['ssh_user'] = \"root\"\n end\n end\n\n return [nat_ssh_key, nat_ssh_user, nat_ssh_host, canonicalIP, @config['ssh_user'], @deploy.ssh_key_name]\n\n end",
"def Host(rh)\n if rh.is_a?(SSHKit::Host)\n rh\n else\n SSHKit::Host.new(rh)\n end\n end",
"def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end",
"def inspect\n if @hostname.nil?\n if @ssh.is_a?(ZTK::SSH)\n @hostname ||= @ssh.exec(%(hostname -s)).output.strip\n else\n if @ssh.respond_to?(:exec!)\n @hostname ||= @ssh.exec!(%(hostname -s)).strip\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n end\n\n tags = Array.new\n tags << \"host=#{@hostname.inspect}\"\n tags << \"use_sudo=#{@use_sudo.inspect}\"\n tags = tags.join(' ')\n\n \"#<#{self.class} #{tags}>\"\n end",
"def initialize_ssh; end",
"def ssh_config_options(host)\n return Net::SSH::Config.for(host)\n end",
"def ssh_data\n <<-SSH_DATA\n ssh-keys = \"#{@user}:#{@public_key_value}}\"\n enable-oslogin = \"FALSE\"\n SSH_DATA\n end",
"def name\n ssh.exec!(\"hostname\").chomp\n end",
"def sshAndScp\n return contentHost.sshAndScp\n end",
"def ssh_common_opts\n [\"-i #{@machine.ssh_info[:private_key_path]}\",\n \"-p #{@machine.ssh_info[:port]}\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\",\n \"-o IdentitiesOnly=yes\",\n \"-o LogLevel=ERROR\"]\n end",
"def to_s()\n return \"ssh:#{@parameters[:user]}@#{@parameters[:host]}\"\n end",
"def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end",
"def getSSHConnectionHelper()\n return SSHConnection.new\n end",
"def desc\n \"SSH command shell\"\n end",
"def ssh?\n @session.transport.class.to_s.include?('SSH')\n end",
"def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend",
"def discover_ssh_executable\n @ssh_executable ||= begin\n guessing_locations = ['ssh']\n\n #:nocov:\n if RHC::Helpers.windows?\n # looks for ssh.exe from git-for-windows or plink.exe from PuTTY, either on path or specific locations\n guessing_locations <<\n discover_windows_executables do |base|\n from_files = ENV['PATH'].split(File::PATH_SEPARATOR).map {|p| p + File::ALT_SEPARATOR + 'ssh.exe'}\n from_files + [\n 'ssh.exe',\n \"#{base}\\\\Git\\\\bin\\\\ssh.exe\",\n \"#{base}\\\\Git\\\\usr\\\\bin\\\\ssh.exe\",\n \"#{base}\\\\ssh.exe\",\n 'plink.exe',\n \"#{base}\\\\PuTTY\\\\plink.exe\",\n \"#{base}\\\\plink.exe\",\n 'putty.exe',\n \"#{base}\\\\PuTTY\\\\putty.exe\",\n \"#{base}\\\\putty.exe\"\n ]\n end\n end\n #:nocov:\n\n # make sure commands can be executed and finally pick the first one\n guessing_locations.flatten.uniq.select do |cmd|\n (check_ssh_executable!(cmd).present? rescue false) &&\n (begin\n # putty -V exit as 1\n cmd =~ /plink\\.exe/i || cmd =~ /putty\\.exe/i || (begin\n ssh_version(cmd)\n $?.success?\n end)\n rescue ; false ; end)\n end.collect{|cmd| cmd =~ / / ? '\"' + cmd + '\"' : cmd}.first\n end\n end",
"def ssh_port\n self.vm_field \"ssh_port\"\n end",
"def ssh?\n true\n end",
"def platform\n Ohai.platform\n end",
"def hostname\n ssh.exec!(\"hostname\").chomp\n end",
"def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end",
"def sshhost\n \"#{script.cluster}.osc.edu\"\n end",
"def ssh_host_name( host )\n # This is included here for expected Space-wide policy settings.\n host[ :internet_name ] || host[ :internet_ip ] || host.name\n end",
"def config_ssh(username, host, options = nil)\n @ssh = SSH.new(username, host, options)\n end",
"def host_info\n @host_info\n end",
"def desc\n\t\t\"metaSSH\"\n\tend",
"def tiny_ssh?\n cc.defines.include? 'MRB_SSH_TINY'\n end",
"def ssh_options\n process_keys\n options = base_options\n\n config.port.nil? or options.merge!(:port => config.port)\n config.password.nil? or options.merge!(:password => config.password)\n config.keys.nil? or options.merge!(:keys => config.keys)\n\n config.ui.logger.debug { \"ssh_options(#{options.inspect})\" }\n options\n end",
"def connect(opts={})\n if Mario::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n # Command line options\n command_options = [\"-p #{options[:port]}\", \"-o UserKnownHostsFile=/dev/null\",\n \"-o StrictHostKeyChecking=no\", \"-o IdentitiesOnly=yes\",\n \"-i #{options[:private_key_path]}\"]\n command_options << \"-o ForwardAgent=yes\" if env.config.ssh.forward_agent\n\n if env.config.ssh.forward_x11\n # Both are required so that no warnings are shown regarding X11\n command_options << \"-o ForwardX11=yes\"\n command_options << \"-o ForwardX11Trusted=yes\"\n end\n\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n pid = nil\n pid = fork if Util::Platform.leopard? || Util::Platform.tiger?\n Kernel.exec \"ssh #{command_options.join(\" \")} #{options[:username]}@#{options[:host]}\".strip if pid.nil?\n Process.wait(pid) if pid\n end",
"def create_ssh_transport(host, options)\n require 'chef/provisioning/transport/ssh'\n ssh_user = options[:user]\n options = options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }\n Chef::Provisioning::Transport::SSH.new(\n host,\n ssh_user,\n options.to_hash,\n @config[:machine_options][:sudo] ? { prefix: 'sudo ' } : {},\n config\n )\n end",
"def ssh_info_check(session, host, user, pass)\n sshdump=@@outdir + host + '-ssh_dump.txt'\n Dir.mkdir(@@outdir + host) unless File.exists?(@@outdir + host) and File.directory?(@@outdir + host)\n f=File.open(sshdump, 'w+')\n f.puts \"Host: #{host}\"\n f.puts \"User: #{user}\"\n f.puts \"Pass: #{pass}\"\n hostname = session.exec!(\"hostname\").chomp\n print_good(\"Hostname: #{hostname}\") unless hostname.nil? or hostname == ''\n f.puts \"Hostname: #{hostname}\" unless hostname.nil? or hostname == ''\n id = session.exec!(\"id\").chomp\n print_good(\"UserID: #{id}\") if id =~ /uid=\\d+/\n f.puts \"UserID: #{id}\" if id =~ /uid=\\d+/\n uname = session.exec!(\"uname -a\").chomp\n print_good(\"Uname: #{uname}\") unless uname.nil? or uname == ''\n f.puts \"Uname: #{uname}\" unless uname.nil? or uname == ''\n uptime = session.exec!(\"uptime\").chomp\n print_good(\"Uptime: #{uptime}\") unless uptime.nil? or uptime == ''\n f.puts \"Uptime: #{uptime}\" unless uptime.nil? or uptime == ''\n f.puts\n puts\n session.close\n end",
"def print_connection_info\n # Print out some debugging commands (probably work on mac/linux only)\n puts ''\n puts 'Server SSH Command:'\n puts \"ssh -i #{@os_aws.private_key_file_name} ubuntu@#{@os_aws.server.data[:dns]}\"\n if !@os_aws.workers.empty?\n puts ''\n puts 'Worker SSH Command:'\n @os_aws.workers.each do |worker|\n puts \"ssh -i #{@os_aws.private_key_file_name} ubuntu@#{worker.data[:dns]}\"\n end\n end\n end",
"def get_sysinfo\n system_data = {}\n kernel_version = cmd_exec(\"uname -a\")\n version = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n system_data[:version] = version\n system_data[:kernel] = kernel_version\n system_data[:hostname] = kernel_version.split(\" \")[1]\n host_info = {\n :host => rhost,\n :os_name => 'Solaris',\n :name => system_data[:hostname]\n }\n # Test cases for these can be found here:\n # http://rubular.com/r/MsGuhp89F0\n # http://rubular.com/r/DWKG0jpPCk\n # http://rubular.com/r/EjiIa1RFxB\n if /(?<OS>(?<!Open|Oracle )Solaris).+s2?(?<major>\\d?\\d)[x|s]?(_u)(?<minor>\\d?\\d)/ =~ system_data[:version]\n host_info[:os_flavor] = \"#{major}.#{minor}\"\n elsif /(?<OS>Oracle Solaris) (?<major>\\d\\d)\\.(?<minor>\\d?\\d)/ =~ system_data[:version]\n host_info[:os_flavor] = \"#{major}.#{minor}\"\n elsif /(?<OS>OpenSolaris|OpenIndiana [\\w]+) (?<major>\\d\\d\\d\\d)\\.(?<minor>\\d\\d)/ =~ system_data[:version]\n host_info[:os_flavor] = \"#{major}.#{minor}\"\n end\n report_host(host_info)\n return system_data\n end",
"def configuration_for(host, use_ssh_config); end",
"def get_connect_info(host, host_id)\n conn_opts = {}\n client = OpenNebula::Client.new\n\n if host.is_a?(String)\n if !host_id\n pool = OpenNebula::HostPool.new(client)\n pool.info\n objects = pool.select {|object| object.name==host }\n host_id = objects.first.id\n @host_id = host_id\n end\n else\n host_id = host['ID']\n end\n\n xmlhost = OpenNebula::Host.new_with_id(host_id, client)\n xmlhost.info(true)\n\n if xmlhost[\"TEMPLATE/PROVISION\"]\n @tmplBase = 'TEMPLATE/PROVISION'\n else\n @tmplBase = 'TEMPLATE'\n end\n\n if xmlhost[\"TEMPLATE/PM_MAD\"]\n @provision_type = :host\n else\n @provision_type = :vm\n end\n\n conn_opts = {\n :access => xmlhost[\"#{@tmplBase}/EC2_ACCESS\"],\n :secret => xmlhost[\"#{@tmplBase}/EC2_SECRET\"],\n :region => xmlhost[\"#{@tmplBase}/REGION_NAME\"]\n }\n\n return conn_opts\n end",
"def ssh_cli_string(id)\n server = @connection.servers.get(id)\n \"ssh -i #{self.key_path} #{self.login_user}@#{server.public_ip_address}\"\n end",
"def hostname\n return 'unknown' unless available?\n @hostname ||= ssh_cmd('hostname').chomp\n end",
"def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n\t\tsystem_data[:version] = version\n\t\tsystem_data[:kernel] = kernel_version\n\t\tsystem_data[:hostname] = kernel_version.split(\" \")[1]\n\t\treturn system_data\n\tend",
"def os\n @host\n end",
"def get_rdp_info(machine)\n rdp_info = {}\n if machine.provider.capability?(:rdp_info)\n rdp_info = machine.provider.capability(:rdp_info)\n rdp_info ||= {}\n end\n\n ssh_info = machine.ssh_info || {}\n\n if !rdp_info[:username]\n username = ssh_info[:username]\n if machine.config.vm.communicator == :winrm\n username = machine.config.winrm.username\n end\n rdp_info[:username] = username\n end\n\n if !rdp_info[:password]\n password = ssh_info[:password]\n if machine.config.vm.communicator == :winrm\n password = machine.config.winrm.password\n end\n rdp_info[:password] = password\n end\n\n rdp_info[:host] ||= ssh_info[:host]\n rdp_info[:port] ||= machine.config.rdp.port\n rdp_info[:username] ||= machine.config.rdp.username\n\n if rdp_info[:host] == \"127.0.0.1\"\n # We need to find a forwarded port...\n search_port = machine.config.rdp.search_port\n ports = nil\n if machine.provider.capability?(:forwarded_ports)\n ports = machine.provider.capability(:forwarded_ports)\n else\n ports = {}.tap do |result|\n machine.config.vm.networks.each do |type, netopts|\n next if type != :forwarded_port\n next if !netopts[:host]\n result[netopts[:host]] = netopts[:guest]\n end\n end\n end\n\n ports = ports.invert\n port = ports[search_port]\n rdp_info[:port] = port\n return nil if !port\n end\n\n rdp_info\n end",
"def connect_options(options)\n connect_options = {:ssh_options=>{}}\n if options[:port]\n connect_options[:ssh_options][:port] = options[:port]\n end\n if options[:ip]\n connect_options[:ssh_options][:host_name] = options[:ip]\n end\n return connect_options\n end",
"def initialize(host, user, comm = nil)\n\n ssh_opts = {\n :port => host.port,\n :config => true,\n :keys => \"~/.ssh/id_rsa\",\n :verbose => :debug,\n :timeout => 20\n #:paranoid => true\n }\n\n ssh_opts.merge!(:password => host.pass) if host.pass && host.pass != \"\"\n p ssh_opts\n Net::SSH.start(host.addr, user, ssh_opts) do |ssh|\n # puts hostname = ssh.exec_with_status(\"hostname\").result\n if comm\n ex = ssh.exec_with_status(comm)\n ssh.loop\n @buffer = ex.result\n\n else\n @result = { }\n for sample in Stat::comm(host)\n puts \"Executing #{sample}\"\n @result[sample[0]] = ssh.exec_with_status(sample[1])\n end\n\n ssh.loop\n @result.map { |k, v| @result[k] = v.result}\n s = host.stats.create(@result)\n end\n\n #s.save!\n end\n end",
"def ssh_port\n max_adapters = machine.parent.system_properties.get_max_network_adapters(machine.chipset_type)\n\n max_adapters.times do |i|\n adapter = machine.get_network_adapter(i)\n\n port_details = adapter.nat_driver.redirects.detect do |redirect|\n redirect.split(',').first == 'ssh'\n end\n\n if port_details\n return port_details.split(',')[3]\n end\n end\n\n nil\n end",
"def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"def ssh_version(cmd=discover_ssh_executable)\n `\"#{cmd}\" -V 2>&1`.strip\n end",
"def home_path\n @ssh_home\n end",
"def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end",
"def host_os; end",
"def host_os; end",
"def platform_details\n data[:platform_details]\n end",
"def initialize shell, id = \"id_rsa\"\n @shell = shell\n @ssh_home = File.join ENV[\"HOME\"], \".ssh\"\n @ssh_id = id\n end",
"def supported_ssh_host_key_algorithms\n @host_key_algo ||= SshKey.supported_host_key_algorithms(\n Util.read_file([:node_ssh_pub_key, @node.name])\n )\n end",
"def system_info\n si = SysInfo.new\n si.to_hash\n rescue \n {}\n end",
"def read_ssh_service_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_ssh_service ...\"\n end\n # resource path\n local_var_path = \"/node/services/ssh\"\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 => 'NodeSshServiceProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_ssh_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def info\n [[\"about\", Mysh::DESCRIPTION],\n [\"version\", Mysh::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mysh\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mysh\").to_s}],\n [\"init file\", $mysh_init_file.to_host_spec],\n [\"user\", ENV['USER']],\n [\"home\", (ENV['HOME'] || \"\").to_host_spec],\n [\"name\", (t = MNV[:name]).empty? ? $PROGRAM_NAME.to_host_spec : t],\n [\"os shell\", (ENV['SHELL'] || ENV['ComSpec'] || \"\").to_host_spec],\n [\"host\", ENV['HOSTNAME'] || ENV['COMPUTERNAME']],\n [\"os\", ENV['OS']],\n [\"platform\", MiniTerm::TERM_PLATFORM],\n [\"java?\", MiniTerm.java? ? true : false],\n [\"PID\", $PROCESS_ID]\n ]\n end",
"def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end",
"def get_host_details\n @host = find_host_by_spoof || find_host_by_token || find_host_by_ip_or_mac\n unless @host\n logger.info \"#{controller_name}: unable to find a host that matches the request from #{request.env['REMOTE_ADDR']}\"\n head(:not_found) and return\n end\n unless @host.operatingsystem\n logger.error \"#{controller_name}: #{@host.name}'s operating system is missing!\"\n head(:conflict) and return\n end\n unless @host.operatingsystem.family\n # Then, for some reason, the OS has not been specialized into a Redhat or Debian class\n logger.error \"#{controller_name}: #{@host.name}'s operating system [#{@host.operatingsystem.fullname}] has no OS family!\"\n head(:conflict) and return\n end\n logger.info \"Found #{@host}\"\n end",
"def build_ssh_command(host)\n user_opt = ''\n key_opt = ''\n port_opt = ''\n ssh_options = config.rsync_options\n\n if user = host.user || ssh_options[:user]\n user_opt = \" -l #{user}\"\n end\n\n if keys = (host.keys.empty? ? ssh_options[:keys] : host.keys)\n keys = keys.is_a?(Array) ? keys : [keys]\n key_opt = keys.map { |key| \" -i #{key}\" }.join('')\n end\n\n if port = host.port || ssh_options[:port]\n port_opt = \" -p #{port}\"\n end\n\n \"ssh#{user_opt}#{key_opt}#{port_opt}\"\n end",
"def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end",
"def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end",
"def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend",
"def get_ssh_session\n ssh = nil\n begin\n ssh = Net::SSH.start(@node, @user, :password => @password)\n ssh.loop(true)\n rescue Exception => e\n puts \"Unknown Net:SSH Exception : #{e.message}\"\n return nil\n end\n ssh\n end",
"def runner_options_for_ssh(config_data)\n kitchen = instance.transport.send(:connection_options, config_data).dup\n\n opts = {\n 'backend' => 'ssh',\n 'logger' => logger,\n # pass-in sudo config from kitchen verifier\n 'sudo' => config[:sudo],\n 'host' => kitchen[:hostname],\n 'port' => kitchen[:port],\n 'user' => kitchen[:username],\n 'keepalive' => kitchen[:keepalive],\n 'keepalive_interval' => kitchen[:keepalive_interval],\n 'connection_timeout' => kitchen[:timeout],\n 'connection_retries' => kitchen[:connection_retries],\n 'connection_retry_sleep' => kitchen[:connection_retry_sleep],\n 'max_wait_until_ready' => kitchen[:max_wait_until_ready],\n 'compression' => kitchen[:compression],\n 'compression_level' => kitchen[:compression_level],\n }\n opts['key_files'] = kitchen[:keys] unless kitchen[:keys].nil?\n opts['password'] = kitchen[:password] unless kitchen[:password].nil?\n\n opts\n end",
"def session\n @session ||= Ssh::Session.new(name,\n :host => '127.0.0.1',\n :port => ssh_port,\n :username => ENV.fetch(\"TRAVIS_CI_ENV_USERNAME\", 'travis'),\n :private_key_path => File.expand_path('keys/vagrant'),\n :buffer => Travis::Worker.config.shell.buffer,\n :timeouts => Travis::Worker.config.timeouts\n )\n end",
"def sysinfo\n\t\trequest = Packet.create_request('stdapi_sys_config_sysinfo')\n\t\tresponse = client.send_request(request)\n\n\t\t{\n\t\t\t'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),\n\t\t\t'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),\n\t\t}\n\tend",
"def container_ssh_command\n # Get the container's SSH info\n info = @machine.ssh_info\n return nil if !info\n info[:port] ||= 22\n\n # Make sure our private keys are synced over to the host VM\n ssh_args = sync_private_keys(info).map do |path|\n \"-i #{path}\"\n end\n\n # Use ad-hoc SSH options for the hop on the docker proxy \n if info[:forward_agent]\n ssh_args << \"-o ForwardAgent=yes\"\n end\n ssh_args.concat([\"-o Compression=yes\",\n \"-o ConnectTimeout=5\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\"])\n\n # Build the SSH command\n \"ssh #{info[:username]}@#{info[:host]} -p#{info[:port]} #{ssh_args.join(\" \")}\"\n end",
"def by_ssh_host\n by_ssh_host = {}\n self.class.list_map.each_pair do |role,list|\n self.send(list).each do |host_instance|\n if not by_ssh_host.has_key?(host_instance.ssh_host)\n by_ssh_host[host_instance.ssh_host] = []\n end\n by_ssh_host[host_instance.ssh_host] << host_instance\n end\n end\n by_ssh_host\n end",
"def shell(reason = nil, username_or_credential = nil)\n if username_or_credential && username_or_credential.respond_to?(:to_str)\n credential = ssh_credential_for username_or_credential\n else\n credential = username_or_credential || ssh_credentials.first\n end\n # TODO(pwnall): loop through all addresses until one works\n address = net_addresses.first\n \n ShellSession.ssh address, credential, reason\n end",
"def ssh_create(host, user, key)\n\n if key.start_with?('-----BEGIN RSA PRIVATE KEY-----')\n ssh = Net::SSH.start(host, user,\n {\n :key_data => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n elsif File.exist?(key)\n ssh = Net::SSH.start(host, user,\n {\n :key_data => IO.read(key),\n :user_known_hosts_file => \"/dev/null\"\n } )\n else\n ssh = Net::SSH.start(host, user,\n {\n :password => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n end\n\n ssh\n end",
"def platform\n data[:platform]\n end",
"def ssh_signature_type; end",
"def ssh_signature_type; end",
"def ssh_signature_type; end",
"def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end",
"def update_ssh(nodes, version)\n fqdns = nodes.map { |node| node.fqdn }.join(' ')\n\n ssh = Chef::Knife::Ssh.new\n ssh.ui = ui\n ssh.name_args = [ fqdns, ssh_command(version) ]\n ssh.config[:manual] = true\n ssh.config[:on_error] = :skip\n ssh.config[:ssh_user] = Chef::Config[:knife][:ssh_user] || config[:ssh_user]\n ssh.config[:ssh_password] = config[:ssh_password]\n ssh.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]\n ssh.config[:ssh_gateway] = Chef::Config[:knife][:ssh_gateway] || config[:ssh_gateway]\n ssh.config[:identity_file] = Chef::Config[:knife][:identity_file] || config[:identity_file]\n ssh.config[:host_key_verify] = Chef::Config[:knife][:host_key_verify] || config[:host_key_verify]\n ssh\n end",
"def has_ssh?\n discover_ssh_executable.present?\n end",
"def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend",
"def prepare metadata\n ssh = @export_obj.ssh_to_source\n metadata.ssh = ssh\n end",
"def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end"
] |
[
"0.7775004",
"0.7382572",
"0.7382572",
"0.7382572",
"0.7382572",
"0.73283446",
"0.70838785",
"0.692864",
"0.6861395",
"0.68420076",
"0.6628104",
"0.6443306",
"0.6394162",
"0.6394162",
"0.6394162",
"0.63198215",
"0.62954736",
"0.6245317",
"0.62439144",
"0.6239657",
"0.6238132",
"0.623654",
"0.6201099",
"0.6173783",
"0.6129348",
"0.6125755",
"0.61156076",
"0.61069465",
"0.6102546",
"0.6040993",
"0.60336375",
"0.6033124",
"0.6015096",
"0.5984653",
"0.59804285",
"0.59747773",
"0.59694",
"0.5930693",
"0.5925157",
"0.5923294",
"0.58944523",
"0.58799136",
"0.5870675",
"0.5862389",
"0.5829602",
"0.5823486",
"0.5809701",
"0.5805274",
"0.5803621",
"0.5782648",
"0.576796",
"0.57563716",
"0.5751198",
"0.57477313",
"0.57476825",
"0.5732001",
"0.57318026",
"0.5708241",
"0.5701321",
"0.5700915",
"0.56932956",
"0.56830966",
"0.5670962",
"0.5651228",
"0.5641897",
"0.563698",
"0.5632451",
"0.56186724",
"0.56186724",
"0.56165636",
"0.5597856",
"0.55965817",
"0.5593403",
"0.55547893",
"0.5549695",
"0.554755",
"0.55429363",
"0.55373013",
"0.5526255",
"0.5525915",
"0.55257154",
"0.55224484",
"0.5521072",
"0.5505401",
"0.55035",
"0.5503066",
"0.5492951",
"0.54911876",
"0.5488952",
"0.54809856",
"0.5466041",
"0.5466041",
"0.5466041",
"0.5461661",
"0.5455731",
"0.544643",
"0.54294944",
"0.54287237",
"0.54222757",
"0.5416652"
] |
0.738389
|
1
|
Linux platformspecific platform object === Return instance of Platform::Linux:: If ruby interpreter is running on Linux nil:: Otherwise
|
def linux
raise PlatformError.new("Only available under Linux") unless linux?
require_linux
return Linux.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def linux?\n kind_of? Unix::Platform rescue false\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def linux?(platform = nil)\n get_platform(platform) == :LINUX\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def linux?\n @linux\n end",
"def linux_type\n redhat_linux_type || suse_linux_type || unknown_linux_type\n end",
"def determine_os\n @os = 'linux'\n end",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def determine_os\n @os = \"linux\"\n end",
"def linux?\n !!(ua =~ /Linux/)\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def linux?\n @linux ||= is? /linux|cygwin/\n end",
"def linux?\n linux_internal?\n end",
"def linux?\n has_os? && !!os_image_type.match(/suse|redhat|ubuntu|debian|centos|fedora/i)\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def is_linux?\n return (!is_windows? && !is_unix?)\n end",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend",
"def platform\n kernel.platform\n end",
"def get_platform(platform = nil)\n platform ||= RUBY_PLATFORM\n case platform\n when /darwin/ then :MACOS\n when /cygwin|mswin|mingw|bccwin|wince|emx/ then :WINDOWS\n else :LINUX\n end\n end",
"def linux?\n unix? and not mac?\n end",
"def platform\n @new_platform ||= Gem::Platform::RUBY\n end",
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def linux?\n unix? and not mac?\n end",
"def unknown_linux_type\n if @unknown_linux_type.nil?\n version = @platform.exec(\"uname\", \"-r\").chomp\n version = \"unknown\" if version.blank?\n @unknown_linux_type = \"unknown-linux-%s\" % version\n end\n \n @unknown_linux_type\n end",
"def ruby_platform\n RUBY_PLATFORM\n end",
"def get_platform(host_os)\n return :osx if host_os =~ /darwin/\n return :linux if host_os =~ /linux/\n return :windows if host_os =~ /mingw32|mswin32/\n return :unknown\n end",
"def ubuntu_platform?(node = __getnode)\n node[\"platform\"] == \"ubuntu\"\n end",
"def linuxmint_platform?(node = __getnode)\n node[\"platform\"] == \"linuxmint\"\n end",
"def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end",
"def linux_version\n case ENV['MACHTYPE']\n when \"s390x-suse-linux\"\n :sles_zlnx\n when /^i[356]86/\n if File.exist? \"/etc/fedora-release\"\n :linux_ia32_cell\n else\n :linux_ia32\n end\n else\n if File.exist? \"/etc/rhel-release\"\n :rhel\n elsif File.exist? \"/etc/redhat-release\"\n `awk '/release 5/||/release 4.9/{v=5};/release 4/{v=4}; END {print \"rhel\" v}' /etc/redhad-release`.to_sym\n elsif File.exist? \"/etc/SuSE-release\"\n `awk '$1==\"VERSION\" { v=$3}; END { print \"sles\" v}' /etc/SuSE-release`.to_sym\n elsif File.exist? \"/etc/yellowdog-release\"\n :yhpc\n else\n :rhel\n end\n end\nend",
"def platform; RUBY_PLATFORM; end",
"def platform\n type = os_type(:nice)\n type = case type\n when /Linux/i then linux_type\n else type\n end\n \n # Grab the Solaris version; turns '5.9' into '9', for example. (Solaris has a really\n # bizarre numbering scheme.)\n #\n # FIXME: This should include patchlevel.\n if type =~ /Solaris/i\n if @solaris_version.nil?\n @solaris_version = @platform.exec(\"uname\", \"-r\").strip\n @solaris_version = $2 if @solaris_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*$/i\n end\n \n type += @solaris_version\n end\n \n # Grab the OS X version by looking at the Darwin kernel version.\n #\n # FIXME: This should include minor version, too (e.g., 10.4.7).\n if type =~ /OSX/i\n if @osx_version.nil?\n @osx_version = @platform.exec(\"uname\", \"-r\").strip\n if @osx_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+).*$/i\n minor_version = [ $1.to_i - 4, 0 ].max # i.e., Darwin 8.x => OS X 10.4, 7.x => OS X 10.3, etc.\n @osx_version = \"10.%d\" % minor_version\n else\n @osx_version = '-unknown-%s' % @osx_version\n end\n end\n \n type += @osx_version\n end\n \n # Grab the Windows version by System.getProperty\n if type =~ /Windows/i\n os_name = JavaSystem.getProperty('os.name');\n sun_os_patch_level = JavaSystem.getProperty('sun.os.patch.level');\n if @windows_version.nil?\n @windows_version = case os_name \n when /Windows 2003/i: \"win2k3\"\n when /Windows XP/i: \"winxp\"\n else os_name.gsub(/ /, '_')\n end\n unless sun_os_patch_level == \"unknown\"\n patch = ''\n sun_os_patch_level.split(/ /).each do |t|\n patch = \"#{patch}#{t[0..0]}\"\n end\n @windows_version += '-' + patch\n end \n end\n \n type = @windows_version\n end\n \n \"%s-%s\" % [ type.downcase, processor_type.downcase ]\n end",
"def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end",
"def platform\n @platform ||= NoPlatform.new\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def platform\n RUBY_PLATFORM\n end",
"def linux?\n !darwin?\n end",
"def oracle_linux?(node)\n node['platform'] == 'oracle'\n end",
"def platform\n osver[0]\n end",
"def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend",
"def unix?\n kind_of? Unix::Platform rescue false\n end",
"def supported_by_platform?\n right_platform = RightScale::Platform.linux?\n right_platform && user_exists?('rightscale') # avoid calling user_exists? on unsupported platform(s)\n end",
"def is_cross_compiled_linux?\n return (is_cross_compiled? && is_linux?)\n end",
"def platform\n System::get_property('platform')\n end",
"def get_platform\n rpc_get_fact_direct('kernel')\n end",
"def get_platform\n platform=[]\n testos=`uname -a`\n # puts \"osname is #{testos}\"\n platform << \"raspberry\" if (/arm-linux/ =~ RUBY_PLATFORM) != nil and `uname -a`.include?('armv6')\n platform << \"raspberry\" if `uname -a`.include?('armv6')\n platform << \"raspberry 2\" if (/armv7l-linux/ =~ RUBY_PLATFORM) != nil and !`uname -a`.include?('armv6')\n platform << \"mac\" if (/darwin/ =~ RUBY_PLATFORM) != nil\n platform << \"arm\" if (/arm/ =~ RUBY_PLATFORM) != nil\n platform << \"x86\" if (/x86/ =~ RUBY_PLATFORM) != nil\n platform << \"i686\" if (/i686/ =~ RUBY_PLATFORM) != nil\n platform << \"microsoft\" if testos.include?('Microsoft')\n platform << \"debian\" if testos.include?('Debian')\n platform << \"ubuntu\" if testos.include?('Ubuntu')\n platform << \"linux\" if (/linux/ =~ RUBY_PLATFORM) != nil\n platform\n end",
"def os_platform\n return @parsed_ua.os ? @parsed_ua.os : 'Unknown'\n end",
"def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend",
"def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end",
"def is_yum_platform\n node[:platform_family] == \"rhel\"\nend",
"def linux_post_processor\n Processor::LinuxPostOS.new(deployment, component_configuration)\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end",
"def platform\n @platform ||= data.platform\n end",
"def os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: #{host_os.inspect}\"\n end\n )\nend",
"def target_platform\n (target and target.platform) ? target.platform : platform\n end",
"def centos_platform?(node = __getnode)\n node[\"platform\"] == \"centos\"\n end",
"def os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"Non supported os: #{host_os.inspect}\"\n end\n )\nend",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def load_platform_specific\n if linux?\n require_linux\n elsif mac?\n require_mac\n elsif windows?\n require_windows\n else\n raise PlatformError.new('Unknown platform')\n end\n end",
"def fetch_linux_os_version\n `lsb_release -rs`.strip\nend",
"def actual_platform\n platform = nil\n\n if explicit_platform.nil? == false\n platform = explicit_platform\n elsif datastore['PLATFORM']\n platform = datastore['PLATFORM']\n elsif assoc_exploit\n platform = assoc_exploit.target_platform\n end\n\n # If we still have an invalid platform, then we suck.\n if platform.nil?\n raise NoCompatiblePayloadError, \"A platform could not be determined by the generic payload\"\n elsif platform.kind_of?(String)\n platform = Msf::Module::PlatformList.transform(platform)\n end\n\n return platform\n end",
"def define_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise GetMeSubsError.new(\"Unknown os: #{host_os.inspect}\")\n end\n )\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def linux_mint?(node)\n node['platform'] == 'linuxmint'\n end",
"def raspbian_platform?(node = __getnode)\n node[\"platform\"] == \"raspbian\"\n end",
"def check_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux \n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: {host_os.inspect}\"\n end\n )\nend",
"def os \n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|bccwin|wince/\n :windows\n when /darwin|mac os|linux|solaris|bsd/\n :nix\n else\n raise Error::WebDriverError, \"unknown os: #{host_os.inspect}\"\n end\n)\nend",
"def platform\n if os.include?('Android')\n 'Android'\n else\n nil\n end\n end",
"def detect_platform\n @@platform_features ||= {\n :interpreter => detect_interpreter,\n :interpreter_language => detect_interpreter_language,\n :ipv4 => detect_reachable_ip,\n :ruby_version => RUBY_VERSION,\n }.merge(detect_os).merge(detect_hardware)\n end",
"def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end",
"def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def ruby_implementation\n case RUBY_ENGINE\n when /java/\n 'jruby'\n when /ruby/\n # I'm actually not sure what rubinius or maglev or other implementions would return. I don't use rubies, other than mri or jruby.\n 'mri'\n else\n nil\n end\nend",
"def ruby_platform_is?(platform)\n ruby_platform = ruby_version?(:<, '1.9.0') ? PLATFORM : RUBY_PLATFORM\n case platform\n when :unix\n ruby_platform =~ /linux|darwin|freebsd|netbsd|solaris|aix|hpux|cygwin/\n when :linux\n ruby_platform =~ /linux/\n when :osx, :darwin\n ruby_platform =~ /darwin/\n when :bsd\n ruby_platform =~ /freebsd|netbsd/\n when :cygwin\n ruby_platform =~ /cygwin/\n when :windows\n ruby_platform =~ /mswin32|mingw32/\n when :mswin32\n ruby_platform =~ /mswin32/\n when :mingw32\n ruby_platform =~ /mingw32/\n when :java\n ruby_platform =~ /java/\n else\n raise RuntimeError, \"Invalid platform specifier\"\n end ? true : false\n end",
"def platform\n return @platform\n end",
"def platform_type\n return @platform_type\n end",
"def platform_type\n return @platform_type\n end",
"def platform\n require \"tty-platform\"\n TTY::Platform.new\n end",
"def name\n RUBY_PLATFORM\n end",
"def load_platform(v)\n Chef::Log.debug \"[dropwizard_pleaserun] loading platform #{v}\"\n platform_lib = \"pleaserun/platform/#{v}\"\n require platform_lib\n const = PleaseRun::Platform.constants.find { |c| c.to_s.casecmp(v).zero? }\n if const.nil?\n raise PlatformLoadError, \"Could not find platform named '#{v}' after loading library \" \\\n \"'#{platform_lib}'. This is probably a bug.\"\n end\n return PleaseRun::Platform.const_get(const)\nrescue LoadError => e\n raise PlatformLoadError, \"Failed to find or load platform '#{v}'. This could be a typo or \" \\\n \" a bug. If it helps, the error is: #{e}\"\nend",
"def host_os; end",
"def host_os; end",
"def amazon_linux?(node)\n node['platform'] == 'amazon'\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def platform\n require 'tty-platform'\n TTY::Platform.new\n end",
"def ubuntu?(node)\n node['platform'] == 'ubuntu'\n end",
"def platform_and_version\n return \"debian-#{node['platform_version'].to_i}\" if node['platform'] == 'debian'\n return \"ubuntu-#{node['platform_version']}\" if node['platform'] == 'ubuntu'\n end",
"def os_linux\n\t\t\t\t\twhere(\"os LIKE '%Linux%'\")\n\t\t\t\tend",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def platform; end"
] |
[
"0.81641793",
"0.81434256",
"0.81431",
"0.8081668",
"0.8068725",
"0.8013422",
"0.7965977",
"0.7919813",
"0.7897795",
"0.7783285",
"0.77361685",
"0.7702981",
"0.76829845",
"0.76795894",
"0.76517737",
"0.7591393",
"0.7581479",
"0.75757873",
"0.755613",
"0.74806726",
"0.74346614",
"0.74332327",
"0.7393629",
"0.73687255",
"0.7346099",
"0.73217106",
"0.7305731",
"0.7304769",
"0.7294812",
"0.7292787",
"0.7251613",
"0.72445107",
"0.72340363",
"0.7212751",
"0.7191544",
"0.7173527",
"0.71649015",
"0.71586436",
"0.7149185",
"0.71435666",
"0.7128272",
"0.712327",
"0.70972544",
"0.70948446",
"0.70928615",
"0.7069071",
"0.7067538",
"0.7067377",
"0.7058497",
"0.7033177",
"0.69991535",
"0.6992146",
"0.6967177",
"0.6935582",
"0.69274455",
"0.69168836",
"0.6909754",
"0.6894414",
"0.6888037",
"0.6872288",
"0.68721086",
"0.68701315",
"0.68499935",
"0.6843831",
"0.6842703",
"0.68337053",
"0.68337053",
"0.6823809",
"0.68179965",
"0.6816371",
"0.6798295",
"0.6793951",
"0.6793951",
"0.6793951",
"0.6778284",
"0.67673373",
"0.67583287",
"0.6757127",
"0.67415607",
"0.6730572",
"0.6703548",
"0.6701586",
"0.6699618",
"0.66970867",
"0.66930014",
"0.6682675",
"0.6682675",
"0.66792554",
"0.6679249",
"0.6671842",
"0.66635543",
"0.66635543",
"0.66621464",
"0.66610116",
"0.6654171",
"0.6652497",
"0.66502345",
"0.6641725",
"0.6630797",
"0.66257304"
] |
0.8190539
|
0
|
Determines which cloud we're on by the cheap but simple expedient of reading the RightScale cloud file.
|
def resolve_cloud_type
cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil
@ec2 = false
@rackspace = false
@eucalyptus = false
case cloud_type
when 'ec2' then ec2 = true
when 'rackspace' then @rackspace = true
when 'eucalyptus' then eucalyptus = true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cloud?(node)\n node.key?('cloud')\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end",
"def get_cloud\n cloud_href = instance.cloud.href\n cloud_id = cloud_href.split('/').last\n cloud = @api_client.clouds(:id => cloud_id)\n end",
"def get_cloud_provider\n\t\t\t\tcloud = node[:cloud][:provider].to_s\n\t\t\t\tcloud.strip!\n\t\t\t\treturn cloud\n\t\t\tend",
"def get_cloud(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}\") \n end",
"def region\n RightScaleAPI::CLOUD_REGIONS.find{|k,v|v == cloud_id}.first\n end",
"def find_cloud(old_cloud_href, name)\n @api.account_id = @options[:dst]\n cloud = @api.clouds.index.select {|cloud| cloud.href == old_cloud_href}.first\n\n if cloud\n puts \"Found matching cloud: \\\"#{cloud.name}\\\" for server: \\\"#{name}\\\"\\n\"\n return cloud.href\n else\n puts \"\\nNo matching cloud found for: \\\"#{name}\\\"\\n\"\n puts \"Choose Cloud:\"\n i = 0\n @api.clouds.index.each do |cloud|\n puts \"[#{i}] #{cloud.name}\\n\"\n i += 1\n end\n print \"\\n? \"\n return @api.clouds.index[gets.chomp.to_i].href\n end\nend",
"def cloud_config\n microbosh_config[\"cloud\"]\n end",
"def cloud\n ext_management_system.provider.cloud_ems.first\n end",
"def test_multicloud\n cid = VirtualMonkey::Toolbox::determine_cloud_id(s_one)\n if cid == 232\n test_cloud_files\n else\n if @storage_type == \"ros\"\n test_s3\n elsif @storage_type == \"volume\"\n test_ebs\n end\n end\n end",
"def detect_database_type! # :nodoc:\n @file.seek(-3, IO::SEEK_END)\n @ip_bits = 32\n\n 0.upto(STRUCTURE_INFO_MAX_SIZE - 1) do |i|\n if @file.read(3).bytes.all? { |byte| byte == 255 }\n @database_type =\n\t if @file.respond_to?(:getbyte)\n\t @file.getbyte\n\t else\n\t @file.getc\n\t end\n\n @database_type -= 105 if @database_type >= 106\n\n if (@database_type == Edition::REGION_REV0)\n # Region Edition, pre June 2003\n @database_segments = [STATE_BEGIN_REV0]\n elsif (@database_type == Edition::REGION_REV1)\n # Region Edition, post June 2003\n @database_segments = [STATE_BEGIN_REV1]\n elsif @database_type == Edition::CITY_REV0 ||\n @database_type == Edition::CITY_REV1 ||\n @database_type == Edition::ORG ||\n @database_type == Edition::ORG_V6 ||\n @database_type == Edition::ISP ||\n @database_type == Edition::ISP_V6 ||\n\t @database_type == Edition::REGISTRAR ||\n\t @database_type == Edition::REGISTRAR_V6 ||\n\t @database_type == Edition::USERTYPE ||\t # Many of these files mis-identify as ASNUM files\n\t @database_type == Edition::USERTYPE_V6 ||\n @database_type == Edition::DOMAIN ||\n @database_type == Edition::DOMAIN_V6 ||\n @database_type == Edition::ASNUM ||\n @database_type == Edition::ASNUM_V6 ||\n\t @database_type == Edition::NETSPEED_REV1 ||\n\t @database_type == Edition::NETSPEED_REV1_V6 ||\n\t @database_type == Edition::LOCATIONA ||\n\t # @database_type == Edition::LOCATIONA_V6 ||\n\t @database_type == Edition::ACCURACYRADIUS ||\n\t @database_type == Edition::ACCURACYRADIUS_V6 ||\n @database_type == Edition::CITYCONF ||\n @database_type == Edition::COUNTRYCONF ||\n @database_type == Edition::REGIONCONF ||\n @database_type == Edition::POSTALCONF ||\n @database_type == Edition::CITY_REV0_V6 ||\n @database_type == Edition::CITY_REV1_V6\n\n # City/Org Editions have two segments, read offset of second segment\n @database_segments = [0]\n sr = @file.read(3).unpack(\"C*\")\n @database_segments[0] += le_to_ui(sr)\n\n end\n\n\tcase @database_type\n\twhen Edition::COUNTRY\n\twhen Edition::NETSPEED_REV1\n\twhen Edition::ASNUM\n\twhen Edition::CITY_REV0\n\twhen Edition::CITY_REV1\n\twhen Edition::REGION_REV0\n\twhen Edition::REGION_REV1\n\t @ip_bits = 32\n\t @record_length = 3\n\n\twhen Edition::ORG,\n\t Edition::DOMAIN,\n\t Edition::ISP\n\t @ip_bits = 32\n\t @record_length = 4\n\n\twhen Edition::ASNUM_V6,\n\t Edition::CITY_REV0_V6,\n\t Edition::CITY_REV1_V6,\n\t Edition::NETSPEED_REV1_V6,\n\t Edition::COUNTRY_V6,\n\t Edition::PROXY\n\t @ip_bits = 128\n\t @record_length = 3\n\n\twhen Edition::ACCURACYRADIUS_V6,\n\t Edition::DOMAIN_V6,\n\t Edition::ISP_V6,\n\t Edition::LARGE_COUNTRY_V6,\n\t Edition::LOCATIONA_V6,\n\t Edition::ORG_V6,\n\t Edition::REGISTRAR_V6,\n\t Edition::USERTYPE_V6\n\t @ip_bits = 128\n\t @record_length = 4\n\n\telse\n\t raise \"unimplemented database type\"\n\tend\n\n break\n else\n @file.seek(-4, IO::SEEK_CUR)\n end\n end\n\n if (@database_type == Edition::COUNTRY ||\n @database_type == Edition::PROXY ||\n @database_type == Edition::COUNTRY_V6 ||\n @database_type == Edition::NETSPEED)\n @database_segments = [COUNTRY_BEGIN]\n end\n\n # puts \"Detected IPv#{@ip_bits == 32 ? '4' : '6'} database_type #{@database_type} with #{@database_segments[0]} records of length #{@record_length} (data starts at #{@database_segments[0]*@record_length*2})\"\n end",
"def parse_cloud_config\n cloud_config = YAML.load(File.read('config/cloud.yml'))\n check_cloud_config(cloud_config)\n\n cloud_config\n end",
"def cloudversion\n clouddata && clouddata['version']\n end",
"def GetPlatformOfFile ( fl )\n platforms = { \"a1\" => \"AQUA-1\", \"t1\" => \"TERRA-1\", \"npp\" => \"NPP\"}\n \n x = File.basename(fl).split(\".\").first\n puts x\n return platforms[x] if ( platforms[x])\n return \"unknown\"\nend",
"def cloud_provider\n (cloud.nil? ? nil : cloud.cloud_provider)\n end",
"def cloud_space\n return nil if self.cloud_space_id.nil?\n begin\n return ::Resources::CloudSpace.new.find(self.cloud_space_id)\n rescue Resources::Exceptions::NotFound => e\n return nil\n end\n end",
"def on_rightscale_platform?\n File.exists?(RightScale::MetaDataFile)\nend",
"def fetch_cloud\n @cloud ||= Cloud.find(params[:cloud_id])\n authorize @cloud, :show?\n end",
"def read_factor\n return nil if !valid? || @database_type != :voldemort\n\n @read_factor\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def soundcloud?\n\t\treturn path && path.starts_with?(\"stoffi:track:soundcloud:\")\n\tend",
"def cloud\n if @cloud.nil?\n @cloud = FeedTools::Cloud.new\n @cloud.domain = FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"cloud/@domain\"],\n :select_result_value => true)\n @cloud.port = FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"cloud/@port\"],\n :select_result_value => true)\n @cloud.path = FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"cloud/@path\"],\n :select_result_value => true)\n @cloud.register_procedure =\n FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"cloud/@registerProcedure\"],\n :select_result_value => true)\n @cloud.protocol =\n FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"cloud/@protocol\"],\n :select_result_value => true)\n @cloud.protocol.downcase unless @cloud.protocol.nil?\n @cloud.port = @cloud.port.to_s.to_i\n @cloud.port = nil if @cloud.port == 0\n end\n return @cloud\n end",
"def fetch_cloud\n cloud = Cloud.find(params[:cloud_id])\n authorize cloud, :show?\n return cloud\n end",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def get_cloud_url\n @last_used_cloud_url\n end",
"def cloud( name )\n require \"capistrano/fastfood/clouds/#{name}\"\n end",
"def parse_cloud_config(env = nil)\n cloud_config = YAML.load(File.read('config/cloud.yml'))\n check_cloud_config(cloud_config)\n\n if env\n unless cloud_config[env]\n fail \"Environement `#{env}` missing in config/cloud.yml\"\n end\n return cloud_config[env]\n end\n return cloud_config\n end",
"def set_cloud\n @cloud = Cloud.find(params[:id])\n end",
"def set_cloud\n @cloud = Cloud.find(params[:id])\n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def cloud=(new_cloud)\n @cloud = new_cloud\n end",
"def cloud_controller_database\n if Chef::Config[:solo]\n return cloud_controller_database_from_attrs\n end\n\n ccdb_role = node['cloudfoundry']['roles']['cloud_controller_database_master']\n unless ccdb_role\n return cloud_controller_database_from_attrs\n end\n\n results = search(:node, \"roles:#{ccdb_role} AND chef_environment:#{node.chef_environment}\")\n unless results.any?\n Chef::Log.warn \"No CCDB found with a search for roles:#{ccdb_role}\"\n return cloud_controller_database_from_attrs\n end\n\n if results.count > 1\n Chef::Log.warn \"More than one CCDB found with a search for roles:#{ccdb_role}, picking the first\"\n end\n ccdb = results[0]\n\n cloud_controller_database_from_attrs(ccdb)\nend",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def soundcloud_id\n\t\tif soundcloud?\n\t\t\treturn path[\"stoffi:track:soundcloud:\".length .. -1]\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend",
"def cloud_desc\n MU::Cloud::Google::Habitat.find(cloud_id: @cloud_id).values.first\n end",
"def get_cloud_href\n @api_client.get_instance.links.detect { |link| link['rel'] == 'cloud' }['href']\n end",
"def is_cloudfront?\n type.downcase == \"cloudfront\"\n end",
"def retrieve_cloud_files(files); end",
"def se_type?(files)\n files.each do |f|\n if /3_BC\\d+/.match(f)\n return \"BC\"\n elsif /_F5-P2/.match(f)\n return \"PE\"\n elsif /_R3/.match(f)\n return \"MP\"\n end\n end\n \"FR\"\n end",
"def cloud_desc\n if @config['flavor'] == \"EKS\"\n resp = MU::Cloud::AWS.eks(region: @config['region'], credentials: @config['credentials']).describe_cluster(\n name: @mu_name\n )\n resp.cluster\n else\n resp = MU::Cloud::AWS.ecs(region: @config['region'], credentials: @config['credentials']).describe_clusters(\n clusters: [@mu_name]\n )\n resp.clusters.first\n end\n end",
"def tax_cloud_tic\n read_attribute(:tax_cloud_tic) || Spree::Config.taxcloud_default_product_tic\n end",
"def cloud_desc\n MU::Cloud::AWS::Log.find(cloud_id: @cloud_id).values.first\n end",
"def flavor f\n @logger.debug \"OpenStack: Looking up flavor '#{f}'\"\n @compute_client.flavors.find { |x| x.name == f } || raise(\"Couldn't find flavor: #{f}\")\n end",
"def cpus\n flavor[2]\n end",
"def stop\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Stopping cloud %s\" % [resource[:name]]\n\n if cloud.leader?()\n if !exists?\n err \"Cloud does not exist\"\n return\n end\n if status != :running\n err \"Cloud is not running\"\n return\n end\n if exists? && status == :running\n \n puts \"It is an appscale cloud\"\n \n # Here we cannot use leader_stop function because appscale_cloud_stop\n # has a different type of arguments. So instead we will use\n # stop_cron_jobs, shutdown_vms and delete_files directly.\n \n # Stop cron jobs on all machiness\n cloud.stop_cron_jobs(\"appscale\")\n \n # Stop cloud infrastructure\n appscale_cloud_stop(cloud.resource, MY_IP) # What if we run\n # stop on a different machine than start?\n\n # Shutdown and undefine all virtual machines explicitly created for this cloud\n cloud.shutdown_vms()\n \n # Delete files\n cloud.delete_files()\n \n # Note: As all the files deleted so far are located in the /tmp directory\n # only the machines that are still alive need to delete these files.\n # If the machine was shut down, these files will not be there the next\n # time it is started, so there is no need to delete them.\n \n puts \"===================\"\n puts \"== Cloud stopped ==\"\n puts \"===================\"\n end\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n \n end",
"def get_clouds_payload(node)\n return node.workorder.payLoad.has_key?(\"Clouds\") ? node.workorder.payLoad.Clouds : (node.workorder.payLoad.has_key?(\"CloudPayload\") ? node.workorder.payLoad.CloudPayload : nil)\n end",
"def cloud cloud_provider=nil, hsh={}, &block\n return @cloud if @cloud\n case cloud_provider\n when :ec2\n @cloud ||= Ironfan::Ec2::Cloud.new(self)\n when :vsphere\n @cloud ||= Ironfan::Vsphere::Cloud.new(self)\n when :static\n @cloud ||= Ironfan::Static::Cloud.new(self)\n else\n raise \"Unknown cloud provider #{cloud_provider.inspect}. Only supports :ec2, :vsphere and :static so far.\"\n end\n @cloud.configure(hsh, &block) if block\n after_cloud_created(hsh)\n @cloud\n end",
"def public\n (cloud.nil? ? nil : cloud.public)\n end",
"def guess_source\n\t\t# Typically csv files come from UniteU\n\t\tif @file =~ /\\.csv$/ then return source = \"uniteu\"\n\t\t# While xml files come from RPro\n\t\telsif @file =~ /\\.xml$/ then return source = \"rpro\"\n\t\t# Otherwise toss out an error\n\t\telse\n\t\t\traise \"Error: No map exists\"\n\t\tend\n\tend",
"def stop\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Stopping cloud %s\" % [resource[:name]]\n \n if cloud.leader?()\n if !exists?\n err \"Cloud does not exist\"\n return\n end\n \n if status != :running\n err \"Cloud is not running\"\n return\n end\n \n if exists? && status == :running\n puts \"It is a torque cloud\"\n \n # Stop cloud infrastructure\n cloud.leader_stop(\"torque\", method(:torque_cloud_stop))\n end\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n \n end",
"def storage_only\n select {|d| d.resource_type == 17}\n end",
"def get_other_scale(scale)\n if scale.downcase == 'c'\n 'f'\n else\n 'c'\n end\n end",
"def frontcover_resource\n fc=@supporting_resources.front_cover\n if fc.length > 0\n if fc.length > 1\n best_found=fc.select{|c| c.versions.last and c.versions.last.image_width}.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first\n if best_found\n # we take larger one\n best_found.versions.last\n else\n # we try first that is not gif\n fc.select{|sr| not sr.versions.last.file_format==\"Gif\"}.first.versions.last\n end\n else\n fc.first.versions.last\n end\n end\n end",
"def get_system_type(filename)\n fl = File.open(filename, \"r\")\n state = fl.readline.rstrip\n fl.close\n state\n end",
"def cloud_desc(use_cache: true)\n return @cloud_desc_cache if @cloud_desc_cache and use_cache\n\n MU::Cloud::Google.getOrg(@config['credentials'])\n\n @cloud_desc_cache = if @config['role_source'] == \"directory\"\n MU::Cloud::Google.admin_directory(credentials: @config['credentials']).get_role(@customer, @cloud_id)\n elsif @config['role_source'] == \"canned\"\n MU::Cloud::Google.iam(credentials: @config['credentials']).get_role(@cloud_id)\n elsif @config['role_source'] == \"project\"\n MU::Cloud::Google.iam(credentials: @config['credentials']).get_project_role(@cloud_id)\n elsif @config['role_source'] == \"org\"\n MU::Cloud::Google.iam(credentials: @config['credentials']).get_organization_role(@cloud_id)\n end\n\n @cloud_desc_cache\n end",
"def get_flavor(flavor_name)\n flavor_res = find_match(@compute.flavors, flavor_name)\n flavor_to_use = (flavor_res != nil) ? flavor_res.id.to_s : nil\n if flavor_to_use.nil?\n Puppet.crit \"The flavor is not found on cloud account!, flavor_name => #{flavor_name}\"\n raise Puppet::Error, \"The flavor is not found on cloud account!, flavor_name => #{flavor_name}\"\n else\n Puppet.notice \"Flavor '#{flavor_name}' found : '#{flavor_to_use}'\"\n end\n return flavor_to_use\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def cloud_management_score\n return @cloud_management_score\n end",
"def initialize(opts)\n opencloud = (opts[:function] == :opencloud)\n\n resume = opts[:resume]\n source_host_def = define_source(opts[:config])\n source_host_ssh = CLI.spinner(\"Logging in to #{source_host_def[:host]}\") do\n host_login(source_host_def)\n end\n\n source_profile = CLI.spinner(\"Checking source host\") do\n profile = Profile.new(source_host_ssh)\n profile.build\n profile\n end\n\n if opencloud\n target_platform = Platform::V2\n else\n target_platform = Platform::V1\n end\n platform = target_platform.new(source_profile[:cpe])\n build_target = platform.build_recommendation(source_profile)\n flavor_list = target_platform::FLAVOR_LIST\n default_target = flavor_list[build_target[:flavor]]\n\n # Generate and display a brief summary of the server Platform/Profile\n os_tag = source_profile[:cpe].vendor == \"Unknown\" ? CLI.red : CLI.blue\n ram_qty = default_target[:mem]\n hdd_qty = default_target[:hdd]\n decision_reason = \"#{CLI.bold}#{build_target[:flavor_reason]}#{CLI.reset}\"\n\n puts \"OS: #{CLI.bold}#{os_tag}#{platform}#{CLI.reset}\"\n puts \"---\"\n puts \"Recommended server:\"\n puts \"RAM: #{CLI.bold} % 6d MiB#{CLI.reset}\" % ram_qty\n puts \"HDD: #{CLI.bold} % 7d GB#{CLI.reset}\" % hdd_qty\n puts \"The reason for this decision is: #{decision_reason}\"\n puts \"---\"\n unless source_profile.warnings.empty?\n print CLI.red + CLI.bold\n source_profile.warnings.each { |warning| puts warning }\n print CLI.reset\n puts \"---\"\n end\n\n if resume\n destination_host_def = define_destination\n migration_exclusions = determine_exclusions(source_profile[:cpe])\n platform.managed = CLI.prompt_yn(\"Managed service level? (Y/N)\",\n default_answer: \"Y\")\n platform.rack_connect = CLI.prompt_yn(\"Rack Connected? (Y/N)\",\n default_answer: \"N\")\n else\n api = {}\n api[:version] = opencloud ? :v2 : :v1\n\n proceed = CLI.prompt_yn(\"Spin up this server? (Y/N)\", default_answer: \"Y\")\n if proceed\n api[:flavor] = default_target[:id]\n else\n puts CLI.build_grid(flavor_list.values,\n {id: \"ID\", mem: \"RAM (MiB)\", hdd: \"HDD (GB)\" })\n api[:flavor] = CLI.prompt(\"Flavor ID\",\n default_answer: default_target[:id])\n api[:flavor] = api[:flavor].to_i if api[:flavor].match(/^[0-9]+$/)\n end\n\n migration_exclusions = determine_exclusions(source_profile[:cpe])\n platform.managed = CLI.prompt_yn(\"Managed service level? (Y/N)\",\n default_answer: \"Y\")\n platform.rack_connect = CLI.prompt_yn(\"Rack Connected? (Y/N)\",\n default_answer: \"N\")\n\n # Warn against Rack Connect\n if platform.rack_connect\n puts \"#{CLI.bold}#{CLI.red}*** Rack Connect servers might not \" +\n \"provision properly when spun up from the API! Resume \" +\n \"recommended!#{CLI.reset}\"\n sleep 5\n end\n\n\n # Check to make sure we have a valid flavor ID\n exit 0 if api[:flavor] == 0 or flavor_list[api[:flavor]].nil?\n\n # Build our API call\n api[:hostname] = CLI.prompt(\"New Server Name\",\n default_answer: source_profile[:hostname])\n\n # OpenCloud only supports US migrations presently\n if opts[:function] == :opencloud\n api[:region] = CLI.prompt(\"Region (dfw, ord, iad, etc...)\", default_answer: \"dfw\",\n valid_answers: [\"ord\", \"dfw\", \"iad\", \"hkg\", \"syd\"])\n else\n api[:region] = :dfw\n end\n\n api[:username] = CLI.prompt(\"RS Cloud Username\")\n api[:api_key] = CLI.prompt(\"RS Cloud API key\")\n\n # Name cannot have any special characters in it\n api[:hostname].gsub!(/[^A-Za-z0-9.]/, '-')\n\n rack_api = Fog::Compute.new(provider: 'rackspace',\n rackspace_username: api[:username],\n rackspace_api_key: api[:api_key],\n rackspace_region: api[:region],\n version: api[:version])\n\n # Send API call\n new_server = CLI.spinner(\"Spinning up new server: #{api[:hostname]}\") do\n rack_api.servers::create(name: api[:hostname],\n image_id: platform.image,\n flavor_id: api[:flavor])\n\n end\n\n # Set the destination host address\n destination_host_def = {}\n CLI.spinner(\"Obtaining information for new instance\") do\n # Obtain the administrative pass for the new host.\n destination_host_def[:password] = new_server.password\n server_id = new_server.id\n\n until new_server.state == 'ACTIVE'\n sleep 30\n begin\n new_server.update\n rescue NoMethodError\n new_server.reload\n end\n end\n\n if opencloud\n dest_host = new_server.addresses[\"public\"].select do |e|\n e[\"version\"] == 4\n end\n destination_host_def[:host] = dest_host[0][\"addr\"]\n else\n destination_host_def[:host] = new_server.addresses[\"public\"][0]\n end\n end\n\n # If we're working within the Managed service level, ensure that Chef\n # has finished successfully\n if platform.managed\n r = 0\n destination_host_ssh = destination_login(destination_host_def)\n\n begin\n message =\n finished = CLI.spinner(\"Waiting for Chef to finish\") do\n # Sleep 180 seconds before trying\n sleep 180\n Migrate.setup_managed(destination_host_ssh)\n end\n unless finished\n panic = \"#{CLI.bold}#{CLI.red}*** MGC Cloud Scripts appear to \" +\n \"have failed to run in a reasonable amount of time.\" +\n \"#{CLI.reset}\"\n puts panic\n exit unless CLI.prompt_yn(\"Continue? (Y/N)\", default_answer: \"Y\")\n end\n destination_host_ssh.logout!\n rescue\n panic = \"#{CLI.bold}#{CLI.red}*** Unable to communicate with the \" +\n \"destination host. Bailing out.#{CLI.reset}\"\n puts panic\n raise\n end\n end\n\n if opts[:function] == :opencloud\n host = destination_host_def[:host]\n CLI.spinner(\"Putting #{host} into rescue mode\") do\n new_server.rescue\n destination_host_def[:password] = new_server.password\n new_server.update\n end\n else\n pass_prompt = \"Please put #{api[:hostname]} into rescue mode and \" +\n \"give password\"\n destination_host_def[:password] = CLI.prompt(pass_prompt)\n end\n\n CLI.spinner \"Letting rescue mode come up...\" do\n until new_server.state == 'RESCUE'\n sleep 30\n begin\n new_server.update\n rescue NoMethodError\n sleep 60\n new_server.reload\n end\n end\n end\n\n Thread.new do\n continue = false\n until continue\n r = 0\n message = \"Checking for SSH on #{destination_host_def[:host]}\"\n ssh_command = \"ssh #{SSH::SSH_ARGUMENTS} \" +\n \"root@#{destination_host_def[:host]}\"\n continue = CLI.spinner(message) do\n begin\n sleep 20\n ssh_expect = Expectr.new(ssh_command, flush_buffer: false)\n ssh_expect.expect(\"password\")\n rescue\n retry if (r+=1) < 10\n raise\n end\n end\n end\n end.join\n end\n\n destination_host_ssh = destination_login(destination_host_def)\n\n unless destination_host_def[:pre_steps] == false\n # Attempt to set up the source host 5 times. If there is a failure,\n # sleep for 60 seconds before retrying.\n r = 0\n begin\n message = \"Setting up source host (attempt #{r + 1}/5)\"\n pubkey = CLI.spinner(message) do\n begin\n message.gsub!(/\\d\\/5/, \"#{r + 1}/5\")\n sleep 60 unless r == 0\n Migrate.setup_source(source_host_ssh, migration_exclusions)\n rescue\n retry if (r += 1) < 5\n raise\n end\n end\n rescue\n panic = \"#{CLI.bold}#{CLI.red}*** Unable to communicate with the \" +\n \"source host. Bailing out.#{CLI.reset}\"\n puts panic\n raise\n end\n\n # Attempt to set up the destination host 5 times. If there is a\n # failure, sleep for 60 seconds before retrying.\n r = 0\n begin\n message = \"Setting up destination host (attempt #{r + 1}/5)\"\n CLI.spinner(message) do\n begin\n message.gsub!(/\\d\\/5/, \"#{r + 1}/5\")\n sleep 60 unless r == 0\n Migrate.setup_destination(destination_host_ssh, pubkey)\n rescue\n retry if (r += 1) < 5\n raise\n end\n end\n rescue\n panic = \"#{CLI.bold}#{CLI.red}*** Unable to communicate with the \" +\n \"destination host. Bailing out.#{CLI.reset}\"\n puts panic\n raise\n end\n end\n\n # Determine if Service Net can be used\n begin\n CLI.spinner \"Checking for ServiceNet\" do\n target_addr = Migrate.check_servicenet(source_host_ssh,\n destination_host_ssh)\n raise if target_addr.nil?\n destination_host_def[:target_addr] = target_addr\n end\n rescue\n destination_host_def[:target_addr] = destination_host_def[:host]\n end\n\n # Set rsync path and no timeout for the migration rsync\n destination_host_def[:timeout] = -1\n destination_host_def[:rsync] = source_profile[:rsync]\n\n # Kick off the migration proper\n if opts[:verbose]\n Migrate.migrate_server(source_host_ssh, destination_host_def)\n else\n CLI.spinner \"Performing migration\" do\n Migrate.migrate_server(source_host_ssh, destination_host_def)\n end\n end\n\n CLI.spinner \"Logging out of source host\" do\n source_host_ssh.logout!\n end\n\n CLI.spinner \"Cleaning up destination host\" do\n Migrate.clean_destination(destination_host_ssh, source_profile[:cpe])\n end\n\n ip_list = determine_ips(source_profile[:ip][:public])\n ip_list.each { |ip| remediate_ip_config(destination_host_ssh, ip, destination_host_def[:host]) }\n\n CLI.spinner \"Logging out of destination host\" do\n source_host_ssh.logout!\n end\n\n puts\n puts \"#{CLI.bold}#{CLI.blue}*** Migration complete#{CLI.reset}\\a\"\n end",
"def flavour\n variables[:flavour]\n end",
"def image\n [:MANAGED_MAP, :UNMANAGED_MAP].each do |map|\n unless self.class.const_defined?(map)\n raise MapUndefined, \"Const #{map} is undefined; maps appear unbuilt\"\n end\n end\n\n map = @managed ? self.class::MANAGED_MAP : self.class::UNMANAGED_MAP\n distro = @distro.downcase.to_sym\n\n unless map[distro].nil?\n return map[distro][@version] unless map[distro][@version].nil?\n return map[distro][\"*\"] unless map[distro][\"*\"].nil?\n end\n\n nil\n end",
"def cloudid_from_name(ciName)\n if ciName == nil || ciName.empty?\n # There was not a name specified. Just return nothing.\n return ''\n end\n\n # The cloud ID is the second component of the CI name:\n #\n # basename-cloudid-instance\n #\n # Split on the '-' character and take the second to last component\n #\n nameComponents = ciName.split('-',-1)\n\n cloudid = nameComponents[nameComponents.length - 2]\n\n return cloudid\nend",
"def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end",
"def stop\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Stopping cloud %s\" % [resource[:name]]\n \n if cloud.leader?()\n if !exists?\n err \"Cloud does not exist\"\n return\n end\n \n if status != :running\n err \"Cloud is not running\"\n return\n end\n \n if exists? && status == :running\n puts \"It is a web cloud\"\n \n # Stop cloud infrastructure\n cloud.leader_stop(\"web\", method(:web_cloud_stop))\n end\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n \n end",
"def read_os(file_path)\n begin\n raw_data = IO.read(file_path)\n json_data = JSON.parse(raw_data)\n return json_data[\"OS\"]\n\n rescue Exception => e\n puts \"\\nERROR: /qa/ci_os.json file seems to be missing. Please create it from a copy of /qa/ci_os.json.template and make sure to configure your OS in ci_env.json\\n\"\n raise\n end\nend",
"def info\n @cloud_core = CloudCore.new(@config, @logger, @volume_manager, @az_selector, API_VERSION)\n @cloud_core.info\n end",
"def frontcover_resource\n fc=@supporting_resources.select { |sr| sr.type.human==\"FrontCover\" }\n if fc.length > 0\n if fc.length > 1\n best_found=fc.select{|c| c.versions.last and c.versions.last.image_width}.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first\n if best_found\n # we take larger one\n best_found.versions.last\n else\n # we try first that is not gif\n fc.select{|sr| not sr.versions.last.file_format==\"Gif\"}.first.versions.last\n end\n else\n fc.first.versions.last\n end\n end\n end",
"def cloud_provisioning_score\n return @cloud_provisioning_score\n end",
"def read_os(file_path)\n begin\n raw_data = IO.read(file_path)\n json_data = JSON.parse(raw_data)\n return json_data[\"OS\"]\n rescue Exception => e\n puts \"\\nERROR: /qa/ci_os.json file seems to be missing. Please create it from a copy of /qa/ci_os.json.template and make sure to configure your OS in ci_os.json\\n\"\n raise\n end\nend",
"def dicom?\n @raw_image_files.first.dicom?\n end",
"def geifile?\n @raw_image_files.first.geifile?\n end",
"def flux_gs2?\n\t\t\t@flux_option == \"gs2\"\n\t\tend",
"def cloud_service_name\n return @cloud_service_name\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 ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end",
"def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend",
"def cloud_desc(use_cache: true)\n return @cloud_desc_cache if @cloud_desc_cache and use_cache\n @cloud_desc_cache = MU::Cloud::AWS::Habitat.find(cloud_id: @cloud_id).values.first\n @cloud_desc_cache\n end",
"def memory\n flavor[1]\n end",
"def flavor\n if ENV[\"CHEF_API_FLAVOR\"]\n ENV[\"CHEF_API_FLAVOR\"].to_sym\n elsif config[\"CHEF_API_FLAVOR\"]\n config[\"CHEF_API_FLAVOR\"]\n else\n endpoint.include?(\"/organizations\") ? :enterprise : :open_source\n end\n end",
"def _ROOT_FILE_STORE\n return \"/home/cesteam/cloudstorge/\"\nend",
"def flavor\n return @flavor\n end",
"def dicom?\n return @file_type == \"dicom\"\n end",
"def region(hostname)\n if (@database_type == Edition::CITY_REV0 ||\n @database_type == Edition::CITY_REV1 ||\n @database_type == Edition::CITY_REV1_V6)\n return city(hostname)\n end\n\n if (@database_type == Edition::REGION_REV0 ||\n @database_type == Edition::REGION_REV1)\n ip = lookup_ip(hostname)\n ipnum = iptonum(ip)\n pos = seek_record(ipnum)\n else\n throw \"Invalid GeoIP database type, can't look up Region by IP\"\n end\n\n if pos == @database_segments[0]\n nil\n else\n read_region(pos, hostname, ip)\n end\n end",
"def run\n super\n \n # Now that we have our core details, check cloud statusi\n cloud_providers = determine_cloud_status(@entity)\n _log \"Got: #{cloud_providers}\"\n\n _set_entity_detail \"cloud_providers\", cloud_providers.uniq.sort\n _set_entity_detail \"cloud_hosted\", !cloud_providers.empty?\n \n end",
"def get_metadata(cloud_file)\n uri = {file_path: cloud_file.path} if cloud_file.path\n response = format_response(Dropbox.successful_request?(:metadata, access_token, uri))\n tree_cache(response)\n end",
"def determine_distribution\n # Some distros ship with a file containing the CPE for their platform;\n # this should be used if at all possible.\n release = @shell.query('CPE', 'cat /etc/system-release-cpe')\n begin\n cpe = CPE.parse(release)\n cpe.version.gsub!(/[^0-9.]/, '')\n @info[:cpe] = cpe\n return\n rescue ArgumentError\n cpe = CPE.new(part: CPE::OS, product: 'linux')\n end\n\n # Fall back to depending on /etc/issue if available\n issue = @shell.query('ISSUE', 'cat /etc/issue')\n cpe.vendor = distro_name(issue)\n\n # If all else fails, resort to looking in release files\n if cpe.vendor.empty?\n release_cmd = \"grep -h '^ID=' /etc/[A-Za-z]*[_-][rv]e[lr]*|head -1\"\n release = @shell.query(\"RELEASE\", release_cmd)\n cpe.vendor = distro_name(release)\n end\n\n # Fall back to \"Unknown\"\n cpe.vendor = \"\" if cpe.vendor.empty?\n\n # Version number will be determined from /etc/issue\n cpe.version = version_number(issue)\n @info[:cpe] = cpe\n end",
"def read_platform_from_file(path:)\n path.basename.to_s.split('.').first\n end",
"def low\n unless self.url.nil?\n httpsimagepath = self.url.insert(4, 's')\n # httpsimagepath.slice! self.filename\n filename = self.url.split('/').last\n if filename.last(4) == \".jpg\"\n filename_noext = filename.split('.').first\n else\n filename_noext = filename\n end\n version = self.url.split('/').last(2).first\n httpsimagepath.slice! filename\n if version.match('[v]\\d*').to_s == version\n httpsimagepath.slice! version + '/'\n httpsimagepath = httpsimagepath + 'q_auto:low/' + version + '/' + filename_noext\n else\n httpsimagepath = httpsimagepath + 'q_auto:low/' + filename_noext\n end\n return httpsimagepath\n end\n end",
"def set_cloud_resource\n @cloud_resource = CloudResource.find(params[:id])\n end",
"def geo\n fetch('creature.bird.geo')\n end",
"def get_region()\n status, stdout, stderr = xenstore_command(\"read\", \"vm-data/provider_data/region\")\n if status == 0\n stdout.strip\n else\n Ohai::Log.debug(\"could not read region information for Rackspace cloud from xen-store\")\n nil\n end\nend",
"def image_name(server)\r\n name = instance.platform.name\r\n return name unless server\r\n\r\n # 1:\r\n if server.downcase.start_with? \"https://cloud-images.ubuntu.com\"\r\n info \"Using cloud-image '#{name}'\"\r\n return name.downcase.sub(/^ubuntu-/, \"\")\r\n end\r\n # 2:\r\n if server.downcase.start_with? \"https://images.linuxcontainers.org\"\r\n name = name.downcase.split(\"-\")\r\n # 'core' parses out in this method as the 'version' so just use 'ubuntu-core' in the kitchen.yml\r\n if UBUNTU_RELEASES.key?(name[1]) && name[0] == \"ubuntu\"\r\n name[1] = UBUNTU_RELEASES[name[1]]\r\n name[0] = \"ubuntu-core\" if name[1] == \"16\" # Logic patch for the edge case. We'll do something different if this gets complicated\r\n end\r\n name = name.join(\"/\")\r\n info \"Using standard image #{name}\"\r\n end\r\n name\r\n end",
"def cloud_desc(use_cache: true)\n return @cloud_desc_cache if @cloud_desc_cache and use_cache\n return nil if !@cloud_id\n max_retries = 5\n retries = 0\n if !@cloud_id.nil?\n begin\n resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(instance_ids: [@cloud_id])\n if resp and resp.reservations and resp.reservations.first and\n resp.reservations.first.instances and\n resp.reservations.first.instances.first\n @cloud_desc_cache = resp.reservations.first.instances.first\n return @cloud_desc_cache\n end\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return nil\n rescue NoMethodError\n if retries >= max_retries\n raise MuError, \"Couldn't get a cloud descriptor for #{@mu_name} (#{@cloud_id})\"\n else\n retries = retries + 1\n sleep 10\n retry\n end\n end\n end\n nil\n end",
"def index\n if @@cloud.nil?\n puts \"TAAGGGGSSS BY MOST COMPOETELELELKJ!!!\"\n @@cloud = Person.tags_by_most_complete\n end\n @cloud = @@cloud\n render\n end",
"def new(cloud_name)\n target = Kite::Cloud.new(self, cloud_name)\n target.prepare\n end",
"def gce?(node)\n node.key?('gce')\n end",
"def get_data\n data_array = File.open(RightScale::MetaDataFile)\n data_array.each do |d|\n key, data = d.split('=')\n key.strip!\n data.strip!\n rightscale_deprecated[key.sub(/RS_/,'')] = data unless add_server(key,data) \n end\nend",
"def load_pcd_file(file_path)\n NMatrix::IO::PointCloudReader::MetaReader.new(file_path)\n end",
"def get_appropriate_flavors(resource_map = {})\n resource_map[:ram] ||= {mem_used: 0, swapping?: false}\n resource_map[:hdd] ||= {disk: 0}\n ram = resource_map[:ram] * (resource_map[:ram][:swapping?] ? 2 : 1)\n disk = resource_map[:hdd][:disk] * 1.2\n\n @flavor_map.select do |id|\n @flavor_map[e][:ram] >= ram && @flavor_map[e][:disk] >= disk\n end\n end"
] |
[
"0.6666226",
"0.64531565",
"0.61970085",
"0.60109115",
"0.59555256",
"0.59150255",
"0.5889657",
"0.568545",
"0.5662921",
"0.5646818",
"0.5626254",
"0.5564425",
"0.5551584",
"0.5496858",
"0.54917866",
"0.5428814",
"0.540402",
"0.5390353",
"0.5338402",
"0.5304133",
"0.5275231",
"0.52734363",
"0.5267551",
"0.52333665",
"0.52313906",
"0.5225419",
"0.52218556",
"0.51952535",
"0.51920754",
"0.51920754",
"0.5169468",
"0.5163966",
"0.516313",
"0.51358783",
"0.51293194",
"0.5082683",
"0.5075553",
"0.5075227",
"0.50414526",
"0.5030368",
"0.50263643",
"0.49680355",
"0.49600795",
"0.495039",
"0.4912766",
"0.49093717",
"0.48975953",
"0.48653862",
"0.48597074",
"0.48453113",
"0.48241308",
"0.48228565",
"0.48056108",
"0.4802859",
"0.4790377",
"0.47826028",
"0.47824517",
"0.47669703",
"0.47613272",
"0.4759419",
"0.4755773",
"0.47477216",
"0.47334456",
"0.4732445",
"0.47062516",
"0.4702178",
"0.47010943",
"0.46949944",
"0.4693657",
"0.4684852",
"0.4677692",
"0.4668175",
"0.46528563",
"0.46491265",
"0.46463308",
"0.46458513",
"0.46399716",
"0.46288168",
"0.46260437",
"0.46242794",
"0.46149766",
"0.4610673",
"0.45858917",
"0.4580263",
"0.45702535",
"0.45680013",
"0.45669907",
"0.45639417",
"0.45620236",
"0.4561101",
"0.45582172",
"0.4552562",
"0.45516527",
"0.45454177",
"0.45416686",
"0.454066",
"0.45400056",
"0.4530367",
"0.45288944",
"0.45248425"
] |
0.724408
|
0
|
formats the order number in 6 groups, e.g. a41793f76125f9032a10415705b20a66
|
def number_with_formatting
if /^(.*)(.{6})(.{6})(.{6})(.{6})(.{6})/i.match(number_without_formatting)
"#{$1}-#{$2}-#{$3}-#{$4}-#{$5}-#{$6}"
else
number_without_formatting
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_order_number(number)\n number.to_s.gsub(/[^\\w_]/, '').rjust(4, \"0\")[0...20]\n end",
"def format_order_number(number)\n number.to_s.gsub(/[^\\w]/, '').rjust(4, '0')[0...20]\n end",
"def format_order_number(number)\n number.to_s.gsub(/[A-Z]/, '').rjust(12, \"0\")\n end",
"def format_order_id(num_operacion)\n num_operacion.to_s.rjust(12,'0') \n end",
"def formatOunces(value)\n\t\twholeNum = value[1, 4] #Pulls the 2nd (A), 3rd (B), 4th (C) and 5th (D) digit from the format 0ABCDdddd where 'd' is the decimal portion of the eVS weight convention\n\t\tdecimal = value[5, 4] #Pulls the decimal portion\n\t\treturn (\"#{wholeNum}.#{decimal}\".to_f * 16.0).round(4).to_s\n\tend",
"def formatOunces(value)\n\t\t\twholeNum = value[1, 4] #Pulls the 2nd (A), 3rd (B), 4th (C) and 5th (D) digit from the format 0ABCDdddd where 'd' is the decimal portion of the eVS weight convention\n\t\t\tdecimal = value[5, 4] #Pulls the decimal portion\n\t\t\treturn (\"#{wholeNum}.#{decimal}\".to_f * 16.0).round(4).to_s\n\t\tend",
"def digit_grouping(txt,n,sep,pos0,pos1)\n txt[pos0...pos1] = txt[pos0...pos1].gsub(/(\\d)(?=(#{'\\\\d'*n})+(?!\\d))/, \"\\\\1#{sep}\") if sep\n txt\n end",
"def number\n @order_number ||= text.select do |line|\n line =~ /order no/i\n end.map do |line|\n line[@number_pattern]\n end.uniq.first\n end",
"def to_s\n order_number\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 grn_no_format\n grn_no.to_s.rjust(5, INOCRM_CONFIG[\"inventory_grn_no_format\"])\n end",
"def nhs_numberize\n return self unless length == 10\n self[0..2] + ' ' + self[3..5] + ' ' + self[6..9]\n end",
"def format_phone_number(arr)\n\tphone_num = \"(\"\n\t3.times {phone_num += arr.shift.to_s}\n\tphone_num += \") \"\n\t3.times {phone_num += arr.shift.to_s}\n\tphone_num += \"-\"\n\t4.times {phone_num += arr.shift.to_s}\n\tphone_num\nend",
"def swedish_organisation_number\n # Valid leading digit: 1, 2, 3, 5, 6, 7, 8, 9\n # Valid third digit: >= 2\n # Last digit is a control digit\n base = [sample([1, 2, 3, 5, 6, 7, 8, 9]), sample((0..9).to_a), sample((2..9).to_a), format('%06d', rand(10**6))].join\n base + luhn_algorithm(base).to_s\n end",
"def create_order_number\n alpha = %w[0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]\n # try a short order number first\n # in case of collision, increase length of order number\n (4..10).each do |length|\n self.order_number = Time.now.strftime(\"%Y%m%d-\")\n length.times {self.order_number += alpha[rand 36]}\n existing_order = Order.find_by(order_number: order_number)\n return if existing_order.nil?\n end\n end",
"def separate_number_into_groups num_as_string\n num_groups = Array.new\n str = ''\n num_as_string.each_char do |c|\n if str[0] != c and str != ''\n num_groups << str\n str = ''\n end\n str += c\n end\n num_groups << str\nend",
"def order_m999(order)\n m999 = MARC::DataField.new('999', '9', '4')\n m999.append(MARC::Subfield.new('a', order.rnum_trunc))\n m999.append(MARC::Subfield.new('b', order.ocode3))\n m999.append(MARC::Subfield.new('c', order.number_copies.first.to_s))\n m999.append(MARC::Subfield.new('d',\n order.received_date&.strftime('%Y-%m-%d')))\n m999.append(MARC::Subfield.new('e',\n order.cat_date&.strftime('%Y-%m-%d')))\n m999.append(MARC::Subfield.new('f', order.location.first))\n m999.append(MARC::Subfield.new('g', order.status_code))\n m999\n end",
"def group_by_hundreds(num)\n str = num.to_i.to_s\n a = []\n str.split(//).reverse.each_slice(3) { |slice| a << slice }\n\n t = str.length % 3\n t = 3-t if t>0\n for i in 1..t\n a << 0\n end\n\n new_a = []\n a.each do |item|\n new_a << item\n end\n\n new_a.flatten.join\nend",
"def DashInsert(num)\n\n num.to_s.gsub(/[13579]{2,}/){|x| x.split('').join(\"-\")}\n \nend",
"def format_number(number)\n whole, decimal = number.to_s.split(\".\")\n num_groups = whole.chars.to_a.reverse.each_slice(3)\n whole_with_commas = num_groups.map(&:join).join(',').reverse\n [whole_with_commas, decimal].compact.join(\".\")\nend",
"def format_number(number)\n whole, decimal = number.to_s.split(\".\")\n num_groups = whole.chars.to_a.reverse.each_slice(3)\n whole_with_commas = num_groups.map(&:join).join(',').reverse\n [whole_with_commas, decimal].compact.join(\".\")\nend",
"def formatted_number(phone_number)\n number = phone_number.dup\n number = number.gsub(' ', '').gsub('.', '').gsub('-', '').gsub('/', '')\n\n PhoneNumber::MOBILE_PREFIXES.each do |prefix|\n if number.starts_with? prefix\n number = number.gsub prefix, \"0033#{prefix.last}\" #.last because last is 6 or 7\n break\n end\n end\n number\n end",
"def fancy_number(num)\n \"$\" + num.to_s.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n end",
"def format_phone_number(phone_number_str)\n ret = []\n fin = phone_number_str.split(/\\W+/).join.split(//)\n fin.each do |n|\n ret << n.to_i\n end\n x = ret.first(3)\n y = ret[3..5]\n z = ret.last(4)\nreturn \"(\" + x.join + \") \" + y.join + \"-\" + z.join\n\nend",
"def formatGroup(value)\n\t\t\treturn value.delete(\"Price Group\").chomp\n\t\tend",
"def formatGroup(value)\n\t\treturn value.delete(\"Price Group\").chomp\n\tend",
"def to_s\n \"(#{ self.area_code }) #{ @number.slice(3,3) }-#{ @number.slice(6,4) }\"\n end",
"def expanded_form(num)\n number = num.to_s # This will be \"12\"\n num_digits = num.to_s.length\n split_number = number.split(\"\").reverse # This will be [\"2\",\"1\"]\n expanded_array = []\n 0.upto(num_digits-1) do |n| # This will be 0 up to 1\n single_split_number = split_number[n].to_i*(10**n)\n next if single_split_number == 0\n expanded_array << single_split_number.to_s\n end\n expanded_array.reverse! # This will be [\"10\",\"2\"]\n output_array = expanded_array.join(\" + \") # Final statement\nend",
"def format_num(t_sym, f_sym, num)\n chars = num.split('')\n form_num = \"\"\n chars.each do |c|\n if c == \"0\"\n form_num += f_sym\n elsif c == \"1\"\n form_num += t_sym\n end\n end\n return form_num\nend",
"def numberize(options = {})\n # Basisarray das alle zeichen enthält die verschlüsselt werden können\n string_array = STRING_BASE.split(\"\")\n\n if options[:token]\n string_array = string_array.sort_by {|x| x.hash*options[:token].inspect.bytes.join(\"\").to_i}\n end\n\n # Nur Zahlen und buchstaben für die verschlüsselung/mix nehmen wg. URLs\n string_array_filtered = string_array.select {|s| !s.match(/[a-zA-Z0-9\\-_]/).nil? }\n splitted = self.split(\"\")\n\n numbered_string = \"\"\n\n splitted.each do |s|\n position = string_array.index(s)\n if !position.nil?\n numbered_string << (position.to_s.rjust(2, \"0\")+string_array_filtered[rand(string_array_filtered.size-1)])\n end\n end\n\n return options[:base_64] == true ? Base64.encode64(numbered_string) : numbered_string\n end",
"def esr9_format_account_id(account_id)\n (pre, main, post) = account_id.split('-')\n\n sprintf('%02i%06i%1i', pre.to_i, main.to_i, post.to_i)\n end",
"def order_weight(strng)\n strng.split.sort_by(&:to_s).sort_by{ |v| v.to_i.digits.inject(:+) }.join(' ')\nend",
"def to_phone_number(arr)\n area_code_array = arr[0..2].join(\"\").to_s\n part2_array = arr[3..5].join(\"\").to_s\n part3_array = arr[6..-1].join(\"\").to_s\n return \"(\" + area_code_array + \") \" + part2_array + \"-\" + part3_array\nend",
"def routing_number_with_format; end",
"def format_number\n number.to_s.gsub(/\\s+/,'') =~ FORMAT_REGEXP\n [$1,$2.to_s.split(/(...)/).map{|x| x.empty? ? nil : x}].flatten.compact.join(' ')\n end",
"def to_hex_string(grouping = false)\n ret = self.unpack('H*').first\n if grouping\n if grouping.is_a?(::Integer) && grouping > 0\n ret.gsub(/(#{'.' * grouping})/,'\\1 ').rstrip\n else\n ret.gsub(/(..)/,'\\1 ').rstrip\n end\n else\n ret\n end\n end",
"def create_ordered_output_from_format_string(f,u,c,i)\n found = Hash.new\n found[\"u\"] = f.index(/(%[\\-\\.0-9]*u[0-9]*)/)\n found[\"c\"] = f.index(/(%[\\-\\.0-9]*c[0-9]*)/)\n found[\"i\"] = f.index(/(%[\\-\\.0-9]*i[0-9]*)/)\n positions = Array.new\t\n positions[f.index(/(%[\\-\\.0-9]*u[0-9]*)/)] = u if !found[\"u\"].nil?\n positions[f.index(/(%[\\-\\.0-9]*c[0-9]*)/)] = c if !found[\"c\"].nil?\n positions[f.index(/(%[\\-\\.0-9]*i[0-9]*)/)] = i if !found[\"i\"].nil?\n positions.compact!\n positions\nend",
"def reformat(number)\n num_without_decimal = number.gsub('.','') \n unless num_without_decimal.length == 4\n num_without_decimal = '0' + num_without_decimal \n end\n num_without_decimal\n end",
"def czech_organisation_number\n sum = 0\n base = []\n [8, 7, 6, 5, 4, 3, 2].each do |weight|\n base << sample((0..9).to_a)\n sum += (weight * base.last)\n end\n base << (11 - (sum % 11)) % 10\n base.join\n end",
"def order\n \"Order nr. #{number}\"\n end",
"def order\n \"Order nr. #{number}\"\n end",
"def to_s\n account_number.gsub(/(\\d{2})(\\d{2})(\\d{2})(\\d{3})/, '\\1.\\2.\\3.\\4')\n end",
"def group(places = nil, delim = ',')\n # Return number as a string with embedded commas\n # for nice printing; round to places places after\n # the decimal\n\n # Only convert to string numbers with exponent unless they are\n # less than 1 (to ensure that really small numbers round to 0.0)\n return to_s if abs > 1.0 && to_s =~ /e/\n\n # Round if places given\n str =\n if places.nil?\n whole? ? to_i.to_s : to_f.to_s\n else\n to_f.round(places).to_s\n end\n\n # Break the number into parts; underscores are possible in all components.\n str =~ /\\A(?<sg>[-+])?(?<wh>[\\d_]*)((\\.)?(?<fr>[\\d_]*))?(?<ex>x[eE][+-]?[\\d_]+)?\\z/\n sig = Regexp.last_match[:sg] || ''\n whole = Regexp.last_match[:wh] ? Regexp.last_match[:wh].delete('_') : ''\n frac = Regexp.last_match[:fr] || ''\n exp = Regexp.last_match[:ex] || ''\n\n # Pad out the fractional part with zeroes to the right\n unless places.nil?\n n_zeroes = [places - frac.length, 0].max\n frac += '0' * n_zeroes if n_zeroes.positive?\n end\n\n # Place the commas in the whole part only\n whole = whole.reverse\n whole.gsub!(/([0-9]{3})/, \"\\\\1#{delim}\")\n whole.gsub!(/#{Regexp.escape(delim)}$/, '')\n whole.reverse!\n if frac.blank? # || places <= 0\n sig + whole + exp\n else\n sig + whole + '.' + frac + exp\n end\n end",
"def display_number\n # \n ('X' * (account_number.to_s.length - last_digits.size)) + last_digits\n # account_number.to_s[0..last_digits.size].to_s.size + \n # last_digits.to_s\n end",
"def to_n_pck\n name = @name.ljust(5, '_')\n # format(\"%02d#{name}\", @id) # old 2 byte ids\n \"#{@id}#{@score}#{name}\" # new 1 byte id\n end",
"def format_phone_number(num)\n num = num.delete(' ')\n return \"#{num[0..2]}-#{num[3..6]}\" if num.size == 7\n return \"(#{num[0..2]}) #{num[3..5]}-#{num[6..9]}\" if num.size == 10\n num\nend",
"def format(match_data, length)\n match_data[1].gsub('_', '').downcase + (\"%0#{length}d\" % match_data[2].to_i)\n end",
"def generate_number_strings(cleaned_multiline_digits)\n cleaned_multiline_digits.map do |multiline_digit|\n convert_to_numbers(multiline_digit)\n end\nend",
"def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end",
"def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end",
"def separate_comma (number)\n a = number.to_s.chars.to_a.reverse\n b = a.count/3\n if a.count < 4\n return number.to_s\n elsif a.count == 6\n a.insert(3, \",\")\n return a.join.reverse\n elsif\n c = 3\n b.times do |n|\n a.insert(c, \",\")\n c = c +4\n end\n return a.join.reverse\n end\nend",
"def format_order(items)\n\n format_lock = items.map do |x|\n\n summery = x.first[:summery]\n puts \"#{summery[:qty]} #{summery[:sku_number]} $#{summery[:total]}\\n\"\n\n x.first[:line_items].each do |line_item|\n puts \"\\t#{line_item[:qty]} X #{line_item[:pack]} $#{line_item[:each_pack]}\\n\"\n end\n\n puts '---'* 5\n\n end\n\n return format_lock\n\n end",
"def format\n return @phone if mask_too_short?\n mask_array.map do |item|\n if item == \"#\"\n next_digit\n else\n item\n end\n end.join\n end",
"def generate_order_no\n Time.now.to_f.to_s.tr('.', '')\n end",
"def expanded_form(num)\n array = num.to_s.split(\"\")\n length = num.to_s.size - 1\n numbers_array = []\n\n array.each do |number|\n numbers_array << number.to_i * 10**(length)\n length -= 1\n end\n\n numbers_array.delete_if {|i| i == 0} # cleans up 0s from array. For example: expanded_form(70304)\n numbers_array.join(\" + \")\n\nend",
"def generate_order_code\n\t\t\tsize = 5\n\t\t\tcharset = %w{0 1 2 3 4 6 7 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\n\t\t\tself.code = \"DH\" + Time.now.strftime(\"%Y\").last(2) + (0...size).map{ charset.to_a[rand(charset.size)] }.join\n\t\tend",
"def convert9\r\n @phone.split(\"\").each do |c|\r\n c = 9 if @num_list.include?(c)\r\n @formatted_phone += c.to_s\r\n end\r\n end",
"def format(number)\n # Start with an empty string;\n # maybe change it, but definitely return it.\n \"\".tap do |output|\n @format_data.each do |key, value|\n output << key if even_split?(number, value)\n end\n output << number.to_s if output.empty?\n end\n end",
"def normalize_order(order); end",
"def format_phone_numbers\n\t\tif self.phone_number_1.present? and self.phone_number_1.length > 9\n\t\t\told = self.phone_number_1.gsub(/\\D/,'')\n\t\t\tnew_phone = \"(#{old[0..2]}) #{old[3..5]}-#{old[6..9]}\"\n\t\t\tself.phone_number_1 = new_phone\n\t\tend\n\t\tif self.phone_number_2.present? and self.phone_number_2.length > 9\n\t\t\told = self.phone_number_2.gsub(/\\D/,'')\n\t\t\tnew_phone = \"(#{old[0..2]}) #{old[3..5]}-#{old[6..9]}\"\n\t\t\tself.phone_number_2 = new_phone\n\t\tend\n\tend",
"def format_number(number)\n number.to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\nend",
"def e010_fax(pedido)\n return \"%-16s\" % \"(19)3241-5135\"\n end",
"def format(cnpj)\n cnpj = cnpj.to_s.rjust(14, \"0\")\n \"%s.%s.%s/%s-%s\" % [cnpj[0,2], cnpj[2,3], cnpj[5,3], cnpj[8,4], cnpj[12,2]]\n end",
"def format; :n3; end",
"def pretty_trxn_card_digits(delim = ', ')\n trxn_card_digits.join(delim)\n end",
"def format_phone_number(phone_number_str)\n\n\tp_n_s = phone_number_str.to_s\n\n\t#Use each substring of the phone number string to create formatted phone number.\n\tph_frmtd = \"(\" + p_n_s[0..2] + \")\" + p_n_s[3..5] + \"-\" + p_n_s[6..9]\n\t\n\treturn phone_number_str\n\nend",
"def format_phone_number(numbers)\n phone_number = \"(\" \n i = 0\n while i <= 2 do\n phone_number += numbers[i].to_s\n i += 1\n end\n phone_number += \") \"\n while i <= 5 do\n phone_number += numbers[i].to_s\n i += 1\n end\n phone_number += \"-\"\n while i <= 9 do\n phone_number += numbers[i].to_s\n i += 1\n end\n return phone_number\nend",
"def separate_comma(number)\n\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length<=6\n x = 0\n elsif length%2 == 0\n x = 1\n else \n x = 2\n end\n\n\n\n if length < 4\n return array.join.reverse.to_s \n else\n i = 3\n while i < length+n do\n array.insert(i, ',')\n i += 4\n end\n end\n return array.join.reverse.to_s\nend",
"def separate_comma(number)\n number.to_s.reverse.split(\"\").each_with_index { |x,y| x << \",\" if y == 3 || y == 6 }.reverse.join\nend",
"def formatted_sentence(sentence)\n split_ary = word_to_digit(sentence)\n pos = []\n split_ary.each { |i| pos << split_ary.index(i) if integer?(i) }\n split_ary[pos[0]..pos[-1]] = format_phone_number(split_ary[pos[0]..pos[-1]].join)\n split_ary.join\nend",
"def number\n # TODO have this be our order id \n #CGI::Session.generate_unique_id\n mydate = Date.today().strftime('%Y%m%d')\n \"#{self.user.last_name}_#{mydate}_#{self.id}\"\n end",
"def convert_phone_nbr_scrp\n if self[0] == \"0\"\n self[0].gsub(\"0\", \"+33\") + self[1..-1]\n end\n end",
"def format(number)\n \"\".tap do |output|\n # The next two lines will only ever give us\n # the fizzbuzz behavior we've been after.\n #\n # What if we wanted to be able to turn these\n # into configuration data being read from\n # our robot's memory bank after we turn it on?\n output << \"fizz\" if even_split?(number, 3)\n output << \"buzz\" if even_split?(number, 5)\n output << number.to_s if output.empty?\n end\n end",
"def number\n \"#{self.id}\".rjust(8, \"0\")\n end",
"def number\n \"#{self.id}\".rjust(8, \"0\")\n end",
"def number\n \"#{self.id}\".rjust(8, \"0\")\n end",
"def card_number\n card = full_card_number.scan(/(\\d{4})/)\n card[2] = card[1] = 'X' * 4\n card.join\n end",
"def format_phone_number(phone_number_str)\n\tarray = []\n\tarray = phone_number_str.split(\"\")\n\tphone_number_str = \"\"\n\tarray.keep_if { |i| i =~ /[0123456789]/ } \n\tarray.insert(0,\"(\") \n\tarray.insert(4,\")\")\n\tarray.insert(8,\"-\")\n\tarray.insert(5,\" \")\n\tphone_number_str = array.join\n return phone_number_str\nend",
"def commify(number)\n\t\t\tc = { :value => \"\", :length => 0 }\n\t\t\tr = number.to_s.reverse.split(\"\").inject(c) do |t, e| \n\t\t\tiv, il = t[:value], t[:length]\n\t\t\tiv += ',' if il % 3 == 0 && il != 0 \n\t\t\t{ :value => iv + e, :length => il + 1 }\n\t\tend\n\t\tr[:value].reverse!\n\tend",
"def hidden_digits(num)\n\t\tarray = @deposit_account.match(/(\\d{3})-(\\d{3})-(\\d{3})/).captures\n\t\tarray2 = array.join()\n\t\tarray2.gsub(/.(?=.{4})/,'*')\n\tend",
"def commify(n)\n\tn.to_s =~ /([^\\.]*)(\\..*)?/\n\t\tint, dec = $1.reverse, $2 ? $2 : \"\"\n\twhile int.gsub!(/(,|\\.|^)(\\d{3})(\\d)/, '\\1\\2,\\3')\n\tend\n\tint.reverse + dec\nend",
"def acct_number\n hidden_length = @acct_number.length - 4\n @acct_number.sub(Regexp.new(\"^.{#{hidden_length}}\"), \"*\" * hidden_length)\n end",
"def calculate_nus_matric_number(id)\n matric_regex = /^A\\d{7}|U\\d{6,7}/\n matches = matric_regex.match(id.upcase)\n\n if (matches)\n match = matches[0]\n\n if (match[0].eql?('U') && match.length === 8)\n match = match[0, 3] + match[4]\n end\n\n weights = {\n U: [0, 1, 3, 1, 2, 7],\n A: [1, 1, 1, 1, 1, 1]\n }\n\n weights = weights[:\"#{match[0]}\"]\n\n sum = 0\n digits = match[2, 7]\n\n for i in 0..6 do\n sum += weights[i].to_i * digits[i].to_i\n end\n\n match.to_s + 'YXWURNMLJHEAB' [sum % 13]\n end\nend",
"def pretty\n cpf_numbers = numeric\n \"%s.%s.%s-%s\" % [cpf_numbers[0..2], cpf_numbers[3..5], cpf_numbers[6..8], cpf_numbers[9..10]]\n end",
"def card_number_mask\n \"XXX XXXX XXX #{last4}\"\n end",
"def genbank\n chars = 60\n lines = (length / chars.to_f).ceil\n width = length.to_s.length\n\n s = ''\n (1..lines).each do |i|\n s << \"%#{width}d\" % (chars * (i - 1) + 1)\n s << ' '\n s << to_s[chars * (i - 1), chars].scan(/\\w{1,10}/).join(' ')\n s << \"\\n\"\n end\n s\n end",
"def to_phone_number(arr)\n \"(#{arr[0..2].join}) #{arr[3..5].join}-#{arr[6..-1].join}\"\nend",
"def iformat( n )\n # FIXME by locale\n return numberFormat( n, ',', nil, nil );\nend",
"def format_phone_number\n area_code = self.phone_number.slice!(0,3)\n area_code = '(' + area_code + ') '\n return area_code + self.phone_number.insert(3, '-')\n end",
"def transform_numbers_row fields,row\n re = /(\\+?\\d*)?(\\/TYPE=PLMN@?)?([a-z0-9\\._-]*)@?([a-z0-9\\._-]*)?/i\n @numbers.each do |f,arr|\n i = fields[f]\n next unless i\n val = row[i]\n re.match val\n number = $1 || \"\"\n mail = \"\"\n mail += $3 if $3\n mail += \"@\"+$4 if $3 && !$3.empty? && $4 && !$4.empty?\n row << number.sub(\"+\",\"\")\n row << mail\n end\n return row\n end",
"def to_phone_number(arr)\n arr.unshift(\"(\")\n arr.insert 4, \") \"\n arr.insert 8, \"-\"\n arr.join\nend",
"def format_num(int)\n int.to_s.reverse.scan(/\\d{1,3}/).reverse.join(\",\")\nend",
"def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n end\nend",
"def to_phone_number(arr)\n # your code goes here\n area_code = arr[0,3].join('').to_s\n first_main = arr[3,3].join('').to_s\n second_main = arr[6,4].join('').to_s\n\n \"(#{area_code}) #{first_main}-#{second_main}\"\nend",
"def separate_comma(number)\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length <= 6\n n = 0\n elsif length % 2 == 0\n n = 1\n else\n n = 2\n end\n\n if length < 4\n return array.join.reverse\n elsif length <= 9 \n i = 3 \n while i < length + n do \n array.insert(i, \",\")\n i = i + 4 \n end\n end\n\n return array.join.reverse.to_s\nend",
"def prepare_group(integer, roman, group_value, group_letter, lower_value, lower_letter)\n count, integer = integer.divmod(group_value)\n roman += group_letter * count\n if lower_value and integer >= lower_value\n roman += lower_letter\n integer -= lower_value\n end\n return integer, roman\nend",
"def to_pretty_s\n if self.is_valid?\n if @type == :magic\n \"#{@number}\"\n else\n \"#{area_code}-#{@number}\"\n end\n end\n end",
"def reorganize_string(a)\np a\n a = get_frequencies(a)\n\n count = count_char_numbers(a)\n\n return \"\" unless can_reorganize?(count)\n\n build_new_string(a, count)\nend",
"def to_s() designation_number; end",
"def to_phone_number(arr)\n # your code goes here\n str = arr.join\n \"(#{str[0,3]}) #{str[3,3].to_s}-#{str[6,4]}\"\nend"
] |
[
"0.73183244",
"0.726796",
"0.7087502",
"0.6887272",
"0.60761565",
"0.60745347",
"0.6074007",
"0.600839",
"0.5908821",
"0.5887172",
"0.5837277",
"0.5827815",
"0.57644016",
"0.57526374",
"0.56678563",
"0.5646001",
"0.5641444",
"0.5597025",
"0.55739653",
"0.5566751",
"0.5566751",
"0.5545678",
"0.5536887",
"0.5528356",
"0.55066246",
"0.5492352",
"0.54845077",
"0.5483446",
"0.5469356",
"0.5452861",
"0.5437278",
"0.5434402",
"0.5418688",
"0.5396704",
"0.53905606",
"0.5386645",
"0.53816134",
"0.5381053",
"0.53769106",
"0.53717345",
"0.53717345",
"0.53684765",
"0.53683084",
"0.5349297",
"0.5347298",
"0.5343644",
"0.53428584",
"0.5340824",
"0.5339937",
"0.5339937",
"0.53380454",
"0.53364426",
"0.5333088",
"0.5312671",
"0.53124845",
"0.5307725",
"0.5303847",
"0.52960366",
"0.52896214",
"0.52778053",
"0.5276263",
"0.5272564",
"0.5271144",
"0.5264229",
"0.52622634",
"0.5260526",
"0.5259791",
"0.52308255",
"0.52239186",
"0.52233803",
"0.5216727",
"0.521523",
"0.521254",
"0.5193168",
"0.5193168",
"0.5193168",
"0.5192165",
"0.51876754",
"0.5186565",
"0.518345",
"0.51659286",
"0.5162109",
"0.5158712",
"0.5150416",
"0.51487803",
"0.5141495",
"0.5138077",
"0.5137092",
"0.5133131",
"0.5130804",
"0.51297146",
"0.5125253",
"0.51164937",
"0.5115975",
"0.5114798",
"0.511075",
"0.51084226",
"0.51068985",
"0.510407",
"0.5096208"
] |
0.64736897
|
4
|
e.g. "000001082011" for 1st in Oct 2011
|
def short_number
self.new_record? ? self.number : "#{self.id.to_s.rjust(6, "0")}#{I18n.l(self.created_at, :format => "%m%Y")}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def number_to_substring_month(number)\n case number\n when 1\n return \"Jan\"\n when 4\n return \"Apr\"\n when 9\n return \"Sep\"\n when 10\n return \"Oct\"\n end\nend",
"def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend",
"def sortable_year_str_for_early_numeric\n return unless orig_date_str.match(EARLY_NUMERIC)\n\n if orig_date_str =~ /^\\-/\n # negative number becomes x - 1000 for sorting; -005 for -995\n num = orig_date_str[1..-1].to_i - 1000\n return '-' + num.to_s[1..-1].rjust(3, '0')\n else\n return orig_date_str.rjust(4, '0')\n end\n end",
"def display_str_for_early_numeric\n return unless orig_date_str.match(EARLY_NUMERIC)\n # return 1 B.C. when the date is 0 since there is no 0 year\n return '1 B.C.' if orig_date_str == '0'\n # negative number becomes B.C.\n return \"#{orig_date_str[1..-1].to_i + 1} B.C.\" if orig_date_str =~ /^\\-/\n\n # remove leading 0s from early dates\n \"#{orig_date_str.to_i} A.D.\"\n end",
"def date_from_string(date)\n\n#remove st rd nd and th\n\nfirstParse = Chronic.parse(date)\nr1 = /[a-zA-Z]/\n\nif firstParse #check if chronic managed to find anything\n\n #daY Less than 12, assume chronic wrong, aslong as also no characters such as December, \n #where it would be right\n if firstParse.day <= 12 and !r1.match(date) \n\t\n\t #swap month with day\n\t firstParse = firstParse.change(:day => firstParse.month, :month => firstParse.day)\n\n end #of if <= 12\n\n return firstParse\n \n else\n \n\treturn Date.new\n \n end #of if firstParse\nend",
"def number_to_short_month_name(a)\n return number_to_full_month_name(a).slice(0,3)\nend",
"def sortable_year_for_yyyy\n matches = orig_date_str.match(/\\d{4}/) if orig_date_str\n matches.to_s if matches\n end",
"def st(value)\n value = value.to_s\n while (value =~ /\\d{4,}\\b/)\n value = value.sub(/(\\d{3})\\b/, \" \\\\1\")\n end\n value.lstrip\nend",
"def sortable_year_str_for_bc\n bc_matches = orig_date_str.match(BC_REGEX) if orig_date_str\n ($1.to_i - 1000).to_s if bc_matches\n end",
"def normalize_date( date )\n\n # look for the expected pattern (YYYY-MM-DD)\n matches = /^(\\d{4}-\\d{2}-\\d{2})/.match( date )\n return matches[ 1 ] if matches\n\n # look for YYYY-MM and append '-01' if we find it\n matches = /^(\\d{4}-\\d{2})/.match( date )\n return \"#{matches[ 1 ]}-01\" if matches\n\n # look for YYYY and append '-01-01' if we find it\n matches = /^(\\d{4})/.match( date )\n return \"#{matches[ 1 ]}-01-01\" if matches\n\n # give up and return what we were provided\n return date\n\n end",
"def dateify_dob\n self.dob ||= \"\"\n parts = self.dob.split(\"/\").map{|i| i.to_i}\n self.dob = \"#{parts[0].to_s.rjust(2, \"0\")}/#{parts[1].to_s.rjust(2, \"0\")}/#{parts[2]}\"\n end",
"def clean_date(date)\n mo_day_year = date.split(\" \")[0]\n \n return mo_day_year.split(\"/\")\nend",
"def pub_date_sort\n if pub_date\n pd = pub_date\n pd = '0' + pd if pd.length == 3\n pd = pd.gsub('--', '00')\n end\n fail \"pub_date_sort was about to return a non 4 digit value #{pd}!\" if pd && pd.length != 4\n\n pd\n end",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def format_date(string)\n return string.split(/-/).reverse.join('.') if string.match(/-/)\n string\nend",
"def convert_date(datestr)\n components = datestr.split('.')\n components.unshift(components.pop).join('-')\n end",
"def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end",
"def resolve_date(date_str)\n u_count = date_str.count 'u'\n # Replace unknown digits with 0.\n date = date_str.tr('u', '0').to_i\n if u_count.positive? && date != 0\n delta = 10**u_count # 10^u_count, exponent\n date + (delta / 2) if delta <= ESTIMATE_TOLERANCE\n elsif date != 0\n date\n end\n end",
"def entity_date(str)\n Time.at(str[/\\d{6,}/].to_i / 1000)\n end",
"def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end",
"def date_parse raw_day, raw_month\n str_month = raw_month.scan(@regex_monthes)[0]\n month = @monthes[str_month]\n return if not month\n day = raw_day.to_i\n return if day==0\n today = Date.today\n if day < today.day and month == 12\n year = today.year + 1\n else\n year = today.year\n end\n #puts year, year.class, month, month.class, day, day.class\n return \"#{year}-#{\"%02d\"%month}-#{\"%02d\"%day}\"\nend",
"def shorten_to_date(long_date)\n long_date.partition(',')[0]\nend",
"def century(year)\n century_string = ''\n case year.to_s.length \n when 1..2\n century_string = '1'\n when 3\n century_string = (year.to_s[0].to_i+1).to_s\n when 4\n if year.to_s[-1] == '0'\n century_string = year.to_s[0..1].to_i.to_s\n else \n century_string = (year.to_s[0..1].to_i+1).to_s\n end \n when 5\n century_string = (year.to_s[0..2].to_i+1).to_s\n end \ncentury_string += last_digit(century_string)\n\nend",
"def reg_binary_to_date(str)\n\t\tbegin\n\t\tcut=str.scan(/..../)\n\t\tyear=(cut[0][2,4]+cut[0][0,2]).hex.to_i\n\t\tmonth=(cut[1][2,4]+cut[1][0,2]).hex.to_i\n\t\tweekday=(cut[2][2,4]+cut[2][0,2]).hex.to_i\n\t\tdate=(cut[3][2,4]+cut[3][0,2]).hex.to_i\n\t\thour=(cut[4][2,4]+cut[4][0,2]).hex.to_i\n\t\tmin=(cut[5][2,4]+cut[5][0,2]).hex.to_i\n\t\tif min < 10 then\n\t\t\tmin=\"0#{min}\"\n\t\tend\n\t\tt = Time.gm(year,month,date,hour,min)\n\t\tmonth = t.strftime(\"%B\")\n\t\tweekday = t.strftime(\"%A\")\n\t\treturn \"#{weekday}, #{date} #{month} #{year} #{hour}:#{min}\"\n\t\trescue\n\t\t\treturn 'Error resolving last connected date'\n\t\tend\n\tend",
"def century_name_ending(number)\n if number[-2] == '1' # 10-19 are last two digits\n 'th'\n else\n case number[-1]\n when '0', '4', '5', '6', '7', '8', '9' then 'th'\n when '1' then 'st'\n when '2' then 'nd'\n when '3' then 'rd'\n end\n end\nend",
"def to_s\n \"#{year}-#{month.to_s.rjust(2, '0')}\"\n end",
"def date_reformatting(date)\n month = [[\"January\", 1], [\"February\", 2], [\"March\", 3], [\"April\", 4], [\"May\", 5], [\"December\", 12], [\"Dec\", 12]]\n data = date.split(\" \")\n if data.length == 1\n data = data[0].split(\"-\")\n end\n if data.length == 1\n data = data[0].split(\".\")\n end\n if data.length == 1\n data = data[0].split(\"/\")\n end\n \n send_back = []\n\n month.each do |moth|\n if moth[0] = data[0]\n send_back[0] = moth[1].to_i\n end\n end\n\n send_back[1] = data[1].tr(\",\", \" \").to_i\n send_back[2] = data[2].to_i\n\n return send_back\nend",
"def input_date_format(date)\n if date.split(\"-\").count > 2\n new_date = date.split(\"-\")\n return new_date[1] + \"-\" + new_date[0]\n else\n return date\n end\n end",
"def convert_date(date)\r\n if ( date == nil )\r\n return nil\r\n end\r\n string_date = date.to_s\r\n t = string_date.rindex('T')\r\n string_date = string_date.slice(0,t)\r\n string_date \r\nend",
"def wrong_date(num)\n first_day(num).text\nend",
"def century(num)\n century_num = ((num - 1) / 100) + 1\n\n century_string = century_num.to_s\n century_string << if (century_num % 100).between?(11, 13)\n 'th'\n elsif century_num % 10 == 1\n 'st'\n elsif century_num % 10 == 2\n 'nd'\n elsif century_num % 10 == 3\n 'rd'\n else\n 'th'\n end\nend",
"def fmt_date(date)\n if (date == :now)\n return Date.today\n end\n if (date.is_a? Integer)\n date = {:year => date, :month => 1}\n end\n Date.parse(date[:year].to_s+\"-\"+date[:month].to_s+\"-01\")\n end",
"def year(string)\n return if string.blank?\n return string if string.is_a?(Range)\n\n components = string\n .split(\"-\")\n .map(&:to_i)\n .map { |y| y.zero? ? nil : y }\n\n return if components.empty?\n\n # Set end if only one year\n components << components.first if components.count == 1\n\n components[0]..components[1]\n end",
"def format_sins(string)\n puts string.gsub!(/\\b(\\d{3})\\D?(\\d{3})\\D?(\\d{3})\\b/, '\\1-\\2-\\3')\n return string\nend",
"def get_month(month)\n month = month.to_s\n month.length == 2 ? month : \"0#{month}\"\n end",
"def number_to_short_month_name(number)\n sliced_month_name = number_to_full_month_name(number).slice(0,3)\n return sliced_month_name\nend",
"def get_yyyymmdd_hhnnss(s)\n return s.gsub('T', ' ').gsub('Z', '')\n end",
"def format_date(date)\n return date unless !!date.match(/[\\-]+/)\n date.split(/\\-/).reverse.join(\".\")\nend",
"def change_date_form(date)\n\n \n date_array = date.to_s.split(\"-\")\n puts date_array\n new_date = date_array[2]+ \"/\" + date_array[0] + \"/\" + date_array[1]\n puts new_date.inspect\n return new_date\n\n end",
"def number_to_short_month_name(n)\n short_month_string = number_to_full_month_name(n)[0..2]\nend",
"def extract_yyyymmdd_from_datestring( date )\n\n return nil if date.blank?\n\n #puts \"==> DATE IN [#{date}]\"\n begin\n\n # try yyyy-mm-dd (at the start of the string)\n dts = date.match( /^(\\d{4}-\\d{1,2}-\\d{1,2})/ )\n return dts[ 0 ] if dts\n\n # try yyyy/mm/dd (at the start of the string)\n dts = date.match( /^(\\d{4}\\/\\d{1,2}\\/\\d{1,2})/ )\n return dts[ 0 ].gsub( '/', '-' ) if dts\n\n # try yyyy-mm (at the start of the string)\n dts = date.match( /^(\\d{4}-\\d{1,2})/ )\n return dts[ 0 ] if dts\n\n # try yyyy/mm (at the start of the string)\n dts = date.match( /^(\\d{4}\\/\\d{1,2})/ )\n return dts[ 0 ].gsub( '/', '-' ) if dts\n\n # try mm/dd/yyyy (at the start of the string)\n dts = date.match( /^(\\d{1,2}\\/\\d{1,2}\\/\\d{4})/ )\n return DateTime.strptime( dts[ 0 ], \"%m/%d/%Y\" ).strftime( \"%Y-%m-%d\" ) if dts\n\n # try yyyy (anywhere in the string)\n dts = date.match( /(\\d{4})/ )\n return dts[ 0 ] if dts\n\n rescue => ex\n #puts \"==> EXCEPTION: #{ex}\"\n # do nothing...\n end\n\n # not sure what format\n return nil\n end",
"def sortable_year_int_for_bc\n bc_matches = orig_date_str.match(BC_REGEX) if orig_date_str\n \"-#{$1}\".to_i if bc_matches\n end",
"def number_to_short_month_name(short)\n if short == 1\n return \"Jan\"\n elsif short == 4\n return \"Apr\"\n else short == 10\n return \"Oct\"\n end\nend",
"def monthstamp(year, month)\n \"#{year}#{month.to_s.rjust(2, \"0\")}\".to_i\nend",
"def parse_year(date)\n date.split(\"-\").first.to_i rescue nil\n end",
"def sortable_year_string_from_date_str\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return sortable_year_str_for_bc if orig_date_str.match(BC_REGEX)\n\n result = sortable_year_for_yyyy_or_yy\n result ||= sortable_year_for_decade # 19xx or 20xx\n result ||= sortable_year_for_century\n result ||= sortable_year_str_for_early_numeric\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).sortable_year_string_from_date_str if no_brackets\n end\n result if self.class.year_str_valid?(result)\n end",
"def git_date2txt( datestring)\n # Date: Mon Aug 2 14:39:56 2021 +0100\n # assume we dont care about seconds, tz or year most of time.\n wd,month,day,time,year = datestring.split\n return sprintf \"%02d-%3s %s\", day, month, time[0,5]\nend",
"def day_string(value)\n day = month = year = nil\n if value.is_a?(String)\n case (value = value.strip)\n when /^\\d{4}$/ then day = year = \"#{value}-01-01\"\n when /^\\d{4}(\\D?)\\d{2}$/ then day = month = \"#{value}#{$1}01\"\n else day = value\n end\n end\n # noinspection RubyMismatchedReturnType\n return day, !!month, !!year\n end",
"def day_string(value)\n day = month = year = nil\n if value.is_a?(String)\n case (value = value.strip)\n when /^\\d{4}$/ then day = year = \"#{value}-01-01\"\n when /^\\d{4}(\\D?)\\d{2}$/ then day = month = \"#{value}#{$1}01\"\n else day = value\n end\n end\n # noinspection RubyMismatchedReturnType\n return day, !!month, !!year\n end",
"def date_range_from_string(date_str)\n if date_str == nil || date_str.length < 4\n return nil\n end\n\n if date_str.length == 4\n # single year\n return date_str\n end\n\n # multiple year, take the first two\n years = date_str.split(\"/\")\n if years.count < 2\n return years[0]\n end\n return years[0] + \"/\" + years[1]\n end",
"def serial_to_date (s)\r\n\t\t# round down and convert from string if need be\r\n\t\t# zero day is actually \"Jan 0\" and indexing starts from 1, so subtract 2\r\n\t\ts = s.to_i() - 2\r\n\t\t# add to zero day\r\n\t\treturn JAN_1_1900 + s\r\n\tend",
"def sortable_year_for_century\n return unless orig_date_str\n return if orig_date_str =~ /B\\.C\\./\n\n century_matches = orig_date_str.match(CENTURY_4CHAR_REGEXP)\n if century_matches\n return $1 + '00' if $1.length == 2\n return '0' + $1 + '00' if $1.length == 1\n end\n century_str_matches = orig_date_str.match(CENTURY_WORD_REGEXP)\n if century_str_matches\n yy = ($1.to_i - 1).to_s\n return yy + '00' if yy.length == 2\n return '0' + yy + '00' if yy.length == 1\n end\n end",
"def century(year)\n # create century_str--------------\n if year.to_s.end_with?('00')\n century_str = year / 100\n else\n century_str = year / 100 + 1\n end\n century_str = century_str.to_s\n # --------------------------------\n\n # create suffix-------------------\n suffix = nil\n\n if century_str.length == 1\n if century_str == '1'\n suffix = 'st'\n elsif century_str == '2'\n suffix = 'nd'\n elsif century_str == '3'\n suffix = 'rd'\n else\n suffix = 'th'\n end\n\n elsif century_str.length < 4\n if century_str.reverse[1] == '1'\n suffix = 'th'\n elsif century_str.end_with?('1')\n suffix = 'st'\n elsif century_str.end_with?('2')\n suffix = 'nd'\n elsif century_str.end_with?('3')\n suffix = 'rd'\n else\n suffix = 'th'\n end\n\n elsif century_str.length == 3\n # case century_str\n # end\n end\n # --------------------------------\n\n result = \"#{century_str}#{suffix}\"\n\n\n\n p result\nend",
"def normalize_fuzzy_date(date_str)\n if date_str.present?\n date_str = date_str.gsub(\"-\", \"\")\n if date_str.length < 8\n pad = 8 - date_str.length\n date_str += \"0\" * pad\n end\n end\n date_str\n end",
"def nice_day string\r\n string = string.to_s\r\n return convert_day_to_date(string).strftime('%A, %B %e, %Y') if string.length == 8\r\n return Date.new(string).strftime('%A, %B %e, %Y')\r\n end",
"def number_to_short_month_name(num)\n month = number_to_full_month_name(num)\n return month [0..2]\nend",
"def date_mathable(datestr)#i.e. '2011-02-20'\r\n date_time = datestr.split(\" \")\r\n if date_time.length == 1\r\n arg = datestr.split('-')\r\n arg = arg.length == 1 ? datestr.split('.') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n date = Time.local(y,m,d)\r\n return date\r\n elsif date_time.length == 2\r\n arg = date_time[0].split('-')\r\n arg = arg.length == 1 ? date_time[0].split('.') : arg\r\n arg = arg.length == 1 ? date_time[0].split('/') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n arg2 = date_time[1].split(':')\r\n hour = Integer( trim_lead(arg2[0],'0') )\r\n min = arg2[1] == '00' ? 0 : Integer( trim_lead(arg2[1],'0') )\r\n sec = arg2[2] == '00' ? 0 : Integer( trim_lead(arg2[2],'0') )\r\n date = y >= 1000 ? Time.local(y,m,d,hour,min,sec) : Time.local(d,y,m,hour,min,sec)\r\n return date\r\n end \r\n end",
"def date_str_for_display\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return display_str_for_bc if orig_date_str.match(BC_REGEX)\n # decade next in case there are 4 digits, e.g. 1950s\n return display_str_for_decade if orig_date_str.match(DECADE_4CHAR_REGEXP) || orig_date_str.match(DECADE_S_REGEXP)\n\n result = sortable_year_for_yyyy_or_yy\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).date_str_for_display if no_brackets\n end\n # parsing below this line gives string inapprop for year_str_valid?\n unless self.class.year_str_valid?(result)\n result = display_str_for_century\n result ||= display_str_for_early_numeric\n end\n # remove leading 0s from early dates\n result = \"#{result.to_i} A.D.\" if result && result.match(/^0\\d+$/)\n result\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def year_name(number); end",
"def format_date(str)\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def to_s\n # TODO this breaks the minus spec: strftime\n format \"#{year}-%02d-%02d\", month, day\n end",
"def normalized\n expanded = length == 2 ? \"20#{self}\".to_i : self.to_i # Assume no 3-digit years\n expanded >= Time.now.year ? expanded : Time.now.year\n end",
"def reformat_date_for_save(date_string)\n return if date_string.nil?\n month = \"1\"\n day = \"1\"\n year = \"1900\"\n #match = date_string.gsub(\"-\",\"/\").match(/(\\d+)\\/|\\-(\\d+)\\/|\\-(\\d+)/)\n match = date_string.gsub(\"-\", \"/\").split(\"/\")\n month_numbers = {\"Jan\" => \"1\", \"Feb\" => \"2\", \"Mar\" => \"3\", \"Apr\" => \"4\", \"May\" => \"5\", \"Jun\" => \"6\",\n \"Jul\" => \"7\", \"Aug\" => \"8\", \"Sep\" => \"9\", \"Oct\" => \"10\", \"Nov\" => \"11\", \"Dec\" => \"12\"}\n format_codes = GlobalSettings[:default_date_format].gsub(\"-\", \"/\").gsub(\" \", \"/\").split(\"/\")\n format_codes.each_with_index do |fmt, idx|\n case fmt.downcase\n when '%m'\n month = match[idx]\n when '%d'\n day = match[idx]\n when '%y'\n year = match[idx]\n when '%b'\n month = month_numbers[match[idx]]\n end\n end\n \"#{year}-#{month}-#{day}\"\n end",
"def sortable_year_int_for_early_numeric\n return orig_date_str.to_i if orig_date_str.match(EARLY_NUMERIC)\n\n orig_date_str.to_i if orig_date_str =~ /^-\\d{4}$/\n end",
"def silly_years(year)\n result_arr = []\n # retrieves first two digits\n first_half = year.to_s.split('')[0..1].join('').to_i\n while result_arr.length < 10\n first_half += 1\n mid = first_half%10\n next if mid*10 - first_half < 0\n \n mid = mid*10 + (((mid*10) - first_half)/10)\n second_half = mid - first_half\n year = first_half.to_s\n if second_half.to_s.length == 1\n year += \"0\" + second_half.to_s\n else\n year += second_half.to_s\n end\n \n \n result_arr << year.to_i\n end\n\n result_arr\nend",
"def year_via_ruby_parsing\n return unless orig_date_str =~ /\\d\\d/ # need at least 2 digits\n # need more in string than only 2 digits\n return if orig_date_str.match(/^\\d\\d$/) || orig_date_str.match(/^\\D*\\d\\d\\D*$/)\n return if orig_date_str =~ /\\d\\s*B.C./ # skip B.C. dates\n\n date_obj = Date.parse(orig_date_str)\n date_obj.year.to_s\n rescue ArgumentError\n nil # explicitly want nil if date won't parse\n end",
"def publication_date\n the_date = nil\n return the_date if @pubmed['DP'].blank?\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9] [a-zA-Z]+)-([0-9][0-9][0-9][0-9] [a-zA-Z]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.split(\"-\")[1]\n end\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.gsub(/([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i, '\\1 \\3')\n end\n pubdate=@pubmed['DP'].strip.split(\" \")\n year_range = pubdate[0].split(\"-\")\n if year_range.length > 1\n pubdate[0] = year_range[1]\n end\n if pubdate.length > 1\n month_range = pubdate[1].split(\"-\")\n if month_range.length > 1\n pubdate[1] = month_range[1]\n end\n pubdate[1] = case pubdate[1] \n when /spring/i then 'Mar'\n when /summer/i then 'Jun'\n when /fall|autumn/i then 'Sep'\n when /winter/i then 'Dec'\n else pubdate[1]\n end\n end\n if pubdate.length > 2\n day_range = pubdate[2].split(\"-\")\n if day_range.length > 1\n pubdate[2] = day_range[1]\n end\n the_date = pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n the_date = '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n the_date = '01-JAN-'+ pubdate[0]\n end\n return the_date\n end",
"def process_date(date)\n #store our values in a hash, making it easier to access\n date_hash = Hash.new\n #if the date is only a year we'll process that\n if date.length == 4\n date_hash[\"year\"] = \"2011\"\n\n #otherwise we'll process it as a normal date.We assume normal date formatting'\n else\n separated_date = date.split(\"-\")\n date_hash[\"year\"] = separated_date[0]\n #case incase they forget that month should be before day.\n #so if the \"month\" is greater than 12 we know the meant day instead\n if separated_date[1].to_i >12\n date_hash[\"month\"] = separated_date[2].gsub(\"0\",\"\")\n date_hash[\"day\"] = separated_date[1].gsub(\"0\",\"\")\n #else proceed as normal\n else\n date_hash[\"month\"] = separated_date[1].gsub(\"0\",\"\")\n date_hash[\"day\"] = separated_date[2].gsub(\"0\",\"\")\n end\n\n end\n\n\n return date_hash\n end",
"def vali_date(str)\n # Define month and day variables\n month, day = str.split('/').map(&:to_i)\n\n # Case month variable and return month and day if they are valid\n case month\n when 2 # February (28 days)\n return month, day if (1..28).include? day\n when 4, 6, 9, 11 # April, June, September, November (30 days)\n return month, day if (1..30).include? day\n when 1, 3, 5, 7, 8, 10, 12 # January, March, May, July, August, October, December (31 days)\n return month, day if (1..31).include? day\n end\n\n # Return nil otherwise\n nil\n end",
"def month_result_string(day)\n start = day.beginning_of_month.yday - 1\n finish = day.end_of_month.yday - 1\n result_string(day.year).slice(start..finish)\n end",
"def number_to_full_month_name(a)\n case a\n when 1\n return \"January\"\n when 3\n return \"March\"\n when 4\n return \"April\"\n when 9\n return \"September\"\n when 10\n return \"October\"\n end\nend",
"def number_to_full_month_name(number)\n\n result = case number\n when 1\n \"January\"\n when 3\n \"March\"\n when 9\n \"September\"\n end\n return result\nend",
"def lunar_date(year, month, day)\n l = yang_to_nong(year, month, day)\n l[0].to_s + '-' + l[1].to_s + '-' + (/^\\d+/.match(l[2].to_s)).to_s\n end",
"def change_date_format(date)\n date_array = date.split(\"/\")\n if date_array[1].to_i > 12\n new_date = date_array[1]+\"/\"+date_array[2]+\"/\"+date_array[0]\n else\n new_date = date_array[0]+\"/\"+date_array[2]+\"/\"+date_array[1]\n end\n puts \"anusha\"\n puts new_date.inspect\n return new_date\n end",
"def reformat(string, format)\n case format\n when \"MM/YYYY\"\n val = string.to_i\n sprintf(\"%02d/%4d\", val % 12 + 1, val / 12)\n when /.*%.*f.*/\n sprintf(format, string.to_f).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n when /.*%.*d.*/\n sprintf(format, string.to_i).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n else\n string\n end\nend",
"def test_String_009_format_dateString_mmddyyyy\n \n #require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_009_format_dateString_mmddyyyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS to the 1900's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1/1/01\",\n \"01/02/01\",\n \"11/1/01\",\n \"1/10/01\",\n \"12/31/2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\"/\" ,\"19\"))\n end\n \n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS to the 2300's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1.1.01\",\n \"01.02.01\",\n \"11.1.01\",\n \"1.10.01\",\n \"12.31.2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\".\" ,\"23\"))\n end\n \n end",
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def grab_ssn(string)\n string.scan(/\\d{3}-\\d{2}-\\d{4}/).join.slice!(0..10)\nend",
"def parse_date(s)\n begin\n if s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([2-9]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/19#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([0-1]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/20#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\n date = DateTime.parse(\"#{$2}/#{$1}/#{$3}\")\n elsif s =~ /^(\\d\\d\\d\\d)-(\\d\\d)$/\n if (1...13).include?($2.to_i) and (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n elsif s =~ /^(\\d\\d\\d\\d)$/\n if (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n else\n date = DateTime.parse(s)\n end\n rescue\n return nil\n end\n return date.strftime(\"%Y-%m-%d\")\n end",
"def format_for_spreadsheet(str)\n if str =~ /^\\d+$/ && str.length > 1\n return \"'#{str}\" if str.start_with?('0') || str.length > 10\n end\n str\n end",
"def get_formatted_date(date)\n date = date.gsub(\",\",\"\")\n date = date.gsub(\" \",\"-\")\n arr = date.split(\"-\")\n new_date = arr[1] + \"-\" + arr[2] + \"-\" + arr[3]\n end",
"def century(number)\n century_int = ''\n suffix_str = ''\n\n century_int = (number / 100) + 1\n century_int -= 1 if number % 100 == 0\n suffix_str = suffix(century_int)\n\n century_int.to_s + suffix_str\nend",
"def birth_path_number(date)\n no1 = date[0].to_i\n no2 = date[1].to_i\n no3 = date[2].to_i\n no4 = date[3].to_i\n no5 = date[4].to_i\n no6 = date[5].to_i\n no7 = date[6].to_i\n no8 = date[7].to_i\n\n # Adds all the digits of the birthdate\n number = no1 + no2 + no3 + no4 + no5 + no6 + no7 + no8\n\n # Reverts the number into a string\n number = number.to_s\nend",
"def year_month(date, fmt=\"yyyy mmm\")\n return nil unless date\n yyyy = date.year.to_s\n mmm = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[date.month-1]\n case fmt\n when \"mmm-yy\" then \"%s-%s\" % [mmm, yyyy[2, 2]]\n when \"mmm yyyy\" then \"%s %s\" % [mmm, yyyy]\n else \"%s %s\" % [yyyy, mmm]\n end\n end",
"def split_date\n\t self.date.to_s.split(\" \").first\n\tend",
"def parse_date(content)\n return content.lstrip.rstrip\n end",
"def year_month_int_to_str(year_month)\n \"#{year_month / 12} #{MONTHS[year_month % 12]}\"\n end",
"def generate_prefix(date1, date2)\n prefix = date1.strftime('%Y%m%d')\n return prefix += \"-\"+date2.strftime('%Y%m%d') if date1.year != date2.year\n return prefix += \"-\"+date2.strftime('%m%d') if date1.mon != date2.mon\n return prefix += \"-\"+date2.strftime('%d') if date1.mday != date2.mday\n return prefix\n end",
"def date_str\n date.strftime(\"%Y%m%d\")\n end",
"def year_int_from_date_str\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return sortable_year_int_for_bc if orig_date_str.match(BC_REGEX)\n\n result = sortable_year_for_yyyy_or_yy\n result ||= sortable_year_for_decade # 19xx or 20xx\n result ||= sortable_year_for_century\n result ||= sortable_year_int_for_early_numeric\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).year_int_from_date_str if no_brackets\n end\n result.to_i if result && self.class.year_int_valid?(result.to_i)\n end",
"def convertDate(date)\n dateHash = date\n dateFormat = Date.parse dateHash\n dateString = dateFormat.strftime('%A, %b %d')\n return dateString \nend",
"def January ; Date::MONTHNAMES.index(\"January\"); end",
"def number_to_short_month_name(number)\n case\n when number == 1\n return \"Jan\"\n when number == 4\n return \"Apr\"\n when number == 10\n return \"Oct\"\n else\n return \"Not a month\"\n end\nend",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/, '\\3.\\2.\\1')\nend",
"def space_in number\n number.to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1 ').reverse\nend"
] |
[
"0.6640362",
"0.6465642",
"0.6465642",
"0.6465642",
"0.63995576",
"0.63748497",
"0.6364608",
"0.6320617",
"0.6211488",
"0.6190731",
"0.6174991",
"0.6163901",
"0.61307484",
"0.60894346",
"0.6062938",
"0.606069",
"0.60377425",
"0.60359275",
"0.6032843",
"0.59946954",
"0.5964215",
"0.5962939",
"0.59578484",
"0.59452844",
"0.59419054",
"0.59147173",
"0.5907289",
"0.59000087",
"0.58944523",
"0.5882141",
"0.5876268",
"0.5857919",
"0.5855351",
"0.58474535",
"0.5842301",
"0.5837603",
"0.5833424",
"0.58121735",
"0.57978755",
"0.5797105",
"0.57898426",
"0.57880694",
"0.57872266",
"0.57667637",
"0.57597274",
"0.5759102",
"0.57470435",
"0.5739358",
"0.57185173",
"0.5716542",
"0.5712018",
"0.57076037",
"0.5702257",
"0.5702257",
"0.5701714",
"0.5696457",
"0.5695884",
"0.5694141",
"0.5684943",
"0.567985",
"0.56783056",
"0.5675139",
"0.56721777",
"0.5671145",
"0.56693107",
"0.5660838",
"0.56504714",
"0.5644896",
"0.5643171",
"0.5641111",
"0.5638121",
"0.56330854",
"0.56239885",
"0.5622389",
"0.56195384",
"0.5614212",
"0.56091785",
"0.5595045",
"0.55865455",
"0.5584675",
"0.5582884",
"0.5580995",
"0.5580602",
"0.5577346",
"0.55732775",
"0.55683327",
"0.5567992",
"0.55657786",
"0.5565574",
"0.5555942",
"0.5552317",
"0.5551556",
"0.55473804",
"0.5530866",
"0.5522231",
"0.5516022",
"0.55107707",
"0.5509293",
"0.5500574",
"0.5493194",
"0.54922545"
] |
0.0
|
-1
|
in case we need one, e.g. "Rechnung000001082011.pdf" Note: this is
|
def human_pdf_filename
"Rechnung-#{self.short_number}.pdf"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_filename(url)\n parts = url.split('/')\n dirname = parts[-2]\n filename = parts[-1].split('.')[0] + \"_ocr.pdf\"\n '990s/' + dirname + '/' + filename\nend",
"def filename2seq(name)\n m = name.sub(\"_\",\"\").match(/([0-9]{12}).jpg/)\n return nil unless m\n return m[1].to_i\nend",
"def number\n @file_name.split('_').last[1..-1].to_i\n end",
"def filename(count = 0)\n \"_paypal_#{count.to_s.rjust(4, '0')}.iif\"\nend",
"def file_name(title)\n name = title.gsub(/[\\r\\n]/, \" \")\n .gsub(/[^a-zA-Z\\d\\s]/, \"\")\n .gsub(/ /, \"_\")\n\n name.length > 31 ? name[0..30] : name\n end",
"def filename\n original_filename.try(:gsub, '+', '-')\n end",
"def extractAndrewID(filename)\n underscoreInd = filename.index(\"_\")\n if !underscoreInd.nil? \n return filename[0...underscoreInd]\n end\n return nil \n end",
"def filename_doi\n formatted_doi.gsub('/', '.')\n end",
"def file_name(title)\n name = title.gsub(/[\\r\\n]/, ' ')\n .gsub(/[^a-zA-Z\\d\\s]/, '')\n .tr(' ', '_')\n\n name.length > 31 ? name[0..30] : name\n end",
"def original_filename(filename)\n /\\d+_\\d+_(.+)?/.match(filename.to_s)&.captures&.first\n end",
"def original_filename(filename)\n /\\d+_\\d+_(.+)?/.match(filename.to_s)&.captures&.first\n end",
"def pdf_name(name = nil)\n name ||= self.name\n Pathname(name).sub_ext(\".pdf\")\n end",
"def pdf_version?(filename, base_name)\n (filename.gsub(/-(\\d+)\\.(.+)$/, '') == base_name) &&\n (file_extension(filename) == 'pdf')\n end",
"def versioned_filename(base, first_suffix='.00')\n suffix = nil\n filename = base\n while File.exists?(filename)\n suffix = (suffix ? suffix.succ : first_suffix)\n filename = base + suffix\n end\n return filename\n end",
"def default_pdf_file_name\n \"#{self.number}.pdf\" if self.number\n end",
"def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend",
"def file_title(title)\n title.downcase.gsub(/\\s+/, '-').gsub(/-{2,}/, '-').gsub(':', '')\nend",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def parsed_serial_no\n (no_extension_or_in_end? ? data_file_name.gsub(ext, '').split('.')[1] : data_file_name.split(ext)[1]&.gsub('.', ''))&.to_i\n end",
"def page_file_name(name, format)\n format.nil? ? name : \"#{name}.#{::Gollum::Page.format_to_ext(format)}\"\n end",
"def extractVersion(filename)\n firstUnderscoreInd = filename.index(\"_\")\n return nil unless !firstUnderscoreInd.nil? \n\n secondUnderscoreInd = filename.index(\"_\", firstUnderscoreInd + 1)\n return nil unless !secondUnderscoreInd.nil?\n return filename[firstUnderscoreInd + 1...secondUnderscoreInd].to_i\n end",
"def get_file_name(manual, version)\n\n fn = ''\n\n case manual\n when 'audio_2.json'\n fn = 'audio'\n when 'checking_1.json'\n fn = 'checking-vol1'\n when 'checking_2.json'\n fn = 'checking-vol2'\n when 'translate_1.json'\n fn = 'translate-vol1'\n when 'translate_2.json'\n fn = 'translate-vol2'\n when 'gateway_3.json'\n fn = 'gl'\n when 'intro_1.json'\n fn = 'intro'\n when 'process_1.json'\n fn = 'process'\n else\n 'en-ta-v%s' % [version]\n end\n\n '%sen-ta-%s-v%s.pdf' % [@context.registers[:site].config['ta_pdf_cdn'], fn, version]\n end",
"def filename\n @data[10..-1]\n end",
"def full_filename(filename)\n if filename.include? '.pdf'\n filename.gsub! '.pdf' '.jpg' \n end\n \"thumb_#{filename}\"\n end",
"def filename\n @basename + PAGE_FILE_EXT\n end",
"def create_filename(prev_name)\n prev_name[/\\d+$/] ? prev_name.next : prev_name + '02'\n end",
"def pdf_filename\n invoice_number.present? ? invoice_number : number\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end",
"def filename\n \"#{mounted_as}_#{Time.zone.now.to_s :number}.pdf\" if original_filename\n end",
"def filename\n @parts[-1]\n end",
"def fileid_and_filename(url)\n url.split('/').slice(-2,2) || ['', '']\n end",
"def filename\n\t\t\"%s/data/RFCs/rfc%d.txt\" % [ RAILS_ROOT, number ]\n\tend",
"def find_free_name(filename); end",
"def pdf_cover\n cover.gsub(/\\.[^\\.]+\\Z/, '.pdf')\n end",
"def untitled_file_name()\n return \"ללא שם\"\n end",
"def basename_without_ext; end",
"def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end",
"def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end",
"def printable_part(pathname)\r\n if (!@rl_filename_completion_desired) # don't need to do anything\r\n return (pathname)\r\n end\r\n\r\n temp = pathname.rindex('/')\r\n return pathname if temp.nil?\r\n File.basename(pathname)\r\n end",
"def file_title(path)\n filename_from_path(path).split(\".\")[0]\n end",
"def image_pdf\r\n directory = File.expand_path File.dirname(__FILE__)\r\n specific_filename = directory + \"/\" + \"Media/file1.pdf\"\r\nend",
"def extract_filename(full_path = T.unsafe(nil)); end",
"def file_suffix\n file_name.split('.').last \n end",
"def valid_new_filename(file)\n new_file = file\n counter = 0\n while File.exist?(new_file) do\n counter += 1\n ext = File.extname(file)\n basename = file.split(ext).first\n new_file = \"#{basename}_#{counter}#{ext}\"\n end\n new_file\n end",
"def parse_filename(source)\n if source =~ /^.*(\\d{4})-(\\d{2})-(\\d{2})-(.*)\\.md$/ then\n @year = $1\n @month = $2\n @day = $3\n @id = $4\n end\n end",
"def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end",
"def find_free_name filename\n base_filename = filename ||= @filename\n\n number = 1\n\n while File.exist? filename do\n filename = \"#{base_filename}.#{number}\"\n number += 1\n end\n\n filename\n end",
"def filename\n Time.now.to_i.to_s + [*('A'..'Z')].sample(8).join + \".\" + file.extension if original_filename\n end",
"def filename(name)\n # Reemplaza letras con acentos y ñ\n filename = name.gsub('á','a').gsub('é','e').gsub('í','i').gsub('ó','o').gsub('ú','u').gsub('ñ','n').downcase\n return filename\nend",
"def filename\n \"#{directory}/MCF-Invoice-#{@order.order_number}.pdf\"\n end",
"def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n return full_name\n end",
"def filename_from_path(name, content_type)\n return \"#{Time.now.to_i}_#{name}\" if content_type.empty?\n\n extension = content_type.split('/').last\n filename = name.split('/').last\n alternative_name = extension.empty? ? \"#{Time.now.to_i}_#{filename}\" : \"#{Time.now.to_i}_#{filename}.#{extension}\"\n filename = File.extname(filename).empty? ? alternative_name : filename\n CGI.unescape(filename) if filename\n end",
"def full_filename (for_file = model.document.file)\n for_file\n end",
"def file_extension; end",
"def file_extension; end",
"def file_extension; end",
"def file_ext\n File.extname(@file_name).downcase\n end",
"def parsed_file_name\n data_file_name.split('.')[0]\n end",
"def error_for_new_doc_name(filename, extension)\n full_file_name = filename + \".\" + extension\n if !(1..20).cover?(filename.size)\n return \"File name must be between 1 and 20 characters\"\n elsif find_by_name(full_file_name)\n return \"File name must be unique\"\n elsif (filename =~ /(^[A-Za-z][A-Za-z0-9_]+)$/).nil?\n return \"Invalid file name. File must begin with an alpha character. The rest of the file name can only contain alphanumeric characters and underscores\"\n end\n nil\nend",
"def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end",
"def get_filename(year, month)\n\tfolder = year == nil ? '.' : './_c' + year.to_s\n\tfilename = month == nil ? 'index' : month.to_s\n\textension = 'md'\n\treturn folder + \"/\" + filename + \".\" + extension\nend",
"def public_filename(record, file)\n filename = [application_for_offering.id.to_s] \n filename << application_for_offering.person.fullname\n filename << title\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n filename.join(' ').gsub(/[^a-z0-9 \\(\\)]+/i,'') + \".#{ext}\"\n end",
"def filename identifier\n raise \"An identifier is required\" if identifier.to_s == ''\n \"./#{application}_#{customer}_#{identifier}.pdf\"\n end",
"def file_of(file, serial)\n suffix = serial.zero? ? '' : \"_#{serial}\"\n ext = File.extname(file)\n base = File.basename(file, ext)\n File.join(File.dirname(file), base + suffix) + ext\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext end",
"def extname; end",
"def extname; end",
"def extname; end",
"def extname; end",
"def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end",
"def filename(version)\n @file_id.sub(/\\.#{file_type}\\Z/, \".#{version}.#{file_type}\")\n end",
"def parse_filename(string)\n string.sub(/^\\//, '') #remove leading slash\n end",
"def page_file_name(name, format)\n ext = @page_class.format_to_ext(format)\n @page_class.cname(name) + '.' + ext\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 possible_sample_name(filename)\n\t\tfilename.split('/').last.split('.').first\n\tend",
"def pretty_filename_for_download\n student_name = \"#{student.last_name} #{student.first_name}\"\n escaped_student_name = student_name.gsub(/[^a-zA-Z0-9]+/, '')\n date_text = self.created_at.strftime('%Y%m%d')\n \"IEP_#{escaped_student_name}_#{date_text}_#{student.id}_#{self.id}.pdf\"\n end",
"def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end",
"def get_unique_file_name fname\n 100.times do |i|\n suffix = \"%03d\" % i\n extn = File.extname(fname)\n base = File.basename(fname, extn)\n # f = fname + '.' + suffix\n f = base + suffix + extn\n return f unless File.exist?(f)\n end\n\n timestamp = Time.now.strftime('%Y%m%d-%H%M%S')\n return fname + '.' + timestamp\nend",
"def make_filename(filename)\n ### Making the filename\n bname=File.basename(filename,\".xml\")\n dname=File.dirname(filename)\n part=Array.new\n part=dname.split(\"/\")\n tmp1=String.new\n if (!(part.empty?)) then \n part.each{|ex| if (ex=~/^[0-9]/) then tmp1=ex end}\n end\n if (!(tmp1.empty?)) then \n newfilename=bname+\"_\"+tmp1\n else \n newfilename = bname\n end\n return newfilename\n end",
"def find_test_name( filename )\n check = /^[^\\.+$]\\w+_(of.*)\\..*/.match( filename )\n return check[ 1 ].to_s if check\n return \"\"\nend",
"def display_deriv_fname\n tokens = @filename.split('.')\n if tokens.length > 1\n return \"#{tokens[0]}.htm\"\n else\n return \"#{@filename}.htm\"\n end\n end",
"def notest_should_remove_blank_char_from_filename\n\n document_field = CGI.new( :multipart => true )\n puts document_field.inspect\n document = Document.new(document_field)\n \n puts document.inspect\n \n \n end",
"def file_name_from_object_name(object_name)\n object_name.gsub(OBJECT_DATE_REGEXP, '')\n end",
"def file_name_date_to_date(record,row)\n #rintraccio il file\n file = ImportFile.find(session[:file_id])\n #campagna 199X\n camp90 = /([9])(\\d)\\D+\\d+[.]\\S*/\n #campagna 20XX in avanti\n camp00 = /(\\d+)\\D+\\d+[.]\\S*/\n #se il file si riferisce alle campagne dal 1990 al 1999\n if file.file_name =~ camp90\n #anno = 19 + numeri rimanenti\n anno = \"19\" + $1 + $2\n #se il file si riferisce alle campagne dal 2000 al 2099\n elsif file.file_name =~ camp00\n #anno = 20 + numeri rimanenti\n anno = \"20\" + $1\n end\n #memorizzo temporaneamente la data per poterci lavorare sopra\n data_temp = Copl.new\n data_temp.data = record.data\n #a meno che l'anno della data del record non corrisponda a quello del nome del file\n unless data_temp.data.year == anno.to_i\n #salvo l'errore\n save_error(record,\"File name - Data\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end",
"def filename\n if url\n url.match(%r{([^\\/]+\\z)})[0]\n else\n nil\n end\n end",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end",
"def export_file_name(extension)\n \"CompSage Report on #{@survey.job_title.gsub(/[\\\\\\/:\\*\\?\"<>\\|]/,' ')}.#{extension}\"\n end",
"def get_filename(line)\n parts = line.split(\" \")\n filename_b = parts[3]\n filename_b[2..-1]\n end",
"def discover_file_title(page = current_page)\n\n if page.data.title\n return page.data.title # Frontmatter title\n else\n filename = page.url.split(/\\//).last.gsub('%20', ' ').titleize\n\n return filename.chomp(File.extname(filename))\n end\n end",
"def file_number\n begin\n self.job.file_number\n rescue\n \"\"\n end\n end",
"def file_string(file)\n return file.class == Fixnum ? files[file] : file\n end",
"def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end",
"def safe_filename(str)\n return render(str).gsub(\" \", \"_\")\n end",
"def get_processed_filename\n # We can make this if statement a single line, but then it'd be too long.\n filename = if file_options.nil? || file_options[:name].blank?\n name + '.csv'\n else\n file_options[:name]\n end\n if filename =~ /\\Ay#/\n date = Date.today.advance(days: -1)\n return date.strftime(filename[2..-1])\n else\n date = Date.today\n return date.strftime(filename)\n end\n end",
"def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end",
"def access_file_name\n end",
"def clean_filename\n doc_file_name.gsub!(' ', '_')\n end"
] |
[
"0.6600497",
"0.6376852",
"0.634441",
"0.6344274",
"0.63266385",
"0.630589",
"0.62819576",
"0.62586564",
"0.61954087",
"0.6180131",
"0.6180131",
"0.617402",
"0.616587",
"0.61601573",
"0.6150146",
"0.6129026",
"0.6111114",
"0.6099381",
"0.60984665",
"0.60891366",
"0.6083737",
"0.60712916",
"0.6045572",
"0.6035618",
"0.6010041",
"0.6004996",
"0.59949124",
"0.59660333",
"0.5963216",
"0.59592336",
"0.59356076",
"0.59344876",
"0.59243816",
"0.5920957",
"0.59137243",
"0.5913322",
"0.59117967",
"0.5909718",
"0.5909718",
"0.5904185",
"0.5886449",
"0.5883951",
"0.58766276",
"0.5867068",
"0.5864941",
"0.586388",
"0.58507633",
"0.5849709",
"0.5837842",
"0.58320934",
"0.58318627",
"0.58310384",
"0.58242273",
"0.5822076",
"0.5820249",
"0.5820249",
"0.5820249",
"0.58162326",
"0.5813234",
"0.5812473",
"0.57804364",
"0.57775235",
"0.5777494",
"0.576457",
"0.57641983",
"0.5761445",
"0.5761445",
"0.5753797",
"0.5753797",
"0.5753797",
"0.5753797",
"0.5750955",
"0.57412034",
"0.5739943",
"0.5738327",
"0.57344157",
"0.573077",
"0.57296497",
"0.5713128",
"0.5702098",
"0.5701175",
"0.569963",
"0.5698935",
"0.5691694",
"0.56901973",
"0.5679114",
"0.5678391",
"0.56774235",
"0.5658791",
"0.56518793",
"0.5647547",
"0.5647201",
"0.5632751",
"0.5624736",
"0.5607908",
"0.56028825",
"0.55993307",
"0.5597562",
"0.55967826",
"0.55964214"
] |
0.68372995
|
0
|
returns "geschlossen" etc. for current_state
|
def human_current_state_name
self.class.human_attribute_name("status_#{self.current_state}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_state_s\n self.current_state.to_s.humanize.downcase\n end",
"def current_state_s\n self.current_state.to_s.humanize.downcase\n end",
"def show_current_state\n {created: 'criado', ready: 'pronto', delivered: 'entregue', paid: 'pago'}[current_state.to_sym]\n end",
"def state\n object.human_state_name\n end",
"def state\n @current_state\n end",
"def friendly_state\r\n return '' if current_state == 'unstarted'\r\n return 'in progress' if current_state == 'started'\r\n current_state\r\n end",
"def state()\n info[:state]\n end",
"def current_state\n find_state(@current_state_name)\n # TODO: add caching, i.e. with `@current_state ||= ...`\n end",
"def state_label\n self.state == 3 ? \"Confirmado\" : \"Borrador\"\n end",
"def state\n info[:state]\n end",
"def current_state\n if self.steps.where(state: 'reproved').exists?\n 'reproved'\n elsif self.steps.pluck(:state).uniq == ['approved']\n 'approved'\n else\n 'waiting'\n end\n end",
"def state\n status.state name\n end",
"def current_state?(state) \n\t return state == current_state.to_sym\n\tend",
"def current_state_number\n 1\n end",
"def state\n end",
"def state_name\n self.state.name if self.state.name?\n end",
"def current_state_s(new_state=nil)\n case state = new_state || self.current_state\n when :created then 'new'\n else \"#{state}\"\n end\n end",
"def state\n @@states[@state]\n end",
"def state\n object.state_code\n end",
"def game_state\n end",
"def state\n self.well_info.state\n end",
"def name\n state_name\n end",
"def state\n @state\n end",
"def current_state\r\n self.send(self.class.state_column).to_sym\r\n end",
"def current_state\n events.first\n end",
"def state\n self[:ST]\n end",
"def state_code\n end",
"def state_name\n self.state.name if self.state\n end",
"def human_current_state_name\n self.user.human_current_state_name if self.user\n end",
"def state\n @game.state\n end",
"def game_state\n\t\t\"YOURTURN #{self.current_round} #{@hunter.to_state}, #{@prey.to_state}, W[#{@walls.map{|w| w.to_state}.join(\", \")}]\"\n\tend",
"def state_code\n end",
"def get_state\n return self.state == 't' || self.state == true\n end",
"def current_state?(state)\n state == current_state.to_sym\n end",
"def known_states; end",
"def known_states; end",
"def known_states; end",
"def state_name\n state_name = CS.states(:us)[ self.try(:state).try(:to_sym) ]\n end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def states; end",
"def states; @_hegemon_states.keys; end",
"def get_state\n \"Treasury state: #{@resources}\"\n end",
"def state\n @state\n end",
"def state\n status[\"state\"]\n end",
"def complete_state_name()\n return engine.complete_state_name()\n end",
"def state\n data[:state]\n end",
"def state_string()\n ss = 'UNKNOWN'\n case @state\n when STARTING\n ss = 'STARTING'\n when STOPPED\n ss = 'STOPPED'\n when RUNNING\n ss = 'RUNNING'\n when CLOSING\n ss = 'CLOSING'\n when BLOCKED\n ss = 'BLOCKED'\n when STEP\n ss = 'STEP'\n end\n ss\n end",
"def state_obj; @_hegemon_states[@_hegemon_state]; end",
"def state\n @state.first\n end",
"def state_s\n # return \"审核中\" if approving?\n return \"等待激活中\" if unapproved?\n return \"审核被拒绝\" if rejected?\n return \"展示中\" if opened? and available?\n return \"高亮展示中\" if highlighted? and opened? and available?\n return \"已过期\" if !available?\n return \"未展示\" if closed?\n end",
"def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend",
"def state\n @gameState.state\n end",
"def state\n @state\n end",
"def current_state\n\t # Started and not finished\n\t if running? \n\t\tif respond_to?(\"state_machine\")\n # state_machine.status # => String\n # state_machine.status_name # => Symbol\n\t\t return state_machine.status_name\n\t\telse\n\t\t return :running\n\t\tend\n\t end\n\t\n\t # True, when task has never been started\n\t if pending? \n\t\treturn :pending \n elsif failed_to_start? \n\t\treturn :failed_to_start\n elsif starting?\n\t return :starting\n\t # True, when terminal event is pending\n elsif finishing? \n\t return :finishing\n\t # Terminated with success or failure\n elsif success? \n\t return :succeeded\n elsif failed? \n\t return :failed \n\t end\n\tend",
"def current_state\n current = StateTransition.where(record_id: id, record_type: self.class.to_s, current: true).order(id: :desc).limit(1).first\n if current\n current.to_state.to_sym\n else\n self.initial_state.to_sym\n end\n end",
"def state\n states.first\n end",
"def human_state_name\n I18n.t \"activerecord.state_machines.tramway/core/application_record.state.states.#{state}\"\n end",
"def state_str\n VN_STATES[state]\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def state\n return @state\n end",
"def current_state\n result = { current_state: @game_array,\n current_player: @current_player }\n\n mark = winner_mark\n\n if mark\n result.merge!(winner: player_by_mark(mark).name)\n end\n\n\n result\n end",
"def gamestate\n\t\t@game_state\n\tend",
"def current_state_t(new_state=nil)\n self.current_state_s(new_state).t\n end",
"def current_state(states)\n active_states = states.select { |_, v| v['status'] == 'active' }.keys\n states_depth = active_states.map { |state| state.split('/').length }\n active_states[states_depth.index(states_depth.max)]\n end",
"def state_abbr; end",
"def show_state\n return \"#{@name} a #{@life_points} points de vie\"\n end",
"def extended_state\n\t if self.state == 'complete'\n \t if !self.accepted_at\n \t 'submitted'\n elsif self.accepted_at && (self.packed_at == nil) && self.shipment_state != 'shipped'\n 'accepted'\n elsif self.packed_at && (self.shipment_state != 'shipped' && self.shipment_state != 'delivered')\n 'ready_for_pick_up'\n elsif self.shipment_state == 'shipped'\n 'shipped'\n elsif self.shipment.state == 'delivered'\n 'delivered'\n end\n else\n self.state\n end\n end",
"def connection_state_name\n conn_state = @ole_connection.State\n \n STATECODES.each_with_index do |value, index|\n return STATENAMES[index] if (((conn_state & value) == value && value > 0) || (conn_state == value))\n end\n \n return 'Unknown'\n end",
"def state\n data.state\n end",
"def state\n data.state\n end",
"def current_state\n Rails.cache.fetch([self, \"current_state\"]) { fetch_current_state }\n end",
"def show_state\n return \"#{@name} a #{life_points} points de vie et une amre de niveau #{weapon_level}\"\n end",
"def state\n params['state']\n end",
"def fresh_state\n if state == :unknown\n current_state\n else\n state\n end\n end",
"def state_to_string(state)\n {\n STATE_SEARCH => 'STATE_SEARCH',\n STATE_IN_KEY => 'STATE_IN_KEY',\n STATE_EXPECT_EQUAL => 'STATE_EXPECT_EQUAL',\n STATE_EXPECT_VALUE => 'STATE_EXPECT_VALUE',\n STATE_IN_VALUE => 'STATE_IN_VALUE',\n STATE_EXPECT_END => 'STATE_EXPECT_END',\n STATE_EXPECT_COMMENT => 'STATE_EXPECT_COMMENT',\n STATE_IN_COMMENT_MULTI => 'STATE_IN_COMMENT_MULTI',\n STATE_EXPECT_COMMENT_END => 'STATE_EXPECT_COMMENT_END',\n STATE_IN_COMMENT_SINGLE => 'STATE_IN_COMMENT_SINGLE',\n STATE_EXPECT_UTF8_BOM => 'STATE_EXPECT_UTF8_BOM'\n }[state]\n end",
"def state_group\n state = @current_policy ? @current_policy.tax_state_abbr : @company_info.hq_state\n case state\n when nil\n 'All'\n when 'CA'\n 'California'\n else\n 'non_California'\n end\n end",
"def describe_state(state)\n $states[state.to_sym].last.join(' ,')\nend",
"def state_str\n VM_STATE[state]\n end",
"def state_str\n VM_STATE[state]\n end",
"def current_state\n Display.hangman(@lives)\n puts @hints.join('.')\n Display.errors(@incorrect)\n end",
"def get_state(key)\n @state[key]\n end",
"def state(*args)\n result = self.info(\"--state\", *args).collect{ |str| str.scan(REGEX_STATE) }\n result.flatten!.compact!\n\n result.first.strip.downcase.to_sym\n end"
] |
[
"0.78282785",
"0.78282785",
"0.7298336",
"0.7281511",
"0.71969175",
"0.70957404",
"0.70547503",
"0.70515317",
"0.7040694",
"0.70346314",
"0.70282656",
"0.70155334",
"0.6997517",
"0.6968779",
"0.69068193",
"0.6895653",
"0.6894868",
"0.6891493",
"0.6859557",
"0.6844566",
"0.6843952",
"0.6836684",
"0.6830775",
"0.6804607",
"0.6798669",
"0.678981",
"0.6776958",
"0.67762774",
"0.6742135",
"0.67340803",
"0.6725752",
"0.67081106",
"0.67079705",
"0.670332",
"0.6694703",
"0.6694703",
"0.6694703",
"0.6690472",
"0.66819185",
"0.66819185",
"0.66819185",
"0.66819185",
"0.66819185",
"0.66819185",
"0.66819185",
"0.66819185",
"0.6672345",
"0.6654654",
"0.66533536",
"0.6640834",
"0.6639679",
"0.66291726",
"0.6611114",
"0.66089046",
"0.66076565",
"0.6607568",
"0.66037655",
"0.6593694",
"0.65919316",
"0.657439",
"0.6544159",
"0.65062267",
"0.6495664",
"0.6495314",
"0.64901286",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.6484321",
"0.64629096",
"0.6448232",
"0.6440906",
"0.64375883",
"0.64278203",
"0.6397185",
"0.6370179",
"0.63674855",
"0.635975",
"0.635975",
"0.6358852",
"0.6350397",
"0.6347708",
"0.63468945",
"0.6340337",
"0.63330835",
"0.6328204",
"0.63279915",
"0.63279915",
"0.6322114",
"0.63196385",
"0.6317412"
] |
0.6711958
|
34
|
only if we are an invoice with subscibable products
|
def update_service_periods
if self.purchase_order
payments = self.purchase_order.payments.recurring.find(:all, :order => "payments.id ASC")
unless payments.empty?
self.update_attributes(:service_period_start_on => self.service_period_start_on,
:service_period_end_on => self.service_period_end_on)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def partial_invoicing?\n # do we have an eventbooking for a BundleEvent\n if order.product.class == BundleEvent\n # and does self belong to a BundleEvent\n if event.class == BundleEvent\n # full invoice for bundle event\n false\n # or to a Subevent\n else\n # allow partial invoice for subevent of bundle booking\n true\n end\n # or any other type of Event\n else\n false\n end\n\n end",
"def has_batch_products_included?\n result=false\n invoice_line_items.each do |line_item|\n result=true if !line_item.product.blank? && line_item.product.batch_enable? && !line_item.marked_for_destruction?\n end\n result\n end",
"def has_access?(subproduct)\n unless subproduct == :Communication\n# return true if subproduct == :FinancialAccount\n @subproducts ? @subproducts.include?(subproduct.to_s) : (@subproducts = subproducts).include?(subproduct.to_s)\n else\n self.verified_lawyer_id_by_secretary.present?\n end\n end",
"def ensure_not_referenced_by_any_invoice_products\n if invoice_products.empty?\n true\n else\n errors.add(:base, 'Invoice products present')\n false\n end\n end",
"def sales_invoice?\n false\n end",
"def sales_invoice?\n false\n end",
"def sales_invoice?\n false\n end",
"def line_item_product_subscriptions\n self.line_item_products.select(&:subscription?)\n end",
"def invoices?\n return invoices.any?\n end",
"def product?\n self.level == \"product\" && !self.products.blank?\n end",
"def invoice_possible?\n # 1. facture globale ?\n invoices = Invoice.find :first,\n \t:conditions => ['order_id = ? AND ds_id IS NULL', self.order_id]\n return false if (!invoices.nil?)\n # 2. facture pour cette livraison ?\n invoices = Invoice.find :first, :conditions => ['ds_id = ?', self.id]\n return false if (!invoices.nil?)\n # 3. bon de commande pour cette livraison ?\n return false if (self.order_id.nil?)\n return true\n end",
"def wholesale?\n line_items.any? do |line_item|\n product = line_item.product\n # a product could have multiple wholesale prices\n [\n product.wholesale_price,\n product.wholesale_subscription_price\n ].include? line_item.price\n end\n end",
"def is_partner_subscription?\n sku_type.to_s == Product::SKU_TYPE_PARTNER_SUBSCRIPTION && self.internal?\n end",
"def virtual_product?\n begin\n istomp = Product.find(\"istomp\")\n self.parents.include?(istomp)\n rescue\n false\n end\n end",
"def bundle?\n @product_composition.human == \"MultipleComponentRetailProduct\"\n end",
"def any_sold?\r\n self.is_a?(Listing) && invoices.exists?(status: 'paid')\r\n end",
"def includes_product?(product)\n products.include?(product)\n end",
"def has_invoice?\n !self.freshbooks_invoice_id.nil?\n end",
"def matches? invoice\n contact_ids.include? invoice.contact_id\n end",
"def custom_order?\n order_items.all? { |oi| oi.purchasable_type == 'Effective::Product' }\n end",
"def invoiced?\n !invoice_number.blank?\n end",
"def require_product?\n !!!catalog_request?\n end",
"def require_product?\n !!!catalog_request?\n end",
"def products?\n !products.empty?\n end",
"def can_be_registered?\n !!!(self.product_status.not_supported?) && !!(self.product_status.show_on_website?) && !!!(self.product_status.vintage?) && !!!(self.parent_products.size > 0) && !!!self.is_accessory?\n end",
"def purchased?(product)\n purchase_items.exists?(product_id: product.id)\n end",
"def quantity_check_availabilty(shop_id)\n a = sub_products.map do |p|\n p.quantity if p.shop_id == shop_id\n end.reject(&:blank?)\n rv = a[0]\n end",
"def not_single_sku?\n return self.product && self.product.skus.map(&:active).count == 1 && self.product.single ? false : true\n end",
"def match?(line_item)\n @product_ids.include?(line_item.variant.product.id)\n end",
"def has_discount?\n !discount.nil? && (!discount.product_list? || discount.product_ids.include?(line_item.product_id))\n end",
"def not_priced?\n bundle? || has_variants?\n end",
"def is_superior_to?(product)\n if product && product.is_subscription? && self.is_subscription?\n if self.is_flat? && product.is_flat?\n return false\n elsif self.is_flat? && !product.is_flat?\n return true\n elsif self.contacts.to_i != 0 && product.is_flat?\n return false\n elsif self.contacts.to_i > product.contacts.to_i\n return true\n end\n elsif self.is_subscription? && product.nil?\n return true\n end\n false\n end",
"def invoice?\n (payment_on_account? || payment_received?) && fully_shipped?\n end",
"def candidate_items\n sku_items.select {|i| i.paid_quantity > 0}\n end",
"def part_of_products\n linking(\"IsPartOf\")\n end",
"def institution_can_access?(book_products)\n entity_id = params[:filterByEntityId]\n return true unless entity_id\n\n @products ||= accessible_products(entity_id)\n (book_products & @products).present?\n end",
"def subclients?\n subclients.any?\n end",
"def is_subscribable?\n is_partner_subscription? || is_premium_subscription?\n end",
"def invoice_agreement_required?\n !self.billable? && !self.invoice_agreement_accepted?\n end",
"def group?\n self.invoiceable_type == \"Group\"\n end",
"def eligible?(product)\n @product_codes.include?(product.product_code)\n end",
"def invoiced_for_superficie_presentation_unit_type_measurement\n finished_products.each do |finished_product|\n finished_product.products.each do |product|\n product.product_by_invoices.each do |product_by_invoice|\n total_presentation_unit_type_to_use = product_by_invoice.total_presentation_unit_type_to_use\n finished_product.presentation_unit_type.presentation_unit_type_conversions.each do |presentation_unit_type_conversion|\n if packing_material.presentation_unit_type_id.eql?(presentation_unit_type_conversion.presentation_unit_type_to_id)\n invoiced += (total_presentation_unit_type_to_use*presentation_unit_type_conversion.proportion).to_i\n end\n end\n end\n end\n end\n end",
"def products_in_stock?(products)\n in_stock = false\n products.each_value {|p| in_stock = true if product_in_stock?(p) }\n return in_stock\n end",
"def provider?\n self.invoiceable_type == \"Provider\"\n end",
"def check_line_items_quantities?\n self.line_items.each do |line_item|\n line_item_addresses_quantity = line_item.line_item_addresses.pluck(:quantity).sum\n if line_item.quantity == line_item_addresses_quantity\n line_item.line_item_addresses.each do |line_item_address|\n if line_item_address.quantity < 1\n unless self.user.quadvision_user.quadvision_delivery_addresses.pluck(:id).include?(line_item_address.address.id)\n return false\n end\n end\n end\n else\n return false\n end\n end\n return true\n end",
"def may_purchase?(_company)\n false\n end",
"def visible_on_catalog?\n contador = 0\n self.variants.each do |v|\n contador += v.stock\n end\n\n (contador > 0) ? false : true\n end",
"def ensure_not_referenced_by_any_product\n if products.empty?\n return true\n else\n errors.add(:base, 'Kann nicht geloescht werden! Es gibt Produkte dieser Marke!')\n return false\n end\n end",
"def has_qty? listing\n !listing.is_category_type? %w(employment service vehicle)\n end",
"def reserved?(product)\n product.status == 'Reserved'\n end",
"def subproducts\n if self.role?(:secretary) || self.role?(:team_manager)\n user_id = self.service_provider_id_by_telephony.present? ? ServiceProvider.find(self.service_provider_id_by_telephony).user_id : self.id\n employee_id = self.verified_lawyer_id_by_secretary\n @subproduct_assignment ||= SubproductAssignment.all(:include => [:product_licence, :subproduct], :conditions => ['user_id = ? AND employee_user_id = ?', user_id, employee_id])\n else\n @subproduct_assignment ||= SubproductAssignment.all(:include => :subproduct, :conditions => ['user_id = ?', self.id])\n end\n mysubproducts = []\n for myObj in @subproduct_assignment\n mysubproducts << myObj.subproduct.name.to_s\n end\n mysubproducts\n end",
"def credit_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) < 0\")\n .group(\"spina_shop_invoices.id\")\n end",
"def product_memberships\n super.reject { |pm| pm.concept_product.nil? }\n end",
"def prod?\n is_prod\n end",
"def visible_on_catalog?\n #self.variants.each do |variant|\n # if variant.stock > 0\n # return true\n # end\n # false\n #end\n\n #contador = 0 \n #self.variants.each do |variant|\n # contador = contador + variant.stock\n #end\n\n #if contador > 0 \n # false\n #else\n # true\n #end\n\n #forma corta\n total_stock = self.variants.map(&:stock).inject(0,&:+)\n (total_stock > 0)\n\n end",
"def shippable?\n status != \"shipped\" && products.count >= 1\n end",
"def has_discounts?\n rpg_shop.permit_sales\n end",
"def can_add_product(p) \n university_id && \n ! products_unshipped_and_uncancelled.include?(p) &&\n ( ! p.premium? || univ_premium? ) # we can add non-prem products to any univ, or premium prods to premium univs\n end",
"def inventory\n product=Product.find(params[:id])\n haveProduct = false\n if product.inventory && product.inventory > 0\n haveProduct = true;\n end\n render plain: haveProduct\n end",
"def is_part_of_bill?(key)\n Invoice::BILL_ITEM_TYPES.include?(key)\n end",
"def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Products present')\n throw :abort\n end\n end",
"def needs_prod_set\n\t\treturn false\n\tend",
"def multiple_items?\n self.frontend == :shopcart\n end",
"def has_child?(product)\r\n\t\tr = false\r\n\t\tcomponents.each do |c|\r\n\t\t\tr ||= (c.child.id == product.id)\r\n\t\t\tif !r and c.child.is_a? CompositeProduct\r\n\t\t\t\tr ||= c.child.has_child?(product)\r\n\t\t\tend\r\n\t\t\tbreak unless !r\r\n\t\tend\r\n\t\tr\r\n\tend",
"def pending_financials?\n shop && shop.pending_products.any?\n end",
"def with_sku?(sku, quantity)\n return false\n return false if order.order_items.size == 0 && quantity == 1\n (sku.price_with_taxes.in_euro.to_yuan.amount * quantity + order_price) > Setting.instance.max_total_per_day\n end",
"def pdf_invoice?\n Object.const_defined?('TradoPdfInvoiceModule') ? true : false\n end",
"def check_product_dependencies\n # Iterate though the products associated to this SO, that are not deleted.\n products.visible.each do |p|\n # throw(:abort) will make the destroy method return false and the controller will know the destroy didn't work.\n throw(:abort) if p.shippingoptions.count == 1\n end\n end",
"def sales_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) >= 0\")\n .group(\"spina_shop_invoices.id\")\n end",
"def production_partnerships_shared_products\n#\t\tMoved to production products\n\tend",
"def find_product? (aProductId)\r\n return false if (find_product(aProductId) == {})\r\n return true\r\n end",
"def can_sell?\n inventory.any? { |inv| inv.price > 0 }\n end",
"def is_subpart?\n case @raw_provider['organization_subpart']\n when 'yes'\n true\n when 'no'\n false\n else\n nil\n end\n end",
"def is_purchasing_credit?\n sku_type.to_s == Product::SKU_TYPE_PURCHASING_CREDIT && self.internal?\n end",
"def invoice_paid_in_full?(invoice_id) # Paid in full if t/f\n sale = @transactions.find_all_by_invoice_id(invoice_id)\n sale.any? { |trans| trans.result == :success }\n end",
"def notification?\n !Notification.where(product_id: self.id).empty?\n end",
"def subscriber?\n self.subscription.plan_id != nil && self.subscription.plan_id >= 1\n end",
"def ready_for_merge?(order_detail)\n case order_detail.product\n when Service\n order_detail.valid_service_meta?\n when Instrument\n order_detail.valid_reservation?\n else\n true\n end\n end",
"def contains_routed_products?\n line_items.inject(false) {|routed, line_item| routed = routed || line_item.product.is_routed?}\n end",
"def is_under_process?\n #if true then this sub has got orders which are under process(by payment / shipment)\n self.orders.where('(delivery_date <= ? and delivery_date > ?) or (state = ? and payment_state = ?)', ORDER_UPDATE_LIMIT.days.from_now.to_date, Time.now, 'placed', 'paid').present?\n end",
"def inventory_product_exists?\n ! inventory_product_id.nil? # don't hit the db\n end",
"def products_covered?(dep_prods, man_prods)\n if dep_prods.nil? || man_prods.nil?\n return false\n end\n\n return (dep_prods - man_prods).empty?\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def tested_products\n return self.products.select do |product|\n product.incomplete_tests.count == 0\n end\n end",
"def validate_products_type(products)\n products.each do |product|\n return false unless product.kind_of?(OpenskyBis::Product) && product.valid?\n end\n true\n end",
"def any_eob_processed?\n self.insurance_payment_eobs.length >= 1\n end",
"def cap? ; prod_type == 'cap' end",
"def priced?()\n priced = true\n if (self.order_in_lines.length == 0)\n return false\n end\n self.order_in_lines.each do |line|\n if (not line.price or line.price == 0)\n priced = false\n end\n end\n return priced\n end",
"def purchased_before?\n if @receipts\n true\n end\n end",
"def build_invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def locked?\n self.invoiced? && self.invoice.issued?\n end",
"def to_be_performed?\n self.research_billing_qty > 0\n end",
"def add_accessories?\n complete? && product.accessories.count > child_order_details.count\n end",
"def has_supplier?\n supplier_product.present? && supplier.present?\n end",
"def has_inventory?\n inventory_count > 0\n end",
"def has_inventory?\n inventory_count > 0\n end",
"def is_similar_to?(product)\n if product\n if self.is_subscription? && product.is_subscription?\n if self.contacts == product.contacts\n return true\n end\n end\n end\n false\n end",
"def compute_matching_product(among_products) among_products.select { |product| concern?(product, among_products) } end",
"def reflowable?\n return true if @product_form_details.select { |fd| fd.code == \"E200\" }.length > 0\n return false if @product_form_details.select { |fd| fd.code == \"E201\" }.length > 0\n end",
"def has_shopped?\n self.points_entries.purchases.count > 0\n end",
"def only_downloadable\n downloadable_count = 0\n @order.line_items.each do |item|\n if((!item.product.downloadables.empty?) || (!item.variant.downloadables.empty?))\n downloadable_count += 1\n end\n end\n @order.line_items.size == downloadable_count\n end"
] |
[
"0.71502197",
"0.7053656",
"0.68730384",
"0.68404514",
"0.67886543",
"0.67886543",
"0.6777313",
"0.6727001",
"0.6663362",
"0.6630176",
"0.659371",
"0.64199907",
"0.6404109",
"0.63965225",
"0.6280335",
"0.62682736",
"0.62649447",
"0.6260845",
"0.62414926",
"0.62103385",
"0.6209089",
"0.6181793",
"0.6181793",
"0.6181693",
"0.6179452",
"0.61657786",
"0.6139264",
"0.61345553",
"0.6116093",
"0.611314",
"0.6090582",
"0.60765404",
"0.6074408",
"0.60606396",
"0.60383964",
"0.60366184",
"0.6022745",
"0.6019217",
"0.5971598",
"0.5962915",
"0.5959522",
"0.5956128",
"0.5955244",
"0.5955215",
"0.59459686",
"0.59408146",
"0.5940627",
"0.5914645",
"0.5905535",
"0.58716625",
"0.5859096",
"0.5849796",
"0.583823",
"0.58298314",
"0.58292526",
"0.5827898",
"0.58220464",
"0.5819811",
"0.5819115",
"0.5806298",
"0.5803401",
"0.57958215",
"0.5775301",
"0.5763763",
"0.5756018",
"0.5746095",
"0.573658",
"0.5731057",
"0.5730783",
"0.57157296",
"0.57052743",
"0.57020354",
"0.5698707",
"0.5698126",
"0.5681957",
"0.5675805",
"0.567352",
"0.56660944",
"0.5652357",
"0.5650471",
"0.5642759",
"0.56263024",
"0.56242114",
"0.56231415",
"0.56156546",
"0.5595143",
"0.5583603",
"0.5582718",
"0.55762506",
"0.5575032",
"0.55746037",
"0.55691063",
"0.5568027",
"0.5539895",
"0.55392796",
"0.55392796",
"0.5535354",
"0.55348146",
"0.55289865",
"0.551945",
"0.55157214"
] |
0.0
|
-1
|
Array of products purchased part of this order
|
def line_item_products
self.line_items.map(&:sellable).map {|s| s.respond_to?(:product) ? s.product : s}.compact.reject {|p| !p.is_a?(Product)}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_products_bought\n res = []\n\n @data.product_qty.each do |prd_id, qty|\n qty = qty.to_i\n if qty > 0\n res << [ qty, @data.products.with_id(prd_id) ]\n end\n end\n\n res\n end",
"def products\n products_at_market = []\n vendors_at_market = self.vendors\n vendors_at_market.each do |vendor|\n products_at_market << vendor.products\n end\n return products_at_market.flatten\n end",
"def products\n vendors_at_market = self.vendors\n products_at_market = []\n vendors_at_market.each do |vendor|\n products_at_market << vendor.products\n end\n return products_at_market.flatten\n end",
"def products\n @products ||= [].tap { |prods| each { |prod| prods << prod } }\n end",
"def products\n products_this_vendor_sells = []\n products_to_check = FarMar::Product.all\n products_to_check.each do |product_to_check|\n if self.id == product_to_check.vendor_id\n products_this_vendor_sells << product_to_check\n end#of if\n end#of do\n return products_this_vendor_sells\n end",
"def products\n @products ||= rules.of_type('Spree::Promotion::Rules::Product').map(&:products).flatten.uniq\n end",
"def quantified_items\n products.map { |product| [product.variant, product.quantity] }\n end",
"def products\n @products ||= rules.of_type('Promotion::Rules::Product').map(&:products).flatten.uniq\n end",
"def products()\n return filter_products()\n end",
"def ordered_products_total_arr\n ordered_products_arr = cart.items.map { |item| item[:product_id] }\n ordered_products_arr.map { |id| [id] * Item.where(product_id: id)[0].quantity }.flatten\n end",
"def bought_products\n order_details.sum(:quantity)\n end",
"def products\n @products.map{|prouduct, num| (1..num).map{|i| prouduct}}.flatten\n end",
"def products\n Spree::Product\n .joins(variants: { line_items: { order: :order_cycle } })\n .for_order_cycle(order_cycle)\n .where(\"spree_orders.state = 'complete'\")\n .uniq\n .select(\n 'spree_products.name, ' \\\n 'spree_variants.id AS variant_id, ' \\\n 'spree_products.variant_unit, ' \\\n 'spree_products.variant_unit_name, ' \\\n 'spree_products.variant_unit_scale'\n )\n end",
"def items\n self.purchases.map { |purchase| purchase.item }\n\n # items = []\n # purchases.each do |purchase|\n # items << purchase.item\n # end\n # items\n end",
"def products\n collection = []\n\n all_products = FarMar::Product.all\n all_products.each do |product|\n if product.vendor_id == self.id\n collection.push(product)\n end\n end\n\n return collection\n end",
"def products\n @products ||= hash[\"Products\"].map { |p| Merchant::Product.new p }\n end",
"def products\n collection = []\n vendors_array = self.vendors\n\n vendors_array.each do |vendor|\n collection += FarMar::Product.by_vendor(vendor.id)\n end\n\n return collection\n end",
"def delivered_products\n @delivered_products ||= begin\n products = order['OrderDetails']['OrderRows']\n products.each do |ol|\n if ol['OrderRowId'].to_s == line_id.to_s\n ol['QuantityToDeliver'] = quantity\n ol['PackageId'] = track_and_trace_reference\n end\n\n if ol['ProductId'] == 'Postage'\n ol['QuantityToDeliver'] = 1\n ol['PackageId'] = track_and_trace_reference\n end\n end\n products.collect do |pr|\n pr.slice 'OrderRowId', 'QuantityToDeliver', 'PackageId'\n end\n end\n end",
"def get_vendor_inventory_products\n\t\tis_unassigned_vendor = self.vendor.nil?\n\t\tif is_unassigned_vendor\n\t\t\treturn []\n\t\telse\n\t\t\t_inventory = self.vendor.inventory\n\t\t\treturn _inventory.products\n\t\tend\n\tend",
"def parts\n product.parts\n end",
"def parts\n product.parts\n end",
"def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end",
"def products\n Product.find_by_vendor(@id)\n end",
"def products\n products_by_market = []\n #gives me an array of vendors\n venders_by_market = FarMar::Vendor.by_market(@id)\n\n venders_by_market.each do | value |\n products = FarMar::Product.by_vendor(value.id)\n products_by_market.concat(products)\n end\n\n return products_by_market\n end",
"def products\n @product_map.keys\n end",
"def products(start_date = nil)\n begin\n response = self.class.get(\"/products\",\n headers: headers,\n query: {start_date: start_date},\n timeout: 10\n ).parsed_response\n response.map { |item|\n {\n code: item['barcode2'].presence || item['barcode'],\n customer_code: item['id'].to_s,\n title: item['descriptions'][0]['name'],\n retail_price: Money.new(item['sales_price_cents']),\n online: item['removed'].nil? && item['stock_sales'].to_i >= THRESHOLD,\n updated_at: item['updated_at']\n }\n }\n rescue => e\n return []\n end\n end",
"def other_products_purchased(purchased_item, other_line_items)\n similar_products = []\n other_products = []\n\n # extract an array of all the other purchase order ids minus this purchase order\n # that had a line item for the same purchased_item\n other_purchase_order_ids = other_line_items.collect{|line_item| line_item.purchase_order_id if line_item.purchase_order_id != self.id}.flatten.compact.uniq\n if other_purchase_order_ids.present?\n other_purchase_orders = PurchaseOrder.find other_purchase_order_ids\n\n # now extract all the other products purchased\n other_purchase_orders.each do |po|\n other_line_item_products = po.line_items.collect{|line_item| line_item.stuffed_animal_id.present? ? ((line_item.stuffed_animal_id != purchased_item.id) ? line_item.stuffed_animal : nil) : ((line_item.accessory_id != purchased_item.id) ? line_item.accessory : nil)}.flatten.compact\n other_products += other_line_item_products\n end\n end\n\n return other_products\n end",
"def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend",
"def subproducts\n if self.role?(:secretary) || self.role?(:team_manager)\n user_id = self.service_provider_id_by_telephony.present? ? ServiceProvider.find(self.service_provider_id_by_telephony).user_id : self.id\n employee_id = self.verified_lawyer_id_by_secretary\n @subproduct_assignment ||= SubproductAssignment.all(:include => [:product_licence, :subproduct], :conditions => ['user_id = ? AND employee_user_id = ?', user_id, employee_id])\n else\n @subproduct_assignment ||= SubproductAssignment.all(:include => :subproduct, :conditions => ['user_id = ?', self.id])\n end\n mysubproducts = []\n for myObj in @subproduct_assignment\n mysubproducts << myObj.subproduct.name.to_s\n end\n mysubproducts\n end",
"def matching_products\n if compute_on_promotion?\n calculable.promotion.rules.map do |rule|\n rule.respond_to?(:products) ? rule.products : []\n end.flatten\n end\n end",
"def items\n product.items\n end",
"def products_in_cart (complete)\n cart = []\n @total = 0\n Cart.all.each do |item|\n product_total = item.quantity * item.price\n @total += product_total\n cart.append('Name': item.name,\n 'Description': item.description,\n 'Item ID': item.item_id,\n 'Price': item.price,\n 'Quantity': item.quantity,\n 'Subtotal': \"$#{product_total.round(2)}\")\n if complete\n product = Product.find_by(name: item.name)\n product.update_columns(quantity: product.quantity - item.quantity)\n end\n end\n cart.append('Total': \"$#{@total.round(2)}\")\n return cart\n end",
"def product_list\n a = selectable_products\n l = products a\n l\n end",
"def my_purchases\n @orders = Effective::Order.deep.purchased_by(current_user)\n EffectiveOrders.authorized?(self, :index, Effective::Order.new(user: current_user))\n end",
"def get_products()\n products = Product.where(company_id: self.id).order(:name)\n \n return products\n end",
"def get_products()\n products = Product.where(company_id: self.id).order(:name)\n \n return products\n end",
"def get_products()\n products = Product.where(company_id: self.id).order('name')\n \n return products\n end",
"def products_data\n $products_hash[\"items\"].each do |toy|\n # toy_result = calculate_products_data(toy)\n print_products_data(toy)\n end\n end",
"def products(params = {})\n @products ||= product_ids.map do |product_id|\n client.products.find(product_id)\n end\n end",
"def show\n \n @product = []\n @order.product_id.each do |z|\n a = Product.find(z[0])\n @product << a\n end\n @product\n @order\n end",
"def products\n Product.find_all_by_vendor_id(@id)\n end",
"def cart_line_items(products)\n products.map {|p| self.cart_line_item(p)}\n end",
"def products\n @products ||= (@doc/\"Product\").collect { |it| Element.new(it) }\n end",
"def add_products(products)\n # remove nil element and save bidimensional array.\n (@cart_products << [products].compact).flatten!\n end",
"def products\n FarMar::Product.all.select { |product| product.vendor_id == id }\n end",
"def products\n @api_adapter.products_for_publisher(self)\n end",
"def list_products\n @products.map { |p| \"#{p.name} costs £#{p.price / 100.round(2)}\" }\n end",
"def matching_products\n # Regression check for #1596\n # Calculator::PerItem can be used in two cases.\n # The first is in a typical promotion, providing a discount per item of a particular item\n # The second is a ShippingMethod, where it applies to an entire order\n #\n # Shipping methods do not have promotions attached, but promotions do\n # Therefore we must check for promotions\n if self.calculable.respond_to?(:promotion)\n self.calculable.promotion.rules.map(&:products).flatten\n end\n end",
"def products\n FarMar::Product.by_vendor(self.id)\n end",
"def items\n @cart.each_pair.reduce([]) do |list, (product, qty)|\n list + Array.new(qty, product)\n end.join(', ')\n end",
"def fill_in_products\n products = []\n @data.products.all_products.each_with_index do |p, i|\n prod = {}\n prod['index'] = i\n prod['qty'] = @data.product_qty[p.prd_id]\n prod['desc'] = p.prd_long_desc\n prod['price'] = \"$\" + p.fmt_total_price\n prod['prd_id'] = p.prd_id\n products << prod\n end\n \n products\n end",
"def products\n @page_title = \"Purchased Products - #{@customer.name} - Customers\"\n if params[:reading_level_id].blank? && params[:category_id].blank?\n options = {}\n else\n conditions = []\n conditions << \"products.reading_level_id = :reading_level_id\" unless params[:reading_level_id].blank?\n conditions << \"cp.category_id = :category_id\" unless params[:category_id].blank?\n options = { :conditions => [ conditions.join(' and '), \n { :reading_level_id => params[:reading_level_id], :category_id => params[:category_id] } ] \n }\n end\n @purchases = @customer.purchased_products(options).group_by {|p| p.name }\n end",
"def cartProd\n @items = []\n @arr1.each{ |a|\n @arr2.each{ |b|\n item = [] << a << b\n @items << item\n }\n }\n end",
"def products\n @products ||= ProductProxy.new(self)\n end",
"def related_products\n return [] if self.tags.empty?\n products = Product.visible.tagged_with(self.tags.map{|tag| tag.to_s}, :any => true)\n products - [self]\n end",
"def index\n @orderproducts = Orderproduct.where(product_id: params[:product_id])\n @orders = []\n @orderproducts.each do |orderproduct|\n order = Order.find_by(id: orderproduct.order_id)\n @orders << order\n end\n end",
"def passing_products\n return self.products.select do |product|\n product.passing?\n end\n end",
"def products\n pages = page.children.all(\n :conditions => { :class_name => 'ShopProductPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_product)\n end",
"def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']\n product[:pricing_list_id] = pricing_list.id\n attributes = value['attributes']\n product[:service_code] = attributes['servicecode']\n product[:location] = attributes['location']\n product[:location_type] = attributes['locationType']\n product[:usage_type] = attributes['usagetype']\n product[:operation] = attributes['operation']\n product[:request_description] = attributes['requestDescription']\n product[:request_type] = attributes['requestType']\n product[:service_name] = attributes['servicename']\n product[:pricing_list_id] = pricing_list.id\n product[:created_at] = Time.zone.now.utc\n product[:updated_at] = Time.zone.now.utc\n products_ops << product\n end\n products_ops\n end",
"def payment_items\n\t\t\t\t\treturn self.order_items\n\t\t\t\tend",
"def product_list\n current_user.products.order('name').collect {|p| [ p.name, p.ticket_project_id, p.id ]}\n end",
"def products\n vendor_ids = vendors.collect { |vendor| vendor.vendor_id}\n CSV.read(PRODUCT_CSV).collect do |line|\n FarMar::Product.new(line) if vendor_ids.include? line[2].to_i\n end\n end",
"def unique_products\n @products.uniq\n end",
"def get_enterable_products\n return call('Product.get_enterable_products')\n end",
"def inherited_product_ids\n products = []\n products += operatingsystem.product_ids if operatingsystem\n products += Content::HostgroupProduct.where(:hostgroup_id => hostgroup.path_ids).pluck(:product_id) if hostgroup_id\n products.uniq\n end",
"def real_variants\n Product.where(openerp_id: product_variants.collect(&:openerpid)).order('id ASC').uniq\n end",
"def sales\n return array_of_instances(FarMar::Sale.all, \"product_id\", product_id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def incomplete_products\n return self.products.select do |product|\n !product.passing? && !product.failing?\n end\n end",
"def buys\n orders[:buys]\n end",
"def products_list\n @products = Haiwet::Product.list\n @products.each.with_index(1) do |prod, i|\n puts \"#{i}- #{prod.name}\"\n end\n end",
"def monies\n products.map(&:price)\n end",
"def products_with_cache\n if new_record?\n @products || []\n else\n self.products_without_cache\n end\n end",
"def extra_discounts_arr\n extras = cart.discounts.where(kind: 'extra').map do |extra|\n extra[:product_ids].each_slice(1).map { |e| (e * extra[:count]).push(extra[:id].to_s + 'e') }\n end\n extras.flatten(1)\n end",
"def get_products(ids=[])\n ids = [ids] unless ids.is_a? Array\n return call('Product.get_products', {:ids => ids})\n end",
"def index\n @product_in_orders = ProductInOrder.all\n end",
"def buyable_items(_entity)\n []\n end",
"def produce(products)\n return if products.nil?\n @products |= products.flatten\n end",
"def related_products( options = {} )\n #data_source = ( options[:data_source] || self.current_piece.current_data_source )\n data_filter = ( options[:data_filter] || self.current_piece.data_filter )\n\n current_product = (self.running_data_item_by_class( Products::WrappedProduct ) || self.current_page_tag.product_tag )\n if current_product\n case data_filter\n when Spree::PageLayout::DataSourceFilterEnum.next\n item = Spree::Classification.where( taxon_id: current_product.accurate_taxon_tag.id, product_id: current_product.id ).first.try(:lower_item).try(:product)\n item.present? ? Products.new( self.page_generator, [item], current_product.accurate_taxon_tag ) : []\n when Spree::PageLayout::DataSourceFilterEnum.previous\n item = Spree::Classification.where( taxon_id: current_product.accurate_taxon_tag.id, product_id: self.page_generator.resource.id ).first.try(:higher_item).try(:product)\n item.present? ? Products.new( self.page_generator, [item], current_product.accurate_taxon_tag ) : []\n else\n products( current_product.accurate_taxon_tag, { search:{ without_ids: [current_product.id]} } )\n end\n else\n []\n end\n end",
"def products\n end",
"def candidate_items\n sku_items.select {|i| i.paid_quantity > 0}\n end",
"def items_from_cart\n items = session[:cart]\n products = []\n items.each do |item|\n product = Product.find(item['product'])\n products << { name: product.name, price: product.price, image: product.product_images[0].image.url(:thumb), quantity: item['quantity'] }\n end\n return products\n end",
"def get_selectable_products\n return call('Product.get_selectable_products')\n end",
"def product_ids\n new_record? ? (@products_cache ? @products_cache.map(&:id) : []) : self.products.map(&:id)\n end",
"def confirm_products_order\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '3'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @users_sales=Array.new\n @customers_sales=Array.new\n @sales=Sale.where(\"is_delivered='f'\")\n\n @sales.each do |sale|\n if sale.customer\n @customers_sales.push(sale)\n else\n @users_sales.push(sale)\n end\n end\n puts \"user sale count:#{@users_sales.length}\"\n puts \"customer sale count:#{@customers_sales.length}\"\n end",
"def get_products_selected\n raise \"expecting knowledge to be set\" unless @current_knowledge\n unless @products_selected\n @products = @current_knowledge.get_products\n if session[:product_ids_selected]\n @products_selected = @products.select { |p| session[:product_ids_selected].include?(p.id) }\n else\n session[:product_ids_selected] = (@products_selected = @products.first(5)).collect(&:id)\n end\n end\n [@products, @products_selected]\n end",
"def products\n ServiceDecorator.decorate_collection(raw_products)\n .map(&:new_application_data)\n end",
"def sales\n sales = []\n FarMar::Sale.all.each do |i|\n if i.product_id == self.id\n sales << i\n end\n end\n return sales\n end",
"def generate_related_products\n related_product_scores.delete_all\n\n purchase_counts = Hash.new(0)\n\n orders.uniq.each do |order|\n order\n .order_lines\n .where(\"product_id != #{id} AND product_id IS NOT NULL\")\n .pluck(:product_id)\n .uniq\n .each { |product_id| purchase_counts[product_id] += 1 }\n end\n\n scores = purchase_counts.map { |product_id, purchased|\n [product_id, relatedness(orders.count, purchased)]\n }.to_h\n\n scores.each_pair do |related_id, score|\n RelatedProductScore.create(product_id: id, related_product_id: related_id, score: score)\n end\n end",
"def promoted_products\n promoted.is_a?(Product) ? [promoted] : promoted.products.all\n end",
"def coupons\n @items = @product.product_coupons\n end",
"def related_products(product_id)\n item = DirectedEdge::Item.new(@database, \"product#{product_id}\")\n item.related(['product']).map { |product| product.sub('product', '').to_i }\n end",
"def products(store = nil)\n return super if store.nil?\n\n Product\n .joins(:product_categories)\n .where('gemgento_product_categories.store_id = ? AND gemgento_product_categories.category_id = ?', store.id, self.id)\n .order('gemgento_product_categories.position ASC')\n .uniq\n end",
"def products_with_cache\n if new_record?\n @products_cache || []\n else\n self.products_without_cache\n end\n end",
"def shop_products\n products.shop_products\n end",
"def products\n if params[:ids]\n arraycheck = JSON.parse(params[:ids])\n if arraycheck.length > 0\n @products = SupplierRecord.where(contractnumber: arraycheck).joins(:product).select([\"products.id\" , \"products.name AS description\"]).uniq\n end\n else\n \n end\n end",
"def deduct_quantities_from_products\n line_items.each do |item|\n item.product_or_variant.deduct_quantity(item.quantity)\n end\n end",
"def products(ven_id)\n FarMar::Product.all.find_all { |product| product.vendor_id == ven_id }\n end",
"def products\n @product = Product.includes(:images).find(params[:id])\n @products = []\n\n # Cross-Selling: derzeit noch zufällig.\n 6.times do\n offset = rand(Product.count)\n @products << Product.includes(:images).offset(offset).first\n end\n end"
] |
[
"0.7324542",
"0.7234469",
"0.7231418",
"0.7056456",
"0.69550353",
"0.69398594",
"0.6922405",
"0.68613017",
"0.6790389",
"0.6789984",
"0.67376876",
"0.6736284",
"0.672384",
"0.66453874",
"0.65976536",
"0.65903336",
"0.65899014",
"0.656392",
"0.6547726",
"0.64978963",
"0.64978963",
"0.6459748",
"0.64006",
"0.63763136",
"0.63492507",
"0.6313785",
"0.62974197",
"0.6230355",
"0.622569",
"0.6222286",
"0.62009233",
"0.6136542",
"0.61362344",
"0.61191875",
"0.60734636",
"0.60734636",
"0.60585105",
"0.60522485",
"0.6048016",
"0.603321",
"0.6023072",
"0.60180557",
"0.6010824",
"0.5980668",
"0.5978754",
"0.59721214",
"0.59522396",
"0.5932838",
"0.59204847",
"0.59121585",
"0.590205",
"0.5893815",
"0.58872765",
"0.58478624",
"0.58396095",
"0.5827487",
"0.58155006",
"0.58129954",
"0.5810064",
"0.58090824",
"0.5798613",
"0.5791022",
"0.5790068",
"0.57771003",
"0.576487",
"0.576484",
"0.5754884",
"0.57439923",
"0.57439923",
"0.5741887",
"0.5734958",
"0.5729458",
"0.5721405",
"0.57181394",
"0.5715786",
"0.57113737",
"0.5704218",
"0.5694884",
"0.56729156",
"0.5667418",
"0.5666009",
"0.56659585",
"0.5665058",
"0.5659519",
"0.5657784",
"0.5654085",
"0.56402546",
"0.5634992",
"0.5634463",
"0.5630518",
"0.5614879",
"0.5612904",
"0.56026566",
"0.5599328",
"0.55711025",
"0.5561921",
"0.5555993",
"0.5555419",
"0.55529714",
"0.55361986"
] |
0.62258774
|
28
|
Array of products purchased part of this order
|
def line_item_product_subscriptions
self.line_item_products.select(&:subscription?)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_products_bought\n res = []\n\n @data.product_qty.each do |prd_id, qty|\n qty = qty.to_i\n if qty > 0\n res << [ qty, @data.products.with_id(prd_id) ]\n end\n end\n\n res\n end",
"def products\n products_at_market = []\n vendors_at_market = self.vendors\n vendors_at_market.each do |vendor|\n products_at_market << vendor.products\n end\n return products_at_market.flatten\n end",
"def products\n vendors_at_market = self.vendors\n products_at_market = []\n vendors_at_market.each do |vendor|\n products_at_market << vendor.products\n end\n return products_at_market.flatten\n end",
"def products\n @products ||= [].tap { |prods| each { |prod| prods << prod } }\n end",
"def products\n products_this_vendor_sells = []\n products_to_check = FarMar::Product.all\n products_to_check.each do |product_to_check|\n if self.id == product_to_check.vendor_id\n products_this_vendor_sells << product_to_check\n end#of if\n end#of do\n return products_this_vendor_sells\n end",
"def products\n @products ||= rules.of_type('Spree::Promotion::Rules::Product').map(&:products).flatten.uniq\n end",
"def quantified_items\n products.map { |product| [product.variant, product.quantity] }\n end",
"def products\n @products ||= rules.of_type('Promotion::Rules::Product').map(&:products).flatten.uniq\n end",
"def products()\n return filter_products()\n end",
"def ordered_products_total_arr\n ordered_products_arr = cart.items.map { |item| item[:product_id] }\n ordered_products_arr.map { |id| [id] * Item.where(product_id: id)[0].quantity }.flatten\n end",
"def bought_products\n order_details.sum(:quantity)\n end",
"def products\n @products.map{|prouduct, num| (1..num).map{|i| prouduct}}.flatten\n end",
"def products\n Spree::Product\n .joins(variants: { line_items: { order: :order_cycle } })\n .for_order_cycle(order_cycle)\n .where(\"spree_orders.state = 'complete'\")\n .uniq\n .select(\n 'spree_products.name, ' \\\n 'spree_variants.id AS variant_id, ' \\\n 'spree_products.variant_unit, ' \\\n 'spree_products.variant_unit_name, ' \\\n 'spree_products.variant_unit_scale'\n )\n end",
"def items\n self.purchases.map { |purchase| purchase.item }\n\n # items = []\n # purchases.each do |purchase|\n # items << purchase.item\n # end\n # items\n end",
"def products\n collection = []\n\n all_products = FarMar::Product.all\n all_products.each do |product|\n if product.vendor_id == self.id\n collection.push(product)\n end\n end\n\n return collection\n end",
"def products\n @products ||= hash[\"Products\"].map { |p| Merchant::Product.new p }\n end",
"def products\n collection = []\n vendors_array = self.vendors\n\n vendors_array.each do |vendor|\n collection += FarMar::Product.by_vendor(vendor.id)\n end\n\n return collection\n end",
"def delivered_products\n @delivered_products ||= begin\n products = order['OrderDetails']['OrderRows']\n products.each do |ol|\n if ol['OrderRowId'].to_s == line_id.to_s\n ol['QuantityToDeliver'] = quantity\n ol['PackageId'] = track_and_trace_reference\n end\n\n if ol['ProductId'] == 'Postage'\n ol['QuantityToDeliver'] = 1\n ol['PackageId'] = track_and_trace_reference\n end\n end\n products.collect do |pr|\n pr.slice 'OrderRowId', 'QuantityToDeliver', 'PackageId'\n end\n end\n end",
"def get_vendor_inventory_products\n\t\tis_unassigned_vendor = self.vendor.nil?\n\t\tif is_unassigned_vendor\n\t\t\treturn []\n\t\telse\n\t\t\t_inventory = self.vendor.inventory\n\t\t\treturn _inventory.products\n\t\tend\n\tend",
"def parts\n product.parts\n end",
"def parts\n product.parts\n end",
"def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end",
"def products\n Product.find_by_vendor(@id)\n end",
"def products\n products_by_market = []\n #gives me an array of vendors\n venders_by_market = FarMar::Vendor.by_market(@id)\n\n venders_by_market.each do | value |\n products = FarMar::Product.by_vendor(value.id)\n products_by_market.concat(products)\n end\n\n return products_by_market\n end",
"def products\n @product_map.keys\n end",
"def products(start_date = nil)\n begin\n response = self.class.get(\"/products\",\n headers: headers,\n query: {start_date: start_date},\n timeout: 10\n ).parsed_response\n response.map { |item|\n {\n code: item['barcode2'].presence || item['barcode'],\n customer_code: item['id'].to_s,\n title: item['descriptions'][0]['name'],\n retail_price: Money.new(item['sales_price_cents']),\n online: item['removed'].nil? && item['stock_sales'].to_i >= THRESHOLD,\n updated_at: item['updated_at']\n }\n }\n rescue => e\n return []\n end\n end",
"def other_products_purchased(purchased_item, other_line_items)\n similar_products = []\n other_products = []\n\n # extract an array of all the other purchase order ids minus this purchase order\n # that had a line item for the same purchased_item\n other_purchase_order_ids = other_line_items.collect{|line_item| line_item.purchase_order_id if line_item.purchase_order_id != self.id}.flatten.compact.uniq\n if other_purchase_order_ids.present?\n other_purchase_orders = PurchaseOrder.find other_purchase_order_ids\n\n # now extract all the other products purchased\n other_purchase_orders.each do |po|\n other_line_item_products = po.line_items.collect{|line_item| line_item.stuffed_animal_id.present? ? ((line_item.stuffed_animal_id != purchased_item.id) ? line_item.stuffed_animal : nil) : ((line_item.accessory_id != purchased_item.id) ? line_item.accessory : nil)}.flatten.compact\n other_products += other_line_item_products\n end\n end\n\n return other_products\n end",
"def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend",
"def line_item_products\n self.line_items.map(&:sellable).map {|s| s.respond_to?(:product) ? s.product : s}.compact.reject {|p| !p.is_a?(Product)}\n end",
"def subproducts\n if self.role?(:secretary) || self.role?(:team_manager)\n user_id = self.service_provider_id_by_telephony.present? ? ServiceProvider.find(self.service_provider_id_by_telephony).user_id : self.id\n employee_id = self.verified_lawyer_id_by_secretary\n @subproduct_assignment ||= SubproductAssignment.all(:include => [:product_licence, :subproduct], :conditions => ['user_id = ? AND employee_user_id = ?', user_id, employee_id])\n else\n @subproduct_assignment ||= SubproductAssignment.all(:include => :subproduct, :conditions => ['user_id = ?', self.id])\n end\n mysubproducts = []\n for myObj in @subproduct_assignment\n mysubproducts << myObj.subproduct.name.to_s\n end\n mysubproducts\n end",
"def matching_products\n if compute_on_promotion?\n calculable.promotion.rules.map do |rule|\n rule.respond_to?(:products) ? rule.products : []\n end.flatten\n end\n end",
"def items\n product.items\n end",
"def products_in_cart (complete)\n cart = []\n @total = 0\n Cart.all.each do |item|\n product_total = item.quantity * item.price\n @total += product_total\n cart.append('Name': item.name,\n 'Description': item.description,\n 'Item ID': item.item_id,\n 'Price': item.price,\n 'Quantity': item.quantity,\n 'Subtotal': \"$#{product_total.round(2)}\")\n if complete\n product = Product.find_by(name: item.name)\n product.update_columns(quantity: product.quantity - item.quantity)\n end\n end\n cart.append('Total': \"$#{@total.round(2)}\")\n return cart\n end",
"def product_list\n a = selectable_products\n l = products a\n l\n end",
"def my_purchases\n @orders = Effective::Order.deep.purchased_by(current_user)\n EffectiveOrders.authorized?(self, :index, Effective::Order.new(user: current_user))\n end",
"def get_products()\n products = Product.where(company_id: self.id).order(:name)\n \n return products\n end",
"def get_products()\n products = Product.where(company_id: self.id).order(:name)\n \n return products\n end",
"def get_products()\n products = Product.where(company_id: self.id).order('name')\n \n return products\n end",
"def products_data\n $products_hash[\"items\"].each do |toy|\n # toy_result = calculate_products_data(toy)\n print_products_data(toy)\n end\n end",
"def products(params = {})\n @products ||= product_ids.map do |product_id|\n client.products.find(product_id)\n end\n end",
"def show\n \n @product = []\n @order.product_id.each do |z|\n a = Product.find(z[0])\n @product << a\n end\n @product\n @order\n end",
"def products\n Product.find_all_by_vendor_id(@id)\n end",
"def cart_line_items(products)\n products.map {|p| self.cart_line_item(p)}\n end",
"def products\n @products ||= (@doc/\"Product\").collect { |it| Element.new(it) }\n end",
"def add_products(products)\n # remove nil element and save bidimensional array.\n (@cart_products << [products].compact).flatten!\n end",
"def products\n FarMar::Product.all.select { |product| product.vendor_id == id }\n end",
"def products\n @api_adapter.products_for_publisher(self)\n end",
"def list_products\n @products.map { |p| \"#{p.name} costs £#{p.price / 100.round(2)}\" }\n end",
"def matching_products\n # Regression check for #1596\n # Calculator::PerItem can be used in two cases.\n # The first is in a typical promotion, providing a discount per item of a particular item\n # The second is a ShippingMethod, where it applies to an entire order\n #\n # Shipping methods do not have promotions attached, but promotions do\n # Therefore we must check for promotions\n if self.calculable.respond_to?(:promotion)\n self.calculable.promotion.rules.map(&:products).flatten\n end\n end",
"def products\n FarMar::Product.by_vendor(self.id)\n end",
"def items\n @cart.each_pair.reduce([]) do |list, (product, qty)|\n list + Array.new(qty, product)\n end.join(', ')\n end",
"def fill_in_products\n products = []\n @data.products.all_products.each_with_index do |p, i|\n prod = {}\n prod['index'] = i\n prod['qty'] = @data.product_qty[p.prd_id]\n prod['desc'] = p.prd_long_desc\n prod['price'] = \"$\" + p.fmt_total_price\n prod['prd_id'] = p.prd_id\n products << prod\n end\n \n products\n end",
"def products\n @page_title = \"Purchased Products - #{@customer.name} - Customers\"\n if params[:reading_level_id].blank? && params[:category_id].blank?\n options = {}\n else\n conditions = []\n conditions << \"products.reading_level_id = :reading_level_id\" unless params[:reading_level_id].blank?\n conditions << \"cp.category_id = :category_id\" unless params[:category_id].blank?\n options = { :conditions => [ conditions.join(' and '), \n { :reading_level_id => params[:reading_level_id], :category_id => params[:category_id] } ] \n }\n end\n @purchases = @customer.purchased_products(options).group_by {|p| p.name }\n end",
"def cartProd\n @items = []\n @arr1.each{ |a|\n @arr2.each{ |b|\n item = [] << a << b\n @items << item\n }\n }\n end",
"def products\n @products ||= ProductProxy.new(self)\n end",
"def related_products\n return [] if self.tags.empty?\n products = Product.visible.tagged_with(self.tags.map{|tag| tag.to_s}, :any => true)\n products - [self]\n end",
"def index\n @orderproducts = Orderproduct.where(product_id: params[:product_id])\n @orders = []\n @orderproducts.each do |orderproduct|\n order = Order.find_by(id: orderproduct.order_id)\n @orders << order\n end\n end",
"def passing_products\n return self.products.select do |product|\n product.passing?\n end\n end",
"def products\n pages = page.children.all(\n :conditions => { :class_name => 'ShopProductPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_product)\n end",
"def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']\n product[:pricing_list_id] = pricing_list.id\n attributes = value['attributes']\n product[:service_code] = attributes['servicecode']\n product[:location] = attributes['location']\n product[:location_type] = attributes['locationType']\n product[:usage_type] = attributes['usagetype']\n product[:operation] = attributes['operation']\n product[:request_description] = attributes['requestDescription']\n product[:request_type] = attributes['requestType']\n product[:service_name] = attributes['servicename']\n product[:pricing_list_id] = pricing_list.id\n product[:created_at] = Time.zone.now.utc\n product[:updated_at] = Time.zone.now.utc\n products_ops << product\n end\n products_ops\n end",
"def payment_items\n\t\t\t\t\treturn self.order_items\n\t\t\t\tend",
"def product_list\n current_user.products.order('name').collect {|p| [ p.name, p.ticket_project_id, p.id ]}\n end",
"def products\n vendor_ids = vendors.collect { |vendor| vendor.vendor_id}\n CSV.read(PRODUCT_CSV).collect do |line|\n FarMar::Product.new(line) if vendor_ids.include? line[2].to_i\n end\n end",
"def unique_products\n @products.uniq\n end",
"def get_enterable_products\n return call('Product.get_enterable_products')\n end",
"def inherited_product_ids\n products = []\n products += operatingsystem.product_ids if operatingsystem\n products += Content::HostgroupProduct.where(:hostgroup_id => hostgroup.path_ids).pluck(:product_id) if hostgroup_id\n products.uniq\n end",
"def real_variants\n Product.where(openerp_id: product_variants.collect(&:openerpid)).order('id ASC').uniq\n end",
"def sales\n return array_of_instances(FarMar::Sale.all, \"product_id\", product_id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def incomplete_products\n return self.products.select do |product|\n !product.passing? && !product.failing?\n end\n end",
"def buys\n orders[:buys]\n end",
"def products_list\n @products = Haiwet::Product.list\n @products.each.with_index(1) do |prod, i|\n puts \"#{i}- #{prod.name}\"\n end\n end",
"def monies\n products.map(&:price)\n end",
"def products_with_cache\n if new_record?\n @products || []\n else\n self.products_without_cache\n end\n end",
"def extra_discounts_arr\n extras = cart.discounts.where(kind: 'extra').map do |extra|\n extra[:product_ids].each_slice(1).map { |e| (e * extra[:count]).push(extra[:id].to_s + 'e') }\n end\n extras.flatten(1)\n end",
"def get_products(ids=[])\n ids = [ids] unless ids.is_a? Array\n return call('Product.get_products', {:ids => ids})\n end",
"def index\n @product_in_orders = ProductInOrder.all\n end",
"def buyable_items(_entity)\n []\n end",
"def produce(products)\n return if products.nil?\n @products |= products.flatten\n end",
"def related_products( options = {} )\n #data_source = ( options[:data_source] || self.current_piece.current_data_source )\n data_filter = ( options[:data_filter] || self.current_piece.data_filter )\n\n current_product = (self.running_data_item_by_class( Products::WrappedProduct ) || self.current_page_tag.product_tag )\n if current_product\n case data_filter\n when Spree::PageLayout::DataSourceFilterEnum.next\n item = Spree::Classification.where( taxon_id: current_product.accurate_taxon_tag.id, product_id: current_product.id ).first.try(:lower_item).try(:product)\n item.present? ? Products.new( self.page_generator, [item], current_product.accurate_taxon_tag ) : []\n when Spree::PageLayout::DataSourceFilterEnum.previous\n item = Spree::Classification.where( taxon_id: current_product.accurate_taxon_tag.id, product_id: self.page_generator.resource.id ).first.try(:higher_item).try(:product)\n item.present? ? Products.new( self.page_generator, [item], current_product.accurate_taxon_tag ) : []\n else\n products( current_product.accurate_taxon_tag, { search:{ without_ids: [current_product.id]} } )\n end\n else\n []\n end\n end",
"def products\n end",
"def candidate_items\n sku_items.select {|i| i.paid_quantity > 0}\n end",
"def items_from_cart\n items = session[:cart]\n products = []\n items.each do |item|\n product = Product.find(item['product'])\n products << { name: product.name, price: product.price, image: product.product_images[0].image.url(:thumb), quantity: item['quantity'] }\n end\n return products\n end",
"def get_selectable_products\n return call('Product.get_selectable_products')\n end",
"def product_ids\n new_record? ? (@products_cache ? @products_cache.map(&:id) : []) : self.products.map(&:id)\n end",
"def confirm_products_order\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '3'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @users_sales=Array.new\n @customers_sales=Array.new\n @sales=Sale.where(\"is_delivered='f'\")\n\n @sales.each do |sale|\n if sale.customer\n @customers_sales.push(sale)\n else\n @users_sales.push(sale)\n end\n end\n puts \"user sale count:#{@users_sales.length}\"\n puts \"customer sale count:#{@customers_sales.length}\"\n end",
"def get_products_selected\n raise \"expecting knowledge to be set\" unless @current_knowledge\n unless @products_selected\n @products = @current_knowledge.get_products\n if session[:product_ids_selected]\n @products_selected = @products.select { |p| session[:product_ids_selected].include?(p.id) }\n else\n session[:product_ids_selected] = (@products_selected = @products.first(5)).collect(&:id)\n end\n end\n [@products, @products_selected]\n end",
"def products\n ServiceDecorator.decorate_collection(raw_products)\n .map(&:new_application_data)\n end",
"def sales\n sales = []\n FarMar::Sale.all.each do |i|\n if i.product_id == self.id\n sales << i\n end\n end\n return sales\n end",
"def generate_related_products\n related_product_scores.delete_all\n\n purchase_counts = Hash.new(0)\n\n orders.uniq.each do |order|\n order\n .order_lines\n .where(\"product_id != #{id} AND product_id IS NOT NULL\")\n .pluck(:product_id)\n .uniq\n .each { |product_id| purchase_counts[product_id] += 1 }\n end\n\n scores = purchase_counts.map { |product_id, purchased|\n [product_id, relatedness(orders.count, purchased)]\n }.to_h\n\n scores.each_pair do |related_id, score|\n RelatedProductScore.create(product_id: id, related_product_id: related_id, score: score)\n end\n end",
"def promoted_products\n promoted.is_a?(Product) ? [promoted] : promoted.products.all\n end",
"def coupons\n @items = @product.product_coupons\n end",
"def related_products(product_id)\n item = DirectedEdge::Item.new(@database, \"product#{product_id}\")\n item.related(['product']).map { |product| product.sub('product', '').to_i }\n end",
"def products(store = nil)\n return super if store.nil?\n\n Product\n .joins(:product_categories)\n .where('gemgento_product_categories.store_id = ? AND gemgento_product_categories.category_id = ?', store.id, self.id)\n .order('gemgento_product_categories.position ASC')\n .uniq\n end",
"def products_with_cache\n if new_record?\n @products_cache || []\n else\n self.products_without_cache\n end\n end",
"def shop_products\n products.shop_products\n end",
"def products\n if params[:ids]\n arraycheck = JSON.parse(params[:ids])\n if arraycheck.length > 0\n @products = SupplierRecord.where(contractnumber: arraycheck).joins(:product).select([\"products.id\" , \"products.name AS description\"]).uniq\n end\n else\n \n end\n end",
"def deduct_quantities_from_products\n line_items.each do |item|\n item.product_or_variant.deduct_quantity(item.quantity)\n end\n end",
"def products(ven_id)\n FarMar::Product.all.find_all { |product| product.vendor_id == ven_id }\n end",
"def products\n @product = Product.includes(:images).find(params[:id])\n @products = []\n\n # Cross-Selling: derzeit noch zufällig.\n 6.times do\n offset = rand(Product.count)\n @products << Product.includes(:images).offset(offset).first\n end\n end"
] |
[
"0.7324542",
"0.7234469",
"0.7231418",
"0.7056456",
"0.69550353",
"0.69398594",
"0.6922405",
"0.68613017",
"0.6790389",
"0.6789984",
"0.67376876",
"0.6736284",
"0.672384",
"0.66453874",
"0.65976536",
"0.65903336",
"0.65899014",
"0.656392",
"0.6547726",
"0.64978963",
"0.64978963",
"0.6459748",
"0.64006",
"0.63763136",
"0.63492507",
"0.6313785",
"0.62974197",
"0.6230355",
"0.62258774",
"0.622569",
"0.6222286",
"0.62009233",
"0.6136542",
"0.61362344",
"0.61191875",
"0.60734636",
"0.60734636",
"0.60585105",
"0.60522485",
"0.6048016",
"0.603321",
"0.6023072",
"0.60180557",
"0.6010824",
"0.5980668",
"0.5978754",
"0.59721214",
"0.59522396",
"0.5932838",
"0.59204847",
"0.59121585",
"0.590205",
"0.5893815",
"0.58872765",
"0.58478624",
"0.58396095",
"0.5827487",
"0.58155006",
"0.58129954",
"0.5810064",
"0.58090824",
"0.5798613",
"0.5791022",
"0.5790068",
"0.57771003",
"0.576487",
"0.576484",
"0.5754884",
"0.57439923",
"0.57439923",
"0.5741887",
"0.5734958",
"0.5729458",
"0.5721405",
"0.57181394",
"0.5715786",
"0.57113737",
"0.5704218",
"0.5694884",
"0.56729156",
"0.5667418",
"0.5666009",
"0.56659585",
"0.5665058",
"0.5659519",
"0.5657784",
"0.5654085",
"0.56402546",
"0.5634992",
"0.5634463",
"0.5630518",
"0.5614879",
"0.5612904",
"0.56026566",
"0.5599328",
"0.55711025",
"0.5561921",
"0.5555993",
"0.5555419",
"0.55529714",
"0.55361986"
] |
0.0
|
-1
|
billing due is end of next billing period + 1 day
|
def update_billing_cycle
if recurring_payment = self.purchase_order.payments.recurring.first
recurring_payment = recurring_payment.decrement(:duration_occurrences)
# udpate the billing period of the order only
if recurring_payment.duration_occurrences > 0
nbp = self.next_service_billing_period
if nbp && (!self.purchase_order.billing_due_on || nbp.include?(self.purchase_order.billing_due_on))
self.purchase_order.billing_due_on = nbp.last + 1.day
self.purchase_order.save(false)
end
else
self.purchase_order.cancel!
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def next_service_billing_period\n if self.purchase_order && self.purchase_order.recurring? && self.purchase_order.pending?\n payment = self.purchase_order.payments.recurring.find(:all, :order => \"payments.id ASC\").last\n (self.service_period_end_on + 1.day)..(self.service_period_end_on + (payment.interval_length.to_i.send(payment.interval_unit || :month)))\n end\n end",
"def next_due_at(now = Time.zone.now)\n # The next billing date is always the original date if \"now\" is earlier than the original date\n return created_at if now <= created_at\n\n number_of_cycles = number_of_cycles_since_created(now)\n next_due_at = calculate_due_at(number_of_cycles)\n\n # The number of cycles since the billing cycle was created only gets us to \"now\"\n # so we need probably need to add another cycle to get the next billing date.\n while next_due_at < now\n number_of_cycles += interval_value\n next_due_at = calculate_due_at(number_of_cycles)\n end\n\n next_due_at\n end",
"def next_billing_date\n paypal_recurring_details[:next_billing_date]\n end",
"def too_soon_to_renew?\n due_date_after_renewal <= due_date\n end",
"def overdue?\n next_payment_at && next_payment_at.to_date < Date.today\n end",
"def refresh_billing_date\n new_next_billing_date = nil\n begin\n bt_sub = Braintree::Subscription.find(self.subscription_id)\n new_next_billing_date = bt_sub.next_billing_date\n rescue Braintree::ServerError,\n Braintree::SSLCertificateError,\n Braintree::UnexpectedError,\n Braintree::NotFoundError => e\n logger.warn \"#{__FILE__}:#{__LINE__} Error fetching new Subscription billing date from Braintree.\n Won't update next_billing_date. : #{e}\"\n end\n if new_next_billing_date.present?\n parsed_date = DateTime.parse(new_next_billing_date)\n self.next_billing_date = new_next_billing_date\n self.billing_active = self.next_billing_date.present? && self.next_billing_date > DateTime.now\n else\n return false\n end\n end",
"def add_due\n \t\t# if !self.company.plan.custom\n \t\t# \tcompany = self.company\n \t\t# \tday_number = DateTime.now.day\n # \t\tmonth_number = DateTime.now.month\n # \t\tmonth_days = DateTime.now.days_in_month\n \t\t# \tcompany.due_amount += (((month_days - day_number + 1).to_f / month_days.to_f) * company.company_plan_setting.base_price * company.computed_multiplier).round(2)\n \t\t# \tcompany.save\n \t\t# end\n \tend",
"def payment_deadline\n return self.charges.pluck(:created_at).last + 60*60*24*7\n end",
"def due_later?\n @due_date > Date.today\n end",
"def waiting_date (last_promo_item, plan)\n num = ((last_promo_item.validez - last_promo_item.created_at)/60/60/24).round\n case num\n when 7\n if (plan == 'plus')\n last_promo_item.validez + 3.days\n elsif (plan == 'basic')\n last_promo_item.validez + 10.days\n end\n when 3\n if (plan == 'plus')\n last_promo_item.validez + 2.days\n elsif (plan == 'basic')\n last_promo_item.validez + 5.days\n end\n when 1\n if (plan == 'plus')\n last_promo_item.validez + 1.days\n elsif (plan == 'basic')\n last_promo_item.validez + 2.days\n end\n else\n #Error -> Promo lasted and unselectable number of days\n end\n\n end",
"def next_payment_due_on\n return second_payment_is_due_on unless second_payment_is_paid?\n return security_deposit_is_due_on unless security_deposit_is_paid?\n nil\n end",
"def last_payment_due_on\n entry = workshop_price.specific_payment_schedule(initial_payments_should_start_on, Date.today)\n entry ? entry[:due_on] : initial_payments_should_start_on.to_date\n end",
"def next_invoice_date\n self.invoices.length > 0 ? self.invoices.order(:id).last.issue_date + period.send(period_type) : starting_date\n end",
"def expire!\n successor = BillingPeriod.create! booking: booking,\n start_date: start_of_next_period\n successor.delay.charge!\n end",
"def in_renewal_span?\n (0..7).include?(end_date.to_date - Time.zone.now.to_date)\n end",
"def paid_until\n last_payment&.end_date\n end",
"def substract_due\n \t\t# if !self.company.plan.custom\n \t\t# \tcompany = self.company\n \t\t# \tday_number = DateTime.now.day\n # \t\tmonth_number = DateTime.now.month\n # \t\tmonth_days = DateTime.now.days_in_month\n \t\t# \tcompany.due_amount -= (((month_days - day_number + 1).to_f / month_days.to_f) * company.company_plan_setting.base_price * (company.computed_multiplier + company.company_plan_setting.locations_multiplier)).round(2)\n \t\t# \tcompany.save\n \t\t# end\n \tend",
"def due_date\n if @lease.grace_period.present? && @lease.grace_period >= 0\n @date + @lease.grace_period.day\n else\n @date\n end\n end",
"def service_billing_period\n (self.service_period_start_on..self.service_period_end_on)\n end",
"def target_response_time\n now = Time.now\n if Time.before_business_hours?(now)\n next_business_day = now.midnight\n else\n next_business_day = 1.business_day.after(now).midnight\n end\n due_date = 5.business_hour.after(next_business_day)\n end",
"def change_next_bill_date(next_bill_date, current_agent = nil, concept = \"\")\n if not is_billing_expected?\n errors = { member: 'is not expected to get billed.' }\n answer = { message: I18n.t('error_messages.not_expecting_billing'), code: Settings.error_codes.user_not_expecting_billing, errors: errors }\n elsif not self.can_change_next_bill_date?\n errors = { member: 'is not in billable status' }\n answer = { message: I18n.t('error_messages.unable_to_perform_due_user_status'), code: Settings.error_codes.next_bill_date_blank, errors: errors }\n elsif next_bill_date.blank?\n errors = { next_bill_date: 'is blank' }\n answer = { message: I18n.t('error_messages.next_bill_date_blank'), code: Settings.error_codes.next_bill_date_blank, errors: errors }\n elsif next_bill_date.to_date < Time.zone.now.in_time_zone(self.club.time_zone).to_date\n errors = { next_bill_date: 'Is prior to actual date' }\n answer = { message: \"Next bill date should be older that actual date.\", code: Settings.error_codes.next_bill_date_prior_actual_date, errors: errors }\n elsif self.valid? and not self.active_credit_card.expired?\n next_bill_date = next_bill_date.to_datetime.change(offset: self.get_offset_related(next_bill_date.to_date))\n self.next_retry_bill_date = next_bill_date\n self.bill_date = next_bill_date\n self.recycled_times = 0\n self.save(validate: false)\n message = \"Next bill date changed to #{next_bill_date.to_date} #{concept.to_s}\"\n Auditory.audit(current_agent, self, message, self, Settings.operation_types.change_next_bill_date)\n answer = {message: message, code: Settings.error_codes.success }\n else\n errors = self.errors.to_hash\n errors = errors.merge!({credit_card: \"is expired\"}) if self.active_credit_card.expired?\n answer = { errors: errors, code: Settings.error_codes.user_data_invalid }\n end\n answer\n rescue ArgumentError => e\n return { message: \"Next bill date wrong format.\", errors: { next_bill_date: \"invalid date\"}, code: Settings.error_codes.wrong_data } \n rescue Exception => e\n Auditory.report_issue(\"User:change_next_bill_date\", e, { user: self.id })\n return { message: I18n.t('error_messages.airbrake_error_message'), code: Settings.error_codes.could_not_change_next_bill_date }\n end",
"def end_of_commitment\n user.invoices.with_state(:open).last.next_payment_at.advance(months: commitment_period - 1)\n end",
"def calculate_next_delivery\n interval = @schedulable.repeat_every\n next_delivery_date =\n case\n when @schedulable.company_survey.counter == 0 || @schedulable.time.present?\n set_next_delivery\n when @schedulable.repeat_mode == 'd'\n @schedulable.next_delivery_at + interval.days\n when @schedulable.repeat_mode == 'w'\n @schedulable.next_delivery_at + interval.weeks\n end\n\n @schedulable.update_column(:next_delivery_at, next_delivery_date)\n next_delivery_date\n end",
"def overdue?\n due < Date.current\n end",
"def past_due\n stripe_status == 'past_due'\n end",
"def expires_on\n case self.current_state\n when :active then (self.last_renewal_on.to_time + self.length_in_issues.months).to_date\n end\n end",
"def plan_expiry\n @trial_days = TrialDay.first\n @plan_expiry = (current_user.created_at + @trial_days.days.days)\n @current_date = (Time.zone.now)\n @remaining_days = (@plan_expiry - @current_date).to_i / 1.day \n end",
"def new_recurring_product_subscription_start_on\n # if currrent_end_date = self.last_active_recurring_product_subscription_term_period_end_on\n if current_order = last_active_recurring_order\n current_order.service_period_end_on + 1.day\n else\n Date.today\n end\n end",
"def deal_with_payment\n if human_amount_due <= 0\n update_attributes!(active: false)\n lease.mark_next_active_from_date(self.due_date)\n else\n true\n end\n end",
"def future_expense_checker (record)\n\t\tdate = record.date_paid\n \ttime = date.to_time\n \ttime.future?\n end",
"def next_available_delivery_date\n now = Time.zone.now\n next_available_date = next_available(now)\n\n if(!Config.processing_cut_off_enabled? || (processing_cut_off.nil? || now < now.change(hour: processing_cut_off.hour, min: processing_cut_off.min)))\n return next_available_date\n end\n\n next_available(next_available_date)\n end",
"def previous_due_at(now = Time.zone.now)\n # There was no previous billing date before the original billing date\n return nil if now <= created_at\n\n number_of_cycles = number_of_cycles_since_created(now) + interval_value\n previous_due_at = calculate_due_at(number_of_cycles)\n\n # The number of cycles since the billing cycle was created gets us to \"now\",\n # and if now matches a billing date exactly, we want the previous billing date.\n while previous_due_at >= now\n number_of_cycles -= interval_value\n previous_due_at = calculate_due_at(number_of_cycles)\n end\n\n previous_due_at\n end",
"def next_anniversary_date\n while (@due_date <= Date.today)\n @due_date = Date.new(@year += 1, @month, @day)\n end\n end",
"def remaining_days\n self.paid_through - Date.today\n end",
"def billing_period\n # TODO: ugly oneliner\n @billing_period ||= @options[:billing_period].presence || period(Event::START_TIME_EVENTS.include?(@event.name) ? @event.started_at : @event.finished_at)\n end",
"def next_date\n next_observance.try(:start_on) || 100.years.from_now.to_date\n end",
"def paid?\n unless self.last_paid_at.blank?\n return Time.now - 365.days < self.last_paid_at\n else\n return false\n end\n end",
"def overdue? ()\n\t\t@due_date < Time.now\n end",
"def is_due?\n self.datetime.past?\n end",
"def first_billing_at\n time = Time.now\n time = time.advance(:days => trial_period) if trial_period?\n return time\n end",
"def overdue?\n @due_date < Date.today\n end",
"def due_date\n created_at + Spree::BilletConfig.due_date.days\n end",
"def suspended?\n next_payment_at \\\n && (next_payment_at + UserSystem.account_grace_period).to_date < Date.today\n end",
"def estimated_end_date\n Date.today + remaining_days\n end",
"def last_scheduled_payment_date(from_date)\n payment_schedule(from_date).last[:due_on]\n end",
"def next_available_move_in_date\n \tbookings = self.bookings.where(state: ['booked', 'deposit outstanding']).order(:move_out)\n \t# if self.bookable_date && self.bookable_date <= Date.today\n return nil if bookings.last&.state == 'deposit outstanding'\n if bookings.empty? || bookings.last.move_out&.past?\n Date.tomorrow\n elsif !bookings.last.move_out.nil?\n bookings.last.move_out + 1.day\n end\n end",
"def in_billing_retry_period?\n is_in_billing_retry_period == 1\n end",
"def check_out(due_date)\n\n if @due_date == nil\n @due_date = 0\n end\n\n @due_date += 7\n\n end",
"def paid_days_remaining\n days_elapsed = (Time.now.to_i - self.trial_started_at.to_i) / 60 / 60 / 24\n remaining = 365 - days_elapsed\n remaining = 0 if remaining < 0\n remaining\n end",
"def due_date\n self.created_at.to_date + 7\n end",
"def due?\n cron_parser && (@next_run < Time.now)\n end",
"def\n check_out(due_date)\n\n if @due_date == nil\n @due_date = 0\n end\n\n @due_date += 7\n\n end",
"def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end",
"def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end",
"def current_period_end_date\n next_period = current_period_start_date + PERIODICITY\n if (Date.today.month == 1 && start_at.day >= 29) || start_at.day == 31\n # In january, the next month will be February: special rule\n next_period.end_of_month - 1.day\n else\n Date.new(next_period.year, next_period.month, start_at.day) - 1.day\n end\n end",
"def due?\n return true if @payment_due.to_f > 0\n false\n end",
"def pro_rata_end_date\n (subscription_start_date - 1.day).to_date # unless subscription_start_date.blank?\n end",
"def due_by\n #occurring_days = ae_definition.occurring_days\n dob = profile.kids_type.birthdate.to_date\n dob + (ae_definition.occurring_days + ae_definition.due_by_days )\n end",
"def overdue?\r\n @overdue = Time.now > @due_date\r\n end",
"def set_last_as_unpaid\n active_period = self.find_active_period\n old_period = self.periods[-2]\n old_period.used += active_period.used\n self.total_used += self.active_used\n active_period.destroy && old_period.save && self.save\n end",
"def next_delivery_date\n self.release_dates.first.delivery_date\n end",
"def overdue?\n Date.today > to_date\n end",
"def time_over?\r\n return self.due_date <= Time.now\r\n end",
"def add_on_minimal_charge? invoice_period_end\n minimal_charge_enabled? and minimal_charge_start_at and minimal_charge_start_at < invoice_period_end #Time.parse('2001-01-01 00:00:00') < invoice_period_end#Date.parse(minimal_charge_start_at) < invoice_period_end\n end",
"def past_due?\n self.updated_at.to_date > self.due_date\n end",
"def due_today?\n due_date == Date.due_today\n end",
"def end_date\n\t\tself.next.start_date - 1\n\tend",
"def days_remaining\n enrollment.days_to_due_date - 1\n end",
"def overdue\n @date > Date.today\n end",
"def past_end_date\n past_end_date = Time.zone.today - 1.day\n past_end_date < charge_start_date ? charge_start_date : past_end_date\n end",
"def past?\n due_on < Date.today\n end",
"def bill_for(period, invoice, plan = self.plan)\n # TODO: this makes the bill_for method dependent on Time.zone.now\n # so it should be handled differently\n #\n return false if trial?\n\n transaction do\n if paid_until.to_date < period.end.to_date\n\n period = intersect_with_unpaid_period(period, paid_until)\n\n bill_fixed_fee_for(period, invoice, plan)\n\n self.paid_until = period.end\n end\n\n bill_setup_fee_for(period, invoice, plan)\n\n # no validation because our DB has broken data\n # TODO: cleanup DB and add validations?\n self.save(:validate => false) if invoice.used?\n\n return invoice.used?\n end\n end",
"def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end",
"def time_before_next_payment\n delay = payment_frequency[:days]\n withdrawls = sort_operations_desc\n # next_payment_date = operations.last.date + delay.days\n next_payment_date = withdrawls.first.date + delay.days\n distance_of_time_in_words(Date.today, next_payment_date)\n end",
"def overdue?\n return false if due_at.nil?\n due_at < Time.now \n end",
"def next_scheduled_at\n reviewed_at + (24.hours * next_interval)\n end",
"def expired?\n overdue_days > 0\n end",
"def next_scheduled_use_date\n next_date = nil\n\n open_orders.each do |o|\n if o.access_date_start\n next_date ||= o.access_date_start\n if o.access_date_start < next_date\n next_date = o.access_date_start\n end\n end\n end\n next_date\n end",
"def charge\r\n if paypal?\r\n if (@response = paypal.get_profile_details(billing_id)).success?\r\n next_billing_date = Time.parse(@response.params['next_billing_date'])\r\n if next_billing_date > Time.now.utc\r\n update_attributes(:next_renewal_at => next_billing_date, :state => 'active')\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount) unless amount == 0\r\n true\r\n else\r\n false\r\n end\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n else\r\n if amount == 0 || (@response = gateway.purchase(amount_in_pennies, billing_id)).success?\r\n update_attributes(:next_renewal_at => self.next_renewal_at.advance(:months => self.renewal_period), :state => 'active')\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount, :transaction_id => @response.authorization) unless amount == 0\r\n true\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n end\r\n end",
"def pay_remaining_amount_chronogically!\n # Add negative (payback) invoice to remaining_amount\n @remaining_amount += -invoices.where('amount < 0').sum(:amount)\n\n last_invoice = invoices.last\n invoices.each do |invoice|\n if invoice == last_invoice\n invoice.increment!(:paid_amount, @remaining_amount)\n elsif invoice.missing_amount.positive?\n paid_amount = [@remaining_amount, invoice.missing_amount].min\n invoice.increment!(:paid_amount, paid_amount)\n @remaining_amount -= paid_amount\n end\n invoice.reload.close_or_open!\n end\n end",
"def is_expired?\n self.end_date < DateTime.now\n end",
"def remaining_value(plan = self.subscription_plan)\n self.daily_rate(:plan => plan) * remaining_days\n end",
"def due_today?\n @due_date == Date.today\n end",
"def is_in_billing_retry_period # rubocop:disable Naming/PredicateName\n read_integer('is_in_billing_retry_period')\n end",
"def incomplete_payment?\n past_due || incomplete\n end",
"def get_postponement_date(options)\n subscription_date = options.fetch(:subscription_date)\n first_renewal_date = options.fetch(:first_renewal_date)\n merchant_cutoff_day = options.fetch(:merchant_cutoff_day)\n max_delay = options.fetch(:max_delay)\n is_shippable = options.fetch(:is_shippable)\n\n return nil unless is_shippable\n\n first_mcd = get_first_merchant_cutoff_date(subscription_date, merchant_cutoff_day)\n postponement_end = first_mcd + max_delay\n\n (first_mcd..postponement_end).include_with_range?(first_renewal_date) ? postponement_end + 1.day : nil\n end",
"def notification_due?\n notification_due = false\n if hw_coverage_end_date.present?\n planned_notification_dates.each do |planned_notice|\n if in_the_past(planned_notice) and last_notice_before(planned_notice)\n notification_due = true\n break\n end\n end\n end\n notification_due\n end",
"def notification_due?\n notification_due = false\n if hw_coverage_end_date.present?\n planned_notification_dates.each do |planned_notice|\n if in_the_past(planned_notice) and last_notice_before(planned_notice)\n notification_due = true\n break\n end\n end\n end\n notification_due\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 last_active_recurring_product_subscription_term_period_end_on\n if order = self.last_active_recurring_order\n order.created_at.to_date + last_active_recurring_product_subscription.term_in_days\n end\n end",
"def future_expense_checker (record)\n\t\tdate = record.date_incurred\n \ttime = date.to_time\n \ttime.future?\n end",
"def estimated_end_date\n start_date + 12.days\n end",
"def next_due_date\n del = self.deliverables\n return nil unless del.size > 0\n\n dates = del.collect(&:due).delete_if { |d| d.blank?}\n \n return dates.sort[0]\n end",
"def expires_on\n self.expires_on = Date.strptime(expiration_date,'%m/%Y')+1.month\n end",
"def payment_expiry_time\n payment = self.payments.where(status: :failed).order(:paid_at).first\n unless payment.nil?\n return payment.paid_at + PAYMENT_EXPIRY_DAYS.days\n end\n nil\n end",
"def payment_owed\n if workshop_price&.recurring_payments?\n to_pay = recurring_what_should_be_paid_by_now - amount_paid\n to_pay.negative? ? Money.new(0, workshop_price.price.currency) : to_pay\n else\n balance_owed\n end\n end",
"def start_recurring_payment\n return unless recurring_period.present?\n run_at = nil\n if recurring_period.to_s.is_i? # each custom days\n run_at = recurring_period.to_i.days.from_now\n # run_at = recurring_period.to_i.minutes.from_now\n else\n case recurring_period\n when 'daily'\n run_at = 1.day.from_now\n when 'weekly'\n run_at = 7.days.from_now\n when 'monthly'\n run_at = 1.month.from_now\n when 'quarterly'\n run_at = 3.months.from_now\n when 'biannually'\n run_at = 6.months.from_now\n when 'yearly'\n run_at = 1.year.from_now\n end\n end\n Delayed::Job.enqueue(LongTasks::RecurringPaymentNotification.new(id), run_at: run_at - 1.day) if run_at && ['tithe', 'partnership'].include?(goal)\n Delayed::Job.enqueue(LongTasks::RecurringPayment.new(id), run_at: run_at) if run_at\n end",
"def membership_past_grace_period_end?(this_date = Date.current)\n memberships_manager.date_after_grace_period_end?(self, this_date)\n end",
"def overdue_days\n (Time.now.utc.to_date - expires_at.to_date).to_i\n end",
"def remaining_days_of_grace\n self.expire_on - Date.today - 1\n end"
] |
[
"0.76777565",
"0.74972445",
"0.7120942",
"0.70368123",
"0.70172274",
"0.6989992",
"0.69674504",
"0.69435805",
"0.69261986",
"0.69202167",
"0.68964934",
"0.6803151",
"0.6741143",
"0.6684632",
"0.66652316",
"0.6659329",
"0.66487676",
"0.66462344",
"0.6642693",
"0.6580261",
"0.6525783",
"0.6524887",
"0.65068424",
"0.64888966",
"0.64615107",
"0.645499",
"0.64357376",
"0.64314705",
"0.6428073",
"0.64255774",
"0.6389947",
"0.6386688",
"0.63765836",
"0.6365822",
"0.634907",
"0.63449204",
"0.63015455",
"0.6295112",
"0.62844557",
"0.628085",
"0.6275111",
"0.6260489",
"0.62270796",
"0.62246174",
"0.6214321",
"0.6211093",
"0.62075526",
"0.61841387",
"0.6173668",
"0.61693954",
"0.61603373",
"0.6156048",
"0.61510605",
"0.61510605",
"0.61204964",
"0.6103292",
"0.6080201",
"0.6078116",
"0.6056394",
"0.60511744",
"0.6049819",
"0.6041293",
"0.60398793",
"0.603343",
"0.60118186",
"0.6010515",
"0.6009627",
"0.60091907",
"0.6005449",
"0.60047084",
"0.59925383",
"0.5991367",
"0.5987836",
"0.5981033",
"0.5980456",
"0.5977564",
"0.5950289",
"0.5949732",
"0.59462327",
"0.59254754",
"0.59240675",
"0.5922467",
"0.59118956",
"0.59117275",
"0.5907986",
"0.58951163",
"0.5894502",
"0.5894502",
"0.5875804",
"0.58665353",
"0.5864621",
"0.58545583",
"0.58544004",
"0.58447915",
"0.5828578",
"0.5827008",
"0.5820569",
"0.5816941",
"0.580689",
"0.58062387"
] |
0.743061
|
2
|
e.g. Feb 26..Mar 25
|
def service_billing_period
(self.service_period_start_on..self.service_period_end_on)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def month() end",
"def month; end",
"def month; end",
"def date_move_formatter\n '%Y-%m'\n end",
"def month_names; end",
"def format_dates\n days = (1..@number_of_days_in_month).to_a\n days.map! do |d|\n d < 10 ? \" \" + d.to_s : d.to_s\n end\n # adds blank elements to the beginning of the days array to offset the\n # first day of the month\n @first_day_of_month.times do\n blankday = \" \"\n days.unshift(blankday)\n end\n days\n end",
"def translated_month_names; end",
"def months() 30 * days end",
"def month_name(number); end",
"def spelled_out_for_date(date)\n %w[%B %b].map { |month| date.strftime(\"#{month} %Y\") }\n end",
"def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end",
"def publish_month_and_year\n [publish_on.month, publish_on.year]\n end",
"def date_reformatting(date)\n #date.split('/')..join(',')\n Date.parse.(date).strftime'[%m, %d, %Y]'\nend",
"def date_page_format\n '%B %d, %Y'\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def each_april( n=1); each_monthnum(self.Apr,n); end",
"def format_table_date_range(date)\n date.strftime('%Y%m*')\n end",
"def format_start_end_date(s_date, e_date)\n # Format the dates based on month and year.\n if (s_date.mon == e_date.mon) && (s_date.year == e_date.year)\n date = s_date.strftime(\"%b %d-\").to_s + e_date.strftime(\"%d, %Y\").to_s\n elsif s_date.year == e_date.year\n date = s_date.strftime(\"%b %d - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n else\n date = s_date.strftime(\"%b %d, %Y - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n end\n date\n end",
"def friendly_date_range\n sessions.first.start.month == sessions.last.start.month ?\n \"#{sessions.first.start.strftime('%B %-d')}-#{sessions.last.start.strftime('%-d, %Y')}\" :\n \"#{sessions.first.start.strftime('%B %-d')} - #{sessions.last.start.strftime('%B %-d, %Y')}\"\n end",
"def month\n end",
"def month_depot\n \"#{depot.name} \"+\"#{issue_date.strftime(\"%b\")} \"+\"#{issue_date.year}\"\n end",
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def pub_date_facet\n return nil unless pub_date\n return \"#{pub_date.to_i + 1000} B.C.\" if pub_date.start_with?('-')\n return pub_date unless pub_date.include? '--'\n\n \"#{pub_date[0, 2].to_i + 1}th century\"\n end",
"def January ; Date::MONTHNAMES.index(\"January\"); end",
"def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend",
"def each_february( n=1); each_monthnum(self.Feb,n); end",
"def months ; self * 30.days ; end",
"def month=(_arg0); end",
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def months_in_year\n 12\nend",
"def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj.is_a? DateTime\n\n if [*3..7].include? date_obj.month # months 3,4,5,6,7 are written as is in AP\n date_obj.strftime('%B %-d, %Y')\n elsif date_obj.month == 9 # Sept. is special\n date_obj.strftime('%bt. %-d, %Y')\n else # 3 letter abbr with .\n date_obj.strftime('%b. %-d, %Y')\n end\nend",
"def each_may( n=1); each_monthnum(self.May,n); end",
"def date_labels\n if @count < 90\n dates.collect { |date| date.to_date.strftime('%d') == Time.now.strftime('%a') ? date.to_date.strftime('%b %e') : '' }\n else\n dates.collect { |date| date.to_date.strftime('%d') == '01' ? date.to_date.strftime('%b %e') : '' }\n end\n end",
"def months_list\n\t (Date.today-1.year..Date.today).map{|d| [d.strftime(\"%b-%Y\"), d.strftime(\"%m-%Y\")]}.uniq.reverse\n\tend",
"def number_to_short_month_name(a)\n return number_to_full_month_name(a).slice(0,3)\nend",
"def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end",
"def month\n start_date&.strftime('%b %Y')\n end",
"def monthly\n end",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def month\n self.founded.strftime(\"%B\")\n end",
"def humanize_date_range(d1,d2,separator=\" - \")\n d2,d1 = d1,d2 if d1 > d2\n return d1.to_time.to_formatted_s(:month_day_year) if (d1 == d2)\n return \"#{d1.to_formatted_s(:month_day_year)}#{separator}#{d2.to_formatted_s(:month_day_year)}\" if d1.year != d2.year\n # same year\n if d1.month == d2.month\n \"#{d1.strftime('%b')} #{d1.mday}#{separator}#{d2.mday}, #{d1.year}\"\n else\n \"#{d1.strftime('%b %e')}#{separator}#{d2.strftime('%b %e')}, #{d1.year}\"\n end\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 month_labels\n dates.collect { |date| date.to_date.day == 1 ? date.to_date.strftime('%B') : '' }\n end",
"def month\n @month.to_s.rjust(2, '0')\n end",
"def each_june( n=1); each_monthnum(self.Jun,n); end",
"def ordinalize(date)\n date = datetime(date)\n d = \"<span class='date-month'>#{date.strftime('%b')}</span> \"\n d = \"<span class='date-day'>#{date.strftime('%e')}</span> \"\n d += \"<span class='date-suffix'>#{ordinal_suffix(date)}</span>, \"\n d += \"<span class='date-year'>#{date.strftime('%Y')}</span>\"\n end",
"def format_date(number)\n if number == 1\n dates = @start_date.strftime(\"%D\") if @start_date\n dates << \" -- \" + @end_date.strftime(\"%D\") if @end_date\n dates = \"N/A\" if !dates\n return dates\n else\n @due ? @due.strftime(\"%D\") : \"No due date\"\n end\n end",
"def month_name\n report_date.strftime(\"%B\")\n end",
"def formatted_date( date )\n date.strftime( \"%Y-%b-%d\" ) + \" \" + date.strftime( \"%A\" ).slice( 0..2 ) unless date == nil\n end",
"def calendar_month_header date\n \"#{I18n.translate('date.month_names')[date.month]} #{date.year}\"\n end",
"def month\n self.range('month')\n end",
"def number_to_substring_month(number)\n case number\n when 1\n return \"Jan\"\n when 4\n return \"Apr\"\n when 9\n return \"Sep\"\n when 10\n return \"Oct\"\n end\nend",
"def date_reformatting(date)\n month = [[\"January\", 1], [\"February\", 2], [\"March\", 3], [\"April\", 4], [\"May\", 5], [\"December\", 12], [\"Dec\", 12]]\n data = date.split(\" \")\n if data.length == 1\n data = data[0].split(\"-\")\n end\n if data.length == 1\n data = data[0].split(\".\")\n end\n if data.length == 1\n data = data[0].split(\"/\")\n end\n \n send_back = []\n\n month.each do |moth|\n if moth[0] = data[0]\n send_back[0] = moth[1].to_i\n end\n end\n\n send_back[1] = data[1].tr(\",\", \" \").to_i\n send_back[2] = data[2].to_i\n\n return send_back\nend",
"def each_july( n=1); each_monthnum(self.Jul,n); end",
"def each_march( n=1); each_monthnum(self.Mar,n); end",
"def ymd_header\n (@report.start_date.to_date..@report.end_date.to_date).to_a\n end",
"def ymd_header\n (@report.start_date.to_date..@report.end_date.to_date).to_a\n end",
"def form_date\n \"#{date.month}/#{date.day}/#{date.year - 2000}\"\n end",
"def date\n \"#{day} #{month.capitalize} #{year}\"\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 dates\n \t\"(#{years})\".sub(\"()\",\"\")\n end",
"def format_month_body\n d = ((first_day + 5) % 7) + 1\n if d == 7\n d = 0\n end\n padding = Array.new(d, nil)\n updated_list = (padding + get_number_of_month).each_slice(7).to_a\n updated_list.each do |a|\n if a.length < 7\n (7 - a.length).times {a << nil}\n end\n end\n (6 - updated_list.length).times {updated_list << Array.new(7, nil)}\n updated_list\n end",
"def unusual_day_2(num)\n if page.has_no_text?('29', count: 2)\n february(num)\n else\n not_february(num)\n end\nend",
"def split_date\n\t self.date.to_s.split(\" \").first\n\tend",
"def all_month\n beginning_of_month..end_of_month\n end",
"def year_month(date, fmt=\"yyyy mmm\")\n return nil unless date\n yyyy = date.year.to_s\n mmm = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[date.month-1]\n case fmt\n when \"mmm-yy\" then \"%s-%s\" % [mmm, yyyy[2, 2]]\n when \"mmm yyyy\" then \"%s %s\" % [mmm, yyyy]\n else \"%s %s\" % [yyyy, mmm]\n end\n end",
"def month\n start_on.strftime(MONTH_NAME)\n end",
"def rsmonth(month)\n case month\n when 1\n return 'januar'\n when 2\n return 'februar'\n when 3\n return 'mart'\n when 4\n return 'april'\n when 5\n return 'maj'\n when 6\n return 'jun'\n when 7\n return 'jul'\n when 8\n return 'avgust'\n when 9\n return 'septembar'\n when 10\n return 'oktobar'\n when 11\n return 'novembar'\n when 12\n return 'decembar'\n end\nend",
"def validate_feb\n errors.add( \"day\", \"day is greater than 29!!!\" ) if day > 29 and month == 2\n end",
"def publication_date\n the_date = nil\n return the_date if @pubmed['DP'].blank?\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9] [a-zA-Z]+)-([0-9][0-9][0-9][0-9] [a-zA-Z]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.split(\"-\")[1]\n end\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.gsub(/([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i, '\\1 \\3')\n end\n pubdate=@pubmed['DP'].strip.split(\" \")\n year_range = pubdate[0].split(\"-\")\n if year_range.length > 1\n pubdate[0] = year_range[1]\n end\n if pubdate.length > 1\n month_range = pubdate[1].split(\"-\")\n if month_range.length > 1\n pubdate[1] = month_range[1]\n end\n pubdate[1] = case pubdate[1] \n when /spring/i then 'Mar'\n when /summer/i then 'Jun'\n when /fall|autumn/i then 'Sep'\n when /winter/i then 'Dec'\n else pubdate[1]\n end\n end\n if pubdate.length > 2\n day_range = pubdate[2].split(\"-\")\n if day_range.length > 1\n pubdate[2] = day_range[1]\n end\n the_date = pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n the_date = '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n the_date = '01-JAN-'+ pubdate[0]\n end\n return the_date\n end",
"def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end",
"def report_period_to_title\n case self\n when 'this_month'\n 'Days'\n when 'last_month'\n 'Days'\n when 'last_6_months'\n 'Months'\n when 'this_year'\n 'Months'\n end\n end",
"def to_s; \"%d-%02d\" % [@years, @months.abs] end",
"def each_august( n=1); each_monthnum(self.Aug,n); end",
"def show_date month_of_year, day_of_week\n month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n day = dom\n return month[month_of_year-1] + day[day_of_week].to_s\nend",
"def amy_kids_ages\n [ Time.now.year - 1996, Time.now.year - 1985].join(' to ')\n end",
"def inspect\n \"the day of the month is the \" + ordinal_list(@parts)\n end",
"def each_september(n=1); each_monthnum(self.Sep,n); end",
"def expiration_date\n \"#{expiration_month.to_s.rjust(2, '0')} / #{expiration_year}\"\n end",
"def linkedin_date(month)\n \tcase month\n \t\twhen 1\n \t\t\tmonth = \"January\"\n \t\twhen 2\n \t\t\tmonth = \"February\"\n \t\twhen 3\n \t\t\tmonth = \"March\"\n \t\twhen 4\n \t\t\tmonth = \"April\"\n \t\twhen 5\n \t\t\tmonth = \"May\"\n \t\twhen 6\n \t\t\tmonth = \"June\"\n \t\twhen 7\n \t\t\tmonth = \"July\"\n \t\twhen 8\n \t\t\tmonth = \"August\"\n \t\twhen 9\n \t\t\tmonth = \"September\"\n \t\twhen 10\n \t\t\tmonth = \"October\"\n \t\twhen 11\n \t\t\tmonth = \"November\"\n \t\twhen 12\n \t\t\tmonth = \"December\"\n \t\telse\n \t\t\tmonth = \"\"\n \tend\n \treturn month\n end",
"def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end",
"def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end",
"def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end",
"def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end",
"def date_to_html_string(date)\n result = '<span class=\"month\">' + date.strftime('%b').upcase + '</span> '\n result += date.strftime('<span class=\"day\">%d</span> ')\n result += date.strftime('<span class=\"year\">%Y</span> ')\n result\n end",
"def number_to_short_month_name(n)\n short_month_string = number_to_full_month_name(n)[0..2]\nend",
"def get_date_strings(num)\n\t\ti = 1\n\t\tdate_strings_array = []\n\t\twhile (i <= num)\n\t\t\tdate = Date.today\n\t\t\tnew_date = date - i\n\t\t\tformatted_date = new_date.strftime(\"%Y-%m-%d\")\n\t\t\tdate_strings_array << formatted_date\n\t\t\ti += 1\n\t\tend \n\t\treturn date_strings_array\n\tend",
"def format_date(date)\n return date unless !!date.match(/[\\-]+/)\n date.split(/\\-/).reverse.join(\".\")\nend",
"def format_month_body(m)\n d = ((first_day(m) + 5) % 7) + 1\n if d == 7\n d = 0\n end\n padding = Array.new(d, nil)\n updated_list = (padding + get_number_of_month(m)).each_slice(7).to_a\n updated_list.each do |a|\n if a.length < 7\n (7 - a.length).times do\n a << nil\n end\n end\n end\n (6 - updated_list.length).times do\n updated_list << Array.new(7, nil)\n end\n updated_list\n end",
"def month(date)\n [MONTHS[date.month - 1], year(date)].join(', ')\n end",
"def months\n\t\treturn self * 30.days\n\tend",
"def months\n\t\treturn self * 30.days\n\tend",
"def adjust_month(m)\n months = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\"]\n if m.is_a? Integer\n months[m-1]\n else\n m\n end\n end",
"def display_day_published\r\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\r\n end",
"def day_of_month_format(string)\n \tif string =~ /(\\d+)(st|nd|rd|th)?\\sof the month at (.*)/\n \t\tday = $1\n \t\ttimes = parse_times($3)\n \tend\n end",
"def wrong_date(num)\n first_day(num).text\nend",
"def published_natural\n @published.strftime(\"#{@published.day.ordinalize} %B %Y\")\n end",
"def day_of_month\n start_on.day.to_s\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 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 expected_note_long_date_format(date)\n format = (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d %l:%M%P') : date.strftime('%b %-d, %Y %l:%M%P')\n format.gsub(/\\s+/, ' ')\n end"
] |
[
"0.6506498",
"0.63980573",
"0.63980573",
"0.63571674",
"0.63478774",
"0.62980247",
"0.62038165",
"0.620357",
"0.6190526",
"0.6187881",
"0.61655635",
"0.61190826",
"0.61137676",
"0.6086431",
"0.6058293",
"0.601613",
"0.59755987",
"0.5934948",
"0.5931032",
"0.59181046",
"0.5911102",
"0.59110403",
"0.5906078",
"0.58883065",
"0.58791983",
"0.5876565",
"0.5874581",
"0.58680314",
"0.5861413",
"0.58600134",
"0.5849274",
"0.5820452",
"0.581932",
"0.58182263",
"0.58056325",
"0.5791732",
"0.57618594",
"0.5760109",
"0.57547843",
"0.57544595",
"0.5747309",
"0.57393444",
"0.57387316",
"0.57194597",
"0.5716851",
"0.5715684",
"0.5712158",
"0.5709215",
"0.5709067",
"0.5693795",
"0.5692632",
"0.5677811",
"0.56678915",
"0.56647",
"0.5662232",
"0.5662079",
"0.5662079",
"0.56616217",
"0.5657416",
"0.56570494",
"0.56521714",
"0.5648252",
"0.56403947",
"0.5633278",
"0.5615774",
"0.56098735",
"0.5608445",
"0.5607301",
"0.56037664",
"0.56017774",
"0.5598832",
"0.5594026",
"0.5590334",
"0.558758",
"0.55872136",
"0.5582114",
"0.5576024",
"0.5574032",
"0.5573746",
"0.55710644",
"0.55706805",
"0.55706805",
"0.55706805",
"0.55706805",
"0.55706805",
"0.5552375",
"0.5551358",
"0.5548316",
"0.5545208",
"0.5541716",
"0.5540063",
"0.5540063",
"0.5538015",
"0.5534906",
"0.5531302",
"0.55283564",
"0.5526566",
"0.551821",
"0.55163246",
"0.55163246",
"0.5515255"
] |
0.0
|
-1
|
e.g. Mar 26..Apr 25
|
def next_service_billing_period
if self.purchase_order && self.purchase_order.recurring? && self.purchase_order.pending?
payment = self.purchase_order.payments.recurring.find(:all, :order => "payments.id ASC").last
(self.service_period_end_on + 1.day)..(self.service_period_end_on + (payment.interval_length.to_i.send(payment.interval_unit || :month)))
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end",
"def publish_month_and_year\n [publish_on.month, publish_on.year]\n end",
"def friendly_date_range\n sessions.first.start.month == sessions.last.start.month ?\n \"#{sessions.first.start.strftime('%B %-d')}-#{sessions.last.start.strftime('%-d, %Y')}\" :\n \"#{sessions.first.start.strftime('%B %-d')} - #{sessions.last.start.strftime('%B %-d, %Y')}\"\n end",
"def month() end",
"def format_dates\n days = (1..@number_of_days_in_month).to_a\n days.map! do |d|\n d < 10 ? \" \" + d.to_s : d.to_s\n end\n # adds blank elements to the beginning of the days array to offset the\n # first day of the month\n @first_day_of_month.times do\n blankday = \" \"\n days.unshift(blankday)\n end\n days\n end",
"def month; end",
"def month; end",
"def each_april( n=1); each_monthnum(self.Apr,n); end",
"def month_names; end",
"def months() 30 * days end",
"def all_month\n beginning_of_month..end_of_month\n end",
"def pub_date_facet\n return nil unless pub_date\n return \"#{pub_date.to_i + 1000} B.C.\" if pub_date.start_with?('-')\n return pub_date unless pub_date.include? '--'\n\n \"#{pub_date[0, 2].to_i + 1}th century\"\n end",
"def date_labels\n if @count < 90\n dates.collect { |date| date.to_date.strftime('%d') == Time.now.strftime('%a') ? date.to_date.strftime('%b %e') : '' }\n else\n dates.collect { |date| date.to_date.strftime('%d') == '01' ? date.to_date.strftime('%b %e') : '' }\n end\n end",
"def format_table_date_range(date)\n date.strftime('%Y%m*')\n end",
"def date_move_formatter\n '%Y-%m'\n end",
"def amy_kids_ages\n [ Time.now.year - 1996, Time.now.year - 1985].join(' to ')\n end",
"def each_may( n=1); each_monthnum(self.May,n); end",
"def dates\n \t\"(#{years})\".sub(\"()\",\"\")\n end",
"def get_date_strings(num)\n\t\ti = 1\n\t\tdate_strings_array = []\n\t\twhile (i <= num)\n\t\t\tdate = Date.today\n\t\t\tnew_date = date - i\n\t\t\tformatted_date = new_date.strftime(\"%Y-%m-%d\")\n\t\t\tdate_strings_array << formatted_date\n\t\t\ti += 1\n\t\tend \n\t\treturn date_strings_array\n\tend",
"def months_list\n\t (Date.today-1.year..Date.today).map{|d| [d.strftime(\"%b-%Y\"), d.strftime(\"%m-%Y\")]}.uniq.reverse\n\tend",
"def translated_month_names; end",
"def humanize_date_range(d1,d2,separator=\" - \")\n d2,d1 = d1,d2 if d1 > d2\n return d1.to_time.to_formatted_s(:month_day_year) if (d1 == d2)\n return \"#{d1.to_formatted_s(:month_day_year)}#{separator}#{d2.to_formatted_s(:month_day_year)}\" if d1.year != d2.year\n # same year\n if d1.month == d2.month\n \"#{d1.strftime('%b')} #{d1.mday}#{separator}#{d2.mday}, #{d1.year}\"\n else\n \"#{d1.strftime('%b %e')}#{separator}#{d2.strftime('%b %e')}, #{d1.year}\"\n end\n end",
"def spelled_out_for_date(date)\n %w[%B %b].map { |month| date.strftime(\"#{month} %Y\") }\n end",
"def month_name(number); end",
"def range_of_all_posts\n return @range_of_all_posts if @range_of_all_posts\n p = Post.one_per_month\n @range_of_all_posts = if p.empty?\n \"(No posts)\"\n else\n first = p.first.publish_date\n last = p.last.publish_date\n if first != last\n \"#{first.strftime(\"%B %Y\")} through #{last.strftime(\"%B %Y\")}\"\n else\n \"#{first.strftime(\"%B %Y\")}\"\n end\n end\n end",
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def date_reformatting(date)\n #date.split('/')..join(',')\n Date.parse.(date).strftime'[%m, %d, %Y]'\nend",
"def each_june( n=1); each_monthnum(self.Jun,n); end",
"def all_day\n beginning_of_day..end_of_day\n end",
"def each_august( n=1); each_monthnum(self.Aug,n); end",
"def each_july( n=1); each_monthnum(self.Jul,n); end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def month\n self.range('month')\n end",
"def months_in_year\n 12\nend",
"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 ymd_header\n (@report.start_date.to_date..@report.end_date.to_date).to_a\n end",
"def ymd_header\n (@report.start_date.to_date..@report.end_date.to_date).to_a\n end",
"def date_page_format\n '%B %d, %Y'\n end",
"def January ; Date::MONTHNAMES.index(\"January\"); end",
"def period_helper\n \"#{@sprint_start_date } - #{@sprint_end_date}\"\n end",
"def months ; self * 30.days ; end",
"def format_date(number)\n if number == 1\n dates = @start_date.strftime(\"%D\") if @start_date\n dates << \" -- \" + @end_date.strftime(\"%D\") if @end_date\n dates = \"N/A\" if !dates\n return dates\n else\n @due ? @due.strftime(\"%D\") : \"No due date\"\n end\n end",
"def dates\n start_s = start_date ? start_date.to_s : '?'\n end_s = end_date ? end_date.to_s : '?'\n \"#{start_s} to #{end_s}\"\n end",
"def format_start_end_date(s_date, e_date)\n # Format the dates based on month and year.\n if (s_date.mon == e_date.mon) && (s_date.year == e_date.year)\n date = s_date.strftime(\"%b %d-\").to_s + e_date.strftime(\"%d, %Y\").to_s\n elsif s_date.year == e_date.year\n date = s_date.strftime(\"%b %d - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n else\n date = s_date.strftime(\"%b %d, %Y - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n end\n date\n end",
"def month\n end",
"def advent_days(year:)\n min_day .. max_day(year: year)\n end",
"def each_september(n=1); each_monthnum(self.Sep,n); end",
"def build_cal from, to\n (from..to).map{ |d| [d.month, d.year ] }.uniq.map { |m,y|\n `cal #{m} #{y}`\n }.join(\"\\n\").split(/\\n/)\n end",
"def by_interval\n \"/ #{object.interval == \"month\" ? 'mois' : 'an'}\"\n end",
"def month=(_arg0); end",
"def month_groups(sd,ed)\n\t (sd..ed).map{|d| [Date::MONTHNAMES[d.month], d.year]}.uniq\n\tend",
"def each_february( n=1); each_monthnum(self.Feb,n); end",
"def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj.is_a? DateTime\n\n if [*3..7].include? date_obj.month # months 3,4,5,6,7 are written as is in AP\n date_obj.strftime('%B %-d, %Y')\n elsif date_obj.month == 9 # Sept. is special\n date_obj.strftime('%bt. %-d, %Y')\n else # 3 letter abbr with .\n date_obj.strftime('%b. %-d, %Y')\n end\nend",
"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 pub_date_sort\n if pub_date\n pd = pub_date\n pd = '0' + pd if pd.length == 3\n pd = pd.gsub('--', '00')\n end\n fail \"pub_date_sort was about to return a non 4 digit value #{pd}!\" if pd && pd.length != 4\n\n pd\n end",
"def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend",
"def number_to_short_month_name(a)\n return number_to_full_month_name(a).slice(0,3)\nend",
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def monthly\n end",
"def dates\n end",
"def unusual_day_2(num)\n if page.has_no_text?('29', count: 2)\n february(num)\n else\n not_february(num)\n end\nend",
"def month_and_years\n sorted_pages = get_published_pages.sort_by {|page| page.publish_on}.reverse\n sorted_pages.map {|page| page.publish_month_and_year}.uniq\n end",
"def all_day\n beginning_of_day..end_of_day\n end",
"def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end",
"def to_s\n return last_day if start_date == end_date\n \n format = ELEMENTS\n format = format.chomp(' %Y') if start_date.year == end_date.year\n format = format.chomp(' %b') if start_date.month == end_date.month\n first_day = start_date.strftime(format)\n first_day + ' - ' + last_day\n end",
"def >>(n)\n date_with_offset(n, :month)\n end",
"def date_string\n times = []\n showtimes.all.each do |time|\n times << time.date_time\n end\n times = times.sort\n first_date = times.first.to_date.strftime('%m/%d')\n last_date = times.last.to_date.strftime('%m/%d')\n output = first_date\n if last_date != first_date\n output += \" - \" + last_date\n end\n return output\n end",
"def show_date month_of_year, day_of_week\n month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n day = dom\n return month[month_of_year-1] + day[day_of_week].to_s\nend",
"def descomponer_fechas(fecha)\r\n dia=fecha[0..1].to_s\r\n mes=fecha[3..4].to_s\r\n anio=fecha[6..9].to_s\r\n return dia,mes,anio\r\nend",
"def copyright_period\n if Time.now.year > 2009\n raw %Q(2009–#{Time.now.year})\n else\n raw %Q(2009)\n end\n end",
"def ordinalize(date)\n date = datetime(date)\n d = \"<span class='date-month'>#{date.strftime('%b')}</span> \"\n d = \"<span class='date-day'>#{date.strftime('%e')}</span> \"\n d += \"<span class='date-suffix'>#{ordinal_suffix(date)}</span>, \"\n d += \"<span class='date-year'>#{date.strftime('%Y')}</span>\"\n end",
"def formatDateRange(startdate, enddate)\n startdate.strftime(\"%B %-d\") + \" - \" + enddate.strftime(\"%B %-d, %Y\")\n end",
"def format_month_body\n d = ((first_day + 5) % 7) + 1\n if d == 7\n d = 0\n end\n padding = Array.new(d, nil)\n updated_list = (padding + get_number_of_month).each_slice(7).to_a\n updated_list.each do |a|\n if a.length < 7\n (7 - a.length).times {a << nil}\n end\n end\n (6 - updated_list.length).times {updated_list << Array.new(7, nil)}\n updated_list\n end",
"def two_30_one_31_last(num)\n page.has_text?('30', count: 2) && page.has_text?('31', count: 1) &&\n last_date_text(num).to_i == 31\nend",
"def display_day_published\r\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\r\n end",
"def format_date(start_date, end_date = nil)\n dates = start_date.strftime('%D')\n dates << ' -- ' + end_date.strftime('%D') if end_date\n dates\n end",
"def number_to_substring_month(number)\n case number\n when 1\n return \"Jan\"\n when 4\n return \"Apr\"\n when 9\n return \"Sep\"\n when 10\n return \"Oct\"\n end\nend",
"def parse_months\n date_from = Date.parse('2004-05-01')\n date_to = Date.parse('2014-04-01')\n date_range = date_from..date_to\n date_months = date_range.map {|d| Date.new(d.year, d.month, 1) }.uniq\n date_months.map {|d| d.strftime \"%B %Y\" }\n end",
"def report_period_to_title\n case self\n when 'this_month'\n 'Days'\n when 'last_month'\n 'Days'\n when 'last_6_months'\n 'Months'\n when 'this_year'\n 'Months'\n end\n end",
"def all_year\n beginning_of_year..end_of_year\n end",
"def published_natural\n @published.strftime(\"#{@published.day.ordinalize} %B %Y\")\n end",
"def each_march( n=1); each_monthnum(self.Mar,n); end",
"def print_dates ()\n for date in DATES\n pp \"#{date[1]} Tweets On #{date[0].strftime(\"%Y-%m-%d\")}\"\n end\nend",
"def month_labels\n dates.collect { |date| date.to_date.day == 1 ? date.to_date.strftime('%B') : '' }\n end",
"def form_date\n \"#{date.month}/#{date.day}/#{date.year - 2000}\"\n end",
"def months ; Duration[self * 30 * 86400] ; end",
"def date_range_s(format = :short)\n return date.year if all_year?\n\n if format == :long\n if start_date == end_date\n date.strftime(\"%-m/%-d/%Y\")\n else\n \"#{start_date.strftime('%-m/%-d/%Y')}-#{end_date.strftime('%-m/%-d/%Y')}\"\n end\n else\n start_date_s = \"#{start_date.month}/#{start_date.day}\"\n if start_date == end_date\n start_date_s\n elsif start_date.month == end_date.month\n \"#{start_date_s}-#{end_date.day}\"\n else\n \"#{start_date_s}-#{end_date.month}/#{end_date.day}\"\n end\n end\n end",
"def end_date\n self.start_date + self.length.month\n end",
"def format_event_date(start_date, end_date)\n d1 = Date.parse(start_date) rescue nil\n d2 = Date.parse(end_date) rescue nil\n (d1 && d2) ? (d1..d2) : [d1, d2].compact\n end",
"def to_s; \"%d-%02d\" % [@years, @months.abs] end",
"def display_day_published\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\n end",
"def inspect\n \"the day of the month is the \" + ordinal_list(@parts)\n end",
"def publication_date\n the_date = nil\n return the_date if @pubmed['DP'].blank?\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9] [a-zA-Z]+)-([0-9][0-9][0-9][0-9] [a-zA-Z]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.split(\"-\")[1]\n end\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.gsub(/([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i, '\\1 \\3')\n end\n pubdate=@pubmed['DP'].strip.split(\" \")\n year_range = pubdate[0].split(\"-\")\n if year_range.length > 1\n pubdate[0] = year_range[1]\n end\n if pubdate.length > 1\n month_range = pubdate[1].split(\"-\")\n if month_range.length > 1\n pubdate[1] = month_range[1]\n end\n pubdate[1] = case pubdate[1] \n when /spring/i then 'Mar'\n when /summer/i then 'Jun'\n when /fall|autumn/i then 'Sep'\n when /winter/i then 'Dec'\n else pubdate[1]\n end\n end\n if pubdate.length > 2\n day_range = pubdate[2].split(\"-\")\n if day_range.length > 1\n pubdate[2] = day_range[1]\n end\n the_date = pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n the_date = '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n the_date = '01-JAN-'+ pubdate[0]\n end\n return the_date\n end",
"def print_month_old\n day = 1\n days = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]\n start_index = [18, 0, 3, 6, 9, 12, 15]\n start_day = first_day\n start = start_index[start_day]\n puts \"#{@month.capitalize} #{@year}\".center(20)\n puts \"Su Mo Tu We Th Fr Sa\" + \"\\n\"\n\n start_index.each do |num|\n if start == num\n num.times {print \"\\s\"}\n if day.to_s.length == 1\n print \" \" + day.to_s + \"\\s\"\n else\n print day.to_s + \"\\s\"\n end\n end\n end\n print_and_break(start + 3, 2)\n puts \"\\n\"\n puts \"\\n\"\n end",
"def formatshortenedDateRange(startdate, enddate)\n startdate.strftime(\"%b. %-d\") + \" - \" + enddate.strftime(\"%b. %-d, %Y\")\n end",
"def wrong_date(num)\n first_day(num).text\nend",
"def booking_range\n ary = [I18n.localize(begin_date, format: DATE_AND_TIME)]\n if same_day?(begin_date, end_date)\n ary << I18n.localize(end_date, format: '%R') # example: 09:00\n else\n ary << I18n.localize(end_date, format: DATE_AND_TIME)\n end\n ary.join ' - '\n end",
"def month_depot\n \"#{depot.name} \"+\"#{issue_date.strftime(\"%b\")} \"+\"#{issue_date.year}\"\n end",
"def class_months es, class_name\n es.select {|e| e.class_name == class_name }\n .map {|e|e.date.month_start }\n .uniq\n .sort\nend",
"def thirty_days_month\n return @month == 4 || @month == 6 || @month == 9 || @month == 11\n end",
"def rsmonth(month)\n case month\n when 1\n return 'januar'\n when 2\n return 'februar'\n when 3\n return 'mart'\n when 4\n return 'april'\n when 5\n return 'maj'\n when 6\n return 'jun'\n when 7\n return 'jul'\n when 8\n return 'avgust'\n when 9\n return 'septembar'\n when 10\n return 'oktobar'\n when 11\n return 'novembar'\n when 12\n return 'decembar'\n end\nend"
] |
[
"0.63647294",
"0.6199413",
"0.61113375",
"0.6094005",
"0.6038621",
"0.60302895",
"0.60302895",
"0.59761244",
"0.59347767",
"0.5921026",
"0.5909467",
"0.58856434",
"0.5880772",
"0.5872523",
"0.5821792",
"0.57974696",
"0.57964134",
"0.57950217",
"0.57830405",
"0.57760036",
"0.57693344",
"0.5749675",
"0.57414144",
"0.57243615",
"0.5702487",
"0.56971276",
"0.5666843",
"0.5657666",
"0.56569445",
"0.5653661",
"0.5652122",
"0.564782",
"0.5647461",
"0.5641299",
"0.5636708",
"0.56294674",
"0.56294674",
"0.56247824",
"0.56108236",
"0.56086034",
"0.56000865",
"0.559752",
"0.55895567",
"0.5587743",
"0.55869395",
"0.55743384",
"0.5573634",
"0.5562257",
"0.55610335",
"0.5560924",
"0.5557025",
"0.5551474",
"0.5547921",
"0.55462825",
"0.5543177",
"0.55226743",
"0.5516003",
"0.5513062",
"0.5499004",
"0.5498444",
"0.5498007",
"0.5493294",
"0.5470148",
"0.54668665",
"0.54624707",
"0.5462069",
"0.5461772",
"0.54613316",
"0.54586244",
"0.54576266",
"0.545049",
"0.54394096",
"0.543748",
"0.543701",
"0.54324126",
"0.54297197",
"0.5428033",
"0.54279774",
"0.542413",
"0.541594",
"0.5409974",
"0.54093766",
"0.54082394",
"0.5405926",
"0.54010856",
"0.53981656",
"0.5390319",
"0.5389722",
"0.53784776",
"0.53779113",
"0.5373173",
"0.53724194",
"0.5367441",
"0.53623766",
"0.5360352",
"0.5359658",
"0.53595597",
"0.53540397",
"0.53454757",
"0.5344371",
"0.534019"
] |
0.0
|
-1
|
Subclasses may override or supplement validate to perform validation on the list subject
|
def validate(list)
if super && list.length == 2
true
else
log_error(NAME) {"list must have exactly two entries: #{list.to_sxp}"}
false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate\n return (@list_name && @to && @subject) ? true : false\n end",
"def validate\n raise ValidationError, \"Subject is required\" if subject.nil?\n end",
"def validate( _x )\n msg = 'ERROR: Item.validate() not implemented!'\n msg += \"\\nTODO: cover common type-based validations?\"\n msg += \"\\nTODO: Offer validation objects?\"\n fail msg\n end",
"def validate(term, subject)\n raise NotImplementedError, \"validate not implemented in #{self.class.name}\"\n end",
"def validate_subject\n errors.add(:subject_id, 'not presence') if Subject.find_by_id( self[:subject_id] ) == nil\n end",
"def validate_list(input)\n list_request = input[:list_request].call\n if list_request.success?\n Success(input.merge(list: list_request.value!))\n else\n Failure(list_request.failure)\n end\n end",
"def validate(item)\n __setobj__(item)\n super\n\n item.errors.messages.merge!(errors.messages)\n end",
"def validate(list)\n if super && list.to_a.all? {|li| li.list?}\n true\n else\n log_error(NAME) {\"operand is not a list of lists: #{list.to_sxp}\"}\n false\n end\n end",
"def validate\n errors = {}\n\n @items.each_with_index do |item, idx|\n begin\n item.validate\n rescue => error\n errors[idx+1] = error\n end\n end\n\n if !errors.empty?\n raise ValidationError.new(_(\"Validation failed for '%{name}' settings list\") % {name: @name}, :errors => errors)\n end\n end",
"def validate( list )\n # reuse the highline lambda to santize input\n return true if (@allow_empty_list && list.nil?)\n list = highline_question_type.call( list ) if !list.is_a? Array\n return false if !list.is_a?(Array)\n return false if (!@allow_empty_list && list.empty? )\n list.each{ |item|\n return false if !validate_item( item )\n }\n true\n end",
"def validate_subject\n errors << 'invalid email domain' unless domain_valid?\n end",
"def validate\n end",
"def validate\n # add errors if not validate\n end",
"def validator; end",
"def validate(list)\n if list.list? && list.valid?\n true\n else\n log_error(NAME) {\"operand is not a list: #{list.to_sxp}\"}\n false\n end\n end",
"def validate\n fail 'sub class to implement'\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate_item( x )\n fail 'not implemented!'\n end",
"def validate\n validator_class.new(self).validate\n end",
"def validate(validator, *args); validation_chain.validate(validator, *args); end",
"def validate_me(validator)\n validator.validate self, checks\n end",
"def validate_maillist\n listname = params[:maillist]\n\n valid = maillist_is_valid? listname\n is_member = valid && maillist_members(params[:maillist]).include?(@current_user.pseudonym.unique_id.split('@')[0])\n\n if !valid\n payload = { valid_maillist: false, reason: \"#{params[:maillist]} is not a valid SFU Maillist\" }\n elsif !is_member\n payload = { valid_maillist: false, reason: \"You are not a member of #{params[:maillist]}. You must be a member of a list to add it to your Space.\" }\n else\n payload = { valid_maillist: true }\n end\n\n render json: payload, status: :ok\n end",
"def validated; end",
"def validate\n errors.clear\n self.class.validator.invoke self\n end",
"def validate\n [perform_validation].flatten.compact\n end",
"def validate_line_items\n \n end",
"def validate\n \n \n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n super \n end",
"def validate\n return nil unless internal_subset\n\n internal_subset.validate(self)\n end",
"def validate_list(data, options = {})\n list_type = options[:list_type]\n item_type = options[:item_type]\n min_count = options[:min_count] || options[:count] || 0\n max_count = options[:max_count] || options[:count] || 1000000\n offset = options[:offset] || 0\n warn_only = options[:warn_only] || []\n\n # TODO: Should this be :list:#{list_type} rather than the list type before list?\n expected_type = \"urn:blinkboxbooks:schema:#{(list_type || \"\").tr(\"_\", \"\")}list\"\n validate_attribute(data, \"type\", type: String, warn_only: warn_only.include?(:type)) { |value| expect(value).to eq(expected_type) }\n validate_attribute(data, \"count\", type: Integer, warn_only: warn_only.include?(:count)) { |value| expect(min_count..max_count).to cover(value) }\n validate_attribute(data, \"offset\", type: Integer, warn_only: warn_only.include?(:offset)) { |value| expect(value).to eq(offset) }\n validate_attribute(data, \"numberOfResults\", type: Integer, warn_only: warn_only.include?(:number_of_results)) { |value| expect(value).to be >= data[\"count\"] }\n validate_attribute(data, \"items\", type: Array, warn_only: warn_only.include?(:empty_items))\n\n unless list_type.nil?\n further_validation = \"validate_list_of_#{list_type}\".to_sym\n send(further_validation, data) if respond_to?(further_validation)\n end\n\n if data[\"items\"] || min_count > 0\n validate_attribute(data, \"items\", type: Array) do |value|\n if min_count == max_count\n expect(value.count).to eq(min_count)\n else\n expect(value.count).to be_between(min_count, max_count)\n end\n end\n unless item_type.nil?\n item_validation_method = \"validate_#{item_type}\".to_sym\n data[\"items\"].each { |item| self.send(item_validation_method, item) }\n end\n end\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate( _x )\n #TODO: cover common type-based validations?\n #TODO: Offer validation objects?\n raise InternalError.new( \"#{self.class}.validate() not implemented!\" )\n end",
"def validate\n raise NoMethodError, \"must define method 'validate'\"\n end",
"def validate\r\n\r\n end",
"def validate\n\n end",
"def validated?; end",
"def validate\n @domains.each do |d|\n raise 'domain definition error' unless d.class == Domain\n end\n @domains.map(&:validate)\n end",
"def valid?\n li = subject\n list_nodes = []\n while li != RDF.nil do\n return false if list_nodes.include?(li)\n list_nodes << li\n rest = nil\n firsts = rests = 0\n @graph.query({subject: li}) do |st|\n return false unless st.subject.node?\n case st.predicate\n when RDF.first\n firsts += 1\n when RDF.rest\n rest = st.object\n return false unless rest.node? || rest == RDF.nil\n rests += 1\n when RDF.type\n else\n # It may have no other properties\n return false unless li == subject\n end\n end\n return false unless firsts == 1 && rests == 1\n li = rest\n end\n\n # All elements other than the head must be referenced exactly once\n return list_nodes.all? do |li|\n refs = @graph.query({object: li}).count\n case refs\n when 0 then li == subject\n when 1 then true\n else false\n end\n end\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validation; end",
"def validation; end",
"def validations\n []\n end",
"def validate\n super\n end",
"def validate(field, list_attribute)\n generate_validation_scripts unless @scripts_added\n @id_generator.generate_id(field)\n @script_list_fields_with_validation.append_text(\n \"hatemileValidationList.#{list_attribute}.push(\" \\\n \"'#{field.get_attribute('id')}');\"\n )\n end",
"def validate(list)\n if super && list.all?(&:literal?) && list.length == 2\n true\n else\n log_error(NAME) {\"list is not a pair of literals: #{list.to_sxp}\"}\n false\n end\n end",
"def validator=(_); end",
"def validate(spec)\n raise \"undefined method -- `validate'\"\n end",
"def validate(list)\n if super && list.all? {|le| le.is_a?(RDF::Literal)} && list.length == 2\n true\n else\n log_error(NAME) {\"list is not a pair of literals: #{list.to_sxp}\"}\n false\n end\n end",
"def validate!\n super()\n self\n end",
"def validate\n validations = self.class.meta_eval { @validations }\n\n validations.each do |v|\n raise \"#{self.class}.#{v[:name]} #{v[:options][:message]}\" unless\n v[:proc].call(send(v[:name]))\n end\n\n self\n end",
"def validate(_options = 0)\n []\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end",
"def is_valid; end",
"def clean\n self.subject = sanitize subject\n end",
"def validate()\n\t\trules.values.each do |aRule|\n\t\t\tsubrule_invokations = aRule.all_actions.select { |act| act.kind_of?(ApplySubrule) }\n\t\t\tsubrule_invokations.each do |invokation|\n\t\t\t\traise LexerRuleError, \"Reference to unknown subrule '#{invokation.rulename}' in rule '#{aRule.name}'.\" unless rules.has_key? invokation.rulename\n\t\t\tend\n\t\tend\n\tend",
"def validate!\n # pass\n end",
"def validate_subject\n if @subject.nil?\n puts \"No subject, skipping\"\n raise StandardError, \"No subject\"\n else\n @title.strip\n end\n end",
"def create\n # TODO switch on \"rule\" value, and use the proper value in the Where\n puts \"\\n\\n\\n\\n\\n\\n\\n\\n\\nThese are the params: #{params.inspect}\"\n puts \"\\n\\n\\n\\n\\nThis is subscription_list_params object: #{subscription_list_params.inspect}\\n\\n\\nand its class #{subscription_list_params.class}\\n\\n\\n\\n\"\n #@subscription_list = SubscriptionList.new(subscription_list_params)\n @subscription_list = SubscriptionList.new(subscription_list_params[:subscription_list])\n # TODO add a Where according to the rule\n # e.g. @subscription_lists = SubscriptionList.where(:id => params[:subscriptions])\n @subscription_list.students = get_students_from_rule_param\n set_proper_rule_type_from_params(@subscription_list)\n puts \"\\n\\n\\n\\n\\n@subscription_list.students: #{@subscription_list.students.inspect}\\n\\n\\nand its class #{@subscription_list.students.class}\\n\\n\\n\\n\"\n\n respond_to do |format|\n if @subscription_list.save\n format.html { redirect_to @subscription_list, notice: 'La Lista de Entrega se creó exitosamente.' }\n format.json { render :show, status: :created, location: @subscription_list }\n else\n format.html { render :new }\n format.json { render json: @subscription_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validation_rules\n []\n end",
"def validate_inclusion_of_each(attribute_name, list, message = nil)\n value = send(attribute_name)\n value && value.each do |obj|\n unless list.include?(obj)\n append_error(value, message || :isnt_listed) \n break\n end\n end\n end",
"def validate\n begin\n validatable_rules.map{ |k, v| self.send(\"validate_\" + k.to_s) }\n rescue Errors::ValidationError => e\n raise decorate_error e\n end\n end",
"def valid_embedded_item\n return unless embedded_item && !embedded_item.errors.empty?\n\n embedded_item.errors.each do |k, v|\n errors.add k, v\n end\n end",
"def validate(options); end",
"def validate\n super\n raise ValidationError, \"Status must be specified\" if status.nil?\n raise ValidationError, \"Status must be a RSAML::Protocol::Status instance\" unless status.is_a?(Status)\n end",
"def validate\n ::SalesOrderModule::Validations::SalesOrderValidation.new(sales_order).validate\n end",
"def subclass_validations ; true ; end",
"def validate\n raise \"A name for the collection is required.\" unless @attributes[:name]\n raise \"A source for the collection is required (created_by_id).\" unless @attributes[:created_by_id]\n end",
"def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end",
"def validate(instance)\n validator.invoke instance\n end",
"def validate\n self.send(\"validate_#{type}\".to_sym)\n end",
"def validate!\n validator.validate(data: data, schema: schema, logger: validation_logger)\n end",
"def validate_all\n validate\n items.each do |item|\n definition.validate_item item\n end\n definition.validate_columns items\n end",
"def validate(obj, type); end",
"def validators\n []\n end",
"def _before_validation\n end",
"def validate_item item\n Simp::Cli::Config::Utils.validate_domain item\n end",
"def validate_spec(ypath, spec, tree)\n nodes = select_nodes(ypath, tree)\n\n YES.constraints.each do |c|\n @checklist.concat(c.checklist(spec, tree, nodes))\n end\n end",
"def validate\n valid?\n end",
"def validate_inclusion(attribute_name, list, message = nil)\n value = attributes[attribute_name]\n if value && !list.include?(value)\n append_error(attribute_name, message || :isnt_listed)\n end\n end",
"def validate\n each_field_with_value do |key, field, value|\n field.validate(value)\n end\n self\n end",
"def validate_enrolment\n if self.offer_id.present?\n if self.subject_id != Offer.find(self.offer_id).subject_id\n errors.add(:enrolment, 'Offer subject id not same as enrolment subject')\n end\n end\n end",
"def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n else\n [image_changes.created,\n image_changes.updated,\n unit_changes.created,\n unit_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end",
"def clean\n self.subject = sanitize self.subject\n end",
"def update\n @subscription_list.students = get_students_from_rule_param\n set_proper_rule_type_from_params(@subscription_list)\n respond_to do |format|\n #if @subscription_list.update(subscription_list_params)\n if @subscription_list.update(subscription_list_params[:subscription_list])\n format.html { redirect_to @subscription_list, notice: 'La Lista de Entrega se actualizó exitosamente.' }\n format.json { render :show, status: :ok, location: @subscription_list }\n else\n format.html { render :edit }\n format.json { render json: @subscription_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate!\n self.class.validators.each do |validator|\n validator.validate!(self)\n end\n nil\n end",
"def validate(param)\n validator.call(param)\n end",
"def validate(param)\n validator.call(param)\n end",
"def init_validation\n @group = Valid.get_association(self, :group_id, MailingListGroup)\n @mailing_list_address = Valid.get_association self, :id\n end",
"def validate\n validates_presence([:title, :body])\n end",
"def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end"
] |
[
"0.6905453",
"0.665453",
"0.6402456",
"0.63484466",
"0.6278187",
"0.6245461",
"0.61760217",
"0.60865796",
"0.60128623",
"0.58866715",
"0.586856",
"0.58012575",
"0.5797134",
"0.57723945",
"0.57568765",
"0.5695617",
"0.56894886",
"0.56894886",
"0.56894886",
"0.56894886",
"0.56875265",
"0.56669086",
"0.5666077",
"0.5656719",
"0.56429315",
"0.56103545",
"0.56051326",
"0.55754",
"0.55712473",
"0.5548497",
"0.5531675",
"0.5531675",
"0.5531675",
"0.5530892",
"0.55300796",
"0.55015236",
"0.549271",
"0.549271",
"0.549271",
"0.54754806",
"0.54431105",
"0.54389966",
"0.5432446",
"0.542442",
"0.5403758",
"0.539313",
"0.5391913",
"0.5391913",
"0.5391913",
"0.5382885",
"0.5382885",
"0.53579473",
"0.533424",
"0.5333634",
"0.5333278",
"0.5324938",
"0.5297986",
"0.528892",
"0.5287168",
"0.5280804",
"0.5278849",
"0.5273166",
"0.5264042",
"0.52585065",
"0.52583885",
"0.52319837",
"0.5231234",
"0.5218396",
"0.5212896",
"0.52123034",
"0.52112246",
"0.5208863",
"0.52020055",
"0.5197784",
"0.5187631",
"0.5186356",
"0.5181296",
"0.5177668",
"0.5173061",
"0.51667386",
"0.51589465",
"0.51530457",
"0.51469225",
"0.51441646",
"0.51298976",
"0.51294506",
"0.51211226",
"0.5108132",
"0.50964606",
"0.50961477",
"0.5095593",
"0.5088275",
"0.50857484",
"0.508296",
"0.50690997",
"0.5060428",
"0.5060428",
"0.5052225",
"0.50456417",
"0.5044109"
] |
0.61858207
|
6
|
Index page for admin when they are successfully logged in The view greets admin and gives options for creating, searhing users It also has a button for admin to logout and view daily reports of user created..
|
def index
#render plain: "Hey admin"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n\n\n # if ( !current_user || !current_user.isAdmin )\n # render :text => \"You are not authorized to see this page\", :layout => true\n #\n # return\n # end\n\n @users = User.all\n end",
"def index\n @user = current_user\n if @user&& @user.role == \"admin\"\n @title = \"All Registered Users\"\n @users = User.all\n @total = User.all.length\n else\n redirect_to new_user_session_path\n end \n end",
"def index\n\t\tredirect_to dashboard_users_path if current_user\n\tend",
"def index\n if current_user.admin?\n @users = User.all\n else\n redirect_to :root\n flash[:error] = \"You do not have admin access.\"\n end\n end",
"def index\n render ('index') #render the admin_helpers view. The main page controller calls this action after the admin_helpers logs in\n end",
"def index\n if current_user\n if current_user.role == 2\n redirect_to users_adminhome_path\n else\n redirect_to home_user_path(current_user)\n end\n else\n redirect_to new_session_path\n end\n #@users = User.all\n\n end",
"def index\n # only admins see the whole user list\n if current_user && current_user.is_admin\n @users = User.all\n render :index\n else\n redirect_to \"/\"\n end\n end",
"def index\n if Administrator.find_by_user_id(current_user.id).admin\n @users = User.all\n else\n redirect_to root_path\n end\n end",
"def index\n # index not implemented - only admins may list users\n raise \"This action is not implemented\"\n end",
"def index\n if current_user.admin?\n @users = User.paginate(:page => params[:page], :per_page => 10)\n @title = \"All Users\"\n else\n redirect_to root_path\n end\n end",
"def index\n if current_user && current_user.admin? \n @users = User.all\n respond_with users_path\n else\n flash[:notice] = 'You do not have rights to see the list of users.'\n redirect_to home_index_path\n end\n end",
"def index\n\t\tbegin\n\t\t\tif(session[:user][\"admin\"])\n\t\t\t\t@users = User.where.not(id: 1)\n\t\t\telse\n\t\t\t\traise \"No_ACCESS\"\n\t\t\tend\n\t\trescue\n\t\t\trender \"error\"\n\t\telse\n\t\tend\n\tend",
"def index\n if(session[:username] && session[:username]=='admin1')\n @users = User.all.paginate(page: params[:page], per_page: 5)\n else\n respond_to do |format|\n format.html { redirect_to controller: 'welcome', action: 'index', notice: 'Only Admin is allowed access' }\n end\n end\n end",
"def index\n if current_user\n flash.keep\n redirect_to dashboard_path \n return\n end \n @user = User.new #used for signing up a new User\n end",
"def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end",
"def index\n # set_user, is the only action taken here\n end",
"def index\n # set_user, is the only action taken here\n end",
"def index\n # @admins = Admin.all\n # \n # respond_to do |format|\n # format.html # index.html.erb\n # format.xml { render :xml => @admins }\n # end\n @admin_session = AdminSession.new\n if current_admin\n redirect_to dashboards_url\n end\n end",
"def index\n # FIXME: if logged in as an author, only show own user's crUd stuff; for\n # admins, show all CRUD operations for all users\n if logged_in?\n @users = User.order(:name)\n else\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Cannot view all users.' }\n end\n end\n end",
"def index\n @current_user ||= User.find_by(id: session[:user_id])\n if current_user.is_admin?\n @users = User.all\n else\n redirect_to '/home'\n end\n end",
"def index\n @users = User.all\n @title = 'Users Management'\n @breadcrumb = 'Users'\n end",
"def index\n if current_user.admin?\n @users = User.all\n end\n \n end",
"def index\n if :notice.empty?\n flash.now[:notice] = \"Welcome #{@user}\"\n # @users = User.all\n # @user = User.new(user_params)\n #if params[:commit] == 'Login'\n # redirect_to dum_path\n #end\n end\n end",
"def users_index\n\t\t@view.users_list($users)\n\t\t@view.second_view(@current_user, @current_user.actions)\n\tend",
"def index\n if @current_user[:role] == 'admin'\n @users = User.all\n else \n redirect_to root_path\n end\n end",
"def index\n\t\tif !admin?\n\t\t\thead 404\n\t\tend\n @users = User.all\n end",
"def index\n\t\t# Logs user in if session cookie is present\n\t\tif @user = User.find_by_id(session[:user]) \n\t\t\tredirect_to user_dash_path(@user) \n\t\tend\n\tend",
"def index\n redirect_to admin_users_path\n end",
"def index\n redirect_to admin_users_path\n end",
"def index\n #if is_admin?\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @users }\n end\n # else \n # redirect_to :root\n # end\n end",
"def index\n if current_user && current_user.role == 'admin'\n @users = User.all\n else\n redirect_to root_path\n end\n end",
"def index\n return unless authenticated_admin?\n @users = User.all\n end",
"def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend",
"def index\n if current_user.rol == 1\n @users = User.order(:id)\n else\n @mensaje = \"Seccion exclusiva para administrador\"\n end\n end",
"def index\n @loggedin_user=current_user.name\n @users = User.all\n end",
"def index\n @tab = :admins\n @users = User.all\n end",
"def index\n @username = (is_admin? ? params[:id] : current_user_model.username)\n @pronoun = (is_admin? ? \"\" : \" Your \")\n @username = current_user_model.username if @username.blank?\n if is_admin?\n @investigators = Investigator.by_name\n render :action => 'admin_index'\n else\n render\n end\n end",
"def index\n unless user_signed_in?\n flash[:notice]= \"You must be signed in to see other users\"\n redirect_to root_path\n end\n @users = User.all\n end",
"def admin_user\n\t unless current_user.admin?\n flash[:danger] = \"Log in as Admin.\"\n redirect_to(root_url)\n\t end \n\t end",
"def index\n\n if user_signed_in?\n if current_user.id == 1\n @users = User.all\n else\n flash[:error] = \"Não tens permissões para realizar tal acção!\"\n redirect_to root_url\n end\n elsif params[:type] == 'admin'\n @users = User.all\n else\n flash[:error] = \"Não tens permissões para realizar tal acção!\"\n redirect_to root_url\n end\n\n end",
"def index\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = User.find(session[:user_id])\n end\n end",
"def index\n redirect_to user_path(current_user)\n end",
"def index\n if(!admin_signed_in?)\n redirect_back(fallback_location: root_path, notice: 'Acesso negado.')\n end\n @admins = Admin.all\n end",
"def show\n\t\t@user = User.find_by_md5(params[:id])\n\t\t@admin = User.find(1)\n\t\tsignin_and_active(@user,@admin)\n\n\tend",
"def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end",
"def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_to(root_url)\n end\n end",
"def index\n if signed_in?\n redirect_to current_user\n else\n redirect_to new_user_path\n end\n end",
"def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end",
"def index\n if current_user.role == \"super_admin\" || current_user.role == \"admin\" #[99, 100]\n @users = User.all\n else\n redirect_to user_path(current_user)\n end\n end",
"def index\n # Shut up I know this is stupid\n @users = User.all\n unless user_signed_in? and current_user.is_admin?\n redirect_to root_path, notice: \"Log in first\"\n end\n end",
"def index\n\t @users = User.all\t\n\t render :index_user\n\tend",
"def show\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def user_dashboard\n if @current_user.superadmin_role\n path = auth_hub.index_superadmin_url\n elsif @current_user.admin_role\n path = auth_hub.index_admin_url\n elsif @current_user.admin_servizi\n path = auth_hub.index_admin_url\n end\n redirect_to path unless path.blank?\n end",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def index\n\n\n unless session[:user].nil?\n if session[:user]['perfil'] == 'Administrador'\n @users = User.all\n else\n respond_to do |format|\n flash[:warning] ='Você não possui permissão para acessar esse recurso.'\n format.html {redirect_to '/'}\n end\n end\n else\n respond_to do |format|\n format.html {redirect_to '/'}\n end\n end\n end",
"def index\n #Count admin's events\n @counter=Event.where(owner_id: current_user).size\n\n #Show events according to variety of user_type\n if current_user==nil\n redirect_to root_path\n #show all events if superadmin\n elsif current_user.user_type=='superadmin'\n @events=Event.all\n else\n #show current user's events if not superadimin\n @events=Event.where(owner_id: current_user)\n end\n end",
"def index\n # Reset the session enduser\n session[:enduser] = '0'\n\tend",
"def index\n # if !user_signed_in?\n # redirect_to new_user_session_path\n # end\n end",
"def index\n if current_user.role == \"admin\"\n @users = User.all\n # Der Admin kann eine Liste aller User anschauen\n else\n redirect_to trips_path\n # Die Member werden weitergeleitet\n end\n end",
"def index\n if current_user.is_admin\n @user_alerts = UserAlert.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_alerts }\n end\n else\n redirect_to new_session_path\n end\n end",
"def index\n @user=Userlogindetail.new(params[:userlogindetail])\n currentuser=Userlogindetail.find_by_id(session[:user_id])\n @currentuser=currentuser\n respond_to do |format|\n format.html\n end\n \n end",
"def index\n\t\tif current_user\n\t\t\t@user = current_user\n\t\t\trender :index\n\t\telse\n\t\t\t@errors = nil\n \t\trender \"api/shared/errors\", status: 299\n \tend\n\tend",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def show\n drop_breadcrumb(\"用户管理\",users_path)\n drop_page_title(\"用户详情\")\n drop_breadcrumb\n end",
"def index\n @adminusers = Adminuser.all\n end",
"def index\n @users = User.search(params[:search], params[:page])\n @total_count = User.search(params[:search],\"\").count\n \n @menu = \"user\"\n @board = \"user\"\n @section = \"index\"\n \n render 'admin/users/user'\n end",
"def index\n\t\tis_current_role_site_admin = session[:role] == User.site_admin\n\t\tis_current_role_vendor_admin = session[:role] == User.vendor_admin\n\t\tis_administrator_role = is_current_role_site_admin || is_current_role_vendor_admin\n\t\tif is_administrator_role\n\t\t\t@users = User.all.where(role_id: Role.get_user_id)\n\t\tend\n\tend",
"def show\n @user = current_user\n @admin = @user.admin\n unless @admin\n redirect_to :root, :alert => t(\"notice.access\")\n end\n end",
"def index\n \tif current_user\n\t\tredirect_to home_profile_path\n\tend\n end",
"def index # ☑️ will get all users\n if current_user.admin == true \n render json: User.all\n else \n render json: {message: \"Authorized access denied. Admin status: #{current_user.admin}\"} \n end\n end",
"def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end",
"def logged_in_admin\n unless admin?\n # show a flash message on the page\n flash[:danger] = \"Non sei autorizzato a visitare questa pagina\"\n # redirect user to home page\n redirect_to root_path\n end\n end",
"def index\n #if admin, \n # show all accounts\n # else\n \n @accounts = current_user.accounts\n \n end",
"def show\n\n @user = User.get(params[:id])\n \n if admin_signed_in?\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'admin/users/user'\n else\n redirect_to '/'\n end\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def index\n if current_user.admin_group?\n @admin_user = current_user\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), auth_assign_permits_path\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_user }\n end\n end\n end",
"def index\n return false unless authorize(permissions = [\"view_user\"])\n render :layout => 'login' unless current_user\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n\t\tif signed_in?\n \t\t user=User.find(session[:user_id])\n \t\tcase user.role\n \twhen \"s\"\n \t\tredirect_to supervisor_index_path and return\n \twhen \"a\"\n \t redirect_to receptionnist_index_path and return\n \tend\t\n \tend\n\tend",
"def index\n if isAdmin?\n @title= \"Listing All Professors\"\n @users = User.where('role' => 2).paginate(page: params[:page])\n if(!@users.any?)\n flash[:notice]= \"No professor on CMS. To create a new professor click on Create New Professor\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n else\n flash[:notice]= \"You don't have permission to browse all users\"\n redirect_to courses_path\n end\n end",
"def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end",
"def index\n if( is_admin? )\n \t\t@users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.json {render :json => @users.collect{|x| x.email} }\n end\n else\n redirect_to \"/home\", notice: \"Access Denied\"\n end\n end",
"def index\n if !user_signed_in?\n redirect_to home_path\n elsif current_user.admin?\n redirect_to admin_portal_path\n else\n redirect_to portal_path\n end\n end",
"def index\n # Replace TaskAdmin with User if we want SuperAdmin to manage all users\n @users = TaskAdmin.all\n end",
"def index\n if can? :update, @users\n @users = User.all\n else\n \n redirect_to :root\n flash[:alert] = \"Vous n'avez pas les deroits a acceder ces informations.\"\n end\n \n end",
"def index\n @title = \"User List\"\n @users = User.all\n end",
"def index\n \tif user_signed_in?\n \t\tname = current_user.name(false)\n# TODO: Investigate if this is even relevant anymore. The name var will never be blank here because the logic in\n# User says to return the email if the firstname and surname are empty regardless of the flag passed in\n \t\tif name.blank?\n \t\t\tredirect_to edit_user_registration_path\n \t\telse\n \t\t\tredirect_to plans_url\n \t\tend\n \tend\n end",
"def admin\n if user_signed_in?\n \t redirect_to members_url\n \telse\n \t redirect_to new_user_session_path\n \t end\n \n end",
"def index\n if (!@isLogin)\n return\n end\n @users = User.all\n end",
"def dashboard_admin\n @user = current_user\n @users = User.all\n @grid = AdminsGrid.new(params[:admins_grid]) do |scope|\n scope.page(params[:page]).per(10)\n end\n @index_path = request.path\n end",
"def index\n if session[:current_user_super_admin]\n @users = User.find(:all,:order => 'username')\n else\n @users = User.find(:all,:order => 'username', :joins => :member, :conditions => ['members.center_id = ?', session[:center_id]]).paginate :page => params[:page], :per_page => 10\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @title = \"Nos utilisateurs\"\n @description = \"Liste de nos plus fervents utilisateurs\"\n @users = User.all\n end",
"def index\n if @current_user.id != 1\n redirect_to root_path\n end\n @users = User.all\n end",
"def index\n if not current_user.role? :admin\n redirect_to root_path\n end\n end",
"def index\n\t\t# will automatically go into views/users and look for 'index' file to render\n\t\t@all_users = User.all\n\t\t# p @all_users, \"all users\"\n\tend",
"def index\n @users = User.all\n @user = retrieve_authenticated_user\n end",
"def index\n @users = User.order(\"id desc\").page(params[:page]).per(20)\n\n @title = \"Manage Users | Admin\"\n\n respond_to do |format|\n format.html { render(layout: !request.xhr?) }\n end\n end",
"def index\n respond_to do |format|\n format.html do\n @page_title = \"TRACKS::Manage Users\"\n @users = User.order('login ASC').paginate :page => params[:page]\n @total_users = User.count\n # When we call users/signup from the admin page we store the URL so that\n # we get returned here when signup is successful\n store_location\n end\n format.xml do\n @users = User.order('login')\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n stylesheet_link_tag \"application\", :media => \"all\" \n stylesheet_link_tag \"print\", :media => \"print\" \n javascript_include_tag \"application\" \n csrf_meta_tags \n@source_view\n raw(protect_against_forgery? ? form_authenticity_token.inspect : \"\") \n @tag_name ? @tag_name : \"\" \n @group_view_by ? @group_view_by : \"\" \n default_contexts_for_autocomplete.html_safe rescue '{}' \n default_tags_for_autocomplete.html_safe rescue '{}' \n date_format_for_date_picker \n current_user.prefs.week_starts \n root_url \n if current_user.prefs.refresh != 0 \n current_user.prefs[\"refresh\"].to_i*60000 \n end \n unless controller.controller_name == 'feed' or session['noexpiry'] == \"on\" \nurl_for(:controller => \"login\", :action => \"check_expiry\")\n end \ncheck_deferred_todos_path(:format => 'js')\n generate_i18n_strings \n favicon_link_tag 'favicon.ico' \n favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' \n auto_discovery_link_tag(:rss, {:controller => \"todos\", :action => \"index\", :format => 'rss', :token => \"#{current_user.token}\"}, {:title => t('layouts.next_actions_rss_feed')}) \n search_plugin_path(:format => :xml) \n @page_title \n if @count \n @count \n end \n l(Time.zone.today, :format => current_user.prefs.title_date_format) \n navigation_link(t('layouts.navigation.home'), root_path, {:accesskey => \"t\", :title => t('layouts.navigation.home_title')} ) \n navigation_link(t('layouts.navigation.starred'), tag_path(\"starred\"), :title => t('layouts.navigation.starred_title')) \n navigation_link(t('common.projects'), projects_path, {:accesskey=>\"p\", :title=>t('layouts.navigation.projects_title')} ) \n navigation_link(t('layouts.navigation.tickler'), tickler_path, {:accesskey =>\"k\", :title => t('layouts.navigation.tickler_title')} ) \n t('layouts.navigation.organize') \n navigation_link( t('common.contexts'), contexts_path, {:accesskey=>\"c\", :title=>t('layouts.navigation.contexts_title')} ) \n navigation_link( t('common.notes'), notes_path, {:accesskey => \"o\", :title => t('layouts.navigation.notes_title')} ) \n navigation_link( t('common.review'), review_path, {:accesskey => \"r\", :title => t('layouts.navigation.review_title')} ) \n navigation_link( t('layouts.navigation.recurring_todos'), {:controller => \"recurring_todos\", :action => \"index\"}, :title => t('layouts.navigation.recurring_todos_title')) \n t('layouts.navigation.view') \n navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) \n navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>\"d\", :title=>t('layouts.navigation.completed_tasks_title')} ) \n navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) \n navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) \n link_to(t('layouts.toggle_contexts'), \"#\", {:title => t('layouts.toggle_contexts_title'), :id => \"toggle-contexts-nav\"}) \n link_to(t('layouts.toggle_notes'), \"#\", {:accesskey => \"S\", :title => t('layouts.toggle_notes_title'), :id => \"toggle-notes-nav\"}) \n group_view_by_menu_entry \n t('layouts.navigation.admin') \n navigation_link( t('layouts.navigation.preferences'), preferences_path, {:accesskey => \"u\", :title => t('layouts.navigation.preferences_title')} ) \n navigation_link( t('layouts.navigation.export'), data_path, {:accesskey => \"e\", :title => t('layouts.navigation.export_title')} ) \n navigation_link( t('layouts.navigation.import'), import_data_path, {:accesskey => \"i\", :title => t('layouts.navigation.import_title')} ) \n if current_user.is_admin? \n navigation_link(t('layouts.navigation.manage_users'), users_path, {:accesskey => \"a\", :title => t('layouts.navigation.manage_users_title')} ) \n end \n t('layouts.navigation.help') \n link_to t('layouts.navigation.integrations_'), integrations_path \n link_to t('layouts.navigation.api_docs'), rest_api_docs_path \n navigation_link(image_tag(\"system-search.png\", :size => \"16X16\", :border => 0), search_path, :title => t('layouts.navigation.search')) \n link_to(\"#{t('common.logout')} (#{current_user.display_name}) »\".html_safe, logout_path) \n \n controller.controller_name \n render_flash \n controller.controller_name \n t('users.manage_users') \n t('users.total_users_count', :count => \"<span id=\\\"user_count\\\">#{@total_users}</span>\").html_safe \n User.human_attribute_name('login') \n User.human_attribute_name('display_name') \n User.human_attribute_name('auth_type') \n User.human_attribute_name('open_id_url') \n t('users.total_actions') \n t('users.total_contexts') \n t('users.total_projects') \n t('users.total_notes') \n for user in @users \n \"class=\\\"highlight\\\"\" if user.is_admin? \n user.id \nh user.login \nh user.display_name \n h user.auth_type \n h user.open_id_url || '-' \n h user.todos.size \n h user.contexts.size \n h user.projects.size \n h user.notes.size \n !user.is_admin? ? remote_delete_user(user) : \" \".html_safe \n end \n will_paginate @users \n link_to t('users.signup_new_user'), signup_path \n TRACKS_VERSION \n (link_to(t('layouts.mobile_navigation.full'), todos_path(:format => 'html'))) \n \n\nend\n\n end\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n stylesheet_link_tag \"application\", :media => \"all\" \n stylesheet_link_tag \"print\", :media => \"print\" \n javascript_include_tag \"application\" \n csrf_meta_tags \n@source_view\n raw(protect_against_forgery? ? form_authenticity_token.inspect : \"\") \n @tag_name ? @tag_name : \"\" \n @group_view_by ? @group_view_by : \"\" \n default_contexts_for_autocomplete.html_safe rescue '{}' \n default_tags_for_autocomplete.html_safe rescue '{}' \n date_format_for_date_picker \n current_user.prefs.week_starts \n root_url \n if current_user.prefs.refresh != 0 \n current_user.prefs[\"refresh\"].to_i*60000 \n end \n unless controller.controller_name == 'feed' or session['noexpiry'] == \"on\" \nurl_for(:controller => \"login\", :action => \"check_expiry\")\n end \ncheck_deferred_todos_path(:format => 'js')\n generate_i18n_strings \n favicon_link_tag 'favicon.ico' \n favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' \n auto_discovery_link_tag(:rss, {:controller => \"todos\", :action => \"index\", :format => 'rss', :token => \"#{current_user.token}\"}, {:title => t('layouts.next_actions_rss_feed')}) \n search_plugin_path(:format => :xml) \n @page_title \n if @count \n @count \n end \n l(Time.zone.today, :format => current_user.prefs.title_date_format) \n navigation_link(t('layouts.navigation.home'), root_path, {:accesskey => \"t\", :title => t('layouts.navigation.home_title')} ) \n navigation_link(t('layouts.navigation.starred'), tag_path(\"starred\"), :title => t('layouts.navigation.starred_title')) \n navigation_link(t('common.projects'), projects_path, {:accesskey=>\"p\", :title=>t('layouts.navigation.projects_title')} ) \n navigation_link(t('layouts.navigation.tickler'), tickler_path, {:accesskey =>\"k\", :title => t('layouts.navigation.tickler_title')} ) \n t('layouts.navigation.organize') \n navigation_link( t('common.contexts'), contexts_path, {:accesskey=>\"c\", :title=>t('layouts.navigation.contexts_title')} ) \n navigation_link( t('common.notes'), notes_path, {:accesskey => \"o\", :title => t('layouts.navigation.notes_title')} ) \n navigation_link( t('common.review'), review_path, {:accesskey => \"r\", :title => t('layouts.navigation.review_title')} ) \n navigation_link( t('layouts.navigation.recurring_todos'), {:controller => \"recurring_todos\", :action => \"index\"}, :title => t('layouts.navigation.recurring_todos_title')) \n t('layouts.navigation.view') \n navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) \n navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>\"d\", :title=>t('layouts.navigation.completed_tasks_title')} ) \n navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) \n navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) \n link_to(t('layouts.toggle_contexts'), \"#\", {:title => t('layouts.toggle_contexts_title'), :id => \"toggle-contexts-nav\"}) \n link_to(t('layouts.toggle_notes'), \"#\", {:accesskey => \"S\", :title => t('layouts.toggle_notes_title'), :id => \"toggle-notes-nav\"}) \n group_view_by_menu_entry \n t('layouts.navigation.admin') \n navigation_link( t('layouts.navigation.preferences'), preferences_path, {:accesskey => \"u\", :title => t('layouts.navigation.preferences_title')} ) \n navigation_link( t('layouts.navigation.export'), data_path, {:accesskey => \"e\", :title => t('layouts.navigation.export_title')} ) \n navigation_link( t('layouts.navigation.import'), import_data_path, {:accesskey => \"i\", :title => t('layouts.navigation.import_title')} ) \n if current_user.is_admin? \n navigation_link(t('layouts.navigation.manage_users'), users_path, {:accesskey => \"a\", :title => t('layouts.navigation.manage_users_title')} ) \n end \n t('layouts.navigation.help') \n link_to t('layouts.navigation.integrations_'), integrations_path \n link_to t('layouts.navigation.api_docs'), rest_api_docs_path \n navigation_link(image_tag(\"system-search.png\", :size => \"16X16\", :border => 0), search_path, :title => t('layouts.navigation.search')) \n link_to(\"#{t('common.logout')} (#{current_user.display_name}) »\".html_safe, logout_path) \n \n controller.controller_name \n render_flash \n controller.controller_name \n t('users.manage_users') \n t('users.total_users_count', :count => \"<span id=\\\"user_count\\\">#{@total_users}</span>\").html_safe \n User.human_attribute_name('login') \n User.human_attribute_name('display_name') \n User.human_attribute_name('auth_type') \n User.human_attribute_name('open_id_url') \n t('users.total_actions') \n t('users.total_contexts') \n t('users.total_projects') \n t('users.total_notes') \n for user in @users \n \"class=\\\"highlight\\\"\" if user.is_admin? \n user.id \nh user.login \nh user.display_name \n h user.auth_type \n h user.open_id_url || '-' \n h user.todos.size \n h user.contexts.size \n h user.projects.size \n h user.notes.size \n !user.is_admin? ? remote_delete_user(user) : \" \".html_safe \n end \n will_paginate @users \n link_to t('users.signup_new_user'), signup_path \n TRACKS_VERSION \n (link_to(t('layouts.mobile_navigation.full'), todos_path(:format => 'html'))) \n \n\nend\n\n end",
"def index\n \n \n if user_signed_in? && current_user.admin?\n @users = User.all\n @unapproved_users = User.where(:approved => false)\n @approved_users = User.where(:approved => true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n else\n redirect_to root_path\n end\n end"
] |
[
"0.76350015",
"0.75969255",
"0.758603",
"0.75639075",
"0.7499686",
"0.74652964",
"0.7464534",
"0.74331856",
"0.7423181",
"0.741385",
"0.7378951",
"0.7376636",
"0.733727",
"0.73346597",
"0.73291945",
"0.7268962",
"0.7268962",
"0.7224708",
"0.7223567",
"0.7211335",
"0.72104406",
"0.71880156",
"0.7184382",
"0.7181315",
"0.7167495",
"0.7160924",
"0.71575755",
"0.71490324",
"0.71490324",
"0.71483666",
"0.7145479",
"0.71282333",
"0.71230197",
"0.7122389",
"0.7116932",
"0.71110564",
"0.7102292",
"0.70939296",
"0.70886",
"0.7074407",
"0.7071018",
"0.7070887",
"0.7056633",
"0.7051522",
"0.7035151",
"0.70040655",
"0.6992659",
"0.69815207",
"0.6970763",
"0.69642186",
"0.6954472",
"0.695424",
"0.69468087",
"0.6946699",
"0.6943834",
"0.6940112",
"0.6934277",
"0.69288415",
"0.69143194",
"0.6911979",
"0.69114584",
"0.6902572",
"0.68951076",
"0.6884473",
"0.6884473",
"0.6878229",
"0.68764305",
"0.6874892",
"0.6874262",
"0.68678206",
"0.6865629",
"0.6858786",
"0.68558276",
"0.6851851",
"0.6848518",
"0.68466467",
"0.6845894",
"0.68427956",
"0.68395644",
"0.68368113",
"0.68353415",
"0.6834211",
"0.6825374",
"0.6815589",
"0.68152523",
"0.6813126",
"0.6811949",
"0.68081886",
"0.68017805",
"0.67948776",
"0.6792333",
"0.67885053",
"0.67826605",
"0.6777952",
"0.677501",
"0.677204",
"0.6769626",
"0.6769395",
"0.67684215",
"0.67683375"
] |
0.725182
|
17
|
These are the pieces of the current operation
|
def op; (@memblock[@ip]||0)/16; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def operations; end",
"def operations; end",
"def operation; end",
"def cops; end",
"def cops; end",
"def cops; end",
"def operations\n @operations\n end",
"def op; end",
"def extra_state; end",
"def operations\n @operations.dup\n end",
"def operations\n @operations.dup\n end",
"def finalize_operations\n\tend",
"def probers; end",
"def operations\n @operations ||= stream.operations\n end",
"def operation(*_)\n raise 'not implemented'\n end",
"def operation\n nil\n end",
"def private; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def operations\n return @operations\n end",
"def operations\n return @operations\n end",
"def operations\n return @operations\n end",
"def operations\n return @operations\n end",
"def operations\n return @operations\n end",
"def ops!\n @ops\n end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def variables; end",
"def variables; end",
"def stage; end",
"def stage; end",
"def operation_names\n Array.new\n end",
"def instructions\n \n end",
"def operation_names\n raise NotImplementedError\n end",
"def operation\n parsed_operation\n end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def oper\n return @oper\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def operations\n @scope.operations\n end",
"def get_execution_info; end",
"def processor; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def processing_instruction?; end",
"def processing_instruction?; end",
"def info; end",
"def info; end",
"def who_we_are\r\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def for(operation); end",
"def stderrs; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def internship_passed; end",
"def transferred_properties; end",
"def transferred_properties; end",
"def code_of_conduct; end",
"def states; end",
"def main\n\n\n operations.running.retrieve interactive: false\n save_user operations\n debug_setup(operations) if debug\n \n if KIT_NAME == \"uw kit\"\n if debug\n labels = \"ABCDEF\".split('')\n operations.each.with_index do |op, i|\n op.input(INPUT).item.associate(SAMPLE_KEY, labels[i]) \n op.input(INPUT).item.associate(COMPONENT_KEY, \"\") \n end\n end\n end\n \n save_temporary_input_values(operations, INPUT)\n operations.each do |op|\n op.temporary[:pack_hash] = PACK_HASH\n end\n save_temporary_output_values(operations)\n \n # reassign labels to sample numbers if uw kit\n if KIT_NAME == \"uw kit\"\n operations.each do |op|\n op.temporary[:output_sample] = {\"A\"=>1, \"B\"=>2}[op.temporary[:output_sample]]\n end \n end\n \n run_checks operations\n if KIT_NAME == \"uw kit\"\n uw_kit_introduction operations.running\n else\n kenya_kit_introduction operations.running\n end\n area_preparation \"pre-PCR\", MATERIALS, POST_PCR\n get_pcr_packages operations.running\n open_pcr_packages operations.running\n debug_table operations.running\n check_for_tube_defects sorted_ops.running\n # nuttada thaw\n # nuttada needs vortex + centrigure\n centrifuge_samples sorted_ops.running\n resuspend_pcr_mix sorted_ops.running\n add_template_to_master_mix sorted_ops.running\n cleanup sorted_ops\n start_thermocycler sorted_ops.running\n conclusion sorted_ops\n return {}\n end",
"def formation; end",
"def iiop_statistics\n super\n end",
"def start_operation(op_name)\n end",
"def cmd; end"
] |
[
"0.7538386",
"0.7538386",
"0.70927846",
"0.6371145",
"0.6371145",
"0.6371145",
"0.6226398",
"0.61545753",
"0.6110984",
"0.6107939",
"0.6107939",
"0.6034705",
"0.60021824",
"0.5908514",
"0.58837104",
"0.58732873",
"0.5843514",
"0.5820768",
"0.5820768",
"0.5820768",
"0.5795889",
"0.5795889",
"0.5795889",
"0.5795889",
"0.5795889",
"0.57879853",
"0.57816666",
"0.57816666",
"0.57816666",
"0.57816666",
"0.57816666",
"0.57816666",
"0.57816666",
"0.57816666",
"0.57657605",
"0.57657605",
"0.57626194",
"0.57626194",
"0.5747073",
"0.573773",
"0.5720062",
"0.569727",
"0.56898487",
"0.56898487",
"0.56898487",
"0.56898487",
"0.56898487",
"0.56898487",
"0.56898487",
"0.56898487",
"0.56819296",
"0.5638395",
"0.5638395",
"0.5638395",
"0.5602097",
"0.56017613",
"0.55983603",
"0.55857736",
"0.55857736",
"0.55857736",
"0.558262",
"0.558262",
"0.5560706",
"0.5560706",
"0.5560083",
"0.55554247",
"0.55554247",
"0.55220723",
"0.5518015",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.551024",
"0.54969263",
"0.54947734",
"0.54947734",
"0.5491059",
"0.54876155",
"0.5485276",
"0.5467562",
"0.54648566",
"0.5460195",
"0.54549915"
] |
0.0
|
-1
|
Some convenient accessor functions
|
def [](r); @registers[r]; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getters; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attr; end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def attr_reader(*)\n end",
"def getter\r\n @getter ||= Field.getter(@name)\r\n end",
"def [](field_name); end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def get(object); end",
"def accessors\n self.class.accessors\n end",
"def attribute(name); end",
"def value() end",
"def accessor\n @@accessor ||= nil\n @@accessor\n end",
"def attr_info; end",
"def _read_attribute(key); end",
"def attr(name); end",
"def getter_method_names; end",
"def my_attribute\n @my_attribute\n end",
"def instance_attributes; end",
"def read_field\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",
"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",
"def value; end",
"def value; 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 private; end",
"def get()\n \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 accessor(*args)\n attr_accessor(*args)\n args\n end",
"def get(name); end",
"def get(key)\n \n end",
"def values_for_properties; end",
"def valGetter\n \"#{DataMetaDom.getterName(@fld)}()\" + ( isMapping ? '.getKey()' : '')\n end",
"def value_read; end",
"def to_getter\n\t\t\t\tis_setter? ? self.to_s[0...-1].to_sym : self\n\t\t\tend",
"def reflection_or_attribute_name; end",
"def property(name); end",
"def attributes\n end",
"def read_attribute\n record.public_send(attribute)\n end",
"def raw_getter field\n val = self.instance_variable_get(\"@#{field}\")\n return nil if val.nil? == true || val == false\n\n if BOOL_ATTRIBUTES.include? field\n return field.to_s.gsub '_', '-' \n end\n\n if STR_ATTRIBUTES.include? field \n return val \n end\n\n if ARR_STR_ATTRIBUTES.include? field && val.empty? == false \n return val.join ' '\n end\n\n if SUB_STR_ATTRIBUTES.include? field \n return SUB_STR_ATTRIBUTES[field].sub '%sub%', val \n end \n end",
"def get_int(attr); end",
"def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def [](property); end",
"def getc()\n #This is a stub, used for indexing\n end",
"def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end",
"def properties\n self.values\n end",
"def get\n raise NotImplementedError\n end",
"def public_attributes\n attributes\n end",
"def attributes\n instance_values\n end",
"def age; @age; end",
"def [](attr)\n public_send(attr)\n end",
"def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end"
] |
[
"0.7933522",
"0.726432",
"0.726432",
"0.726432",
"0.726432",
"0.726432",
"0.726432",
"0.726432",
"0.6936425",
"0.6754643",
"0.6754643",
"0.6730236",
"0.664818",
"0.6643385",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6584442",
"0.6570931",
"0.6558544",
"0.65487146",
"0.65357137",
"0.653207",
"0.64735967",
"0.6446699",
"0.638857",
"0.6384064",
"0.6376192",
"0.632913",
"0.63174045",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.63131684",
"0.6285646",
"0.6285646",
"0.6285646",
"0.6285646",
"0.6285646",
"0.6285646",
"0.6285646",
"0.6285272",
"0.62644666",
"0.62486064",
"0.6241357",
"0.6218599",
"0.6215144",
"0.62087035",
"0.6197811",
"0.61819017",
"0.6178673",
"0.61693954",
"0.6161382",
"0.6138896",
"0.61261094",
"0.61214185",
"0.61103994",
"0.6106416",
"0.6092547",
"0.6092547",
"0.6092547",
"0.6092547",
"0.6092547",
"0.6092547",
"0.6092547",
"0.6092547",
"0.6063473",
"0.6051876",
"0.60362417",
"0.6022246",
"0.6016564",
"0.6002813",
"0.59959507",
"0.5967509",
"0.59653974",
"0.59511316"
] |
0.0
|
-1
|
Used to implement both addition and subtraction
|
def add(a,b)
ret1 = a + b
ret = ret1 & 0xff
self[0xF] = (ret1!=ret)?1:0
ret
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def +(addend)\n self.plus(addend).to_sub\n end",
"def add\n\t number_1 + number_2\n end",
"def addition (a, b)\n a + b\nend",
"def addition(a, b)\n\ta + b\nend",
"def addition(a,b)\n\ta + b\nend",
"def addition(a, b)\n\treturn a + b\nend",
"def plus(number, other)\n\tnumber + other\nend",
"def add_and_subtract(n1, n2)\r\n add = n1 + n2\r\n sub = n1 - n2\r\n {add: add, sub: sub}\r\nend",
"def add(a, b)\r\n a + b \r\n end",
"def add(val1, val2) val1 + val2 end",
"def addition(a, b) \n return a + b\nend",
"def addition (num1, num2)\n\tnum1 + num2\nend",
"def arithmetic2(a, b)\nend",
"def add one, two\r\n\tone + two\r\nend",
"def plus(x, y)\n\nend",
"def add(num1, num2)\r\n num1 + num2\r\n end",
"def add num1, num2\n num1 + num2\nend",
"def addition(num1, num2)\n num1 + num2\nend",
"def add(a,b)\n a + b\n end",
"def +(x); end",
"def add(tmp1, tmp2)\n tmp1 + tmp2\nend",
"def add (number1, number2)\n number1 +number2\nend",
"def add(int1, int2)\n int1 + int2\nend",
"def add(a, b) #a and b are the value of two number for addition\nreturn a+b\nend",
"def add (a, b) \n return a + b; \nend",
"def add(x, y)\n result = x + y \nend",
"def add(a, b)\n\ta + b\nend",
"def add(a, b)\n\ta + b\nend",
"def add(a, b)\n\ta + b\nend",
"def add(a, b)\n\ta + b\nend",
"def add(a, b)\n\ta + b \nend",
"def add (num_1, num_2)\n\n num_1 + num_2\n\nend",
"def plus(a, b)\n a + b\nend",
"def plus(a, b)\n a + b\nend",
"def add(first_num, second_num)\n @result = (first_num + second_num)\nend",
"def plus\n\n\t\t# we have to make sure we have enough elements to perform the operation by calling empty\n\t\tempty?\n\n\t\t# pop the num1 and num2 in order to take them from the back of the array as needed\n\t\tnum_1 = @calculator.pop\n\t\tnum_2 = @calculator.pop\n\n\t\t# the result of adding the nums are pushed into the @calc array\n\t\t@calculator << num_2 + num_1\n\tend",
"def add (num_one, num_two)\n num_one + num_two\nend",
"def addition(num_one, num_two)\n return num_one + num_two\nend",
"def + b\n 1.plus self.plus(b)\n end",
"def add(num_1, num_2)\n num_1 + num_2\nend",
"def addition(num1, num2)\n return num1 + num2\nend",
"def add ( num_1, num_2)\n num_1.to_i + num_2.to_i\nend",
"def add(num_one, num_two)\n num_one + num_two\nend",
"def add (num1, num2)\n num1 + num2\nend",
"def add(num1,num2)\n\treturn num1 + num2\nend",
"def add(num_1, num_2)\n num_1+num_2\nend",
"def add(term1, term2)\n return term1 + term2\nend",
"def addition(num1, num2)\n num1.to_i + num2.to_i\nend",
"def add(num_1, num_2)\n num_1+num_2\nend",
"def plus(number)\n @operation = '+' \n @number = number\nend",
"def add(one, two)\n\tone + two\nend",
"def add(num_1, num_2)\n\treturn num_1 + num_2\nend",
"def add(num1,num2)\n result = num1 + num2\nend",
"def add(num1,num2)\n result = num1 + num2\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(a, b)\n a + b\nend",
"def add(number_1, number_2)\n number_1 + number_2\nend",
"def add(num1, num2)\n result = num1 + num2\nend",
"def add(num1, num2)\n result = num1 + num2\nend",
"def add(num1, num2)\n return num1 + num2\n end",
"def addition\n expr = multiplication\n\n while match?(:minus, :plus)\n operator = previous\n right = multiplication\n expr = Ringo::Binary.new(expr, operator, right)\n end\n\n return expr\n end",
"def add (x, y)\n return x + y\nend",
"def add(num1,num2)\n num1 + num2 \nend",
"def add(num1,num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(a,b)\n a + b\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def subtractionm(num_1,num_2)\n return num_1 - num_2\nend",
"def add(num_1, num_2)\n\tresult = num_1 + num_2\n\treturn result\nend",
"def +(other); end",
"def +(other); end",
"def +(other); end",
"def add(num_1, num_2)\n sum = num_1 + num_2\nend",
"def subtract (a,b)\n return a-b\nend",
"def - b\n 2.plus self.plus(b)\n end",
"def add(a, b)\n a + b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend"
] |
[
"0.76660156",
"0.72986364",
"0.7241014",
"0.72101796",
"0.71551204",
"0.7151332",
"0.7119813",
"0.7087326",
"0.70708287",
"0.70606005",
"0.7054963",
"0.70482576",
"0.6990657",
"0.69749486",
"0.6954543",
"0.6927131",
"0.6923979",
"0.6921233",
"0.6903691",
"0.6889298",
"0.6871637",
"0.68649757",
"0.68598455",
"0.68573713",
"0.684806",
"0.6842473",
"0.68310225",
"0.68310225",
"0.68310225",
"0.68310225",
"0.6826594",
"0.681294",
"0.681265",
"0.681265",
"0.6800248",
"0.67990637",
"0.6798456",
"0.6794821",
"0.679106",
"0.6790851",
"0.67887634",
"0.67860997",
"0.67768013",
"0.6774451",
"0.6772516",
"0.67687094",
"0.67633617",
"0.67569435",
"0.67534304",
"0.6752227",
"0.6748936",
"0.6748213",
"0.6739726",
"0.6739726",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.6729615",
"0.67260456",
"0.6718254",
"0.6718254",
"0.67169213",
"0.67147297",
"0.671234",
"0.671013",
"0.6708197",
"0.6706995",
"0.6706995",
"0.6706995",
"0.6706995",
"0.6706995",
"0.6706995",
"0.669857",
"0.66979676",
"0.66979676",
"0.66979676",
"0.66979676",
"0.6695342",
"0.66949755",
"0.6694068",
"0.6694068",
"0.6694068",
"0.6692767",
"0.6691961",
"0.66897434",
"0.6688506",
"0.66828847",
"0.66828847"
] |
0.0
|
-1
|
rubocop:enable Metrics/MethodLength rubocop:disable Metrics/MethodLength
|
def alb_5xx_datapoints
@alb_5xx_datapoints ||= cloudwatch_client.get_metric_statistics(
namespace: 'AWS/ApplicationELB',
metric_name: 'HTTPCode_Target_5XX_Count',
dimensions: [
{
name: 'LoadBalancer',
value: ENV['LOGIN_ALB_LOAD_BALANCER_NAME'],
},
],
start_time: twenty_four_hours_ago.dup,
end_time: TIME_ZONE.now,
period: 300,
statistics: ['Sum'],
).datapoints.sort_by(&:timestamp)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def custom; end",
"def custom; end",
"def offences_by; end",
"def suivre; end",
"def strategy; end",
"def used?; end",
"def private_method\n end",
"def operations; end",
"def operations; end",
"def isolated; end",
"def isolated; end",
"def intensifier; end",
"def extra; end",
"def internal; end",
"def missing; end",
"def formation; end",
"def who_we_are\r\n end",
"def initialize\n\n end",
"def initialize\n\n end",
"def overrides; end",
"def celebration; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n \n end",
"def villian; end",
"def ignores; end",
"def initialize\n \n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def spec; end",
"def spec; end",
"def initialize\n super()\n end",
"def anchored; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def initialize\n\t\t\n\tend",
"def weber; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def terpene; end",
"def same; end",
"def operation; end",
"def verdi; end",
"def common\n \n end",
"def initialize() end",
"def wrapper; end",
"def missing?; end",
"def initialize\r\n\r\n end",
"def relatorios\n end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def internship_passed; end",
"def processor; end",
"def ignore; end",
"def returns; end",
"def identify; end",
"def appraisals; end",
"def appraisals; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n # nothing here for now\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def sitemaps; end",
"def under_construction\n end"
] |
[
"0.78097546",
"0.6550692",
"0.6393907",
"0.6393907",
"0.63413805",
"0.6341239",
"0.6341239",
"0.6341239",
"0.6341239",
"0.63261473",
"0.6132386",
"0.6132386",
"0.6035665",
"0.60181385",
"0.59858197",
"0.597906",
"0.59612405",
"0.58933866",
"0.58933866",
"0.5888103",
"0.5888103",
"0.5863022",
"0.5837961",
"0.58362275",
"0.5806279",
"0.5795523",
"0.5794152",
"0.5791959",
"0.5791959",
"0.5769047",
"0.5761127",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5760442",
"0.5757446",
"0.57485706",
"0.57399124",
"0.5737555",
"0.572034",
"0.572034",
"0.572034",
"0.57172394",
"0.57172394",
"0.5709601",
"0.5702412",
"0.5697405",
"0.5697405",
"0.5697405",
"0.5697405",
"0.5697184",
"0.5695819",
"0.5695533",
"0.5695533",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.5680522",
"0.56670296",
"0.566359",
"0.5655269",
"0.56464344",
"0.56259644",
"0.5616344",
"0.56120664",
"0.5611277",
"0.56054115",
"0.56052166",
"0.5599771",
"0.5599771",
"0.5599771",
"0.5599771",
"0.55996317",
"0.5598495",
"0.5589104",
"0.5588666",
"0.5585893",
"0.5581739",
"0.5581739",
"0.5581481",
"0.5581481",
"0.5581481",
"0.5581481",
"0.55735034",
"0.55711466",
"0.55711466",
"0.55611944",
"0.5558025"
] |
0.0
|
-1
|
Restores a DB Instance to a point in time ==== Returns response: body:
|
def restore_db_instance_to_point_in_time(source_db_name, target_db_name, opts={})
request({
'Action' => 'RestoreDBInstanceToPointInTime',
'SourceDBInstanceIdentifier' => source_db_name,
'TargetDBInstanceIdentifier' => target_db_name,
:parser => Fog::Parsers::AWS::RDS::RestoreDBInstanceToPointInTime.new,
}.merge(opts))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def restore_db_instance_to_point_in_time( options = {} )\n raise ArgumentError, \"No :source_db_instance_identifier provided\" if options.does_not_have?(:source_db_instance_identifier)\n raise ArgumentError, \"No :target_db_instance_identifier provided\" if options.does_not_have?(:target_db_instance_identifier)\n\n params = {}\n params['SourceDBInstanceIdentifier'] = options[:source_db_instance_identifier]\n params['TargetDBInstanceIdentifier'] = options[:target_db_instance_identifier]\n\n if options.has?(:use_latest_restorable_time) && options.has?(:restore_time)\n raise ArgumentError, \"You cannot provide both :use_latest_restorable_time and :restore_time\"\n elsif options.has?(:use_latest_restorable_time)\n params['UseLatestRestorableTime'] = case options[:use_latest_restorable_time]\n when 'true', 'false'\n options[:use_latest_restorable_time]\n when true\n 'true'\n when false\n 'false'\n else\n raise ArgumentError, \"Invalid value provided for :use_latest_restorable_time. Expected boolean.\"\n end\n elsif options.has?(:restore_time)\n params['RestoreTime'] = options[:restore_time]\n end\n\n params['DBInstanceClass'] = options[:db_instance_class] if options.has?(:db_instance_class)\n params['Port'] = options[:port].to_s if options.has?(:port)\n params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone)\n\n return response_generator(:action => \"RestoreDBInstanceToPointInTime\", :params => params)\n end",
"def restore\n p \"Doing a restore ...\"\n params = {:instance_href => \"/api/clouds/907/instances/#{@instance2_id}\"}\n id = @test_client.backups.index(:lineage => \"ns_backup_test_lineage\").first.show.href.split(\"/\")[-1] # => to get the id\n task = @test_client.backups(:id => id).show.restore(params)\n return task\nend",
"def restore_db_instance_from_snapshot( options = {} )\n raise ArgumentError, \"No :db_snapshot_identifier provided\" if options.does_not_have?(:db_snapshot_identifier)\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier)\n raise ArgumentError, \"No :db_instance_class provided\" if options.does_not_have?(:db_instance_class)\n\n params = {}\n params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier]\n params['DBInstanceIdentifier'] = options[:db_instance_identifier]\n params['DBInstanceClass'] = options[:db_instance_class]\n\n params['Port'] = options[:port].to_s if options.has?(:port)\n params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone)\n\n return response_generator(:action => \"RestoreDBInstanceFromDBSnapshot\", :params => params)\n end",
"def restore_db\n\n begin\n self.rds.restore_db_instance_from_db_snapshot(new_snap.id,\n backup_server_id,\n {\"DBSubnetGroupName\" => @opts['db_subnet_group_name'],\n \"DBInstanceClass\" => @opts['db_instance_type'] } )\n rescue Exception => e\n raise MyRDSException.new(\"Error in #{self.class}:restore_db: #{e.class}: #{e}\")\n end\n\n end",
"def 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 restart(async: true)\n requires :identity\n\n data = service.restart_instance(identity)\n operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)\n operation.tap { |o| o.wait_for { ready? } unless async }\n end",
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def restore(id)\n http.put(\"#{endpoint_base}/#{id}/restore\") do |response|\n respond_with_object response\n end\n end",
"def reboot_db_instance( options = {} )\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier\n )\n params = {}\n params['DBInstanceIdentifier'] = options[:db_instance_identifier] if options.has?(:db_instance_identifier)\n\n return response_generator(:action => \"RebootDBInstance\", :params => params)\n end",
"def state\n @instance = Instance.find_by_instance_id(params[:id])\n @instance.state = params[:state] if params[:state]\n @instance.save\n \n \n respond_to do |format|\n format.html { redirect_to(instances_url) }\n format.xml { head :ok }\n end\n end",
"def backup(options = {})\n my_aws = {\n region: ENV['AWS_REGION'],\n access_method: 'api_key',\n access_key: ENV['AWS_API_KEY'],\n secret_key: ENV['AWS_SECRET_KEY']\n }\n conn = ::Skejuler::Aws::Connector.new(my_aws)\n\n rds = conn.rds # Aws RDS Client library\n\n rds.describe_db_instances\n instance_id = options.fetch(:instance_id)\n puts instance_id\n # do something on it\n\nend",
"def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end",
"def show\n @database = Database.find(params[:id])\n @database.refresh_database_state\n \n # If the rds was restored from a snapshot, a few fields have to be modify after becomes available: security_groups, password, size\n @database_client = @database.sync_agi_fields_to_rds unless @database.snapshot_id.blank?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @database }\n end\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get\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 reload!\n ensure_service!\n @grpc = service.get_session path\n @last_updated_at = Time.now\n self\n rescue Google::Cloud::NotFoundError\n labels = @grpc.labels.to_h unless @grpc.labels.to_h.empty?\n @grpc = service.create_session \\\n Admin::Database::V1::DatabaseAdminClient.database_path(\n project_id, instance_id, database_id\n ),\n labels: labels\n @last_updated_at = Time.now\n self\n end",
"def instance\n perform_request_with_object(:get, '/api/v1/instance', {}, Mastodon::Instance)\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 refresh!\n refresh_expiry\n save!\n end",
"def reload!\n @client = EspSdk::Api.new(@options)\n 'Reloaded!'\n end",
"def restore\n RESTORE\n end",
"def instance\n perform_request_with_object(:get, '/api/v1/instance', {},\n Mastodon::Instance)\n end",
"def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end",
"def refresh\n @server.make_json_request('show.refresh', tvdbid: @tvdbid)['message']\n end",
"def new\n @database = Database.new\n @restore_db_instance_from_db_snapshot = params[:restore_db_instance_from_db_snapshot] || false\n load_parameter_groups\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @database }\n end\n end",
"def populate\n response = @connection.dbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['instance']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @hostname = data[\"hostname\"]\n @created = data[\"created\"]\n @updated = data[\"updated\"]\n @flavor_id = data[\"flavor\"][\"id\"]\n @volume_size = data[\"volume\"][\"size\"]\n @status = data[\"status\"]\n true\n end",
"def reboot\n # There is no trackable status change for the instance being\n # rebooted, so it's up to CPI client to keep track of agent\n # being ready after reboot.\n # Due to this, we can't deregister the instance from any load\n # balancers it might be attached to, and reattach once the\n # reboot is complete, so we just have to let the load balancers\n # take the instance out of rotation, and put it back in once it\n # is back up again.\n @aws_instance.reboot\n end",
"def update_instance!\n\t\tself.last_attempted = Time.now\n\t\tself.save\n\tend",
"def restore_backup(backup_run_id, async: true)\n requires :identity\n\n data = service.restore_instance_backup(identity, backup_run_id)\n operation = Fog::Google::SQL::Operations.new(service: service).get(data.name)\n operation.tap { |o| o.wait_for { ready? } unless async }\n end",
"def restore(options = {})\n self.class.restore(id, options)\n end",
"def check_status\n response = $RDS.describe_db_instances(:db_instance_identifier => \"#{name}-#{Rails.env}\")\n status = response[:db_instances].first[:db_instance_status]\n if status == \"available\"\n self.url = response[:db_instances].first[:endpoint][:address]\n self.save\n end\n return status\n end",
"def refresh\n update_databases()\n render json: {message: \"Information will be updated shortly\"}, status: :ok\n end",
"def save_now( mask_exception = true ) \n begin\n result = CouchDB.put( uri, self )\n rescue Exception => e\n if mask_exception\n result = false\n else\n raise e\n end \n end\n \n if result && result['ok']\n update_version( result )\n self\n else \n result \n end \n end",
"def restore(restore_id, &block)\n get \"/restore/#{restore_id}/\", nil, &block\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 restart\n client.restart\n end",
"def reredisize_instance\n attrs = Redisable.as_json_for(self)\n key = Redisable.key_name_for(self.model_name.name, attrs, \"instance\")\n\n # binding.pry\n Rails.cache.write(key, self, expires_in: 1000.years)\n Redisable.enqueue(:reredisize_instance_metas, key)\n end",
"def modify_db_instance( options = {})\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier)\n\n # handle a former argument that was misspelled\n raise ArgumentError, \"Perhaps you meant :backup_retention_period\" if options.has?(:backend_retention_period)\n\n params = {}\n params['DBInstanceIdentifier'] = options[:db_instance_identifier]\n\n params[\"AllocatedStorage\"] = options[:allocated_storage].to_s if options.has?(:allocated_storage)\n params[\"DBInstanceClass\"] = options[:db_instance_class] if options.has?(:db_instance_class)\n params[\"Engine\"] = options[:engine] if options.has?(:engine)\n params[\"MasterUsername\"] = options[:master_username] if options.has?(:master_username)\n params[\"MasterUserPassword\"] = options[:master_user_password] if options.has?(:master_user_password)\n params[\"Port\"] = options[:port].to_s if options.has?(:port)\n params[\"DBName\"] = options[:db_name] if options.has?(:db_name)\n params[\"DBParameterGroupName\"] = options[:db_parameter_group_name] if options.has?(:db_parameter_group_name)\n params.merge!(pathlist(\"DBSecurityGroups.member\", [options[:db_security_groups]].flatten)) if options.has_key?(:db_security_groups)\n params[\"AvailabilityZone\"] = options[:availability_zone] if options.has?(:availability_zone)\n params[\"PreferredMaintenanceWindow\"] = options[:preferred_maintenance_window] if options.has?(:preferred_maintenance_window)\n params[\"BackupRetentionPeriod\"] = options[:backup_retention_period].to_s if options.has?(:backup_retention_period)\n params[\"PreferredBackupWindow\"] = options[:preferred_backup_window] if options.has?(:preferred_backup_window)\n\n return response_generator(:action => \"ModifyDBInstance\", :params => params)\n end",
"def create_snapshot(rds_resource, db_instance_name)\n id = \"snapshot-#{rand(10**6)}\"\n db_instance = rds_resource.db_instance(db_instance_name)\n db_instance.create_snapshot({\n db_snapshot_identifier: id\n })\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create DB instance snapshot #{id}:\\n #{e.message}\"\nend",
"def restart_d_b_instance(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RestartDBInstance'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def restore_save version\n @body = version.body\n end",
"def restore_db(db_instance_identifier, restore_from, options = {})\n raise RDSInstanceAlreadyExist if does_db_exist?(db_instance_identifier)\n\n db_snapshot_identifier =\n options[:db_snapshot_identifier].nil? ? find_latest_snapshot(restore_from) : options[:db_snapshot_identifier]\n options[:db_instance_identifier] = db_instance_identifier\n options[:db_snapshot_identifier] = db_snapshot_identifier\n @rds.restore_db_instance_from_db_snapshot(options)\n @rds.wait_until(:db_instance_available, db_instance_identifier: db_instance_identifier)\n end",
"def save!\n raise \"A database must be setted\" unless self.database\n response = id.nil? ? self.database.post( self ) : self.database.put( self )\n pristine_copy\n response\n end",
"def reload\n self.attributes = Connection.get(create_route(:get)).body['data']\n self\n end",
"def modify_db_instance(options)\n options[:apply_immediately] = options[:apply_immediately].nil? ? true : options[:apply_immediately]\n options[:copy_tags_to_snapshot] = options[:copy_tags_to_snapshot].nil? ? true : options[:copy_tags_to_snapshot]\n\n @rds.modify_db_instance(options)\n end",
"def get_instance(payload)\n RestoreAssistantInstance.new(@version, payload)\n end",
"def refresh(call)\n call.body = fetch(call.query)\n call.save!\n call\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 execute_restore_stripe(options={})\n new_vol_name = \"#{options[:lineage]}-#{ENV['EC2_INSTANCE_ID']}\"\n json_result = self.find_latest_ebs_backup(options[:lineage], options[:from_master], options[:timestamp])\n\n if json_result.nil? \n STDERR.puts \"No existing snapshot found for the specified nickname lineage. Aborting...\"\n exit(-1)\n end\n STDERR.puts \"Restoring.. #{json_result.inspect}\"\n options[:new_size_gb] = (options[:new_volume_size_in_gb] / json_result.size.to_f).ceil if options[:new_volume_size_in_gb]\n\n @disk.sync\n @disk.umount\n @disk.disable_volume\n\n self.execute_terminate_volumes if options[:force]\n\n json_result.each do |snapshot|\n \n# create volume from snap\n create_result = ( options[:new_size_gb] ? create_volume_from_snap_size_gb(snapshot[\"aws_id\"],new_vol_name,options[:new_size_gb] ) : create_volume_from_snap(snapshot[\"aws_id\"], new_vol_name ) )\n raise \"FATAL: error occured in create_volume_from_snap(#{snapshot['aws_id']}, #{new_vol_name})\" if create_result.nil?\n\n# attach volume to instance\n retry_seconds = 0\n while retry_seconds < 200\n begin \n attach_result = attach_volume(create_result['aws_id'], snapshot['device'])\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n break if attach_result\n rescue => e\n puts \"CAUGHT EXCEPTION in execute_restore_stripe. Device attachment. #{e}, Retrying #{retry_seconds} of 200 seconds\"\n retry_seconds += 30\n sleep 30 \n end\n end\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n end\n\n# wait for devices to attach, after completing ALL the api calls\n json_result.each { |s| wait_for_attachment(s['device']) }\n @disk.enable_volume\n raise \"FATAL: mount failed!\" unless @disk.mount\n @disk.write_fstab\n# TODO - grow the filesystem if a new size was given\n end",
"def persist\n connection.resource(:post, 'persist', 'CLUSTER_CURRENT_STATUS' => { 'clusterState' => 'CLUSTER_STARTED_5' }.to_json)\n end",
"def recover(instance_id, backup_path, handles, &blk)\n @logger.debug(\"Recover instance: #{instance_id} from #{backup_path} with handles #{handles.inspect}.\")\n prov_handle, binding_handles = find_instance_handles(instance_id, handles)\n @logger.debug(\"Provsion handle: #{prov_handle.inspect}. Binding_handles: #{binding_handles.inspect}\")\n request = prov_handle[\"configuration\"]\n provision_service(request, prov_handle) do |msg|\n if msg['success']\n updated_prov_handle = msg['response']\n # transfrom handle format\n updated_prov_handle[:configuration] = updated_prov_handle[:data]\n updated_prov_handle.delete(:data)\n updated_prov_handle = hash_sym_key_to_str(updated_prov_handle)\n @logger.info(\"Recover: Success re-provision instance. Updated handle:#{updated_prov_handle}\")\n @update_handle_callback.call(updated_prov_handle) do |update_res|\n if not update_res\n @logger.error(\"Recover: Update provision handle failed.\")\n blk.call(internal_fail)\n else\n @logger.info(\"Recover: Update provision handle success.\")\n restore_instance(instance_id, backup_path) do |res|\n if res['success']\n @logger.info(\"Recover: Success restore instance data.\")\n barrier = VCAP::Services::Base::Barrier.new(:timeout => @node_timeout, :callbacks => binding_handles.length) do |responses|\n @logger.debug(\"Response from barrier: #{responses}.\")\n updated_handles = responses.select{|i| i[0] }\n if updated_handles.length != binding_handles.length\n @logger.error(\"Recover: re-bind or update handle failed. Expect #{binding_handles.length} successful responses, got #{updated_handles.length} \")\n blk.call(internal_fail)\n else\n @logger.info(\"Recover: recover instance #{instance_id} complete!\")\n result = {\n 'success' => true,\n 'response' => \"{}\"\n }\n blk.call(result)\n end\n end\n @logger.info(\"Recover: begin rebind binding handles.\")\n bcb = barrier.callback\n binding_handles.each do |handle|\n bind_instance(instance_id, nil, handle) do |bind_res|\n if bind_res['success']\n updated_bind_handle = bind_res['response']\n updated_bind_handle = hash_sym_key_to_str(updated_bind_handle)\n @logger.info(\"Recover: success re-bind binding: #{updated_bind_handle}\")\n @update_handle_callback.call(updated_bind_handle) do |update_res|\n if update_res\n @logger.error(\"Recover: success to update handle: #{updated_prov_handle}\")\n bcb.call(updated_bind_handle)\n else\n @logger.error(\"Recover: failed to update handle: #{updated_prov_handle}\")\n bcb.call(false)\n end\n end\n else\n @logger.error(\"Recover: failed to re-bind binding handle: #{handle}\")\n bcb.call(false)\n end\n end\n end\n else\n @logger.error(\"Recover: failed to restore instance: #{instance_id}.\")\n blk.call(internal_fail)\n end\n end\n end\n end\n else\n @logger.error(\"Recover: failed to re-provision instance. Handle: #{prov_handle}.\")\n blk.call(internal_fail)\n end\n end\n rescue => e\n @logger.warn(e)\n blk.call(internal_fail)\n end",
"def save\n return if @vserver_hash.nil?\n put_rest \"vservers/#{@name}\", @vserver_hash.to_json, :content_type => \"application/json\"\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 restore\n end",
"def dissociate(instance_id)\n conn.service 'get', 'DissociateEips',\n :instance => instance_id,\n :'eips.1' => id\n promise(timeout:60){ wait_for :available }\n end",
"def reboot!\n reboot_instance(_id) && reload!\n end",
"def expiration_get\n @conn.get('/api/v1/backup-expiration/')\n end",
"def create_restore(request, &block)\n post \"/restore/\", request, &block\n end",
"def refresh\n json = JSON(Net::HTTP.get(URI.parse(base_url)))\n unpack(json)\n end",
"def resume\n\t\t@state = STATE_ONLINE\n\tend",
"def restore(server, options={})\n param = {\n :id => @id,\n :uniq_id => server.uniq_id\n }.merge options\n param[:force] = param[:force] ? 1 : 0\n data = Storm::Base::SODServer.remote_call '/Storm/Template/restore',\n param\n data[:reimaged]\n end",
"def refresh\n send_cmd \"refresh\"\n nil\n end",
"def refresh params\n ret = { success: true }\n return ret\n end",
"def update_restore(request, &block)\n put \"/restore/#{request[:restore_id]}/\", request, &block\n end",
"def retire!\n update!(retired: true)\n end",
"def rebalance\n Result.new(call(CMD_REBALANCE))\n end",
"def restore_agent\r\n Admin.restore params[:id]\r\n redirect_to :action => 'show_agents' \r\n end",
"def get_resource\n\t\t\tlogger.debug {\"ALLOCATING NEW RESOURCE --> #{ ActiveOrient.db_pool.size }\" }\n login = [ActiveOrient.default_server[:user] , ActiveOrient.default_server[:password]]\n server_adress = \"http://#{ActiveOrient.default_server[:server]}:#{ActiveOrient.default_server[:port]}\"\n\t\t\t RestClient::Resource.new(server_adress, *login)\n end",
"def refresh!\n dsl_options = cloud_provider.describe_instance(:instance_id => self.instance_id).dsl_options rescue {}\n self.dsl_options.merge!(dsl_options)\n self\n end",
"def restore!\n record = self.restore\n record.save!\n self.destroy\n return record\n end",
"def restore_d_b_instance(backup_id, d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RestoreDBInstance'\n\t\targs[:query]['BackupId'] = backup_id\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def reboot_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"reboot\"}.to_json\n )\n end",
"def create_ebs_backup(options = {})\n params = options.merge( { :commit => \"explicit\", :api_version => 1.0 } )\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_backup.js\", params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAPS: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_ebs_backup(#{options.inspect})\")\n end",
"def save\n timeout_retry(3, 3){\n write \"SAVE\\r\\n\"\n status_code_reply\n }\n end",
"def set_instance\n @instance = @workflow.instances.find(params[:instance_id])\n end",
"def set_rescate\n @rescate = Rescate.find(params[:id])\n end",
"def restore_checkpoint\n @api.send(\"world.checkpoint.restore()\")\n end",
"def sync_agi_fields_to_rds\n # you can only modify when the rds instances is available\n if state == 'available' and any_field_out_of_sync?\n rds_server = {\n :password => password,\n :allocated_storage => instance_storage,\n :multi_az => multi_az,\n :flavor_id => instance_class,\n :security_group_names => [self.security_group_name],\n# :security_group_names => ['dont-exist'], # this will produce a 422 from agifog\n }.reject!{|k,v| v.blank? }\n begin\n if database_client.update_attributes(rds_server)\n self.state = 'modifying'\n else\n self.state = 'error syncing'\n self.save\n end\n rescue\n database_client.errors.add(:base, \"It failed to update the attributes. #{rds_server.inspect}\")\n self.state = 'error syncing'\n self.save\n end\n \n database_client\n end\n end",
"def db_rest_call(method, *args)\n begin\n return @db_rest.send method, *args\n rescue\n self.connected = false\n return nil\n end\n end",
"def reboot_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: Class1InstanceApi.reboot ...'\n end\n # resource path\n local_var_path = '/reboot'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse2004'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['instanceId', 'token']\n\n new_options = opts.merge(\n :operation => :\"Class1InstanceApi.reboot\",\n :header_params => 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: Class1InstanceApi#reboot\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refresh\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n @job = @rest.get_rest(@job_uri)\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n\n @id ||= job['id']\n @status = job['status']\n @created_at = DateTime.parse(job['created_at'])\n @updated_at = DateTime.parse(job['updated_at'])\n @results = job['nodes']\n end",
"def refresh!\n self.data = client.get(path).data\n end",
"def set_instance\n @instance = Instance.find(params[:id])\n end",
"def set_instance\n @instance = Instance.find(params[:id])\n end",
"def set_instance\n @instance = Instance.find(params[:id])\n end",
"def set_instance\n @instance = Instance.find(params[:id])\n end",
"def set_instance\n @instance = Instance.find(params[:id])\n end",
"def set_instance\n @instance = Instance.find(params[:id])\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def refresh\n session.cluster.refresh\n rescue => e\n raise ConnectionFailed, e\n end",
"def restore_patron\r\n Admin.restore params[:id]\r\n redirect_to :action => 'show_patrons' \r\n end",
"def reload\n get\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 reload\n do_url 'reload', :put\n end",
"def renew\n @stream.drop if params.fetch(:force_drop, false)\n success(streams: @stream.api_model_data_create)\n end",
"def reset_state_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"reset-state\"}.to_json\n )\n end",
"def revert_to_snapshot(name)\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} revertToSnapshot #{vmx_path.shellescape} \\\"#{name}\\\" 2>&1\"\n output = `#{command}`\n\n response = Fission::Response.new :code => $?.exitstatus\n response.output = output unless response.successful?\n\n response\n end",
"def backup\n snapshot.clear and snapshot.replace(responses.deep_clone)\n end"
] |
[
"0.65107757",
"0.64428765",
"0.5883472",
"0.58691496",
"0.5715699",
"0.56337386",
"0.55387205",
"0.5503257",
"0.54875857",
"0.5471096",
"0.5401708",
"0.5356772",
"0.5354623",
"0.5327444",
"0.53171396",
"0.52862626",
"0.5278093",
"0.5264664",
"0.5261498",
"0.5260856",
"0.5252471",
"0.52371836",
"0.5225964",
"0.52189696",
"0.5218265",
"0.5194812",
"0.51827645",
"0.51645666",
"0.5149586",
"0.5145834",
"0.51294184",
"0.5112988",
"0.5110612",
"0.5083973",
"0.5078262",
"0.5075226",
"0.5072355",
"0.50561",
"0.5047775",
"0.5042706",
"0.5034609",
"0.50331193",
"0.49913064",
"0.4982118",
"0.4978636",
"0.49752995",
"0.4952953",
"0.4949256",
"0.49442768",
"0.49242544",
"0.49223432",
"0.49218678",
"0.4913734",
"0.48970455",
"0.48951018",
"0.48885784",
"0.4886166",
"0.48851538",
"0.48845145",
"0.48786983",
"0.4876535",
"0.48718393",
"0.48716757",
"0.48713076",
"0.48680207",
"0.48661256",
"0.48621705",
"0.48583317",
"0.48460323",
"0.48441464",
"0.48403645",
"0.48392066",
"0.48363766",
"0.48291764",
"0.48279232",
"0.4822005",
"0.48218924",
"0.48184934",
"0.481815",
"0.48159084",
"0.48099852",
"0.48071727",
"0.480129",
"0.47917977",
"0.47917977",
"0.47917977",
"0.47917977",
"0.47917977",
"0.47917977",
"0.47895125",
"0.47895125",
"0.47859228",
"0.47852743",
"0.47844854",
"0.4779732",
"0.47741967",
"0.47690424",
"0.4765671",
"0.47602358",
"0.47596797"
] |
0.6074114
|
2
|
Our handy snowman array ... that is slowly melting (oh no!)
|
def getWord()
File.open("./corncob_lowercase.txt"){|f|
line=nil
rand(1..58110).times{line=f.gets}
puts line
return line.chomp()
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mmarray()\r\n\t#Using splat operator to create an array filled with range 1-100\r\n\tnums = *(1..100)\r\n\r\n\t#Will use .map method to replace our numbers\r\n\t#Mapping (iterating over) each value in the array. Uses val as a variable for the value at each index position.\r\n\t#Using an IF statement inside the block to replace numbers divisible by 5 and 3 first.\r\n\t#Replaces divisible by 5 next, then divisble by 3\r\n\t#If not divisible by 5 or 3, just uses the current value.\r\n\tnums.map { |val| if val % 5 == 0 && val % 3 == 0\r\n\t\t\t\t\t\t'mined minds'\r\n\t\t\t\t\telsif\r\n\t\t\t\t\t\tval % 5 == 0\r\n\t\t\t\t\t\t'minds'\r\n\t\t\t\t\telsif\r\n\t\t\t\t\t\tval % 3 == 0\r\n\t\t\t\t\t\t'mined'\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tval\r\n\t\t\t\t\t\tend }\r\n\r\nend",
"def lcts(array)\nend",
"def magic_array(ma)\nma.flatten.sort.map{|n|n*2}.uniq.delete_if{|n|n%3==0}\nend",
"def sluggish_octopus(arr)\n lngest_fish = [arr.first]\n # debugger\n arr.each do |fish|\n # debugger\n lngest_fish = [fish] if fish.length > lngest_fish.first.length\n end\n lngest_fish\nend",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference = difference1 / 2\n difference.times do \n array << 0\n array << \"0\"\n end\n else\n end\n end\n arrays\n end",
"def map_to_square(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index] ** 2)\n index += 1 \n end\n return array\nend",
"def convert_song_original_array(song)\n song.map! do |lyric|\n word = lyric[0]\n number = lyric[1]\n (word * number).scan(word) # returns an array of instanaces of word\n end\n song.flatten!\n return song\nend",
"def magic_array(long)\n\tless_long = long.flatten\n\treversed = less_long.reverse\n\t\n\teven_numbers = reversed.map{ |i| i * 2 }\n\t\n\tmultiple_three = even_numbers.delete_if {|m| m % 3 == 0}\n\t\n\tno_duplicate = multiple_three.uniq\n\n\tsorted = no_duplicate.sort\n\treturn sorted\n\nend",
"def ionstable(assigned_bions_mzs_array, assigned_bions_intensities_array, assigned_yions_mzs_array, assigned_yions_intensities_array)\n\t\tionstable = Array.new\n\t\taa = Array.new\n\t\ty0 = Array.new\n\t\ty1 = Array.new\n\t\ty2 = Array.new\n\t\tb0 = Array.new\n\t\tb1 = Array.new\n\t\tb2 = Array.new\n\t\tfor i in 0..bions_array.length - 1\n\t\t\taa[i] = pep_seq[i..i]\n\t\t\t\n\t\t\tb0[i] = \"b(#{i+1})\"\n\t\t\tif assigned_bions_mzs_array[i][1]\n\t\t\t\tb1[i] = \"#{bions_array[i][1]} (#{assigned_bions_mzs_array[i][1]} : #{assigned_bions_intensities_array[i][1]})\"\n\t\t\telse\n\t\t\t\tb1[i] = bions_array[i][1]\n\t\t\tend\n\n\t\t\tif assigned_bions_mzs_array[i][2]\n\t\t\t\tb2[i] = \"#{bions_array[i][2]} (#{assigned_bions_mzs_array[i][2]} : #{assigned_bions_intensities_array[i][2]})\"\n\t\t\telse\n\t\t\t\tb2[i] = bions_array[i][2]\n\t\t\tend\n\t\t\t\n\t\t\ty0[i] = \"y(#{i+1})\"\n\t\t\tif assigned_yions_mzs_array[i][1]\n\t\t\t\ty1[i] = \"#{yions_array[i][1]} (#{assigned_yions_mzs_array[i][1]} : #{assigned_yions_intensities_array[i][1]})\"\n\t\t\telse\n\t\t\t\ty1[i] = yions_array[i][1]\n\t\t\tend\n\n\t\t\tif assigned_yions_mzs_array[i][2]\n\t\t\t\ty2[i] = \"#{yions_array[i][2]} (#{assigned_yions_mzs_array[i][2]} : #{assigned_yions_intensities_array[i][2]})\"\n\t\t\telse\n\t\t\t\ty2[i] = yions_array[i][2]\n\t\t\tend\n\t\tend\n\n\t\taa.push(pep_seq.last)\n\t\tb0.push('')\n\t\tb1.push('')\n\t\tb2.push('')\n\t\ty0.push('')\n\t\ty1.push('')\n\t\ty2.push('')\n\t\ty0.reverse!\n\t\ty1.reverse!\n\t\ty2.reverse!\n\t\tfor i in 0..bions_array.length\n\t\t\tionstable[i] = [aa[i], b0[i], b1[i], b2[i], y0[i], y1[i], y2[i]]\n\t\tend\t\n\t\t\n\t\treturn ionstable\n\tend",
"def cubed_values (array)\n\n cubed_array = array.map { | number | number ** 3 }\n return cubed_array\n\nend",
"def coin_array; end",
"def findlargestdrop(arr)\n\n\n\nend",
"def state_array\n %w(AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY)\nend",
"def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend",
"def mined_minds_array\r\n\tmy_array = []\r\n\t(1..100).each do |number|\r\n\t\tif number % 15 == 0\r\n\t\t\tnumber = \"minedminds\"\r\n\r\n\t\telsif number % 3 == 0\r\n\t\t\tnumber = \"mined\"\r\n\r\n\t\telsif number % 5 == 0\r\n\t\t\tnumber = \"minds\"\r\n\r\n\t\telse number = number\r\n\t\tend\r\n\t\tmy_array << number\r\n\t\tend\r\n\tmy_array\r\nend",
"def doubler(array)\r\n res = []\r\n array.each do |ele|\r\n res << ele * 2\r\n end\r\n res\r\nend",
"def sing(words)\n words.map do |word, number|\n number.times do\n song << word\n end\n end\nend",
"def countSheeps2 array\n array.count(true)\nend",
"def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend",
"def mtdarray\n\t10.times do |num|\n\t\tsquare = num + num\n\t\treturn num, square if num > 5\n\tend\nend",
"def cubes(arr)\n p cubies = arr.map {|n| n ** 3}\nend",
"def mtdarray\n\t10.times do |num|\n\t\tsquare = num * num\n\t\treturn num, square if num > 4\n\tend\nend",
"def mine_sweeper(bombs, num_rows, num_cols)\n result = Array.new(num_rows) {[0] * num_cols}\n\n for a,b in bombs do\n row_i, col_i = a, b \n result[row_i][col_i] = -1\n \n for i in (row_i - 1..row_i + 1) do\n for j in (col_i - 1..col_i + 1) do\n if (i >= 0 and i < num_rows) and (j >= 0 and j < num_cols) and result[i][j] != -1\n result[i][j] += 1\n end\n end\n end\n \n end\n result\nend",
"def virus(array_input)\n new_array = [ ]\n number_of_loops = array_input.length\n index = array_input.length - 1\n\n number_of_loops.times do \n new_array << array_input[index]\n index = index - 1 \n end \n\n output = new_array\n return output\nend",
"def virus(input_array)\n i = input_array.length-1 \n new_array = []\n\n input_array.length.times do \n new_array << input_array[i]\n i -= 1\n end \n return new_array\nend",
"def create_game_field_array\r\n\t\r\n\t\ti=0\r\n\t\twhile i < 8 do\r\n\t\t\tj=0\r\n\t\t\t\r\n\t\t\twhile j < 8 do\r\n\t\t\t #Copy the \".\" object in the actual Position of the 2 dimensional Array \r\n\t \t @nha[i][j] =\".\"\t\t\r\n\t\t\t\tj+=1\t\t\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\treturn true\r\n\tend",
"def strand; @data[8]; end",
"def array_nl()\n #This is a stub, used for indexing\n end",
"def doubler(array)\n array.map { |num| num * 2 }\nend",
"def doubler(array)\n array.map { |num| num * 2 }\nend",
"def converted_arrays; end",
"def initialize(seed)\n @index = 0\n @mt = []\n @mt[0] = seed\n (1...ARRAY_LENGTH).each do |i|\n @mt[i] = (2 **32 -1) & (INIT_CONST * (@mt[i-1] ^ (@mt[i-1] >> 30)) + i)\n end\n end",
"def kesha_maker(array)\n kesha_array = []\n i = 0\n array.each do |name|\n kesha_array.push(name[2] = \"$\")\n end\nend",
"def map_to_double(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index] * 2)\n index += 1 \n end\n return array\nend",
"def doubler(arr)\n new = []\n arr.each do |i|\n new << i*2\n end\n return new\nend",
"def second_great_low(arr)\r\n\r\nend",
"def map_to_square(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array_value = source_array[i] ** 2\n new_array << new_array_value\n \n i += 1\n end\n \n new_array\nend",
"def magic_array(array)\narray.flatten.reverse.map! {|i| i = i*2}.delete_if {|i| i.modulo(3) == 0}.uniq.sort\nend",
"def Array(p0) end",
"def ject(ary)\nr = [ary]\nw = []\n\nr.flatten.each do |y| \n\tif y == 0\n\t\tw << 0\n\telse\n\t\t3.times {|idx| w << ( y / (idx + 2) )}\n\tend\nend\nw\nend",
"def calculate_doubles(array)\n\tmapped_array = array.map { |num| num * 2 }\nend",
"def array_flash(n)\nhash = Hash[\n'&','name: Set Intersection---Returns a new array\ncontaining elements common to the two arrays, with no duplicates.\n\n [ 1, 1, 3, 5 ] _____ [ 1, 2, 3 ] #=> [ 1, 3 ]' ,\n'*','name: Repetition---With a String argument, equivalent to\nself.join(str). Otherwise, returns a new array\nbuilt by concatenating the _int_ copies of self.\n[ 1, 2, 3 ] _____ 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]\n[ 1, 2, 3 ] _____\",\" #=> \"1,2,3\" ',\n'+','name: Concatenation---Returns a new array built by concatenating the\ntwo arrays together to produce a third array.',\n'-','Array Difference---Returns a new array that is a copy of\nthe original array, removing any items that also appear in\nother_ary.\n [ 1, 1, 2, 2, 3, 3, 4, 5 ]____[ 1, 2, 4 ] #=> [ 3, 3, 5 ]',\n'<=>','Comparison---Returns an integer (-1, 0,\nor +1) if this array is less than, equal to, or greater than\nother_ary.\n[ \"a\", \"a\", \"c\" ] _____[ \"a\", \"b\", \"c\" ] #=> -1\n [ 1, 2, 3, 4, 5, 6 ]______[ 1, 2 ] #=> +1',\n 'any?','Passes each element of the collection to the given block. The method\nreturns true if the block ever returns a value other\nthan false or nil. If the block is not\ngiven, Ruby adds an implicit block of {|obj| obj} (that\nis any? will return true if at least one\nof the collection members is not false or\nnil.\n%w{ant bear cat}._____ {|word| word.length >= 3} #=> true\n %w{ant bear cat}._____ {|word| word.length >= 4} #=> true\n [ nil, true, 99 ]._____ #=> true',\n'assoc','Searches through an array whose elements are also arrays\ncomparing _obj_ with the first element of each contained array\nusing obj.==.\nReturns the first contained array that matches (that\nis, the first associated array),\nor nil if no match is found.\n s1 = [ \"colors\", \"red\", \"blue\", \"green\" ]\n s2 = [ \"letters\", \"a\", \"b\", \"c\" ]\n s3 = \"foo\"\n a = [ s1, s2, s3 ]\n a._______ #=> [ \"letters\", \"a\", \"b\", \"c\" ]\n a._______ #=> nil(foo is not an array)',\n'clear','Removes all elements from self\na = [ \"a\", \"b\", \"c\", \"d\", \"e\" ] \n______ #=> [ ]',\n'combination','When invoked with a block, yields all combinations of length n\nof elements from ary and then returns ary itself.\nThe implementation makes no guarantees about the order in which\nthe combinations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n a = [1, 2, 3, 4]\n a.______(1).to_a #=> [[1],[2],[3],[4]]\n a.______(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]\n a.______(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]\n a.______(4).to_a #=> [[1,2,3,4]]\n a.______(0).to_a #=> [[]] # one combination of length 0\n a.______(5).to_a #=> [] # no combinations of length 5',\n'compact','Returns a copy of self with all nil elements removed.\n [ \"a\", nil, \"b\", nil, \"c\", nil ]._________ #=> [ \"a\", \"b\", \"c\" ]',\n'concat','Appends the elements of other_ary to SELF.\n[ \"a\", \"b\" ]._________( [\"c\", \"d\"] ) #=> [ \"a\", \"b\", \"c\", \"d\" ]',\n'','Returns the number of elements. If an argument is given, counts\nthe number of elements which equals to obj. If a block is\ngiven, counts the number of elements yielding a true value.\n \tary = [1, 2, 4, 2]\n ary._______ #=> 4\n ary._______(2) #=> 2\n ary._______{|x|x%2==0} #=> 3',\n'cycle','Calls block for each element repeatedly _n_ times or\nforever if none or nil is given. If a non-positive number is\ngiven or the array is empty, does nothing. Returns nil if the\nloop has finished without getting interrupted.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [\"a\", \"b\", \"c\"]\n a.______ {|x| puts x } # print, a, b, c, a, b, c,.. forever.\n a.______(2) {|x| puts x } # print, a, b, c, a, b, c.',\n'delete','\nDeletes items from self that are equal to obj.\nIf any items are found, returns obj. If\nthe item is not found, returns nil. If the optional\ncode block is given, returns the result of block if the item\nis not found. (To remove nil elements and\nget an informative return value, use #compact!)\na = [ \"a\", \"b\", \"b\", \"b\", \"c\" ]\n a.______(\"b\") #=> \"b\"\n a #=> [\"a\", \"c\"]\n a.______(\"z\") #=> nil\n a.______(\"z\") { \"not found\" } #=> \"not found\"',\n'delete_at','Deletes the element at the specified index, returning that element,\nor nil if the index is out of range. See also\nArray#slice!\na = %w( ant bat cat dog )\n a._______(2) #=> \"cat\"\n a #=> [\"ant\", \"bat\", \"dog\"]\n a._______(99) #=> nil',\n'_____','Deletes every element of self for which block evaluates\nto true.\nThe array is changed instantly every time the block is called and\nnot after the iteration is over.\nSee also Array#reject!\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._____ {|x| x >= \"b\" } #=> [\"a\"]',\n 'dig','Retrieves the value object corresponding to the each key objects \n repeatedly.\n h = { foo: {bar: {baz: 1}}}\nh.________(:foo, :bar, :baz) #=> 1\nh.________(:foo, :zot) #=> nil',\n 'drop','removes first n elements from ary and returns the rest of\nthe elements in an array.\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [4, 5, 0]',\n 'drop_while','removes first elements until the statement is false then returns\n an array with the remaining.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]',\n 'each','passes block once for each element in self, passing that\nelement as a parameter.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.______{|x| print x, \" -- \" } #=> a -- b -- c --',\n 'each_index','passes the index of the element\ninstead of the element itself.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [ \"a\", \"b\", \"c\" ]\n a.________ {|x| print x, \" -- \" } #=> 0 -- 1 -- 2 --',\n 'empty?','\nReturns true if self contains no elements.\n\n [].empty? #=> true',\n 'fetch','Tries to return the element at position index. If the index\nlies outside the array, the first form throws an\nIndexError exception, the second form returns\ndefault, and the third form returns the value of invoking\nthe block, passing in the index. Negative values of index\ncount from the end of the array.\n\n a = [ 11, 22, 33, 44 ]\n a.______(1) #=> 22\n a.______(-1) #=> 44\n a.______(4, \"cat\") #=> \"cat\"\n a.______(4) { |i| i*i } #=> 16',\n'fill','The first three forms set the selected elements of self (which\nmay be the entire array) to obj. A start of\nnil is equivalent to zero. A length of\nnil is equivalent to self.length. The last three\nforms fill the array with the value of the block. The block is\npassed the absolute index of each element to be filled.\nNegative values of start count from the end of the array.\n\n a = [ \"a\", \"b\", \"c\", \"d\" ]\n a._____(\"x\") #=> [\"x\", \"x\", \"x\", \"x\"]\n a._____(\"z\", 2, 2) #=> [\"x\", \"x\", \"z\", \"z\"]\n a._____(\"y\", 0..1) #=> [\"y\", \"y\", \"z\", \"z\"]\n a._____ {|i| i*i} #=> [0, 1, 4, 9]\n a._____(-2) {|i| i*i*i} #=> [0, 1, 8, 27]',\n ['index','find_index'],'Returns the index of the first object in self such that the object is\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is true.\nReturns nil if no match is found.\nSee also Array#rindex.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.index(\"b\") #=> 1\n a.index(\"z\") #=> nil\n a.index{|x|x==\"b\"} #=> 1',\n 'flatten','Returns a new array that is a one-dimensional _______ of this\narray (recursively). That is, for every element that is an array,\nextract its elements into the new array. If the optional\nlevel argument determines the level of recursion to _______.\n\n s = [ 1, 2, 3 ] #=> [1, 2, 3]\n t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]\n a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]\n a._______ #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n a = [ 1, 2, [3, [4, 5] ] ]\n a._______(1) #=> [1, 2, 3, [4, 5]]',\n 'frozen?','Returns the freeze status of obj.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.freeze #=> [\"a\", \"b\", \"c\"]\n a.frozen? #=> true',\n 'include?','Returns true if the given object is present in\nself (that is, if any object == anObject),\nfalse otherwise.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._______(\"b\") #=> true\n a._______(\"z\") #=> false',\n 'insert','adds the given values before the element with the given index\n(which may be negative).\n\n a = %w{ a b c d }\n a._______(2, 99) #=> [\"a\", \"b\", 99, \"c\", \"d\"]\n a._______(-2, 1, 2, 3) #=> [\"a\", \"b\", 99, \"c\", 1, 2, 3, \"d\"] ',\n \"inspect\",\"Creates a string representation of self. like puts but as a method\",\n \"join\",\"Returns a string created by converting each element of the array to\na string, separated by sep.\n\n [ 'a', 'b', 'c' ].______ #=> 'abc'\n [ 'a', 'b', 'c' ].______('-') #=> 'a-b-c' \",\n \"keep_if\",\"Deletes every element of self for which block evaluates\nto false.\nSee also Array#select!\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a._______ {|v| v =~ /[aeiou]/} #=> ['a', 'e']\",\n \"last\",\"Returns the last element(s) of self. If the array is empty,\nthe first form returns nil.\n\n a = [ 'w', 'x', 'y', 'z' ]\n a.______ #=> 'z'\n a.______(2) #=> ['y', 'z']\",\n [\"collect!\",\"map!\"],\" Invokes the block once for each element of self, replacing the\nelement with the value returned by _block_.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ {|x| x + '!' }\n a #=> [ 'a!', 'b!', 'c!', 'd!' ] \",\n \"permutation\",\"When invoked with a block, yield all permutations of length n\nof the elements of ary, then return the array itself.\nIf n is not specified, yield all permutations of all elements.\nThe implementation makes no guarantees about the order in which\nthe permutations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a._______.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(1).to_a #=> [[1],[2],[3]]\n a._______(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]\n a._______(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(0).to_a #=> [[]] # one _______ of length 0\n a._______(4).to_a #=> [] # no _______s of length 4\",\n \"place\",\" Places values before or after another object (by value) in\nan array. This is used in tandem with the before and after\nmethods of the {Insertion} class.\n\nexample _______ an item before another\n [1, 2, 3].place(4).before(3) # => [1, 2, 4, 3]\nexample _______ an item after another\n [:a, :b, :c].place(:x).after(:a) # => [:a, :x, :b, :c]\nparam [Array] values value to insert\nreturn [Insertion] an insertion object to\",\n \"pop\",\"Removes the last element from self and returns it, or\nnil if the array is empty.\n\nIf a number _n_ is given, returns an array of the last n elements\n(or less) just like array.slice!(-n, n) does.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ #=> 'd'\n a.______(2) #=> ['b', 'c']\n a #=> ['a'] \",\n \"product\",\"Returns an array of all combinations of elements from all arrays.\nThe length of the returned array is the product of the length\nof self and the argument arrays.\nIf given a block, product will yield all combinations\nand return self instead.\n\n\n [1,2,3].______([4,5]) #=> [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]\n [1,2].______([1,2]) #=> [[1,1],[1,2],[2,1],[2,2]]\n [1,2].______([3,4],[5,6]) #=> [[1,3,5],[1,3,6],[1,4,5],[1,4,6],\n # [2,3,5],[2,3,6],[2,4,5],[2,4,6]]\n [1,2].______() #=> [[1],[2]]\n [1,2].______([]) #=> [] \",\n \"rassoc\",\" Searches through the array whose elements are also arrays. Compares\n_obj_ with the second element of each contained array using\n==. Returns the first contained array that matches.\n a = [ [ 1, 'one'], [2, 'two'], [3, 'three'], ['ii', 'two'] ]\n a.rassoc('two') #=> [2, 'two']\n a.rassoc('four') #=> nil \",\n [\"reject\",\"delete_if\"], \"Returns a new array containing the items in self\nfor which the block is not true.\nIf no block is given, an enumerator is returned instead.\",\n \"repeated_combination\",\"When invoked with a block, yields all repeated combinations of\nlength n of elements from ary and then returns\nary itself.\nThe implementation makes no guarantees about the order in which\nthe ______________ are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a.___________(1).to_a #=> [[1], [2], [3]]\n a.___________(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]\n a.___________(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],\n # [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]\n a.___________(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],\n # [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],\n # [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]\n a.___________(0).to_a #=> [[]] # one ________ of length 0\",\n \"repeated_permutation\",\"When invoked with a block, yield all repeated permutations of length\nn of the elements of ary, then return the array itself.\nThe implementation makes no guarantees about the order in which\nthe ___________are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2]\n a._______(1).to_a #=> [[1], [2]]\n a._______(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]\n a._______(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],\n # [2,1,1],[2,1,2],[2,2,1],[2,2,2]]\n a._______(0).to_a #=> [[]] # one ___________of length 0\",\n \"replace\",\" Replaces the contents of self with the contents of\nother_ary, truncating or expanding if necessary.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a.______([ 'x', 'y', 'z' ]) #=> ['x', 'y', 'z']\n a #=> ['x', 'y', 'z'] #its like reassigning the variable\",\n \"reverse!\",\"\nReverses SELF in place.\n\n a = [ 'a', 'b', 'c' ]\n a._______ #=> ['c', 'b', 'a']\n a #=> ['c', 'b', 'a'] \",\n \"reverse_each\",\"Same as Array#each, but traverses self in reverse\norder.\n\n a = [ 'a', 'b', 'c' ]\n a.______ {|x| print x, ' ' } #=> c b a\",\n \"rindex\",\" Returns the index of the LAST object in self\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is\ntrue, starting from the last object.\nReturns nil if no match is found.\nSee also Array#index.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'b', 'b', 'c' ]\n a.______('b') #=> 3\n a.______('z') #=> nil\n a.______ { |x| x == 'b' } #=> 3\",\n \"rotate\",\"Returns new array by rotating self so that the element at\ncnt in self is the first element of the new array. If cnt\nis negative then it rotates in the opposite direction.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a._______ #=> ['b', 'c', 'd', 'a']\n a #=> ['a', 'b', 'c', 'd']\n a._______(2) #=> ['c', 'd', 'a', 'b']\n a._______(-3) #=> ['b', 'c', 'd', 'a'] \",\n \"sample\",\"Choose a random element or n random elements from the array. The elements\nare chosen by using random and unique indices into the array in order to\nensure that an element doesn't repeat itself unless the array already\ncontained duplicate elements. If the array is empty the first form returns\nnil and the second form returns an empty array.\n\nIf rng is given, it will be used as the random number generator.\",\n \"select\",\"Invokes the block passing in successive elements from self,\nreturning an array containing those elements for which the block\nreturns a true value (equivalent to Enumerable#______).\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a.______ {|v| v =~ /[aeiou]/} #=> ['a', 'e'] \",\n \"shift\",\"Returns the first element of self and removes it (shifting all\nother elements down by one). Returns nil if the array\nis empty.\n\nIf a number _n_ is given, returns an array of the first n elements\n(or less) just like array.slice!(0, n) does.\n\n args = [ '-m', '-q', 'filename' ]\n args._______ #=> '-m'\n args #=> ['-q', 'filename']\n\n args = [ '-m', '-q', 'filename' ]\n args._______(2) #=> ['-m', '-q']\n args #=> ['filename'] \",\n \"shuffle\",\"Returns a new array with elements of this array ______.\n\n a = [ 1, 2, 3 ] #=> [1, 2, 3]\n a.______ #=> [2, 3, 1]\n\nIf rng is given, it will be used as the random number generator.\n\n a.______(random: Random.new(1)) #=> [1, 3, 2] \",\n [\"slice\",\"[]\"],\"Element Reference---Returns the element at _index_,\nor returns a subarray starting at _start_ and\ncontinuing for _length_ elements, or returns a subarray\nspecified by _range_.\nNegative indices count backward from the end of the\narray (-1 is the last element). Returns nil if the index\n(or starting index) are out of range.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a[2] + a[0] + a[1] #=> 'cab'\n a[6] #=> nil\n a[1, 2] #=> [ 'b', 'c' ]\n a[1..3] #=> [ 'b', 'c', 'd' ]\n a[4..7] #=> [ 'e' ]\n a[6..10] #=> nil\n a[-3, 3] #=> [ 'c', 'd', 'e' ]\n # special cases\n a[5] #=> nil\n a[5, 1] #=> []\n a[5..10] #=> []\",\n \"sort\",\"Returns a new array created by organizing self. Comparisons for\nthe _____ will be done using the <=> operator or using\nan optional code block. The block implements a comparison between\na and b, returning -1, 0, or +1. \n\n a = [ 'd', 'a', 'e', 'c', 'b' ]\n a.______ #=> ['a', 'b', 'c', 'd', 'e']\n a.______ {|x,y| y <=> x } #=> ['e', 'd', 'c', 'b', 'a'] \",\n [\"take\",\"first\"] ,\"Returns first n elements from ary.\n\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [1, 2, 3]\",\n \"take_while\",\"\nPasses elements to the block until the block returns nil or false,\nthen stops iterating and returns an array of all prior elements.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a._______{|i| i < 3 } #=> [1, 2] \",\n \"transpose\",\"Assumes that self is an array of arrays and rearranges the\nrows and columns.\n\n a = [[1,2], [3,4], [5,6]]\n a.________ #=> [[1, 3, 5], [2, 4, 6]]\",\n \"uniq\",\"Returns a new array by removing duplicate values in self. If a block\nis given, it will use the return value of the block for comparison.\n\n a = [ 'a', 'a', 'b', 'b', 'c' ]\n a.uniq # => ['a', 'b', 'c']\n\n b = [['student','sam'], ['student','george'], ['teacher','matz']]\n b.uniq { |s| s.first } # => [['student', 'sam'], ['teacher', 'matz']]\",\n \"unshift\",\"Prepends objects to the front of self,\nmoving other elements upwards.\n\n a = [ 'b', 'c', 'd' ]\n a.unshift('a') #=> ['a', 'b', 'c', 'd']\n a.unshift(1, 2) #=> [ 1, 2, 'a', 'b', 'c', 'd']\",\n \"values_at\",\"Returns an array containing the elements in\nself corresponding to the given selector(s). The selectors\nmay be either integer indices or ranges.\nSee also Array#select.\n\n a = %w{ a b c d e f }\n a._______(1, 3, 5)\n a._______(1, 3, 5, 7)\n a._______(-1, -3, -5, -7)\n a._______(1..3, 2...5) \",\n\"zip\",\"Converts any arguments to arrays, then merges elements of\nself with corresponding elements from each argument. This\ngenerates a sequence of self.size n-element\narrays, where n is one more that the count of arguments. If\nthe size of any argument is less than enumObj.size,\nnil values are supplied. If a block is given, it is\ninvoked for each output array, otherwise an array of arrays is\nreturned.\n\n a = [ 4, 5, 6 ]\n b = [ 7, 8, 9 ]\n [1,2,3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]\n [1,2].zip(a,b) #=> [[1, 4, 7], [2, 5, 8]]\n a.zip([1,2],[8]) #=> [[4,1,8], [5,2,nil], [6,nil,nil]] \",\n \"|\",\"Set Union---Returns a new array by joining this array with\nother_ary, removing duplicates.\n\n [ 'a', 'b', 'c' ] | [ 'c', 'd', 'a' ]\n #=> [ 'a', 'b', 'c', 'd' ] \",\n]\n\n\n\n\n\n\n\na = 0\n\tuntil a == n\n\tindex = rand(hash.size)\n\tquestion = hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\n\tp \"which Array method is this?\"\n\tp ''\n\tp question.split.join(' ')#.gsub(/\\\\n/, \" \").gsub(/\\\\/,\" \")\n\t\n\tinput = gets.chomp\n\t\tuntil hash.keys[index].include?(input)\n\t\t\tbreak if ['idk', 'i dont know', 'i give up'].include?(input)\n\t\t\tp ''\n\t\t\tp hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\t\tp ''\n\t\t\tp '!!!!!!!!! try again !!!!!!!!!!'\n\t\t\t\n\t\t\tinput = gets.chomp \n\t\tend\n\t\t\n\t\tp \"\"\n\t\tp \"------------- good job it is #{hash.keys[index]}-----------------\"\n\t\t\n\t\thash.delete((hash.keys[index]))\n\t\ta += 1\n\tend\n\np '~~~~~~~~~~ you finished ~~~~~~~~~~~~~~~~~'\n\nend",
"def buy_fruit(array)\n final_array = []\n array.each do |subarray|\n subarray[1].times do |_|\n final_array << subarray[0]\n end\n end\n final_array\nend",
"def inject_evil_symbols(array)\n array.insert(\n rand(0..array.length),\n [rand(9999), 9999]\n ).flatten!\nend",
"def sluggish_octopus(array)\n longest_fish = array[0]\n (0...array.length).each do |idx1|\n (idx1...array.length).each do |idx2|\n if array[idx1] < array[idx2] \n longest_fish = array[idx2]\n else\n longest_fish = array[idx1]\n end\n end\n end\n longest_fish\nend",
"def magic_array(arr)\n arr.flatten.sort.uniq.map{|x| x*2}\nend",
"def names_two(names)\n\t\tnames.map{ |i| %Q('#{i}') }.join(',')\n\t\tnames = names.map(&:capitalize)\n\t\tlittle_array = []\n\t\tsets = names.shuffle\n\tif names.length % 2 == 0\n\t\ta = names.length/2\n\t\ta.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\n\telse \n\t\textra = sets.pop\n\t\tb = names.length/2\n\t\tb.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\tlittle_array[0] << extra\nend\nclean_array = clean(little_array)\np clean_array\nend",
"def two_d_translate(array)\n new_arr = []\n array.each do |arr|\n arr[1].times {new_arr << arr[0]}\n end\n new_arr\nend",
"def magic_array (liste)\n\treturn liste.flatten.collect {|x| x * 2} .delete_if { |x| x%3 == 0 } .uniq .sort\nend",
"def square_array(pancakes)\n elephant = []\n pancakes.each do |num|\n elephant << num**2\n end\n return elephant\nend",
"def two_d_translate(arr)\r\n newArray = []\r\n arr.each do |ele|\r\n ele[1].times do\r\n newArray << ele[0]\r\n end\r\n end\r\n return newArray\r\nend",
"def kesha_maker(array)\n array.map do |string|\n string[2] = \"$\"\n end\n array\nend",
"def create_work_matrix(array)\n array[1..-2].each_with_object([]) do |line, arr|\n line.gsub!(/\\s/, '0')\n arr << line[1..-2].chars\n end.to_a\n end",
"def encodeing(array)\n i = 0\n freq = 0\n value = 0\n encoding = []\n while i < array.length\n freq = array[i]\n value = array[i + 1]\n freq.times { encoding << value }\n i += 2\n end\n encoding\nend",
"def guess_array\n @guess_array\n end",
"def rebuild_weight_array\n end",
"def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend",
"def got_milk?(array)\nend",
"def doubler(array)\n array.map do |num|\n num *= 2\n end\n\nend",
"def ary(n); Array.new(n){rand}; end",
"def my_array_function()\n\tmy_Array = []\n\tnumber = 0\n\t100.times do \n\t\tif \n\t\t\tnumber % 3 == 0\n\t\t\tmy_Array[number] = \"Mined\"\n\t\telsif\n\t\t\tnumber % 5 == 0\n\t\t\tmy_Array[number] = \"Minds\"\n\t\telsif \n\t\t\tnumber % 15 == 0\n\t\t\tmy_Array[number] = \"Mined Minds\"\n\t\telse\n\t\t\tmy_Array[number]= number\n\t\tend\n\tnumber = number + 1\n\tend\nmy_Array\nend",
"def buy_fruit(arr)\n new_arr = []\n\n arr.each { |element| element[1].times { |_| new_arr << element[0] } }\n p new_arr\nend",
"def josephus(items,k)\n n = -1\n out = []\n while items.length > 0 do \n n = (n + k) % items.length \n out.push(items.slice!(n))\n n -= 1 \n end\n out\nend",
"def cubes(array)\n array.map { |number| number ** 3}\n # Return array\nend",
"def look_and_say(array)\n\nend",
"def fixed_array\n reformated_array.map! do |element|\n element.join(\", \").split(\", \")\n end \nend",
"def buy_fruit(array)\n returner = []\n array.each{|subarray| subarray[1].times{returner << subarray[0]}}\n returner\nend",
"def kesha_maker(array)\n\tnew_array = []\n\tarray.each do|name|\n\t\tname[2] = \"$\"\n\t\tnew_array << name\n\tend\n\tnew_array\nend",
"def square_array(array) #build square_array method\r\n\r\n new_array = [] #new array of squared numbers\r\n\r\n array.each do |integer|#implement own logic\r\n new_array << integer ** 2 #shovel /push logic into array \r\n end\r\n return new_array #returns array of these squared numbers\r\nend",
"def array_translate(array)\n repeatedWords = \"\"\n i = 0\n while i < array.length-1\n word = array[i]\n num = array[i+1]\n num.times { repeatedWords += word }\n i += 2\n end\n return repeatedWords\nend",
"def magic_array(a)\n a.flatten.sort.map{|x| x*2}.reject{|x| x%3==0}.uniq\n end",
"def countSheeps array\n array.count(true)\nend",
"def two_d_translate(arr)\n one_d_arr = []\n arr.each do | outer |\n outer.each.with_index do | inner, i |\n if i == 0\n outer[1].times do\n one_d_arr << inner\n end\n end\n end\n end\n return one_d_arr\nend",
"def double_all array\n array.map { |i| i*2 }\nend",
"def basic_7\n new_array = []\n i = 1\n while i <= 255\n new_array.push(i)\n i += 2\n end\n return new_array\nend",
"def doubler(numbers)\n\ti = 0\n \tarry = []\n while i < numbers.length\n arry[i] = (numbers[i] * 2)\n i += 1\n end\n return arry\nend",
"def kesha_maker(array)\n array.map do |elem|\n word_splice = elem.split(\"\")\n word_splice[2] = \"$\"\n word_splice.join\n end\nend",
"def two_d_translate(arr)\n result = []\n\tarr.each do |subArray|\n subArray[1].times do \n result.push(subArray[0])\n end\n end\n return result\nend",
"def create_sample_array\n sample_array = []\n\n\n # add songs to sample-array in correct ratios\n @spins_per_week.each do |k,v|\n v.times { sample_array.push(PL::db.get_song(k)) }\n end\n\n sample_array\n end",
"def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend",
"def eveness(array)\n new_array = []\n index = 1\n while index < array.size\n new_array << array[index]\n index += 2\n end\n new_array\nend",
"def map_to_no_change(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index])\n index += 1 \n end\n return array\nend",
"def generate_solved_array(dim)\n tiles = dim.times.map {|i| dim.times.map {|j| (j+1)+dim*(i)}}\n tiles[dim-1][dim-1] = nil\n tiles\n end",
"def yell(words) # DEFINE METHOD WITH ONE PARAM\n \n i = 0 # SET FIRST INDEX VALUE\n \n new_array = [] # CREATE AN EMPTY ARRAY\n \n while i < words.length # WHILE LOOP THAT CHECKS IF I IS LESS THAN THE ARRAY LENGTH\n old_ele = words[i] # VARIABLE TO STORE INDEXED VALUE OF ARRAY\n exclamations = old_ele + \"!\" # VARIABLE THAT CONCATENATES EXCLAMATION TO END OF INDEX ARRAY VALUE\n new_array << exclamations # SHOVELS IT INTO END OF ARRAY VARIABLE\n i += 1 # INCREMENT OF ONE ITERATION\n\n end\n return new_array # RETURNS FINAL VALUE OF NEWLY CREATED ARRAY\n \n\nend",
"def namerisuminarray arr \n len = arr.length\n sum = 0\n sum = sum.to_i\n broqch = 0\n \n while broqch <= len - 1\n sum = sum + arr[broqch].to_i\n broqch = broqch + 1\n end\n \n return sum \nend",
"def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\" # (note: assign value)\n end\n return array\nend",
"def cubes(array)\n array.map { |number| number ** 3 }\nend",
"def make_array\n <<-CODE\n next_int;\n t1 = array_new(state, _int);\n j = _int - 1;\n for(; j >= 0; j--) {\n t2 = stack_pop();\n array_set(state, t1, j, t2);\n }\n\n cpu_perform_hook(state, c, BASIC_CLASS(array),\n global->sym_from_literal, t1);\n stack_push(t1);\n CODE\n end",
"def generate_numbers\n (0...ARRAY_LENGTH).each do |i|\n y = ((1 << 31) & @mt[i]) + ((2**31 -1) & (@mt[(i+1)%ARRAY_LENGTH] % ARRAY_LENGTH))\n @mt[i] = @mt[(i + 397) % ARRAY_LENGTH] ^ (y >> 1)\n if (y % 2) != 0\n @mt[i] = @mt[i] ^ GENERATE_CONST\n end\n end\n end",
"def square_array(array)\n squared = []\n counter = 0\n while array[counter] do\n squared.push( array[counter] ** 2)\n counter +=1\n end\n squared\nend",
"def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = @length.times.collect do\n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end",
"def kesha_maker(array)\n array.map {|item| item[2]=\"$\"}\n array\nend",
"def square_array(array)\n new_numbers = []\n numbers = 0\n while array[numbers] do\n new_numbers << array[numbers] ** 2\n numbers += 1\n end\nreturn new_numbers\nend",
"def ifind_magic(arr)\n return false if arr.size == 0\n s = arr[0]\n e = arr[-1]\n magic_arr = []\n i = 0\n while s < e\n return magic_arr if arr[i] != i\n if arr[i] == i\n magic_arr[i] = i\n end\n i += 1\n end\nend",
"def name_array(array)\n group_size = 2\n # number_of_elements = array.length\n # number_of_arrays = number_of_elements / group_size.to_i\n shuffled = array.shuffle\n sliced = shuffled.each_slice(group_size).to_a\n if shuffled.length % 2 == 1\n sliced[-2] << sliced[-1][0]\n sliced.delete_at(-1)\n else\n sliced\n end\n sliced\nend",
"def kesha_maker(array)\n kesha_array = []\n array.each do |name|\n name[2] = \"$\"\n kesha_array << name\n end\n kesha_array\nend",
"def halvsies(array)\n halvs = []\n first_half_size = array.size % 2 == 0 ? array.size / 2 : array.size / 2 + 1\n halvs[0] = array[0...first_half_size]\n halvs[1] = array[first_half_size..-1]\n halvs\nend",
"def kesha_maker(array)\n array.collect { |x| x[2] = \"$\" }\n array\nend",
"def buy_fruit(array)\n array.map {|value, index| [value] * index}.flatten # by placing value in [brackets] it makes it an array.\nend"
] |
[
"0.60561055",
"0.5911244",
"0.57994264",
"0.5739985",
"0.57292753",
"0.57292753",
"0.57221895",
"0.5701122",
"0.5691158",
"0.5689374",
"0.56052846",
"0.5603371",
"0.56029665",
"0.55971795",
"0.557868",
"0.5549975",
"0.55410516",
"0.55379206",
"0.5516704",
"0.5503602",
"0.55029684",
"0.5483626",
"0.5468249",
"0.54600096",
"0.5458642",
"0.5436762",
"0.54130423",
"0.5393195",
"0.53744084",
"0.5365206",
"0.5364558",
"0.5364558",
"0.53481466",
"0.5346988",
"0.53427464",
"0.5339328",
"0.5339277",
"0.533658",
"0.533586",
"0.5335665",
"0.5328571",
"0.5319441",
"0.5316081",
"0.5309551",
"0.53077173",
"0.5295772",
"0.5288138",
"0.5285696",
"0.5281637",
"0.52810407",
"0.5277676",
"0.52751905",
"0.527205",
"0.52694863",
"0.5268625",
"0.5268607",
"0.5261171",
"0.5255043",
"0.525114",
"0.52488077",
"0.5248367",
"0.5246861",
"0.5244915",
"0.5242376",
"0.5237951",
"0.5237449",
"0.5235372",
"0.5221399",
"0.5208429",
"0.5201814",
"0.51920724",
"0.51834404",
"0.51797783",
"0.51708055",
"0.5168925",
"0.51644826",
"0.51618576",
"0.5160062",
"0.51588035",
"0.5157569",
"0.5156062",
"0.5154249",
"0.515377",
"0.5152683",
"0.5152667",
"0.5147922",
"0.5144357",
"0.51437485",
"0.51410866",
"0.513998",
"0.5134673",
"0.51339483",
"0.51325494",
"0.5129738",
"0.512579",
"0.51223886",
"0.51172495",
"0.51154625",
"0.51111615",
"0.5110319",
"0.51100385"
] |
0.0
|
-1
|
Returns the first ten responses that would be scheduled for the given protocol.
|
def execute
@responses = []
@end_date = end_date
@end_date = TimeTools.increase_by_duration(start_date, protocol.duration) if @end_date.blank?
schedule_responses
# Return at most ten responses
@responses.sort_by! { |response| response[:open_from] }
@responses[0...MAX_PREVIEW_RESPONSE_COUNT]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def top_ten\n Rails.cache.fetch('top_ten_resp', expires_in: 1.minutes) do\n conn = Faraday.new(url: @base_url) do |faraday|\n faraday.adapter(Faraday.default_adapter)\n end\n\n resp = conn.get do |req|\n req.url '/v1/cryptocurrency/listings/latest'\n req.headers['X-CMC_PRO_API_KEY'] = @api_key\n req.params['start'] = 1\n req.params['limit'] = 10\n req.params['convert'] = 'USD'\n req.params['sort'] = 'market_cap'\n req.params['sort_dir'] = 'desc'\n end\n\n raise 'Cannot parse response body' unless resp.body\n\n resp.body\n end\n end",
"def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end",
"def collect1 pages\n id = 'joshuabaer'\n results = []\n 1.upto pages do |page|\n results += http_get id, page\n end\n results\nend",
"def query_scheduled\n send(\"QUERY_GETALLSCHEDULED\")\n response = recv\n \n recording_count = response.shift.to_i\n recordings = []\n\n while recording_count > 0\n recording_array = response.slice!(0, Recording::RECORDINGS_ELEMENTS.length)\n recordings << Recording.new(recording_array, { :protocol_version => @protocol_version })\n recording_count -= 1\n end\n\n recordings = recordings.sort_by { |r| r.startts }\n recordings.reverse!\n end",
"def first_vs_repeat_data\n response = api_request(:summary, {group_by: 'source', fields: 'first_time_callers'})\n results = extract_and_sort_results(response).take(5)\n\n first_timers = results.map { |c| [c[\"key\"], c[\"first_time_callers\"]] }\n repeat_callers = results.map { |c| [c[\"key\"], c[\"total_calls\"] - c[\"first_time_callers\"]] }\n\n [\n { name: \"Repeat Callers\", data: repeat_callers },\n { name: \"First Time Callers\", data: first_timers }\n ]\n end",
"def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end",
"def get_subjects(nums)\n subj_arr = []\n url_array = [\"http://www.swapi.co/api/people\", \"http://www.swapi.co/api/films\",\n \"http://www.swapi.co/api/planets\", \"http://www.swapi.co/api/starships\",\n \"http://www.swapi.co/api/species\"]\n api_array = [\"name\", \"title\", \"name\", \"name\", \"name\"]\n counter = 0\n counter2 = 0\n 10.times do\n if counter == 5\n counter = 0\n end\n url = url_array[counter] + \"/#{nums[counter2]}\"\n api_text = JSON.parse(RestClient.get(url.to_s))\n x = api_text[\"#{api_array[counter]}\"]\n subj_arr << x\n counter = counter + 1\n counter2 = counter2 + 1\n end # end of times loop\n subj_arr\n\nend",
"def perform(metadata)\n scheduled_at = Time.at(metadata[\"scheduled_at\"])\n minutes = scheduled_at.min\n hours = scheduled_at.hour\n\n # 20 requests / minute\n if (minutes % 2 == 0) # Top 0-19; every 2 minutes\n perform_update(1)\n else # Top 20-99; every 2 minutes, full cycle of 6 minutes\n sub_index = (minutes / 2) % 3\n perform_update(2, sub_index)\n end\n\n # 20 requests / minute\n if minutes % 3 == 0 # Top 100-199; every 3 minutes, full cycle of 15 minutes\n sub_index = (minutes / 3) % 5\n perform_update(3, sub_index)\n elsif minutes % 6 == 1 # Top 200-299; every 6 minutes, full cycle of 30 minutes\n sub_index = (minutes / 6) % 5\n perform_update(4, sub_index)\n elsif minutes % 6 == 2 # Top 300-499; every 6 minutes, full cycle of 60 minutes\n sub_index = (minutes / 6) % 10\n perform_update(5, sub_index)\n end\n\n # 25-30 requests / minute\n if minutes % 12 == 0 # Top 500-749; every 12 minutes, full cycle of 1 hour\n sub_index = (minutes / 12) % 5\n perform_update(6, sub_index)\n end\n two_hour_cycle = hours % 2 * 60 + minutes\n if two_hour_cycle % 12 == 1 # Top 750-999; every 12 minutes, full cycle of 2 hours\n sub_index = (two_hour_cycle / 12) % 10\n perform_update(7, sub_index)\n end\n four_hour_cycle = hours % 4 * 60 + minutes\n if four_hour_cycle % 12 == 2 # Top 1000-1499; every 12 minutes, full cycle of 4 hours\n sub_index = (four_hour_cycle / 12) % 20\n perform_update(8, sub_index)\n end\n # 25 requests / 3 minutes with blank periods due to unknown coin limit\n six_hour_cycle = hours % 6 * 60 + minutes\n if six_hour_cycle % 3 == 1 # Top 1500-4499; every 3 minutes, full cycle of 6 hours\n sub_index = (six_hour_cycle / 3) % 120\n perform_update(9, sub_index)\n end\n end",
"def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n puts \">>start:page:\" + page.to_s\n\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 200\n res = JSON.parse(response.to_str)\n jobs += res\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs error: #{err.response}\"\n end\n end\n\n jobs\nend",
"def scan_top (period)\n posts = []\n top = @subreddit.get_top(t: period, limit: 100)\n @logger.puts \"Scanning Content\", \"Num\\tLast ID\"\n begin\n posts.concat top\n after = top.last.fullname\n @logger.puts \"#{top.count}\\t#{after}\"\n top = @subreddit.get_top(t: period, limit: 100, after: after)\n end until top.count < 100\n @logger.puts \"#{top.count}\\tdone\"\n\n if block_given?\n posts.map! do |post|\n yield post\n end\n end\n\n posts\n end",
"def test_get_multiple\n urls = []\n 10.times{ |i| urls << URI.join(@url, \"/echo/#{i}\") }\n ret = Bixby::APIPool.get(urls, \"test\")\n\n assert ret\n assert_kind_of Array, ret\n assert_equal 10, ret.size\n\n 10.times do |i|\n assert_equal \"echo #{i}\", ret[i].body\n end\n end",
"def query_pending\n send(\"QUERY_GETALLPENDING\")\n response = recv\n \n # We can safely discard the explicit conflict count, as we can always itterate\n # throught the recordings, collecting where recstatus_sym == :rsConflict\n conflict_count = response.shift.to_i\n\n # Next comes the number of elements\n recording_count = response.shift.to_i\n recordings = []\n\n while recording_count > 0\n recording_array = response.slice!(0, Recording::RECORDINGS_ELEMENTS.length)\n recordings << Recording.new(recording_array, { :protocol_version => @protocol_version })\n recording_count -= 1\n end\n\n recordings = recordings.sort_by { |r| r.startts }\n recordings.reverse\n end",
"def get_messages( page=0 )\n\t result = []\n\t if page > 0\n\t response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n\t JSON.parse( response.body )\n\t else\n\t response = self.class.get( '/message_threads', body: { page: 1 }, headers: {'authorization' => @auth_token} )\n for page in 1..(response[\"count\"]/10 + 1)\n response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n result << JSON.parse(response.body)\n end\n result\n\t end\n\tend",
"def requests_per_hour\n group_by_hour.map { |hour, ents|\n [hour, ents.size]\n }.sort { |a,b|\n a[0] <=> b[0]\n }\n end",
"def get_questions(number)\n @questions_array = get_from_url(@questions_conn, QUESTIONS_OBTAINTION_KEY, {size: number})\n end",
"def load\n data = []\n page = 1\n total_size = 0\n\n loop do\n request_url = \"#{@request_url_base}&page=#{page}&api_key=#{@api_key}\"\n response = Faraday.get(request_url)\n\n response_json = JSON.parse(response.body)\n\n break if response_json.empty?\n\n response_json.each do |item|\n data << item\n end\n\n unless @limit.nil?\n total_size += response_json.length\n\n break if total_size > @limit\n end\n\n page += 1\n end\n\n data = data.first(@limit) unless @limit.nil?\n\n data\n end",
"def send_status_request(api_symbol, query, options)\n full_response = []\n response = nil\n options[:pages] ||= 1\n options[:pages].times do |page_num|\n response = send_request(:GET, PATH[api_symbol], query, true, options)\n break unless response[:valid]\n break if response[:data].empty?\n full_response += response[:data]\n query[:max_id] = response[:data].last['id'] - 1\n end\n return assemble_multi_page_response(full_response, response, options)\n end",
"def search_and_fetch_jobs\n feed = RSS::Parser.parse(open(target_url_with_query))\n feed.items.take(10)\n end",
"def top10(url)\n\t\tlista=recorre(url)\n\t\tfor i in 1..10\n\t\t\tdatos(lista[i][0])\n\t\tend\n\tend",
"def topTenBooks\n\t\t@requests = requests.order('count desc').limit(10)\n\tend",
"def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n\n begin\n set = handle_timeouts(MAX_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n\n records += set\n offset += per_page\n end until set.empty?\n\n records\nend",
"def pages(time)\n\n response = HTTParty.get(\"https://api.pushshift.io/reddit/search/submission/?subreddit=#{$subreddit}&sort=desc&sort_type=created_utc&size=#{$max_per_page}&search?before=#{time}\")\n json = JSON.parse(response.body)\n\n json[\"data\"].each do |f|\n $urls << [f[\"created_utc\"], f[\"url\"]] if f[\"url\"].match?($img_formats) && f[\"url\"].match?($valid_urls)\n end\n\n if $page < $max_page\n sleep(rand(2..5))\n $page += 1\n pages($urls.last[0])\n else\n write_file\n end\n\nend",
"def process_response(new_response)\n responses.push(new_response)\n responses.shift if responses.size > 5\n responses\n end",
"def test_get_with_reused_connection\n if self.respond_to?(:get_response_multi)\n n = 2\n responses = nil\n\n in_transaction do\n responses = get_response_multi(default_url, n)\n end\n\n responses.each do |res|\n assert_match %r{<head>}i, body(res)\n end\n\n expected = {:call_count => n}\n\n assert_externals_recorded_for('localhost', 'GET', :counts => expected)\n end\n end",
"def poll_next_packet; 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 index\n @http_requests = HttpRequest.order(\"created_at DESC\").page(params[:page]).per(10)\n end",
"def getMovieTitles titles\n url_base = URI('https://jsonmock.hackerrank.com/api/movies/search/?Title=spiderman&page=')\n page_num = 1\n limit = 100\n max_pages_reached = false\n while !max_pages_reached\n params = { :per_page => limit, :page => page_num }\n url_base.query = URI.encode_www_form(params)\n\n p url_base\n\n res = Net::HTTP.get_response(url_base)\n res_str = eval(res.body) if res.is_a?(Net::HTTPSuccess)\n res_str[:data].each { |v| titles << v[:Title] unless v[:Title].nil? }\n\n if params[:page] == res_str[:total_pages]\n max_pages_reached = true\n else\n page_num += 1\n end\n end\nend",
"def batch_requests(pipeline_params, limit = nil)\n limit ||= Process.respond_to?(:getrlimit) ? Process.getrlimit(:NOFILE).first : 256\n responses = []\n\n pipeline_params.each_slice(limit) do |params|\n responses.concat(requests(params))\n end\n\n responses\n end",
"def get(urls)\n if urls.nil? or urls.empty? then\n return {}\n end\n\n urls = [urls] if not urls.kind_of? Array\n urls.each_with_index do |url, i|\n @reqs[i] = url.to_s\n end\n\n results = perform()\n\n ret = []\n (0..results.size-1).each do |i|\n ret << results[i]\n end\n\n return ret\n end",
"def fetch_latest(params)\n wines = []\n offset = 0\n limit = 5000\n params_with_defaults = { limit: limit }.merge(params)\n response = auth_then.get(BASE_URL, params: params_with_defaults)\n count = response.parse[\"count\"]\n\n while offset < count\n if response.code == 200\n response.parse[\"results\"].each do |result|\n wines << result\n end\n else\n []\n end\n response = auth_then.get(response.parse[\"next\"]) if response.parse[\"next\"] != nil\n offset += 5000\n end\n wines\n end",
"def phone_response\n token = PhoneConnect.configuration.token\n timeout_period = PhoneConnect.configuration.timeout.to_i\n retries = 3\n begin\n Timeout.timeout(timeout_period) do\n url = \"#{BASE_URI}#{token}&phone=#{@phone_number}\"\n\n start_time = Time.now\n response = HTTParty.get(url, verify: false)\n execution_time = Time.now - start_time\n\n data = response.parsed_response['response']\n\n # return Hashed response\n return data, execution_time\n end\n rescue Timeout::Error\n retries -= 1\n return [{'status' => 'TIMEOUT', 'error_text' => 'Timeout'}, timeout_period] if retries == 0\n sleep 2\n retry\n rescue Exception => exception\n return [{'status' => 'ERROR', 'error_text' => exception.to_s}, -1]\n end\n end",
"def pods\n retry_on_error backoff: KUBELET_ERROR_BACKOFF_SECONDS do\n throttle per_second: KUBELET_MAX_REQUESTS_PER_SECOND, throttled: [] do\n JSON.parse(http_get('https://localhost:10250/pods')).fetch(\"items\")\n end\n end\n rescue StandardError\n []\n end",
"def fetch_all(qps=DEFAULT_QUERIES_PER_SECOND)\n response = execute\n items = response['items']\n\n while response['current_page'] < response['total_pages']\n self.page = response['current_page'] + 1\n response = execute\n items = items + response['items']\n \n sleep(1.0/DEFAULT_QUERIES_PER_SECOND)\n end\n\n return items\n end",
"def total_by_time_period(options = {})\n response = options[:response] || {}\n search_options = {}\n search_options[:query] = options[:query] || ''\n search_options[:bucket] = options[:bucket] || 'day'\n search_options[:fromDate] = Gnip.format_date(options[:date_from]) if options[:date_from]\n search_options[:toDate] = Gnip.format_date(options[:date_to]) if options[:date_to]\n search_options[:next] = options[:next_cursor] if options[:next_cursor]\n\n url = [counts_url, search_options.to_query].join('?')\n call_done = 0\n\n begin\n gnip_call = self.class.get(url, basic_auth: @auth)\n\n parsed_response = gnip_call.parsed_response\n parsed_response = (parsed_response || {}).with_indifferent_access\n\n raise gnip_call.response.message unless parsed_response.present?\n\n if parsed_response[:error].present?\n response = { results: [], next: nil, error: parsed_response[:error][:message], code: gnip_call.response.code.to_i, calls: (response[:calls] || 0) + 1 }\n else\n call_done = 1 # we have received a valid response\n parsed_response[:results].each_with_index do |item, i|\n parsed_response[:results][i] = item.merge(timePeriod: DateTime.parse(item[:timePeriod]).to_s)\n end\n response = { results: (response[:results] || []) + parsed_response[:results], next: parsed_response[:next], code: gnip_call.response.code.to_i, calls: (response[:calls] || 0) + 1 }\n end\n rescue StandardError => e\n response = { results: [], next: nil, error: e.message, code: 500, calls: (response[:calls] || 0) + call_done }\n end\n # If the next cursor is not present we fetched all the data\n # It happens that twitter returns the same cursor, in that case we stop\n return response if !parsed_response[:next].to_s.present? || (parsed_response[:next].to_s.present? && parsed_response[:next] == search_options[:next])\n\n total_by_time_period(query: search_options[:query],\n date_from: search_options[:fromDate],\n date_to: search_options[:toDate],\n bucket: search_options[:bucket],\n next_cursor: parsed_response[:next],\n response: response)\n end",
"def callSubsplashAPI\n raw_response = HTTParty.get(\"#{ENDPOINT}?page[size]=50&fields=title,youtube_url,reach&page[num]=#{@page}\", \n format: :json, \n :headers => HEADERS)\n case raw_response.code \n when 200\n compileSubsplashResponse(raw_response) if raw_response.success?\n if @page < 5\n @page += 1\n callSubsplashAPI\n end\n when 404\n puts \"Page not found. Code: #{raw_response.code}\"\n when 500...600\n puts \"An error occured. Code: #{raw_response.code}\"\n end\n end",
"def recent_10_games(account_id, api_key_master)\n client = RestClient.get(\"https://na1.api.riotgames.com/lol/match/v4/matchlists/by-account/#{account_id}?endIndex=10&beginIndex=0&api_key=#{api_key_master}\")\n client_parsed = JSON.parse(client)\n end",
"def wait_for(id, pattern)\n response = [ ]\n loop do\n begin\n x = @responses[id].pop\n print @responses[:error].pop\n rescue\n sleep(2)\n end\n unless x.nil?\n if x[:head] =~ pattern\n response << x\n x.each { |key, value| puts \"#{key}=#{value}\" }\n break\n elsif x[:head] =~ /ProtocolError/\n response << x\n x.each { |key, value| puts \"#{key}=#{value}\" }\n break\n else\n response << x\n x.each { |key, value| puts \"#{key}=#{value}\" }\n end\n else\n sleep(1)\n end\n end\n response\n end",
"def responses\n @responses ||= api::BatchResponse.new(responses: responses_by_request.values.uniq)\n end",
"def next_available_number\n request :get_next_available_number\n end",
"def next_available_number\n request :get_next_available_number\n end",
"def fetch(params)\n Resque.logger.info \"Requestable.fetch received #{params.inspect}\"\n past = Time.now\n total = api_count(params)\n remain_requests = (total/250.to_f).ceil\n Resque.logger.info \"pages to request total: #{remain_requests}\"\n batch_num = (remain_requests / BATCH_SIZE.to_f).ceil\n Resque.logger.info \"batch number: #{batch_num}\"\n chap_start = 1\n chap_end = 0\n entity = params.fetch(:entity)\n Resque.logger.info \"entity name: #{entity}\"\n cache = $redis\n pages = []\n batch_num.times do\n entity_url = entity.pluralize\n if remain_requests > BATCH_SIZE\n chap_end += BATCH_SIZE\n remain_requests -= BATCH_SIZE\n else\n chap_end += remain_requests\n end\n hydra = Typhoeus::Hydra.new(max_concurrency: 30)\n\n chap_start.upto(chap_end) do |page|\n pages << page\n # queue up current batch\n request = Typhoeus::Request.new(\n \"https://api.rechargeapps.com/#{entity_url}?#{params[:query]}&limit=250&page=#{page}\",\n # followlocation: true,\n headers: HEADER\n )\n # error logging callbacks\n request.on_complete do |res|\n @used = res.headers['x-recharge-limit'].to_i\n if res.success?\n puts \"#{entity.upcase} request queued\"\n elsif res.timed_out?\n Resque.logger.error \"(HYDRA request) TIMED OUT: #{res.response_headers}\"\n elsif res.code.zero?\n Resque.logger.error \"(HYDRA request) Couldnt get an http response #{res.return_message}\"\n else\n Resque.logger.error(\"(HYDRA request) HTTP request failed: #{res.code}\")\n end\n end\n\n request.on_success do |res|\n # @used = res.headers['x-recharge-limit'].to_i\n # Resque.logger.info res.headers['x-recharge-limit']\n key = \"#{entity}_pull:#{Time.now.strftime(\"%Y%m%d\")}#{page.to_s.rjust(3, '0')}\"\n hash_set(cache, key, res.response_body)\n end\n\n hydra.queue(request)\n chap_start = chap_end\n end\n hydra.run\n batch_throttle(@used)\n end\n Resque.logger.info \"Pages iterated: #{pages.inspect}\"\n Resque.logger.info(\"RUN TIME per #{total} records: #{(Time.now - past)}\")\n end",
"def first(n=nil)\n to_recv = n || 1\n received = []\n each do |m|\n received << m\n break if received.size == to_recv\n end\n n ? received : received.first\n end",
"def collect3 pages\n id = 'barackobama'\n results = []\n tasks = TaskCollection.new( 50 )\n 1.upto pages do |page|\n puts \"queueing page #{page}\"\n task = BackgroundTask.new do \n http_get id, page\n end\n tasks << task\n end\n i=0\n loop do\n i+=1\n puts \"getting next task...\"\n task = tasks.next_finished\n if !task\n puts \"no more tasks\"\n break\n else\n puts \"task retrieved #{i}\"\n results += task.result\n end\n end\n results\nend",
"def find_every(options = {})\n query = {:limit => 100}.merge(options)\n \n feedkey = Wakoopa.feedkey\n if feedkey\n query.merge!(:key => feedkey)\n end\n \n Wakoopa::Request.get(self, :query => query)\n end",
"def peek(count = nil)\n jids = JSON.parse(@client.call('peek', @name, (count || 1)))\n jobs = jids.map { |j| Job.new(@client, j) }\n # If no count was provided, return a job. Otherwsie, return an array\n count.nil? ? jobs[0] : jobs\n end",
"def get_characters_from_api\n #establish initial url from api\n url = 'http://www.swapi.co/api/people/'\n #get all data from first page of API\n page_of_characters = JSON.parse(RestClient.get(url))\n all_characters = page_of_characters\n \n next_call = page_of_characters[\"next\"]\n\n while next_call do\n next_page = next_call\n next_page_of_characters = JSON.parse(RestClient.get(next_page))\n (all_characters[\"results\"] << next_page_of_characters[\"results\"])\n next_call = next_page_of_characters[\"next\"]\n end\n\n all_characters\nend",
"def latest_tweets(k=5)\n\n # Get the tweets\n response = make_response(\"statuses\",\"user_timeline\")\n timeline = JSON.parse(response.body)\n tweets = timeline[0..k-1]\n\nend",
"def next_ten_hosts(db)\r\n\t\tarray1 = []\r\n\t\tarray1 << db.execute(\"SELECT name FROM playgroups WHERE id<=10\")\r\n\t\tputs \"Next ten hosts are...\"\r\n\t\tarray1[0].each do |i|\r\n\t\t\tputs i \r\n\t\t\tputs \"--------------\"\r\n\t\tend\r\n\tend",
"def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def op_request(*_)\n force_break\n end_page\n until @page_number.even? # Because if we stop on an even page, the next one will be odd\n break_page\n end\n end",
"def list_thing(thing)\n next_marker = nil\n things = []\n loop do\n response = waf.send(\"list_#{thing}\", next_marker: next_marker, limit: 10)\n things += response.send(thing)\n next_marker = response.next_marker\n break unless next_marker\n end\n things\n end",
"def collect2 pages\n id = 'joshuabaer'\n results = []\n tasks = []\n 1.upto pages do |page|\n puts \"queueing page #{page}\"\n task = BackgroundTask.new do \n http_get id, page\n end\n tasks << task\n task.run\n end\n tasks.each do |task|\n puts \"task retrieved\"\n results += task.result\n end\n results\nend",
"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 events_request(max_pages=100)\n results = []\n max_pages.times do |page|\n # Repeatedly request events, page by page, until we reach the final page\n # of results (or for some maximum number of pages)\n req = MobilizeAmericaRequest.new(@api_key, @org_id, page+1)\n results += req.results\n break if req.last_page?\n end\n results\n end",
"def get_pages(subreddit, sort_order, howmany)\n # log_message(\"Getting pages...\")\n sort_order = \"/#{sort_order}/\".downcase\n\n pages = []\n\n # log_message(\"In the get_pages method. \")\n\n howmany.to_i.times do |i|\n\n if i == 0\n url = \"https://www.reddit.com/r/#{subreddit}#{sort_order}.json\"\n else\n # id of the last post on the previous page:\n last_id = pages[i-1]['data']['children'].last[\"data\"]['id']\n url = \"https://www.reddit.com/r/#{subreddit}#{sort_order}.json?count=#{i * 25}&after=t3_#{last_id}\"\n end\n\n # pull the json page, parse and add to the pages array.\n begin\n # log_message(\"Beginning curl...\")\n # log_message(url)\n raw = `curl --user-agent \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36\" -s '#{url}' 2>&1`\n # log_message(raw[0..20])\n page = JSON.parse(raw)\n # log_message(\"Page data: #{page.length}\")\n rescue => e\n redirect to('/'), 500\n end\n pages << page\n \n end\n # log_message(\"Successfully got pages.\")\n # return the array\n pages\n end",
"def top_10_requests\n \"|| Volume || Count || Request ||\\n\" +\n top(:request).map { |bytes, count, request|\n \"| #{'%.1f' % (bytes / 1024.0 / 1024.0)} MB \" +\n \"| #{count} | #{request} |\\n\"\n }.join\n end",
"def last_20_jobs(project_id)\n api(\"projects/#{project_id}/jobs\").sort_by { |j| -j['id'] }\nend",
"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 batch_responses\n return [@result] unless @batch_response\n # if batch response, generate array based on the response hash.\n @result.map do |r|\n next r unless r.is_a?(Hash)\n hash = r[SUCCESS] || r[ERROR]\n Parse::Response.new hash\n end\n end",
"def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n page = 1\n\n begin\n log.info \" Requesting set #{page} (limit #{per_page}, offset #{offset})\"\n set = handle_timeouts(MAX_CONSECUTIVE_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n log.info \" Fetched #{set.size} records\"\n\n records += set\n offset += per_page\n page += 1\n end until set.size < per_page\n\n records\n end",
"def peek(count = nil)\n jids = JSON.parse(@client.call('peek', @name, (count || 1)))\n jobs = jids.map { |j| Job.new(@client, j) }\n count.nil? ? jobs[0] : jobs\n end",
"def requests\n @requests_lock.synchronize { Array.new(@requests) }\n end",
"def pull_next(queue=nil, n=15)\n ids = []\n Delayed::Job.transaction do\n query = Delayed::Job.where('(run_at is null or run_at < ?) and locked_at is null', DateTime.now).order('priority asc, run_at asc, id asc')\n if (queue && queue != 'default')\n query = query.where(:queue => queue)\n # if the queue is 'default' or nil, this would be the \"default queue\"\n elsif queue == 'default'\n query = query.where(:queue => ['default', nil])\n end\n # if no queue name is provided, the \"queue\" column would be ignored\n # therefore returning the list of all jobs in all queues\n\n query = query.limit(n)\n ids = query.pluck(:id)\n query.update_all(:locked_at => DateTime.now.utc, :locked_by => hostname)\n end\n\n return Delayed::Job.where(:id => ids)\n end",
"def response_time_entries\n response_time_entries_raw = wrapper(@user).time_entries(1, harvest_project_id)\n\n # Getting the number of pages of the paginated response from projects API\n number_of_pages = response_time_entries_raw['total_pages']\n\n response_time_entries_per_project = []\n\n if number_of_pages == 1\n response_time_entries_per_project = response_time_entries_raw.dig('time_entries')\n else\n # for loop to loop through all the pages and fetch all and put into the variable response_time_entries_per_project\n\n (1..number_of_pages).each do |i|\n time_entries_raw = wrapper(@user).time_entries(i, harvest_project_id)\n\n next_array = time_entries_raw['time_entries']\n\n # add projects array to complete array\n response_time_entries_per_project += next_array\n end\n\n end\n response_time_entries_per_project\n end",
"def all_tweets_with_limit n\n\t\t\n\t\tsdb = AWS::SimpleDB.new(access_key_id: $aws_access, secret_access_key: $aws_secret)\n\n\t\tdomain = sdb.domains['cspp51050-final']\n\t\tresults = domain.items.limit(n)\n\n\t\tconvert_sdb_to_objects results\n\n\tend",
"def get_customer_request\n sleep(120 * rand)\n song = SONGS.shift\n puts \"#{timestamp}: Requesting #{song}\" if song\n song\nend",
"def get_customer_request\n sleep(120 * rand)\n song = SONGS.shift\n puts \"#{timestamp}: Requesting #{song}\" if song\n song\nend",
"def poll!\n find_and_process_next_available(messages)\n end",
"def get_headlines\n\n # this creates an empty array for the headlines to go\n headline_array = []\n # this is a counter for the while loop\n top_five = 0\n\n # this will loop through the stories that are returned\n # via the GET request and put them as strings in the\n # headline_array array\n while top_five < 5\n\n # this passes the headline from the JSON that was\n # returned in @news_instance in to the array\n # and then we increment the top_five counter\n headline_array << @news_instance[\"response\"][\"docs\"][top_five][\"headline\"][\"main\"]\n top_five += 1\n end\n\n # returns the headline array\n return headline_array\n\n end",
"def run\n @cluster.retriable(api_name) do\n process(retriable_requests)\n\n # Stop retrying when there are no more requests to retry\n retriable_requests.empty?\n end\n\n responses\n end",
"def get_character_movies_from_api(character)\n #make the web request\n page = 1\n # iterate over the character hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls,\n until page == 10\n all_characters = RestClient.get(\"https://swapi.co/api/people/?page=#{page}\")\n character_hash = JSON.parse(all_characters)\n\n character_hash[\"results\"].each do |value|\n if value[\"name\"] == character\n films_hash = value[\"films\"]\n end\n end\n page +=1\n end\n\nend",
"def _poll_server_and_retrieve_task\n poll_interval = @config.get(PROVISIONER_WORKER_POLL_INTERVAL).to_i || 1\n poll_error_interval = @config.get(PROVISIONER_WORKER_POLL_ERROR_INTERVAL).to_i || 10\n loop do\n begin\n response = _poll_server\n if response.code == 200 && response.to_str && response.to_str != ''\n task = JSON.parse(response.to_str)\n log.debug \"Received task from server <#{response.to_str}>\"\n break task\n elsif response.code == 204\n sleep poll_interval\n next\n else\n log.error \"Received error code #{response.code} from coopr server: #{response.to_str}\"\n end\n rescue StandardError => e\n log.error \"Caught exception processing response from coopr server: #{e.inspect}\"\n end\n sleep poll_error_interval\n end\n end",
"def poll\n options['poll'] || 10\n end",
"def results(day:, month:, year:)\n date = \"#{year}-#{month}-#{day}\"\n\n uri = URI(\"/schedules/#{date}/results.#{response_format}?api_key=#{API_KEYS[:tennis]}\")\n response = Net::HTTP.get_response(uri)\n\n puts response.status unless response.is_a?(Net::HTTPSuccess)\n puts response.body\n end",
"def first_two_result_pages(options = {})\n get_result_pages([1, 2], options)\n end",
"def get_all_conversations\n response = RestClient::Request.execute method: :get,\n url: URL,\n user: USERNAME,\n password: PASSWORD,\n headers: {params: {pageSize: OBJECTS_PER_PAGE, page:ARGV[1]}},\n :content_type => :json,\n :accept => :json\n JSON(response)['conversations'][396..-1]\n end",
"def getTop10AwesomePeeps\n @persons.sort!\n return @persons[-10..-1]\n end",
"def test_no_request_retry_get\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/delay-sec/20?backend_counter_id=get-timeout\", http_options)\n assert_response_code(504, response)\n assert_match(\"Inactivity Timeout\", response.body)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end",
"def get_problem number\n @url << number.to_s\n page = HTTParty.get(@url)\n parse_page = Nokogiri::HTML(page)\n problem = []\n parse_page.css(\"p\").length.times do |n|\n problem << parse_page.css(\"p\")[n].text\n end\n problem\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 next_times(count)\n\n next_time ? [ next_time ] : []\n end",
"def pending_response_requests; end",
"def all\n end_time = (Time.now - (30 * 60 * 60 * 24)).to_i\n all_items = Array.new\n cur_items = self\n begin\n all_items += cur_items.items\n cur_items = cur_items.next(:count => 200, :start_time => end_time)\n end until cur_items.nil?\n all_items\n end",
"def paginate_all_data(url:, more_params: nil)\n query_params = \"since=#{@start_date}&until=#{@end_date}#{more_params ? \"&#{more_params}\" : ''}\"\n total_count = parse_json_from_api(\"#{url}?#{query_params}\")['page']['total_elements']\n puts \"[#{Time.new.strftime('%k:%M')}] total count for #{url}?#{query_params}: #{total_count}\"\n idx = 0\n result = []\n while idx * PER_PAGE < total_count\n result += parse_json_from_api(\"#{url}?page=#{idx}&per_page=#{PER_PAGE}&#{query_params}\")['data']\n idx += 1\n end\n puts \"[#{Time.new.strftime('%k:%M')}] ERROR: result.length #{result.length} != total_count #{total_count}\" if result.length != total_count\n result\nrescue MyApiError\n []\nend",
"def first_page(ip)\n\t# query for ip list\n\tquery_url = BASE_DOMAIN + QUERY_VAR + ip\n\tdoc = open(query_url){|f| Hpricot(f)}\n\tcount = doc.search('//*[@id=\"count\"]').inner_text.gsub(' results','').to_i\n\t#pages = h.search('//*[@id=\"results_container\"]/div[2]/ul/li[2]/a')\n\tpagination = doc.search('//*[@id=\"results_container\"]/div[2]/ul/li/a')\n\treturn [doc,count,pagination]\nend",
"def auto_pagination(request_proc, opts)\n items = []\n loop do\n new_items, next_opts = request_proc.call opts\n items = [*items, *new_items]\n break unless next_opts\n\n opts = next_opts\n end\n items\n end",
"def request_sequence\n #This routine fails if there are any non-requests within the sequence of requests.\n a = [request1, request2, request3, request4, request5, request6, request7,\n request8, request9, request10]\n\n first_nil = a.index{|i| i.nil?}\n\n unless first_nil.nil?\n suba = a.slice(first_nil, a.size - first_nil)\n next_non_nil = suba.index{|i| i != nil}\n unless next_non_nil.nil?\n error_item = next_non_nil + first_nil\n no_request_message = \"A request is required here.\"\n case error_item\n when 1\n errors.add(:request1, no_request_message)\n when 2\n errors.add(:request2, no_request_message)\n when 3\n errors.add(:request3, no_request_message)\n when 4\n errors.add(:request4, no_request_message)\n when 5\n errors.add(:request5, no_request_message)\n when 6\n errors.add(:request6, no_request_message)\n when 7\n errors.add(:request7, no_request_message)\n when 8\n errors.add(:request8, no_request_message)\n when 9\n errors.add(:request9, no_request_message)\n when 10\n errors.add(:request10, no_request_message)\n end\n end\n end\n end",
"def find_listings(after = nil)\n response = HTTParty.get(\"https://www.reddit.com/r/#{subreddit}/top.json?t=#{occurrence}&after=#{after}\")\n if response.ok? && response.dig(\"data\").present?\n data << response[\"data\"]\n find_listings(response.dig('data', 'after')) if response.dig('data', 'after').present?\n end\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 recent\n @limit = 10\n @webhooks = Webhook.limit(@limit).order(id: :desc)\n end",
"def custom_latest_headlines\r\n @start = (params[:start] || 0).to_i # convert to an integer\r\n @per_page = (params[:per_page] || 10).to_i # convert to an integer\r\n\r\n @custom_topic = params[:custom_topic]\r\n\r\n @count = 0 # temporarily disdable @is_remaining to save our requests while developing\r\n # full breakdown of 'is_remaining' in lib -> my_news_api -> client\r\n #@is_remaining = custom_newsapi_client.headlines_count(@start, @per_page, @custom_topic)\r\n\r\n @headlines = custom_newsapi_client.top_headlines(@start, @per_page, @custom_topic)\r\n end",
"def get_trip_offers(active=true, limit=3)\n dputs __method__.to_s\n if active\n trip_offer_req = setup_http_request($active_trip_offers, @cookie, {:url_arg => [1]})\n obj_ = $active_trip_offers\n page_regex = $active_trip_offers[:url].gsub(\"?\",\"\\\\?\").gsub(\"/\", \"\\\\/\") % \"\"\n page_url = $active_trip_offers[:url]\n else\n trip_offer_req = setup_http_request($inactive_trip_offers, @cookie, {:url_arg => [1]})\n obj_ = $inactive_trip_offers\n page_regex = $inactive_trip_offers[:url].gsub(\"?\",\"\\\\?\").gsub(\"/\", \"\\\\/\") % \"\"\n page_url = $inactive_trip_offers[:url]\n end\n res = @http.request(trip_offer_req)\n trips = {}\n trips = list_trip_offers(CGI.unescapeHTML(res.body.force_encoding(\"utf-8\")))\n pages = res.body.scan(/<a href=\"#{page_regex}(\\d+)/).flatten.uniq\n # in case we got something like 1, 2, 3,4,5,6,7,8,9,21\n pages.map!(&:to_i)\n if not pages.empty?\n if pages.length >= 2\n diff = pages[-2..-1].inject(:-).abs\n if diff > 1\n pages += 1.upto(diff).map{|d| d + pages[-2]}.to_a\n pages.sort!\n pages.slice!(limit..-1)\n end\n end\n pages.map{|p|\n # Using $active_trip_offers for the method, but specify the URL\n trip_offer_req = setup_http_request(obj_, @cookie, {:url => page_url, :url_arg => [p]})\n res = @http.request(trip_offer_req)\n trips = trips.merge(list_trip_offers(res.body))\n }\n end\n trips\n end",
"def pl_request(n, *_)\n force_break\n @page_length = convert_integer(n, \"page length\")\n end",
"def pop_head(key)\n timeout_retry(3, 3){\n write \"LPOP #{key}\\r\\n\"\n bulk_reply\n }\n end",
"def fetch_pending(min_id, per_page, options = {})\n options = {\n :limit => per_page,\n }.merge(options)\n video_ids = self.pending_video_ids.rangebyscore(min_id || \"-INF\", \"INF\", options)\n video_ids.map {|id| Video.find_by_id(id) }\n end",
"def index\n @api_v1_poll_responses = Api::V1::PollResponse.all\n end",
"def get_top_contents(day, nb_messages)\n raise_argument_error(nb_messages) if nb_messages > nb_available_messages\n return [] if nb_messages == 0\n\n top_content_ids = top_contents(nb_messages)\n @last_buffered_contents = top_content_ids.to_a\n @buffered_contents += @last_buffered_contents\n\n Content.find(top_content_ids)\n end",
"def grabResults(address, auth)\n request = Net::HTTP::Get.new address.request_uri\n\n # Set up Net::HTTP to use SSL, which is required by Twitter.\n http = Net::HTTP.new address.host, address.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n # # Issue the request.\n request.oauth! http, auth[:ckey], auth[:atok]\n response = http.request request\n\n ## Check to see if exceeded API limit\n while response.code == '429'\n\n pp 'rate limited, waiting 5min'\n \tsleep 5*60\n \tresponse = grabResults(address, auth)\n end\n\n return response\nend",
"def missed_search_rankings(expires_in: 1.minute)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(\"#{reportbooru_server}/missed_searches\")\n return [] if response.status != 200\n\n body = response.to_s.force_encoding(\"utf-8\")\n body.lines.map(&:split).map { [_1, _2.to_i] }\n end"
] |
[
"0.6036598",
"0.54201394",
"0.52545935",
"0.5220028",
"0.5153872",
"0.51267284",
"0.5106063",
"0.50040185",
"0.4976269",
"0.49652484",
"0.48677963",
"0.48536602",
"0.48529062",
"0.4844984",
"0.48421723",
"0.48193493",
"0.48128352",
"0.4751414",
"0.47443113",
"0.474421",
"0.4727409",
"0.4726016",
"0.47158766",
"0.47106302",
"0.46677276",
"0.46540147",
"0.46502766",
"0.46476433",
"0.46386263",
"0.4632121",
"0.46200007",
"0.46029603",
"0.46013677",
"0.459049",
"0.4580404",
"0.457807",
"0.45722744",
"0.45713547",
"0.45703983",
"0.45670104",
"0.45670104",
"0.4559799",
"0.4552317",
"0.45434165",
"0.45378566",
"0.45358068",
"0.45206663",
"0.45145884",
"0.45119283",
"0.450167",
"0.44991288",
"0.44984078",
"0.4496299",
"0.44890004",
"0.44834822",
"0.44799408",
"0.44562152",
"0.44447303",
"0.4434571",
"0.4422738",
"0.44112137",
"0.44093788",
"0.44070354",
"0.44029182",
"0.4391765",
"0.4386879",
"0.43731666",
"0.43731666",
"0.4371814",
"0.43586484",
"0.43579587",
"0.43566874",
"0.43547714",
"0.4350473",
"0.43464938",
"0.4333315",
"0.43309388",
"0.43212214",
"0.43070856",
"0.43052635",
"0.43040267",
"0.43034518",
"0.42975125",
"0.42822653",
"0.42814347",
"0.42808685",
"0.42807215",
"0.42785886",
"0.427737",
"0.42743635",
"0.42736536",
"0.42726392",
"0.42721418",
"0.4270432",
"0.42624572",
"0.42619932",
"0.42607883",
"0.42590228",
"0.42494178",
"0.42453456"
] |
0.5730701
|
1
|
8kyu I implemented a function which convert the given boolean value into its string representation.
|
def boolean_to_string(b)
return b.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def boolean_to_string(b)\n if true\n \"true\"\n else\n \"false\"\n end\nend",
"def boolean_to_string(b)\n if b \n \"true\"\n else\n \"false\"\n end\nend",
"def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anything\n end",
"def boolString(value)\n if value == \"0\"\n return \"false\"\n else\n return \"true\"\n end\n end",
"def quote_boolean(value)\n value.to_s.upcase\n end",
"def format_value_to_boolean(value)\n value.to_s\n end",
"def to_bool(value)\n value.to_s.downcase == 'true' ? true : false\n end",
"def boolify(val)\n\nend",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def to_boo string\n\t\tActiveRecord::Type::Boolean.new.cast(string)\n\tend",
"def to_boolean(value)\n case value\n when :true, 'true'\n true\n else\n false\n end\n end",
"def to_s\n to_string(true)\n end",
"def bool_conv(value)\n value == HEX_FALSE ? false : true\n end",
"def munge_boolean(value)\n case value\n when true, 'true', :true\n 'true'\n when false, 'false', :false\n 'false'\n else\n raise \"Invalid value for munge_boolean #{value}\"\n end\n end",
"def boolean_to_human(test)\n test ? \"Yes\" : \"No\"\n end",
"def bool_to_word bool\n if bool == \"true\"\n \"Yes\"\n else\n \"No\"\n end\nend",
"def to_true_string(value)\n DS::Number.is_i?(value) && value.to_i == 1 ? 'true' : nil\n end",
"def bool_to_sym(bool)\n bool == true ? :true : :false\n end",
"def bool_to_sym(bool)\n bool == true ? :true : :false\n end",
"def write_bool(*b); end",
"def format_value v\n case v\n when String\n v.inspect\n when TrueClass\n 'true'\n when FalseClass\n 'false'\n else\n v.to_s\n end\n end",
"def to_boolean(str)\n str == 'true'\nend",
"def value_to_boolean(value)\n return value if value==true || value==false\n case value.to_s.downcase\n when \"true\", \"t\", \"1\" then true\n else false\n end\n end",
"def to_boolean(string)\n string == 'true'\nend",
"def to_readable(bool)\n if bool == true\n return \"allowed.\"\n else \n return \"not allowed.\"\n end\n end",
"def to_enable(value)\n value == :true ? 'Yes' : 'No'\n end",
"def old_boolean_to_binary(arr)\n binary = \"\"\n\n arr.each do |boolean|\n if boolean\n binary += \"1\"\n else\n binary += \"0\"\n end\n end\n\n binary\nend",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def to_bool(value)\n ActiveModel::Type::Boolean.new.cast(value.to_s.strip)\n end",
"def bool_to_word(boolean)\n if boolean == true\n return \"Yes\"\n elsif boolean == false\n return \"No\"\n else\n nil\n end\nend",
"def convert_string_to_bool(value)\n case value\n when \"true\"\n true\n when \"false\"\n false\n when Array\n value.map { |elem| convert_string_to_bool(elem) }\n when Hash\n value.each do |key, elem|\n value[key] = convert_string_to_bool(elem)\n end\n value\n else\n value\n end\n end",
"def to_cli_boolean(value)\n case value\n when true\n :true\n else\n :false\n end\n end",
"def convert_booleans(value)\n if [\"true\", \"false\"].include?(value)\n value = (value == \"true\")\n else\n value\n end\n end",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def boolean\n Util.from_bytes :boolean, value\n end",
"def display_boolean(value)\n value == \"true\" ? \"Yes\" : \"No\"\n end",
"def bool_to_word bool\r\n if bool\r\n return 'Yes'\r\n else\r\n return 'No'\r\n end\r\nend",
"def bool_to_word(bool)\n bool ? 'Yes' : 'No'\nend",
"def formatted_value_boolean(value)\n (BOOLEAN_TRUE.include?(value) ? I18n.t('true') : I18n.t('false'))\n end",
"def bool_to_word bool\n if bool == true\n return \"Yes\"\n end\n \"No\"\nend",
"def to_bool str\r\n ActiveRecord::Type::Boolean.new.type_cast_from_user(str)\r\n end",
"def getBoolean\n if @type == 'a'\n return getBooleanValue().rjust(16, '0')\n end\n\n if @type == 'c'\n return '111'+getBooleanComp()+getBooleanDest()+getBooleanJump()\n end\n\n return \"\"\n end",
"def to_bool\n if (self.to_bool == 1)\n puts \"TRUE\"\n elsif (self.to_bool == 0)\n puts \"FALSE\"\n elsif (self.to_bool == -1)\n puts \"NaN\"\n end\nend",
"def boolean_to_binary(arr)\r\n\r\n binary = \"\"\r\n\r\n # iteration each method\r\n arr.each {|bool|\r\n if bool == true\r\n\r\n # bool true to binary 1\r\n binary << \"1\"\r\n else\r\n\r\n # bool false to binary 0\r\n binary << \"0\"\r\n end }\r\n\r\n binary\r\nend",
"def boolean_to_word(bol)\n if bol \n return \"Yes\"\n else\n return \"No\"\n end\n end",
"def boolean_to_word(bol)\n if bol \n return \"Yes\"\n else\n return \"No\"\n end\n end",
"def pp_boolean(value)\n if value\n return \"כן\";\n else\n return \"לא\";\n end\n end",
"def bool_to_words(bool, mode = :on)\r\n case mode\r\n when :on\r\n string_if_true = 'on'\r\n string_if_false = 'off'\r\n when :enabled\r\n string_if_true = 'enabled'\r\n string_if_false = 'disabled'\r\n else\r\n raise ArgumentError\r\n end\r\n\r\n return string_if_true if bool\r\n string_if_false\r\n end",
"def convert_value_to_text value, crow\n case value\n when TrueClass, FalseClass\n value\n else\n value.to_s if value\n end\n end",
"def convert_value_to_text value, crow\n case value\n when TrueClass, FalseClass\n value\n else\n value.to_s if value\n end\n end",
"def value_or_false(value)\n if value\n if value == \"false\"\n return false\n else\n return value.to_s\n end\n else\n return false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def to_boolean(string)\r\n if string.downcase == 'y'\r\n string = true\r\n elsif string.downcase == 'n'\r\n string = false\r\n end\r\nend",
"def bool_to_words(bool, mode = :on)\n case mode\n when :on\n string_if_true = 'on'\n string_if_false = 'off'\n when :enabled\n string_if_true = 'enabled'\n string_if_false = 'disabled'\n else\n raise ArgumentError\n end\n\n return string_if_true if bool\n string_if_false\n end",
"def to_bool() true end",
"def to_bool(questionable_string)\n\tbool = true\n\tunless questionable_string == \"true\"\n\t\tbool = false\n\tend\n\tbool\nend",
"def get_boolean_value\n\t\tend",
"def i18n_b(boolean_value)\n t \"helpers.#{boolean_value}\"\n end",
"def true \n \"true\" \n end",
"def convert_to_boolean(value)\n if value == \"yes\"\n true\n else\n false\n end\nend",
"def display_boolean( value, format = :yesno )\n I18n.t( 'general.boolean.' + format.to_s )[ value ? 0 : 1 ]\n end",
"def boolean_to_binary(arr)\n result = ''\n i = 0\n while i < arr.length\n result << '1' if arr[i]\n result << '0' if !arr[i]\n i += 1\n end\n return result\nend",
"def result_to_s(result)\n case result\n when true\n '2'\n when false\n '1'\n else\n '0'\n end\n end",
"def xml_value(value)\n if value == true\n 1\n elsif value == false\n 0\n else\n value\n end.to_s\n end",
"def to_b\n self != \"false\"\n end",
"def convert(value)\n case value\n when Symbol, '' # can't intern an empty string\n value\n when String\n value.intern\n when true\n :true\n when false\n :false\n else\n value.to_s.intern\n end\n end",
"def convert(value)\n case value\n when Symbol, '' # can't intern an empty string\n value\n when String\n value.intern\n when true\n :true\n when false\n :false\n else\n value.to_s.intern\n end\n end",
"def wordify_boolean(bool)\n# bool ? t(:\"shared.boolean.yes\") : t(:\"shared.boolean.no\")\n bool ? \"Ja\" : \"Nein\"\n end",
"def convert(value)\n case value.to_s\n when /^(yes|y|t(rue)?|1)$/i\n return true\n when /^(no|n|f(alse)?|0)$/i\n return false\n else\n fail TypeError, \"Expected boolean type, got #{value}\"\n end\n end",
"def to_boolean(str)\n !(str == 'false' || str == '0')\nend",
"def value_to_boolean(value)\n value = get_param(value) if value.is_a?(Symbol)\n ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)\n end",
"def bool_to_words(bool, mode = :on)\n\t\tcase mode\n\t\twhen :on\n\t\t\tstring_if_true = 'on'\n\t\t\tstring_if_false = 'off'\n\t\twhen :enabled\n\t\t\tstring_if_true = 'enabled'\n\t\t\tstring_if_false = 'disabled'\n\t\telse\n\t\t\traise ArgumentError\n\t\tend\n\n\t\treturn string_if_true if bool\n\t\t\tstring_if_false\n\tend",
"def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil)\n end",
"def show_onoff(bool)\n if not [TrueClass, FalseClass, NilClass].member?(bool.class)\n return \"??\"\n end\n return bool ? 'on' : 'off'\n end",
"def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end",
"def convert_tinyint_to_bool=(v)\n @conversion_procs[1] = v ? TYPE_TRANSLATOR_BOOLEAN : TYPE_TRANSLATOR_INTEGER\n @convert_tinyint_to_bool = v\n end",
"def db_boolean(val)\n if adapter == :postgres\n val ? 'TRUE' : 'FALSE'\n else\n val ? '1' : '0'\n end\n end",
"def translate_boolean(boolean)\n I18n.translate!(boolean)\n rescue I18n::MissingTranslationData\n boolean.to_s\n end",
"def encode_init_value(value)\n if value.is_a?(String)\n \"\\\"#{value}\\\"\"\n elsif [true, false].include?(value)\n value.to_s\n end\n end",
"def convert_literals(value)\n if value == \"#nil\"\n return nil\n elsif value == \"#true\"\n return true\n elsif value == \"#false\"\n return false\n else\n return value\n end\n end",
"def tbool(b)\n t(b ? \"common._yes\" : \"common._no\")\n end",
"def to_bool\n return true if ['true', '1', 'yes', 'on', 't'].include? self\n return false if ['false', '0', 'no', 'off', 'f'].include? self\n return false\n end",
"def bool(val)\n case val.to_s.downcase\n when 'y', 'yes', 'on', 't', 'true'\n true\n when 'n', 'no', 'off', 'f', 'false'\n false\n else\n nil\n end\nend",
"def boolean(boolI)\n if boolI==1 then\n return true\n end\n return false\nend",
"def coerce_str_to_bool(*keys)\n coerce(*keys){ |str_bool| (str_bool == 'on' || str_bool == 'true')}\n end",
"def bool_value(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end",
"def display_boolean(value:)\n return 'Unspecified' if value.nil?\n\n value ? 'Yes' : 'No'\n end",
"def object_to_boolean(value)\n return [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)\n end",
"def boolean_to_binary(array)\nend",
"def to_bool(str)\n str = str.to_s.downcase\n return true if str == 'yes' or str == 'true' or str == 'on'\n return true if str.to_i > 0\n return false\n end",
"def convert_boolean(key)\n @params[key] = _boolinze(@params[key]) if _is_bool?(get_default(key))\n end",
"def boolean(value)\n value ? true : false\n end",
"def convert_boolean_strings\n %i{ambiguous_ref_bases use_all_contigs include_low_hmes polyploidy}.each do | symbol |\n if @options.key?(symbol)\n @options[symbol] = @options[symbol] == 'false' ? false : true\n end\n end\n end",
"def config_to_value(v)\n case v\n when 'true'\n true\n when 'false'\n false\n else\n v\n end\n end",
"def normalize(boolean_str)\n\t\t\tTrue.include?(boolean_str) ? (:true) : (:false)\n\t\tend",
"def rs_cassandra_bool_config(config_val)\n if config_val.is_a?(String) then\n return config_val\n elsif config_val then\n return \"true\"\n else\n return \"false\"\n end\nend",
"def to_bool\n return false if self.downcase == \"false\"\n return true\n end",
"def write_booleanr(bool)\n\t\twrite_byte(1)\n\t\twrite_boolean(bool)\n\tend",
"def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end"
] |
[
"0.8680349",
"0.86385286",
"0.833737",
"0.79908687",
"0.7712514",
"0.7603247",
"0.7601336",
"0.7394316",
"0.73607004",
"0.73607004",
"0.7343037",
"0.73152786",
"0.72638005",
"0.7253689",
"0.7247133",
"0.7186867",
"0.71535224",
"0.7152073",
"0.7102689",
"0.7102689",
"0.707875",
"0.7059509",
"0.70567733",
"0.7053179",
"0.7051785",
"0.70510536",
"0.6999213",
"0.69971496",
"0.6982137",
"0.69757164",
"0.6972485",
"0.69720155",
"0.6965322",
"0.6960922",
"0.6955006",
"0.6952457",
"0.6945924",
"0.69354856",
"0.69312453",
"0.69104576",
"0.6894982",
"0.6856685",
"0.68372893",
"0.68298817",
"0.6823879",
"0.68205166",
"0.68205166",
"0.6813019",
"0.67900664",
"0.67793363",
"0.67793363",
"0.677585",
"0.6762256",
"0.6750318",
"0.6729187",
"0.6684292",
"0.66750836",
"0.6661105",
"0.6652835",
"0.6629528",
"0.66280264",
"0.6621929",
"0.6620586",
"0.66106164",
"0.6587701",
"0.65868634",
"0.65837014",
"0.65837014",
"0.65797955",
"0.6560334",
"0.6557794",
"0.65469027",
"0.6544271",
"0.6535107",
"0.65257746",
"0.65077066",
"0.64923584",
"0.6476291",
"0.64699817",
"0.6469271",
"0.64647543",
"0.6464744",
"0.64608467",
"0.64557576",
"0.6455057",
"0.64523417",
"0.6432168",
"0.642681",
"0.6423295",
"0.6410226",
"0.6394285",
"0.6383494",
"0.6380116",
"0.63663614",
"0.6359464",
"0.63582474",
"0.6354009",
"0.6333966",
"0.63202345",
"0.63155967"
] |
0.8851261
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_ad
@cp = CompanyPart.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
|
GET /vehicle_armies GET /vehicle_armies.json
|
def index
#@vehicle_armies = VehicleArmy.all
@vehicle_armies = VehicleArmy.order(:v_army_no => :desc).all
@search = VehicleArmy.search(params[:q])
@vehicle_armies = @search.result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @vehicle\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end",
"def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end",
"def set_vehicle_army\n @vehicle_army = VehicleArmy.find(params[:id])\n end",
"def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def vehicle\n fetch('final_space.vehicles')\n end",
"def show\n @media_vehicle = MediaVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @media_vehicle }\n end\n end",
"def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @vehicles = Vehicle.all\n end",
"def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end",
"def show\n render json: @truck\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end",
"def index\n #@space_vehicles = SpaceVehicle.all\n @space_vehicles = current_user.space_vehicles\n\n @being_shared_vehicles = current_user.shared_vehicles_by_others\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @space_vehicles }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @vehicle = Vehicle.find_by_id(params[:id])\n\n respond_to do |format|\n if @vehicle.present?\n format.html do\n if params[:lotredfrm].present?\n redirect_to edit_vehicle_url(@vehicle, lotredfrm: params[:lotredfrm])\n else\n redirect_to edit_vehicle_url(@vehicle) # The 'show' template is also the 'edit' template in this case.\n end\n end\n format.json { render json: { model_object: @vehicle.as_json(include_yard: 'yes', include_documents: \"yes\",\n include_seller_light: \"yes\", service_orders_compact: \"yes\") } }\n else\n format.html { redirect_to vehicles_url }\n format.json { render json: { errors: [ \"Vehicle #{params[:id]} not found.\" ] } }\n end\n end\n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @vehicle = Vehicle.find(params[:id])\n #if current_user.vehicles.contain?(@vehicle)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n #end\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def index\n @airplanes = Airplane.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @airplanes }\n end\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def show\n json_response(@airline.decorate.as_json(airplanes_details: true), :ok)\n end",
"def show\n render json: @car\n end",
"def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def index\n @vehicle_infos = VehicleInfo.all\n end",
"def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end",
"def show\n @airport = Airport.find(params[:id])\n @airlines = Aircompany.where(airport_id: params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @airport }\n end\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def movies\n get('Movies')\n end",
"def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def control \n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def show\n render json: @ride\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def index\n @railcars = Railcar.all\n end",
"def index\n @long_arms = LongArm.all\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def index\n @vehicles = current_user.vehicles\n end",
"def index\n airlines = Airline.includes(:airplanes).all.page(page).per(per)\n json_response(PageDecorator.decorate(airlines)\n .as_json(airplanes_details: true), :ok)\n end",
"def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end",
"def show\n @roadcrime = Roadcrime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roadcrime }\n end\n end",
"def trims(year, model)\n model_id = get_object_id model\n response = get_url \"Trims/#{year}/#{model_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetTrimsResult\"].map{|r| Models::Vehicle.from_response_hash(r)}\n end",
"def create\n @vehicle_army = VehicleArmy.new(vehicle_army_params)\n\n respond_to do |format|\n if @vehicle_army.save\n format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.created')}\n format.json { render action: 'show', status: :created, location: @vehicle_army }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_army.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n id = Vehicle.pluck(:api_id) # integer array\n\n \n end",
"def index\n @chase_vehicles = ChaseVehicle.all\n end",
"def index\n @chase_vehicles = ChaseVehicle.all\n end",
"def index\n @vehicle_locations = VehicleLocation.all \n end",
"def show\n @airplane = Airplane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @airplane }\n end\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vrabat }\n end\n end",
"def index\n @election = Election.find(params[:election_id])\n @races = @election.races\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @races }\n end\n end",
"def index\n @air_moistures = AirMoisture.all\n end",
"def show\n render json: @test_ride\n end",
"def vehicles; end",
"def index\n @rides = Ride.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @rides\n end",
"def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def index\n render json: reservations\n end",
"def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end",
"def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def index\n @hotel_rooms = HotelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hotel_rooms }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def show\n render json: @light\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def show\n @brand = Brand.find(params[:id])\n @makers = @brand.makers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brand }\n end\n end",
"def index\n @stolen_vehicles = StolenVehicle.all\n end",
"def show\n render json: @air_quality\n end",
"def index\n @verticals = Vertical.all()\n render json: @verticals\n end"
] |
[
"0.68414515",
"0.6673916",
"0.65709573",
"0.65295464",
"0.6391356",
"0.6357214",
"0.6283317",
"0.6254717",
"0.6202203",
"0.61548656",
"0.61426264",
"0.6133821",
"0.6106734",
"0.60786355",
"0.60765475",
"0.60387814",
"0.60319215",
"0.6030767",
"0.6009398",
"0.5986829",
"0.59850186",
"0.5982228",
"0.5919665",
"0.59192413",
"0.59084153",
"0.58949465",
"0.5855894",
"0.5827015",
"0.58254457",
"0.57956314",
"0.5793643",
"0.57930726",
"0.578902",
"0.578096",
"0.57678455",
"0.57543606",
"0.57526225",
"0.5752092",
"0.57471955",
"0.5746325",
"0.5746193",
"0.5745985",
"0.57442105",
"0.57401264",
"0.57369375",
"0.57205904",
"0.5713071",
"0.5706152",
"0.570505",
"0.56832975",
"0.56690454",
"0.56567746",
"0.56523377",
"0.56449705",
"0.5637073",
"0.56351966",
"0.56290054",
"0.562791",
"0.5624538",
"0.56110775",
"0.56002796",
"0.5594165",
"0.55891645",
"0.55881786",
"0.55869097",
"0.55838144",
"0.5579183",
"0.55756307",
"0.55725926",
"0.5571229",
"0.5563318",
"0.5563318",
"0.5562886",
"0.5554407",
"0.5549329",
"0.554777",
"0.5546544",
"0.5541722",
"0.5533831",
"0.5524706",
"0.5516432",
"0.5513596",
"0.5512951",
"0.5508818",
"0.55014354",
"0.5497133",
"0.5496778",
"0.54966307",
"0.54939157",
"0.5489006",
"0.5483792",
"0.54830545",
"0.5477607",
"0.54728657",
"0.54688734",
"0.5467159",
"0.546156",
"0.54611987",
"0.5451719",
"0.54482335"
] |
0.6194811
|
9
|
GET /vehicle_armies/1 GET /vehicle_armies/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @vehicle\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def show\n @media_vehicle = MediaVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @media_vehicle }\n end\n end",
"def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def vehicle\n fetch('final_space.vehicles')\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n end",
"def set_vehicle_army\n @vehicle_army = VehicleArmy.find(params[:id])\n end",
"def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end",
"def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @vehicles = Vehicle.all\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def show\n @vehicle = Vehicle.find_by_id(params[:id])\n\n respond_to do |format|\n if @vehicle.present?\n format.html do\n if params[:lotredfrm].present?\n redirect_to edit_vehicle_url(@vehicle, lotredfrm: params[:lotredfrm])\n else\n redirect_to edit_vehicle_url(@vehicle) # The 'show' template is also the 'edit' template in this case.\n end\n end\n format.json { render json: { model_object: @vehicle.as_json(include_yard: 'yes', include_documents: \"yes\",\n include_seller_light: \"yes\", service_orders_compact: \"yes\") } }\n else\n format.html { redirect_to vehicles_url }\n format.json { render json: { errors: [ \"Vehicle #{params[:id]} not found.\" ] } }\n end\n end\n end",
"def index\n #@vehicle_armies = VehicleArmy.all\n\t@vehicle_armies = VehicleArmy.order(:v_army_no => :desc).all\n @search = VehicleArmy.search(params[:q])\n @vehicle_armies = @search.result\n end",
"def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def show\n render json: @truck\n end",
"def vehicle\n vehicles.first\n end",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end",
"def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end",
"def index\n @vehicles = Vehicle.all\n\n id = Vehicle.pluck(:api_id) # integer array\n\n \n end",
"def vehicle()\n sql = \"SELECT * FROM vehicles INNER JOIN rentals ON rentals.vehicle_id\n = vehicles.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Vehicle.new(result)\n end",
"def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end",
"def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @vehicle = Vehicle.find(params[:id])\n #if current_user.vehicles.contain?(@vehicle)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n #end\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end",
"def index\n @vehicle_infos = VehicleInfo.all\n end",
"def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end",
"def show\n render json: @car\n end",
"def show\n @roadcrime = Roadcrime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roadcrime }\n end\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @airport = Airport.find(params[:id])\n @airlines = Aircompany.where(airport_id: params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @airport }\n end\n end",
"def index\n @airplanes = Airplane.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @airplanes }\n end\n end",
"def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end",
"def index\n #@space_vehicles = SpaceVehicle.all\n @space_vehicles = current_user.space_vehicles\n\n @being_shared_vehicles = current_user.shared_vehicles_by_others\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @space_vehicles }\n end\n end",
"def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def show\n render json: @ride\n end",
"def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end",
"def show\n @airplane = Airplane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @airplane }\n end\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end",
"def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end",
"def show\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vrabat }\n end\n end",
"def set_vehicle\n\t\t\t@vehicle = Vehicle.find(params[:id])\n\t\tend",
"def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n json_response(@airline.decorate.as_json(airplanes_details: true), :ok)\n end",
"def control \n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movies }\n end\n end",
"def show\n @jm_verse = JmVerse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jm_verse }\n end\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def show\n @caricullum = Caricullum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caricullum }\n end\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def show\n @monel = Monel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monel }\n end\n end",
"def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @microfilm_reel = MicrofilmReel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microfilm_reel }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def show\n # Show one record\n @maintenance = Maintenance.find(params[:id])\n # Since vehicle id can correspond to truck or trailer, we need to check which one is correct\n # which is set with vehicle type. Use the appropriate query based on the result\n if @maintenance.vehicle_type == 'truck'\n @truck = Truck.find(@maintenance.vehicle_id) rescue nil\n else\n @trailer = Trailer.find(@maintenance.vehicle_id) rescue nil\n end\n @trip = Trip.find(@maintenance.trip_id) rescue nil\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maintenance }\n end\n end",
"def show\n @trucking = Trucking.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trucking }\n end\n end",
"def show\n render json: @test_ride\n end",
"def show\n render json: @air_quality\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end"
] |
[
"0.69964856",
"0.6903795",
"0.6844377",
"0.6773009",
"0.6669359",
"0.65195805",
"0.64644545",
"0.646372",
"0.63832116",
"0.6360878",
"0.63604254",
"0.629952",
"0.6226809",
"0.6192622",
"0.61595255",
"0.6152078",
"0.6140195",
"0.6138111",
"0.61216927",
"0.6118195",
"0.61150986",
"0.61052835",
"0.61034524",
"0.61024183",
"0.6097334",
"0.6078502",
"0.605498",
"0.6036736",
"0.6014015",
"0.5994193",
"0.59468895",
"0.594322",
"0.5942971",
"0.5937775",
"0.5937463",
"0.59349215",
"0.59321225",
"0.59249884",
"0.5915582",
"0.5912446",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5904015",
"0.5895211",
"0.58806103",
"0.5857482",
"0.58412397",
"0.58316857",
"0.58124614",
"0.58119166",
"0.57978284",
"0.5793153",
"0.5791611",
"0.5786417",
"0.57851994",
"0.5776642",
"0.57764727",
"0.57723284",
"0.5748932",
"0.57423675",
"0.5733319",
"0.5729344",
"0.5716299",
"0.5706837",
"0.5706123",
"0.5695901",
"0.5694143",
"0.5686655",
"0.5682323",
"0.5681265",
"0.56778973",
"0.56662583",
"0.56657034",
"0.56613517",
"0.56575155",
"0.5650395",
"0.56460434",
"0.56457573",
"0.56436884",
"0.56422013",
"0.5633486",
"0.56333923",
"0.5630537",
"0.56286955",
"0.56284654",
"0.56248975",
"0.56207097",
"0.5619794",
"0.5619794",
"0.5619794",
"0.5619794",
"0.56141555",
"0.5606575"
] |
0.0
|
-1
|
POST /vehicle_armies POST /vehicle_armies.json
|
def create
@vehicle_army = VehicleArmy.new(vehicle_army_params)
respond_to do |format|
if @vehicle_army.save
format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.created')}
format.json { render action: 'show', status: :created, location: @vehicle_army }
else
format.html { render action: 'new' }
format.json { render json: @vehicle_army.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = get_vehicle_from_params\n\n respond_to do |format|\n if @vehicle.save!\n @vehicle.accounts << current_user.account\n format.html { redirect_to root_path, notice: 'Vehicle was successfully created.' }\n format.json { render @vehicle.id}#json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n\n respond_to do |format|\n binding.pry\n if @vehicle.save\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_model = @vehicle_brand.vehicle_models.build(vehicle_model_params)\n\n respond_to do |format|\n if @vehicle_model.save\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicle_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vehicle_army\n @vehicle_army = VehicleArmy.find(params[:id])\n end",
"def create\n @railcar = Railcar.new(railcar_params)\n\n respond_to do |format|\n if @railcar.save\n format.html { redirect_to @railcar, notice: 'Railcar was successfully created.' }\n format.json { render :show, status: :created, location: @railcar }\n else\n format.html { render :new }\n format.json { render json: @railcar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'El vehículo ha sido creado exitosamente.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:api_id, :api_vehicle_company_id, :number, :status, :ifta, :vin, :make, :model, :year, :license_plate_state, :license_plate_number, :metric_units, :fuel_type, :prevent_auto_odometer_entry, :edl_device_id, :edl_identifier, :edl_model, :api_driver_id, :driver_first_name, :driver_last_name, :driver_username, :driver_email, :driver_internal_id, :driver_status, :driver_role)\n end",
"def create\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n if !@vehicles.nil?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to \"/vehicles\", notice: 'El vehículo fue añadido!' }\n format.json { render :index, status: :created, location: @vehicle }\n else\n format.html { render :index}\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:plate, :brand, :model, :string, :doors, :kind, :user_id, :actual_vehicle)\n end",
"def create\n\t\t@vehicle = Vehicle.new(vehicle_params)\n\n\t\trespond_to do |format|\n\t\t\tif @vehicle.save\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @vehicle }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def vehicle_params\n params.require(:vehicle).permit(:vehicle_model_id, :year, :odometer,\n :license_plate, :engine_number, :drive,\n :chasis_number, :transmission, :engine_type,\n :passenger_capacity, :air_conditioning,\n :airbags_quantity, :door_quantity,\n :steering, :body_type, :comment, :status,\n images: [])\n end",
"def vehicle_params\n params.require(:vehicle).permit(:code, :name, :historic, :speed, :user_id)\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def create\n @stolen_vehicle = StolenVehicle.new(stolen_vehicle_params)\n\n respond_to do |format|\n if @stolen_vehicle.save\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @stolen_vehicle }\n else\n format.html { render :new }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @load_vehicle = LoadVehicle.new(load_vehicle_params)\n\n respond_to do |format|\n if @load_vehicle.save\n format.html { redirect_to @load_vehicle, notice: 'LoadVehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @load_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @load_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @vehicle\n end",
"def create_vehicle\n if @work_order_vehicle.present?\n render json: :conflict, status: :conflict\n else\n @work_order_vehicle = WorkOrderVehicle.new\n @work_order_vehicle.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_vehicle.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_vehicle.save\n render json: serialized_work_order_vehicle(@work_order_vehicle), status: :created\n else\n render json: format_errors(@work_order_vehicle), status: :unprocessable_entity\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:name, \n :model_year, \n :make, \n :model, \n :trim_level, \n :body_style, \n :engine_type, \n :milage, \n :vin, \n :notes,\n :image, \n :bought_date, \n :bought_milage, \n :bought_price)\n end",
"def create\n @vehicle_realtime = VehicleRealtime.new(vehicle_realtime_params)\n\n respond_to do |format|\n if @vehicle_realtime.save\n format.html { redirect_to @vehicle_realtime, notice: 'Vehicle realtime was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_realtime }\n else\n format.html { render :new }\n format.json { render json: @vehicle_realtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end",
"def update_vehicles vehicle\n if self.vehicle.nil?\n self.create_vehicles vehicle\n else\n self.vehicle.update!(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:year, :mileage, :price, :vehiclemodel_id)\n end",
"def create\n @vehicle = @fleet.vehicles.create(params[:vehicle])\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to( [@vehicle.fleet, @vehicle], :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @truck = Truck.new(truck_params)\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n \n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @railway = Railway.new(params[:railway])\n\n respond_to do |format|\n if @railway.save\n format.html { redirect_to @railway, notice: 'Railway was successfully created.' }\n format.json { render json: @railway, status: :created, location: @railway }\n else\n format.html { render action: \"new\" }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit!\n end",
"def create\n @vehicle = Vehicle.new(params[:vehicle])\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vehicle_army_params\n params.require(:vehicle_army).permit(:v_army_no)\n end",
"def create\n @chase_vehicle = ChaseVehicle.new(chase_vehicle_params)\n\n respond_to do |format|\n if @chase_vehicle.save\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @chase_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chase_vehicle = ChaseVehicle.new(chase_vehicle_params)\n\n respond_to do |format|\n if @chase_vehicle.save\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @chase_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_vehicle = City.find(session[:current_city_id]).utility.vehicles.new(admin_vehicle_params)\n @vehicle_type = params[:vehicle][:vehicle_type]\n italian_type = {parking:'Parcheggi', bike:'Bici', taxi:'Taxi'}\n respond_to do |format|\n if @admin_vehicle.save\n format.html { redirect_to session['previous_url'] || admin_vehicles_url(vehicle_type: @admin_vehicle.vehicle_type), notice: \"#{italian_type[@vehicle_type.to_sym]} è stato creato con successo.\" }\n format.json { render :show, status: :created, location: @admin_vehicle }\n else\n format.html { render :new }\n format.json { render json: @admin_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:license_plate, :color, :year)\n end",
"def create\n #@space_vehicle = SpaceVehicle.new(params[:space_vehicle])\n @space_vehicle = current_user.space_vehicles.new(params[:space_vehicle])\n\n respond_to do |format|\n if @space_vehicle.save\n format.html { redirect_to @space_vehicle, notice: 'Space vehicle was successfully created.' }\n format.json { render json: @space_vehicle, status: :created, location: @space_vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicletype = Vehicletype.new(vehicletype_params)\n\n respond_to do |format|\n if @vehicletype.save\n format.html { redirect_to @vehicletype, notice: 'Vehicletype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicletype }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicletype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.find params[:vehicle_id]\n @mileage = @vehicle.mileages.new(params[:mileage])\n \n respond_to do |format|\n if @mileage.save\n format.html { redirect_to([@mileage.vehicle.fleet, @mileage.vehicle], :notice => 'Mileage Record was successfully created.') }\n format.xml { render :xml => @mileage, :status => :created, :location => @mileage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mileage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @air_moisture = AirMoisture.new(air_moisture_params)\n\n respond_to do |format|\n if @air_moisture.save\n format.html { redirect_to @air_moisture, notice: 'Air moisture was successfully created.' }\n format.json { render :show, status: :created, location: @air_moisture }\n else\n format.html { render :new }\n format.json { render json: @air_moisture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @media_vehicle = MediaVehicle.new(params[:media_vehicle])\n\n respond_to do |format|\n if @media_vehicle.save\n format.html { redirect_to @media_vehicle, notice: 'Media vehicle was successfully created.' }\n format.js\n format.json { render json: @media_vehicle, status: :created, location: @media_vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @media_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = @current_user.vehicles.build params[:vehicle]\n\n respond_to do |format|\n if @vehicle.save\n flash[:success] = \"#{@vehicle.name} was successfully created.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @long_arm = LongArm.new(long_arm_params)\n\n respond_to do |format|\n if @long_arm.save\n format.html { redirect_to @long_arm, notice: 'Long arm was successfully created.' }\n format.json { render :show, status: :created, location: @long_arm }\n else\n format.html { render :new }\n format.json { render json: @long_arm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:year, :mileage, :price)\n end",
"def create\n @vehicle=Vehicle.find_or_create_by(vehicle_params)\n end",
"def set_vehicle(id, params)\n fleet[id] = RoutificApi::Vehicle.new(id, params)\n end",
"def vehicle_params\n params.require(:vehicle).permit(:patente, :vehicle_type_id, :description, :phone)\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def create\n @vehicle = Vehicle.new(params[:vehicle])\n if @vehicle.save\n flash[:notice] = \"New Vehicle Created\"\n redirect_to @vehicle\n else\n flash[:error] = @vehicle.errors.full_messages.to_sentence \n redirect_to new_vehicle_path\n end\n end",
"def create\n @vehicle = Vehicle.new(params[:vehicle])\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to(new_process_register_url, :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n attributes = set_attributes(params)\n @carpool = Carpool.find(params[:id])\n @appointment = current_user.created_appointments.new(attributes)\n @appointment.carpool_id = @carpool.id\n if @appointment.save\n @rider = current_user.riders.create(appointment_id: @appointment.id, rider_role: \"Driver\")\n render partial: 'appointment2.json.jbuilder', locals: { appointment: @appointment }, status: :created\n else\n render json: { errors: @appointment.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\n @lease = Lease.new(params[:lease])\n\n respond_to do |format|\n if @lease.save\n car = Car.where(:registration => @lease.registration).first\n car.update_attributes(:longtermassigned => true)\n format.html { redirect_to cars_url, :notice => 'Lease was successfully created.' }\n format.json { render :json => @lease, :status => :created, :location => @lease }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lease.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n assign_vehicle_to_user\n redirect_to @vehicle, notice: 'Vehicle was successfully created.'\n else\n render :new\n end\n end",
"def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def create\n @bike = Bike.new(bike_params)\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.save\n audit(@bike, current_user)\n render json: @bike, status: :created #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end",
"def create\n @airline = Airline.new(airline_params)\n\n if @airline.save\n json_response(@airline.decorate.as_json(airplanes_details: true),\n :created)\n else\n json_response(@airline.errors, :unprocessable_entity)\n end\n end",
"def create\n @vehicle_info = VehicleInfo.new(vehicle_info_params)\n\n respond_to do |format|\n if @vehicle_info.save\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_info }\n else\n format.html { render :new }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_param\n params.require(:vehicle).permit(:license, :colour, :make, :model, :year)\n end",
"def create\n @vehicle_end_of_life = VehicleEndOfLife.new(vehicle_end_of_life_params)\n\n respond_to do |format|\n if @vehicle_end_of_life.save\n format.html { redirect_to vehicles_path, notice: (t 'vehicle_end_of_lives.title2')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @vehicle_end_of_life }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_end_of_life.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_vehicle = UserVehicle.new(user_vehicle_params)\n\t\t@user_vehicle.user = current_user\n respond_to do |format|\n if @user_vehicle.save\n format.html { redirect_to @user_vehicle, notice: 'User vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @user_vehicle }\n else\n format.html { render :new }\n format.json { render json: @user_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.user = current_user\n @reservation.flight = flight\n\n if @reservation.save\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create\n # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end",
"def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, status: :ok\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def create\n @vehicle = Vehicle.new()\n\n \n # Populate the basic information from the form\n @vehicle.make = params[:vehicle][:make]\n @vehicle.model = params[:vehicle][:model]\n @vehicle.miles = params[:vehicle][:miles]\n @vehicle.colour = params[:vehicle][:colour]\n @vehicle.image = params[:vehicle][:image]\n @vehicle.owners = params[:vehicle][:owners]\n @vehicle.reg = params[:vehicle][:reg]\n @vehicle.price = params[:vehicle][:price]\n @vehicle.description = params[:vehicle][:description]\n \n myCar = BasicModelCar.new(@vehicle.make, @vehicle.model, @vehicle.miles, @vehicle.colour, @vehicle.image, @vehicle.owners, @vehicle.reg, @vehicle.price, @vehicle.description)\n crashLogger = CrashLogger.instance\n # Add some additional features to our new car\n # the statements could be written inline: params[:newcar][:fireExt].to_s.length > 0 ? myCar = FireExtinguisher.new(myCar) : null\n if params[:vehicle][:NCT].to_s.length > 0 then\n myCar = NCT.new(myCar)\n end\n if params[:vehicle][:Taxed].to_s.length > 0 then\n myCar = Taxed.new(myCar)\n end\n if params[:vehicle][:ExtendedWarranty].to_s.length > 0 then\n myCar = ExtendedWarranty.new(myCar)\n end\n if params[:vehicle][:Crashed].to_s.length > 0 then\n crashLogger.logCrash(@vehicle.reg.to_s)\n end\n \n ##Populate the cost and description information\n @vehicle.price = myCar.getPrice\n @vehicle.description = myCar.getDescription\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @car = Car.new(car_params)\n\n if @car.save\n render json: @car, status: :created, location: @car\n else\n render json: @car.errors, status: :bad_request\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vehicle_submodel = VehicleSubmodel.new(vehicle_submodel_params)\n\n respond_to do |format|\n if @vehicle_submodel.save\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_submodel }\n else\n format.html { render :new }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:user_id, :model, :year, :vin, :id)\n end",
"def create\n @rayon = Rayon.new(params[:rayon])\n\n respond_to do |format|\n if @rayon.save\n format.html { redirect_to @rayon, notice: 'Rayon was successfully created.' }\n format.json { render json: @rayon, status: :created, location: @rayon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:name, :number, :category, :member_id)\n end",
"def create\n @vrabat = Vrabat.new(params[:vrabat])\n\n respond_to do |format|\n if @vrabat.save\n format.html { redirect_to @vrabat, notice: 'Vrabat was successfully created.' }\n format.json { render json: @vrabat, status: :created, location: @vrabat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vrabat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_card = VehicleCard.new(vehicle_card_params)\n\n respond_to do |format|\n if @vehicle_card.save\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @vehicle_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(allowed_params)\n if @vehicle.save\n flash[:notice] = \"New Vehicle Created\"\n redirect_to @vehicle\n else\n flash[:error] = @vehicle.errors.full_messages.to_sentence\n redirect_to Vehicle.find_by_vin @vehicle.vin\n end\n end",
"def create\n\n @vehicel = @user.vehicels.create(vehicel_params)\n respond_to do |format|\n if @vehicel.save\n format.html { redirect_to user_vehicels_path(@user, @vehicel) }\n format.json { render :show, status: :created, location: @vehicel }\n else\n format.html { render :new }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @motor_bike = MotorBike.new(motor_bike_params)\n\n respond_to do |format|\n if @motor_bike.save\n format.html { redirect_to @motor_bike, notice: 'Motor bike was successfully created.' }\n format.json { render :show, status: :created, location: @motor_bike }\n else\n format.html { render :new }\n format.json { render json: @motor_bike.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n venture = Venture.new(venture_params)\n\n if venture.save \n render json: {venture: venture}, status: :created\n else\n render json: {status: 'Error', message: 'Venture not saved', data: venture.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @plate = Plate.new(params[:plate])\n\n if @plate.save\n render json: @plate, status: :created, location: @plate\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def create\n @airplane = Airplane.new(params[:airplane])\n\n respond_to do |format|\n if @airplane.save\n format.html { redirect_to @airplane, :notice => 'Airplane was successfully created.' }\n format.json { render :json => @airplane, :status => :created, :location => @airplane }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @airplane.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def chase_vehicle_params\n params.require(:chase_vehicle).permit(:description, :identifier, \n :mission_id, :chase_server_id )\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def create\n @race_car = RaceCar.new(race_car_params)\n\n respond_to do |format|\n if @race_car.save\n format.html { redirect_to @race_car, notice: 'Race car was successfully created.' }\n format.json { render :show, status: :created, location: @race_car }\n else\n format.html { render :new }\n format.json { render json: @race_car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @motoristum = Motoristum.new(motoristum_params)\n\n respond_to do |format|\n if @motoristum.save\n format.html { redirect_to @motoristum, notice: 'Motoristum was successfully created.' }\n format.json { render :show, status: :created, location: @motoristum }\n else\n format.html { render :new }\n format.json { render json: @motoristum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mrv = Mrv.new(mrv_params)\n\n respond_to do |format|\n if @mrv.save\n format.html { redirect_to @mrv, notice: 'Mrv was successfully created.' }\n format.json { render :show, status: :created, location: @mrv }\n else\n format.html { render :new }\n format.json { render json: @mrv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:license, :colour, :make, :model, :year, :user_id)\n end",
"def vehicle_params\n params.require(:vehicle).permit(:veh_reg_no, :category, :name, :desc, :photo, :daily_rate, :color => [], :features => [])\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n new_stock = StockQuote::Stock.quote(@vehicle.ticker)\n @vehicle.name = new_stock.name\n @vehicle.last_price= new_stock.last_trade_price_only\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_manufacturer = VehicleManufacturer.new(vehicle_manufacturer_params)\n\n respond_to do |format|\n if @vehicle_manufacturer.save\n flash.now[:notice] = 'Vehicle manufacturer was successfully created.'\n format.html { redirect_to @vehicle_manufacturer, notice: 'Vehicle manufacturer was successfully created.' }\n format.js\n format.json { render action: 'show', status: :created, location: @vehicle_manufacturer }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_manufacturer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n runway = qx_take_off_params[:runway].split(\"/\")\n runway.each do |item|\n qx_take_off_params[:runway_id] = Qx::Runway.get_runay_id(qx_take_off_params[:airport_id], item)\n @qx_take_off = Qx::TakeOff.new(qx_take_off_params)\n end\n\n\n p runway\n\n respond_to do |format|\n if @qx_take_off.save\n format.html { redirect_to @qx_take_off, notice: 'Take off was successfully created.' }\n format.json { render :show, status: :created, location: @qx_take_off }\n else\n format.html { render :new }\n format.json { render json: @qx_take_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plate = @restaurante.plates.create(plate_params)\n @plate.ratings ||= []\n @plate.clients_ratings ||= []\n\n respond_to do |format|\n if @plate.save\n format.html { redirect_to restaurante_plate_path(@restaurante, @plate),\n notice: 'Plato creado exitosamente.' }\n format.json { render :show, status: :created, location: @plate }\n else\n format.html { render :new }\n format.json { render json: @plate.errors,\n status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6746426",
"0.6452859",
"0.63560665",
"0.63560665",
"0.63560665",
"0.61956847",
"0.61088204",
"0.6034517",
"0.59630686",
"0.588549",
"0.5882796",
"0.5863898",
"0.5844551",
"0.5834354",
"0.5832875",
"0.58074296",
"0.58066344",
"0.5794564",
"0.5791548",
"0.5738122",
"0.5736471",
"0.5736175",
"0.57307947",
"0.5680432",
"0.56796885",
"0.56685746",
"0.5659185",
"0.565683",
"0.5656264",
"0.56544316",
"0.5652618",
"0.5647473",
"0.5632758",
"0.5632458",
"0.5632458",
"0.56051993",
"0.5604988",
"0.5603727",
"0.5574867",
"0.55599517",
"0.5557226",
"0.5555813",
"0.5555367",
"0.55543226",
"0.55436945",
"0.5534631",
"0.5530737",
"0.5520923",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.55102676",
"0.5509857",
"0.550502",
"0.550434",
"0.548633",
"0.54852057",
"0.5472673",
"0.54629004",
"0.5456413",
"0.5455209",
"0.54487145",
"0.54403",
"0.5439024",
"0.54351544",
"0.5430959",
"0.5422878",
"0.54212993",
"0.54188573",
"0.53979146",
"0.53965175",
"0.53891504",
"0.53758246",
"0.53731275",
"0.5368122",
"0.5362309",
"0.5361129",
"0.53546923",
"0.5352867",
"0.5352634",
"0.53439105",
"0.5342657",
"0.53333384",
"0.53261477",
"0.5324599",
"0.53242713",
"0.5315352",
"0.53148764",
"0.5306662",
"0.53044856",
"0.52892524",
"0.5289121",
"0.52863836"
] |
0.67126286
|
1
|
PATCH/PUT /vehicle_armies/1 PATCH/PUT /vehicle_armies/1.json
|
def update
respond_to do |format|
if @vehicle_army.update(vehicle_army_params)
format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.updated') }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @vehicle_army.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, status: :ok\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_vehicles vehicle\n if self.vehicle.nil?\n self.create_vehicles vehicle\n else\n self.vehicle.update!(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehcile }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_model.update(vehicle_model_params)\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @vehicle.update(vehicle_params)\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'El vehículo ha sido actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @load_vehicle.update(load_vehicle_params)\n format.html { redirect_to @load_vehicle, notice: 'LoadVehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @load_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @vehicle_model.update_attributes(params[:vehicle_model])\n flash[:notice] = 'VehicleModel was successfully updated.'\n render :partial => 'show', :object => @vehicle_model\n else\n render :partial => 'edit', :object => @vehicle_model, :status => 409\n end\n end",
"def update\n respond_to do |format|\n if @stolen_vehicle.update(stolen_vehicle_params)\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n\n if !@vehicles.nil?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Los datos del vehículo fueron modificados' }\n format.json { render :index, status: :ok, location: @vehicle, notice: 'Los datos del vehículo fueron modificados'}\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chase_vehicle.set(chase_vehicle_params)\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chase_vehicle.set(chase_vehicle_params)\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @media_vehicle = MediaVehicle.find(params[:id])\n\n respond_to do |format|\n if @media_vehicle.update_attributes(params[:media_vehicle])\n format.html { redirect_to @media_vehicle, notice: 'Media vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @media_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_manufacturer.update(vehicle_manufacturer_params)\n format.html { redirect_to @vehicle_manufacturer, notice: 'Vehicle manufacturer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_manufacturer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_submodel.update(vehicle_submodel_params)\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_submodel }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_realtime.update(vehicle_realtime_params)\n format.html { redirect_to @vehicle_realtime, notice: 'Vehicle realtime was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_realtime }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_realtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n \n respond_to do |format|\n if @vehiclepermit.update(permit_params)\n @vehiclepermit.update(vehicle: vehicle)\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehiclepermit }\n else\n format.html { render :edit }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_info.update(vehicle_info_params)\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_info }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicletype.update(vehicletype_params)\n format.html { redirect_to @vehicletype, notice: 'Vehicletype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicletype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_boat_part.update(vehicle_boat_part_params)\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_boat_part }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_vehicle.update(user_vehicle_params)\n format.html { redirect_to @user_vehicle, notice: 'User vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @user_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_information.update(vehicle_information_params)\n format.html { redirect_to @vehicle_information, notice: 'Vehicle information was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_information }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_vehicles\n @vehicles = Customer.find_by(customer_id: params[:customer_id].to_i).vehicles\n respond_to do |format|\n format.html { render(:text => \"not implemented\") }\n format.js\n end\n end",
"def update\n @vehicle = Vehicle.find(id_from_params)\n #if (@vehicle.vehicle_type.casecmp(\"Pickup\") == 0) || (@vehicle.vehicle_type.casecmp(\"SUV\") == 0) || (@vehicle.vehicle_type.casecmp(\"Crossover\") == 0) || (@vehicle.vehicle_type.casecmp(\"CUV\") == 0) || (@vehicle.vehicle_type.casecmp(\"Van\") == 0) || (@vehicle.vehicle_type.casecmp(\"Minivan\") == 0)\n #@vehicle.size = \"Large\"\n #elsif(@vehicle.vehicle_type.casecmp(\"Convertible\") == 0) || (@vehicle.vehicle_type.casecmp(\"Coupe\") == 0) || (@vehicle.vehicle_type.casecmp(\"Sedan\") == 0) || (@vehicle.vehicle_type.casecmp(\"Wagon\") == 0) || (@vehicle.vehicle_type.casecmp(\"Hatchback\") == 0)\n #@vehicle.size = \"Small\"\n #end\n\n respond_to do |format|\n if @vehicle.update_attributes(params_update_vehicle)\n format.html { redirect_to root_path, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle_historic = VehicleHistoric.find(params[:id])\n @vehicle_historic.status = \"aberto\"\n\n respond_to do |format|\n if @vehicle_historic.update_attributes(params[:vehicle_historic])\n format.html { redirect_to(@vehicle_historic, :notice => 'Vehicle historic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle_historic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_vehicle(id, params)\n fleet[id] = RoutificApi::Vehicle.new(id, params)\n end",
"def update\n respond_to do |format|\n if @car_specific_spec.update(car_specific_spec_params)\n format.html { redirect_to @car_specific_spec, notice: 'Car specific spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @car_specific_spec }\n else\n format.html { render :edit }\n format.json { render json: @car_specific_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sub_vehicle = SubVehicle.find(params[:id])\n\n respond_to do |format|\n if @sub_vehicle.update_attributes(params[:sub_vehicle])\n format.html { redirect_to(@sub_vehicle, :notice => 'Sub vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sub_vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_card.update(vehicle_card_params)\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @vehicle = Vehicle.find(params[:id])\n\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end",
"def update\n respond_to do |format|\n if @railcar.update(railcar_params)\n format.html { redirect_to @railcar, notice: 'Railcar was successfully updated.' }\n format.json { render :show, status: :ok, location: @railcar }\n else\n format.html { render :edit }\n format.json { render json: @railcar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_reservation.update(vehicle_reservation_params)\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vehicle_reservation }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bike = Bike.find(params[:id])\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.update(bike_params)\n audit(@bike, current_user)\n render json: @bike, status: :ok #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @long_arm.update(long_arm_params)\n format.html { redirect_to @long_arm, notice: 'Long arm was successfully updated.' }\n format.json { render :show, status: :ok, location: @long_arm }\n else\n format.html { render :edit }\n format.json { render json: @long_arm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_vehicle.update(admin_vehicle_params)\n format.html { redirect_to session['previous_url'] || admin_vehicles_url(vehicle_type: @admin_vehicle.vehicle_type), notice: \"#{@italian_type[@vehicle_type.to_sym]} è stato aggiornato con successo.\" }\n format.json { render :show, status: :ok, location: @admin_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @admin_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feature = Feature.find(params[:id])\n if params[:vehicle_id]\n @method = Vehicle.find(params[:vehicle_id]).toggle_feature(@feature)\n end\n\n respond_to do |format|\n if @feature.update_attributes(feature_params)\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_vehicle_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VehicleApi.update_vehicle ...\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling VehicleApi.update_vehicle\"\n end\n # resource path\n local_var_path = \"/vehicle\"\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/xml', 'application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['vehiclegarage_auth']\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: VehicleApi#update_vehicle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n @tipo_unidad = @truck.get_tipos()\n @config = @truck.get_config()\n @clase = @truck.get_clase()\n @color = @truck.get_color()\n\n\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def set_vehicle_army\n @vehicle_army = VehicleArmy.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @vehicle_service_record.update(vehicle_service_record_params)\n format.html { redirect_to @vehicle_service_record.vehicle, notice: 'Vehicle Service Record was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_service_record }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_service_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n update_resource @ride, ride_params\n end",
"def update\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n if @location.dt_devolucao.nil?\n else\n @vehicle = Vehicle.find_by(id: @location.vehicle_id)\n @client = Client.find_by(id: @location.client_id)\n \n @vehicle.update_attribute(:status, 'DISPONÍVEL')\n @client.update_attribute(:status, 'DISPONÍVEL')\n end\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_type.update(vehicle_type_params)\n images\n\n format.html { redirect_to @vehicle_type, notice: 'Vehicle type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @product_option_vehicle_model.update_attributes(params[:product_option_vehicle_model])\n flash[:notice] = 'ProductOptionVehicleModel was successfully updated.'\n render :partial => 'show', :object => @product_option_vehicle_model\n else\n render :partial => 'edit', :object => @product_option_vehicle_model, :status => 409\n end\n end",
"def update\n respond_to do |format|\n if @check_vehicle_status.update(check_vehicle_status_params)\n format.html { redirect_to @check_vehicle_status, notice: 'Check vehicle status was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_vehicle_status }\n else\n format.html { render :edit }\n format.json { render json: @check_vehicle_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_fine.update(vehicle_fine_params)\n format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_fine }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @airline.update(airline_params)\n json_response(@airline.decorate.as_json(airplanes_details: true),\n :ok)\n else\n json_response(@airline.errors, :unprocessable_entity)\n end\n end",
"def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end",
"def update\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n if @railway.update_attributes(params[:railway])\n format.html { redirect_to @railway, notice: 'Railway was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sims_biga_vehicle_person.update(sims_biga_vehicle_person_params)\n format.html { redirect_to @sims_biga_vehicle_person, notice: t('flash.notice.updated.') }\n format.json { render :show, status: :ok, location: @sims_biga_vehicle_person }\n else\n format.html { render :edit }\n format.json { render json: @sims_biga_vehicle_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(1)\n @trucks = @company.get_trucks()\n @employees = @company.get_employees()\n \n respond_to do |format|\n if @sheet_route_detail.update(sheet_route_detail_params)\n format.html { redirect_to @sheet_route, notice: 'Sheet route detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sheet_route_detail }\n else\n format.html { render :edit }\n format.json { render json: @sheet_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vehicle\n\t\t\t@vehicle = Vehicle.find(params[:id])\n\t\tend",
"def update\n respond_to do |format|\n if @vehicle_end_of_life.update(vehicle_end_of_life_params)\n format.html { redirect_to vehicles_path, notice: (t 'vehicle_end_of_lives.title2')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_end_of_life.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authenticate_request!\n\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @plate.update(plate_params)\n format.html { redirect_to [@client, @budget, @mobile], notice: 'Chapa atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @plate }\n else\n format.html { render :edit }\n format.json { render json: @plate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ball_flight_item = BallFlightItem.find(params[:id])\n\n respond_to do |format|\n if @ball_flight_item.update_attributes(params[:ball_flight_item])\n format.html { redirect_to @ball_flight_item, notice: 'Ball flight item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ball_flight_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opttruck.update(opttruck_params)\n format.html { redirect_to @opttruck, notice: 'Opttruck was successfully updated.' }\n format.json { render :show, status: :ok, location: @opttruck }\n else\n format.html { render :edit }\n format.json { render json: @opttruck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t@vehicle_categories = VehicleCategory.all\n\t@vehicle_category = VehicleCategory.find(params[:id])\n respond_to do |format|\n if @vehicle_category.update(vehicle_category_params)\n format.html { redirect_to @vehicle_category, notice: 'Vehicle category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle_class = VehicleClass.find(params[:id])\n\n respond_to do |format|\n if @vehicle_class.update_attributes(params[:vehicle_class])\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @race_car.update(race_car_params)\n format.html { redirect_to @race_car, notice: 'Race car was successfully updated.' }\n format.json { render :show, status: :ok, location: @race_car }\n else\n format.html { render :edit }\n format.json { render json: @race_car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if (params[:commit] == 'Cancel')\n @vehicle.reload\n flash[:info] = \"Editing of #{@vehicle.name} was cancelled.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { head :ok }\n elsif @vehicle.update_attributes(params[:vehicle])\n first_fill_up = @vehicle.fill_ups.sort{ |a,b| a.odometer <=> b.odometer}[0] unless @vehicle.fill_ups.size == 0\n first_fill_up.save unless first_fill_up.nil?\n flash[:success] = \"#{@vehicle.name} was successfully updated.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_vehicle\n @vehicle = Vehicle.find(params[:id]) rescue Vehicle.find(params[:vehicle_id])\n end",
"def update\n @vehicle_fine_types = VehicleFineType.all\n @vehicle_fine_type = VehicleFineType.find(params[:id])\n respond_to do |format|\n if @vehicle_fine_type.update(vehicle_fine_type_params)\n format.html { redirect_to @vehicle_fine_type, notice: 'Vehicle fine type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_fine_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6961523",
"0.69212383",
"0.6872287",
"0.6872287",
"0.6674775",
"0.6674775",
"0.6674775",
"0.66632587",
"0.66361785",
"0.66121715",
"0.6586705",
"0.6449745",
"0.6431252",
"0.63984746",
"0.63394976",
"0.63379335",
"0.6299391",
"0.62926656",
"0.62926656",
"0.62907225",
"0.62907225",
"0.62643427",
"0.62523055",
"0.62520576",
"0.6221802",
"0.619596",
"0.6180662",
"0.6178206",
"0.6166777",
"0.61194134",
"0.608751",
"0.6078855",
"0.60649717",
"0.6033066",
"0.60321414",
"0.5987405",
"0.59776956",
"0.59723485",
"0.5969439",
"0.5944275",
"0.5921644",
"0.59205",
"0.59048706",
"0.5899503",
"0.5899503",
"0.5899503",
"0.5899503",
"0.5899503",
"0.5898248",
"0.5898244",
"0.5896826",
"0.58926105",
"0.5891094",
"0.5877559",
"0.5870794",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5863326",
"0.5848047",
"0.5842288",
"0.58395255",
"0.5825401",
"0.5824314",
"0.5820876",
"0.5820348",
"0.58182305",
"0.581734",
"0.58017117",
"0.57953686",
"0.57906",
"0.5788831",
"0.5770966",
"0.5761754",
"0.5752781",
"0.5730248",
"0.57221514",
"0.5719952",
"0.5713775",
"0.5710437",
"0.56972927",
"0.5693186",
"0.56905323",
"0.5688456",
"0.5683734",
"0.5672335",
"0.5665906",
"0.566455",
"0.566416",
"0.5655185",
"0.5651609",
"0.564956",
"0.564956"
] |
0.6881056
|
2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.